Package javax.ws.rs.core.Response

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


                response.header("Content-Range", contentRange);
            } else {
                response = Response.ok();
            }

            response.entity(stream);
        }

        setHeaders(found, response);

        // TODO: Support range with head??
View Full Code Here


                .parameters(params);
        ResponseBuilder rb = Response.status(HttpURLConnection.HTTP_OK);
        if ( isSingleInstanceCommand(model)) {
            rb.cookie(getJSessionCookie(jSessionId));
        }
        rb.entity(SseCommandHelper.invokeAsync(commandInvocation, null));
        return rb.build();
    }

    private Response executeCommand(CommandName commandName, Payload.Inbound inbound,
            ParameterMap params, boolean supportsMultiparResult, String xIndentHeader,
View Full Code Here

        if (xIndentHeader != null) {
            rb.header("X-Indent", xIndentHeader);
        }
        if (supportsMultiparResult && outbound.size() > 0) {
            ParamsWithPayload pwp = new ParamsWithPayload(outbound, ar);
            rb.entity(pwp);
        } else {
            rb.type(MediaType.APPLICATION_JSON_TYPE);
            rb.entity(ar);
        }
        if ( isSingleInstanceCommand(model)) {
View Full Code Here

        if (supportsMultiparResult && outbound.size() > 0) {
            ParamsWithPayload pwp = new ParamsWithPayload(outbound, ar);
            rb.entity(pwp);
        } else {
            rb.type(MediaType.APPLICATION_JSON_TYPE);
            rb.entity(ar);
        }
        if ( isSingleInstanceCommand(model)) {
            rb.cookie(getJSessionCookie(jSessionId));
        }
        return rb.build();
View Full Code Here

      MultivaluedMap<String, String> queryParameters = simulatorRequest.getQueryParameters();
     
      //replace query params
      currentResponseBody = replaceAllQueryParamsInReponse(currentResponseBody, queryParameters);
     
      rb = rb.entity(currentResponseBody);
    }  
   
    if (responseHeaders != null){
      for (String headerKey : responseHeaders.keySet()) {
        rb.header(headerKey, responseHeaders.get(headerKey));
View Full Code Here

                if (status >= 400) {
                    entity = currentResponse.getEntity();
                }
            }
            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

        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

                text = e.getMessage();
            }
            if (asHeader) {
                builder.header("oauth_problem", text);
            } else {
                builder.entity(e.getMessage());   
            }
        }
        throw new WebApplicationException(builder.build());
    }
View Full Code Here

                int status = currentResponse.getStatus();
                if (status >= 400) {
                    entity = currentResponse.getEntity();
                }
            }
            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

    private Person get(int id){
        Person person = persons.get(id);
        if (person == null) {
            ResponseBuilder builder = Response.status(Status.NOT_FOUND);
            builder.entity("Person with ID " + id + " not found.");
            throw new WebApplicationException(builder.build());
        }

       return person;
    }
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.