Examples of entity()


Examples of javax.ws.rs.core.Response.ResponseBuilder.entity()

    */
   private Response createErrorResponse(int status, String message)
   {

      ResponseBuilder responseBuilder = Response.status(status);
      responseBuilder.entity(message).type(MediaType.TEXT_PLAIN);
      String jaxrsHeader = getJaxrsHeader(status);
      if (jaxrsHeader != null)
         responseBuilder.header(ExtHttpHeaders.JAXRS_BODY_PROVIDED, jaxrsHeader);

      return responseBuilder.build();
View Full Code Here

Examples of javax.ws.rs.core.Response.ResponseBuilder.entity()

            Response currentResponse = rb.clone().build();
           
            Object entity = readBody(currentResponse, outMessage, responseClass, genericType,
                                     new Annotation[]{});
            rb = JAXRSUtils.fromResponse(currentResponse);
            rb.entity(entity instanceof Response
                      ? ((Response)entity).getEntity() : entity);
           
            return rb.build();
        } catch (Throwable ex) {
            throw (ex instanceof ClientWebApplicationException) ? (ClientWebApplicationException)ex
View Full Code Here

Examples of javax.ws.rs.core.Response.ResponseBuilder.entity()

        return toResponseBuilder(status.getStatusCode());
    }
   
    public static ResponseBuilder fromResponse(Response response) {
        ResponseBuilder rb = toResponseBuilder(response.getStatus());
        rb.entity(response.getEntity());
        for (Map.Entry<String, List<Object>> entry : response.getMetadata().entrySet()) {
            List<Object> values = entry.getValue();
            for (Object value : values) {
                rb.header(entry.getKey(), value);
            }
View Full Code Here

Examples of javax.ws.rs.core.Response.ResponseBuilder.entity()

                    }
                }
            }
        }
        InputStream mStream = responseMessage.getContent(InputStream.class);
        currentResponseBuilder.entity(mStream);
       
        return currentResponseBuilder;
    }
   
    protected <T> void writeBody(T o, Message outMessage, Class<?> cls, Type type, Annotation[] anns,
View Full Code Here

Examples of javax.ws.rs.core.Response.ResponseBuilder.entity()

                    entity = currentResponse.getEntity();
                }
            }
            rb = JAXRSUtils.fromResponse(currentResponse);
           
            rb.entity(entity instanceof Response
                      ? ((Response)entity).getEntity() : entity);
           
            Response r = rb.build();
            ((ResponseImpl)r).setMessage(outMessage);
           
View Full Code Here

Examples of javax.ws.rs.core.Response.ResponseBuilder.entity()

        return toResponseBuilder(status.getStatusCode());
    }
   
    public static ResponseBuilder fromResponse(Response response) {
        ResponseBuilder rb = toResponseBuilder(response.getStatus());
        rb.entity(response.getEntity());
        for (Map.Entry<String, List<Object>> entry : response.getMetadata().entrySet()) {
            List<Object> values = entry.getValue();
            for (Object value : values) {
                rb.header(entry.getKey(), value);
            }
View Full Code Here

Examples of javax.ws.rs.core.Response.ResponseBuilder.entity()

        Response resp = inMessage.getExchange().get(Response.class);
        if (resp != null) {
            return resp;
        }
        ResponseBuilder rb = Response.status((Integer)inMessage.get(Message.RESPONSE_CODE));
        rb.entity(inMessage.get(InputStream.class));
       
        @SuppressWarnings("unchecked")
        Map<String, List<String>> protocolHeaders =
            (Map<String, List<String>>)inMessage.get(Message.PROTOCOL_HEADERS);
        for (Map.Entry<String, List<String>> entry : protocolHeaders.entrySet()) {
View Full Code Here

Examples of javax.ws.rs.core.Response.ResponseBuilder.entity()

    protected void reportInvalidRequestError(OAuthError entity, MediaType mt) {
        ResponseBuilder rb = JAXRSUtils.toResponseBuilder(400);
        if (mt != null) {
            rb.type(mt);
        }
        throw ExceptionUtils.toBadRequestException(null, rb.entity(entity).build());
    }

    /**
     * HTTPS is the default transport for OAuth 2.0 services, this property
     * can be used to block all the requests issued over HTTP
View Full Code Here

Examples of javax.ws.rs.core.Response.ResponseBuilder.entity()

            ResponseBuilder rb = setResponseBuilder(conn, outMessage.getExchange()).clone();
            Response currentResponse = rb.clone().build();
           
            Object entity = readBody(currentResponse, conn, outMessage, responseClass, genericType,
                                     new Annotation[]{});
            rb.entity(entity);
           
            return rb.build();
        } catch (Throwable ex) {
            throw new WebApplicationException(ex);
        }
View Full Code Here

Examples of javax.ws.rs.core.Response.ResponseBuilder.entity()

        // body and content-type
        final JsonRepresentation bodyRepr = ex.getBody();
        final Throwable cause = ex.getCause();
        if (bodyRepr != null) {
            final String body = bodyRepr.toString();
            builder.entity(body);
            builder.type(MediaType.APPLICATION_JSON); // generic; the spec doesn't define what the media type should be
        } else if(cause == null) {
            builder.type(MediaType.APPLICATION_JSON); // generic; the spec doesn't define what the media type should be
        } else {
            String body;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.