/** * Construct given a status, entity and metadata. * * @param status the status * @param headers the metadata, it is the callers responsibility to copy * the metadata if necessary. * @param entity the entity */ public JResponse(int status, OutBoundHeaders headers, E entity) { this(ResponseImpl.toStatusType(status), headers, entity); }
@Override public void _dispatch(Object resource, HttpContext context) throws IllegalAccessException, InvocationTargetException { final Object[] params = getParams(context); final Object o = invoker.invoke(method, resource, params); if (o != null) { Response r = new ResponseBuilderImpl(). entityWithType(o, t).status(200).build(); context.getResponse().setResponse(r); } } }
@Override public void setResponse(Response response) { this.isCommitted = false; this.out = null; this.response = response = (response != null) ? response : Responses.noContent().build(); this.mappedThrowable = null; if (response instanceof ResponseImpl) { final ResponseImpl responseImpl = (ResponseImpl)response; setStatusType(responseImpl.getStatusType()); setHeaders(response.getMetadata()); setEntity(responseImpl.getEntity(), responseImpl.getEntityType()); } else { setStatus(response.getStatus()); setHeaders(response.getMetadata()); setEntity(response.getEntity()); } }
final ContextResolverFactory crf = new ContextResolverFactory(); this.bodyFactory = new MessageBodyFactory(providerServices, getFeaturesAndProperties().getFeature(FeaturesAndProperties.FEATURE_PRE_1_4_PROVIDER_PRECEDENCE)); injectableFactory.add( crf.init(providerServices, injectableFactory); bodyFactory.init();
@Override public void _dispatch(Object resource, HttpContext context) throws IllegalAccessException, InvocationTargetException { final Object[] params = getParams(context); final Object o = invoker.invoke(method, resource, params); if (o instanceof Response) { context.getResponse().setResponse((Response)o); } else if (o instanceof JResponse) { context.getResponse().setResponse(((JResponse)o).toResponse()); } else if (o != null) { final Response r = new ResponseBuilderImpl().status(200).entity(o).build(); context.getResponse().setResponse(r); } } }
public Response build() { final Response r = new ResponseImpl( statusType, getHeaders(), entity, entityType); reset(); return r; }
public Response.ResponseBuilder status(int status) { return status(ResponseImpl.toStatusType(status)); }
public void invoke() throws IllegalAccessException, InvocationTargetException { Object o = method.invoke(resource, params); if (o != null) { Response r = new ResponseBuilderImpl().entity(o).status(200).build(); context.getResponse().setResponse(r); } } });
@Override public ResponseBuilder clone() { return new ResponseBuilderImpl(this); }
public void init() { initReaders(); initWriters(); }
public int compare(T o1, T o2) { int d1 = getDistance(o1); int d2 = getDistance(o2); return d2 - d1; }
public Response.ResponseBuilder cacheControl(CacheControl cacheControl) { headerSingle(HttpHeaders.CACHE_CONTROL, cacheControl); return this; }
public void invoke() throws IllegalAccessException, InvocationTargetException { Object o = method.invoke(resource, params); if (o instanceof Response) { Response r = (Response) o; context.getResponse().setResponse(r); } else if (o != null) { Response r = new ResponseBuilderImpl().status(200).entity(o).build(); context.getResponse().setResponse(r); } } });
@Override public void setStatus(int status) { this.statusType = ResponseImpl.toStatusType(status); }
public Response build() { final Response r = new ResponseImpl( statusType, getHeaders(), entity, entityType); reset(); return r; }
/** * Set the status. * * @param status the response status * @return the updated instance * @throws IllegalArgumentException if status is less than 100 or greater * than 599. */ public B status(int status) { return status(ResponseImpl.toStatusType(status)); }
/** * Construct given a status, entity and metadata. * * @param status the status * @param headers the metadata, it is the callers responsibility to copy * the metadata if necessary. * @param entity the entity */ public JResponse(int status, OutBoundHeaders headers, E entity) { this(ResponseImpl.toStatusType(status), headers, entity); }
/** * Construct given a status, entity and metadata. * * @param status the status * @param headers the metadata, it is the callers responsibility to copy * the metadata if necessary. * @param entity the entity */ public JResponse(int status, OutBoundHeaders headers, E entity) { this(ResponseImpl.toStatusType(status), headers, entity); }