use of org.jboss.resteasy.specimpl.RequestImpl in project keycloak-protocol-cas by jacekkow.
the class ContentTypeHelperTest method get.
private ContentTypeHelper get(String uri, String acceptHeader) throws Exception {
MockHttpRequest req = MockHttpRequest.get(uri);
MockHttpResponse res = new MockHttpResponse();
RequestImpl restReq = new RequestImpl(req, res);
if (acceptHeader != null) {
req = req.header(HttpHeaders.ACCEPT, acceptHeader);
}
return new ContentTypeHelper(req, restReq, req.getUri());
}
use of org.jboss.resteasy.specimpl.RequestImpl in project resteasy by resteasy.
the class SynchronousDispatcher method pushContextObjects.
@SuppressWarnings("unchecked")
public void pushContextObjects(final HttpRequest request, final HttpResponse response) {
@SuppressWarnings("rawtypes") Map contextDataMap = ResteasyContext.getContextDataMap();
contextDataMap.put(HttpRequest.class, request);
contextDataMap.put(HttpResponse.class, response);
contextDataMap.put(HttpHeaders.class, request.getHttpHeaders());
contextDataMap.put(UriInfo.class, request.getUri());
contextDataMap.put(Request.class, new RequestImpl(request, response));
contextDataMap.put(ResteasyAsynchronousContext.class, request.getAsyncContext());
ResourceContext resourceContext = new ResourceContext() {
@Override
public <T> T getResource(Class<T> resourceClass) {
return providerFactory.injectedInstance(resourceClass, request, response);
}
@Override
public <T> T initResource(T resource) {
providerFactory.injectProperties(resource, request, response);
return resource;
}
};
contextDataMap.put(ResourceContext.class, resourceContext);
contextDataMap.putAll(defaultContextObjects);
contextDataMap.put(Cleanables.class, new Cleanables());
contextDataMap.put(PostResourceMethodInvokers.class, new PostResourceMethodInvokers());
}
Aggregations