Package javax.ws.rs

Examples of javax.ws.rs.ClientErrorException


    }
    private void reportError(String message, Exception ex, int status) {
        LOG.warning(message);
        Response response = Response.status(status).type("text/plain").entity(message).build();
        if (ex == null) {
            throw status < 500 ? new ClientErrorException(response) : new ServerErrorException(response);
        } else {
            throw status < 500 ? new ClientErrorException(response, ex) : new ServerErrorException(response, ex);
        }
    }
View Full Code Here


    }
   
    public BookStorePerRequest(@Context HttpHeaders headers,
                               @HeaderParam("BOOK") List<String> bookIds) {
        if (!bookIds.contains("3")) {
            throw new ClientErrorException(Response.status(400).type("text/plain")
                                           .entity("Constructor: Header value 3 is required").build());
        }
        httpHeaders = headers;
        this.bookIds = bookIds;
        init();
View Full Code Here

    }
   
    @HeaderParam("Book")
    public void setBook(List<String> ids) {
        if (!ids.equals(bookIds) || ids.size() != 3) {
            throw new ClientErrorException(Response.status(400).type("text/plain")
                                           .entity("Param setter: 3 header values are required").build());
        }
        setterBookIds = ids;
    }
View Full Code Here

   
    @Context
    public void setHttpHeaders(HttpHeaders headers) {
        List<String> ids = httpHeaders.getRequestHeader("BOOK");
        if (ids.contains("4")) {
            throw new ClientErrorException(Response.status(400).type("text/plain")
                                           .entity("Context setter: unexpected header value").build());
        }
    }
View Full Code Here

        } catch (Exception ex) {
            Throwable t = getOrThrowActualException(ex);
            LOG.severe(new org.apache.cxf.common.i18n.Message("CLASS_CONSTRUCTOR_FAILURE",
                                                               BUNDLE,
                                                               pClass.getName()).toString());
            throw new ClientErrorException(HttpUtils.getParameterFailureStatus(pType), t);
        }
        if (result == null) {
            // check for valueOf(String) static methods
            String[] methodNames = cls.isEnum()
                ? new String[] {"fromString", "fromValue", "valueOf"}
View Full Code Here

        if (!"OPTIONS".equalsIgnoreCase(httpMethod)) {
            LOG.warning(errorMsg.toString());
        }
        Response response =
            createResponse(getRootResources(message), message, errorMsg.toString(), status, methodMatched == 0);
        throw new ClientErrorException(response);
       
    }   
View Full Code Here

    }
    private void reportError(String message, Exception ex, int status) {
        LOG.warning(message);
        Response response = Response.status(status).type("text/plain").entity(message).build();
        if (ex == null) {
            throw status < 500 ? new ClientErrorException(response) : new ServerErrorException(response);
        } else {
            throw status < 500 ? new ClientErrorException(response, ex) : new ServerErrorException(response, ex);
        }
    }
View Full Code Here

    }
    private void reportError(String message, Exception ex, int status) {
        LOG.warning(message);
        Response response = Response.status(status).type("text/plain").entity(message).build();
        if (ex == null) {
            throw status < 500 ? new ClientErrorException(response) : new ServerErrorException(response);
        } else {
            throw status < 500 ? new ClientErrorException(response, ex) : new ServerErrorException(response, ex);
        }
    }
View Full Code Here

        if (!"OPTIONS".equalsIgnoreCase(httpMethod) && logNow) {
            LOG.warning(errorMsg.toString());
        }
        Response response =
            createResponse(resource, message, errorMsg.toString(), status, methodMatched == 0);
        throw new ClientErrorException(response);
       
    }   
View Full Code Here

            result = createFromParameterHandler(value, cls, message);
            if (result == null) {
                LOG.severe(new org.apache.cxf.common.i18n.Message("CLASS_CONSTRUCTOR_FAILURE",
                                                                   BUNDLE,
                                                                   pClass.getName()).toString());
                throw new ClientErrorException(HttpUtils.getParameterFailureStatus(pType), ex);
            }
        }
        if (result == null) {
            // check for valueOf(String) static methods
            String[] methodNames = cls.isEnum()
View Full Code Here

TOP

Related Classes of javax.ws.rs.ClientErrorException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.