Пример #1
0
 protected Response getResponse(
     HttpRequest request, HttpResponse response, ResourceInvoker invoker) {
   Response jaxrsResponse = null;
   try {
     jaxrsResponse = invoker.invoke(request, response);
     if (request.getExecutionContext().isSuspended()) {
       /**
        * Callback by the initial calling thread. This callback will probably do nothing in an
        * asynchronous environment but will be used to simulate AsynchronousResponse in vanilla
        * Servlet containers that do not support asychronous HTTP.
        */
       request.getExecutionContext().getAsyncResponse().initialRequestThreadFinished();
       jaxrsResponse = null; // we're handing response asynchronously
     }
   } catch (Exception e) {
     handleInvokerException(request, response, e);
   }
   return jaxrsResponse;
 }
Пример #2
0
  public void pushContextObjects(HttpRequest request, HttpResponse response) {
    Map contextDataMap = ResteasyProviderFactory.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));
    contextDataMap.put(ExecutionContext.class, request.getExecutionContext());

    contextDataMap.putAll(defaultContextObjects);
  }