Пример #1
0
 public HandlerExecutionChain getHandler(HttpServletRequest request) throws Exception {
   ResteasyRequestWrapper requestWrapper =
       RequestUtil.getRequestWrapper(request, request.getMethod(), prefix);
   try {
     // NOTE: if invoker isn't found, RESTEasy throw NoReourceFoundFailure
     HttpRequest httpRequest = requestWrapper.getHttpRequest();
     if (!httpRequest.isInitial()) {
       String message =
           httpRequest.getUri().getPath()
               + " is not initial request.  Its suspended and retried.  Aborting.";
       logger.error(message);
       requestWrapper.setError(500, message);
     } else {
       Response response = dispatcher.preprocess(httpRequest);
       if (response != null) {
         requestWrapper.setAbortedResponse(response);
       } else {
         requestWrapper.setInvoker(getInvoker(httpRequest));
       }
     }
     return new HandlerExecutionChain(requestWrapper, interceptors);
   } catch (NotFoundException e) {
     if (throwNotFound) {
       throw e;
     }
     logger.error("Resource Not Found: " + e.getMessage(), e);
   } catch (Failure e) {
     logger.error("ResourceFailure: " + e.getMessage(), e);
     throw e;
   }
   return null;
 }
Пример #2
0
 public ResourceInvoker getInvoker(HttpRequest request) throws Failure {
   logger.debug("PathInfo: " + request.getUri().getPath());
   if (!request.isInitial()) {
     throw new InternalServerErrorException(
         request.getUri().getPath()
             + " is not initial request.  Its suspended and retried.  Aborting.");
   }
   ResourceInvoker invoker = registry.getResourceInvoker(request);
   if (invoker == null) {
     throw new NotFoundException(
         "Unable to find JAX-RS resource associated with path: " + request.getUri().getPath());
   }
   return invoker;
 }