/** * Sets up the model in the request attributes, creates a dispatcher, and * forwards the request. */ public void render(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException, WebApplicationException { for (Entry<String, Object> entry : model.entrySet()) { request.setAttribute(entry.getKey(), entry.getValue()); } RequestDispatcher disp = request.getRequestDispatcher(path); if (disp == null) throw new InternalServerErrorException(Messages.MESSAGES.noDispatcherFound(path)); disp.forward(request, response); } }
throw new InternalServerErrorException(e); throw new InternalServerErrorException(e);
throw new InternalServerErrorException(e); throw new InternalServerErrorException(e);
throw new InternalServerErrorException(e);
throw new InternalServerErrorException(e);
throw new InternalServerErrorException(Messages.MESSAGES.notAllowedToReflectOnMethod(method.toString()), e); throw new InternalServerErrorException(msg, e);
throw new InternalServerErrorException(e); throw new InternalServerErrorException(e);
throw new InternalServerErrorException(Messages.MESSAGES.unknownPathParam(paramName, uriInfo.getPath()));
throw new InternalServerErrorException(e); throw new InternalServerErrorException(e);
throw new InternalServerErrorException(Messages.MESSAGES.failedProcessingArguments(constructor.toString()), e); }).thenApply(args -> { try throw new InternalServerErrorException(Messages.MESSAGES.failedToConstruct(constructor.toString()), e); throw new InternalServerErrorException(Messages.MESSAGES.failedToConstruct(constructor.toString()), e); throw new InternalServerErrorException(msg, e);
throw new InternalServerErrorException(msg);
throw new InternalServerErrorException(e);
public ResourceInvoker getInvoker(HttpRequest request) throws Failure { LogMessages.LOGGER.pathInfo(request.getUri().getPath()); if (!request.isInitial()) { throw new InternalServerErrorException(Messages.MESSAGES.isNotInitialRequest(request.getUri().getPath())); } ResourceInvoker invoker = registry.getResourceInvoker(request); if (invoker == null) { throw new NotFoundException(Messages.MESSAGES.unableToFindJaxRsResource(request.getUri().getPath())); } RESTEasyTracingLogger logger = RESTEasyTracingLogger.getInstance(request); logger.log("MATCH_RESOURCE", invoker); logger.log("MATCH_RESOURCE_METHOD", invoker.getMethod()); return invoker; }
/** * Sets up the model in the request attributes, creates a dispatcher, and forwards the request. */ public void render(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException, WebApplicationException { request.setAttribute(View.class.getName(), this); if (this.modelName != null) request.setAttribute(this.modelName, this.model); RequestDispatcher disp = request.getRequestDispatcher(path); if (disp == null) throw new InternalServerErrorException("No dispatcher found for path '" + path + "'"); disp.forward(request, response); } }
public void inject(HttpRequest request, HttpResponse response, Object target) throws Failure { for (Map.Entry<Field, ValueInjector> entry : fieldMap.entrySet()) { try { entry.getKey().set(target, entry.getValue().inject(request, response)); } catch (IllegalAccessException e) { throw new InternalServerErrorException(e); } } for (SetterMethod setter : setters) { try { setter.method.invoke(target, setter.extractor.inject(request, response)); } catch (IllegalAccessException e) { throw new InternalServerErrorException(e); } catch (InvocationTargetException e) { throw new ApplicationException(e.getCause()); } } }
@Override public void writeTo(Object obj, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException { Viewable viewingPleasure = viewResolver.getView(obj, type, genericType, annotations); if (viewingPleasure == null) throw new InternalServerErrorException("No " + ViewWith.class.getSimpleName() + " annotation found for object of type " + type.getName()); HttpServletRequest request = ResteasyProviderFactory.getContextData(HttpServletRequest.class); HttpServletResponse response = ResteasyProviderFactory.getContextData(HttpServletResponse.class); try { viewingPleasure.render(request, response); } catch (ServletException ex) { throw new WebApplicationException(ex); } }
public void inject(HttpRequest request, HttpResponse response, Object target) throws Failure { for (FieldInjector injector : fields) { try { injector.param.getField().set(target, injector.injector.inject(request, response)); } catch (IllegalAccessException e) { throw new InternalServerErrorException(e); } } for (SetterInjector injector : setters) { try { injector.param.getSetter().invoke(target, injector.injector.inject(request, response)); } catch (IllegalAccessException e) { throw new InternalServerErrorException(e); } catch (InvocationTargetException e) { throw new ApplicationException(e.getCause()); } } }
throw new InternalServerErrorException(e); throw new InternalServerErrorException(e);
throw new InternalServerErrorException(e); throw new InternalServerErrorException(e);