private static Form getCachedForm(final ContainerRequest request, boolean decode) { return (Form) request.getProperty(decode ? InternalServerProperties .FORM_DECODED_PROPERTY : InternalServerProperties.FORM_PROPERTY); }
private static Form getCachedForm(final ContainerRequest request, boolean decode) { return (Form) request.getProperty(decode ? InternalServerProperties .FORM_DECODED_PROPERTY : InternalServerProperties.FORM_PROPERTY); }
@Override public String route(RequestEvent event) { return (String) event.getContainerRequest().getProperty("http.route"); }
/** * Returns a {@code FormDataMultiPart} entity from the request and stores it in the request context properties. * * @return a form data multi part entity. */ FormDataMultiPart getEntity(ContainerRequest request) { final String requestPropertyName = FormDataMultiPart.class.getName(); Object entity = request.getProperty(requestPropertyName); if (entity == null) { entity = request.readEntity(FormDataMultiPart.class); if (entity == null) { throw new BadRequestException(LocalizationMessages.ENTITY_IS_EMPTY()); } request.setProperty(requestPropertyName, entity); } return (FormDataMultiPart) entity; } }
@Override public void onEvent(RequestEvent event) { // Note: until REQUEST_MATCHED, we don't know metadata such as if the request is async or not if (event.getType() != REQUEST_MATCHED && event.getType() != FINISHED) return; ContainerRequest request = event.getContainerRequest(); SpanCustomizer span = (SpanCustomizer) request.getProperty(SpanCustomizer.class.getName()); if (span == null) return; if (event.getType() != REQUEST_MATCHED) { parser.requestMatched(event, span); return; } // Set the route attribute on completion to avoid any thread visibility issues reading it request.setProperty("http.route", route(event.getContainerRequest())); }
private HttpServletRequest getServletRequest() { return (HttpServletRequest)currentRequest.getProperty(JERSEY_SERVLET_REQUEST_PROPERTY); } }
private static Form getCachedForm(final ContainerRequest request, boolean decode) { return (Form) request.getProperty(decode ? InternalServerProperties .FORM_DECODED_PROPERTY : InternalServerProperties.FORM_PROPERTY); }
private HttpServletResponse getServletResponse() { return (HttpServletResponse)currentRequest.getProperty(JERSEY_SERVLET_RESPONSE_PROPERTY); } }
private ServletContext getServletContext() { HttpServletRequest req = (HttpServletRequest)currentRequest.getProperty(JERSEY_SERVLET_REQUEST_PROPERTY); if (req == null) { throw new InternalServerErrorException("Could not find servlet request in context"); } ServletContext ctx = req.getServletContext(); return ctx; } }
private static Form getCachedForm(final ContainerRequest request, boolean decode) { return (Form) request.getProperty(decode ? InternalServerProperties .FORM_DECODED_PROPERTY : InternalServerProperties.FORM_PROPERTY); }
private HttpServletRequest getServletRequest() { return (HttpServletRequest)currentRequest.getProperty(JERSEY_SERVLET_REQUEST_PROPERTY); } }
private HttpServletResponse getServletResponse() { return (HttpServletResponse)currentRequest.getProperty(JERSEY_SERVLET_RESPONSE_PROPERTY); } }
private static Form getCachedForm(final ContainerRequest request, boolean decode) { return (Form) request.getProperty(decode ? InternalServerProperties .FORM_DECODED_PROPERTY : InternalServerProperties.FORM_PROPERTY); }
private static Form getCachedForm(final ContainerRequest request, boolean decode) { return (Form) request.getProperty(decode ? InternalServerProperties .FORM_DECODED_PROPERTY : InternalServerProperties.FORM_PROPERTY); }
private static Form getCachedForm(final ContainerRequest request, boolean decode) { return (Form) request.getProperty(decode ? InternalServerProperties .FORM_DECODED_PROPERTY : InternalServerProperties.FORM_PROPERTY); }
@GET @Produces(MediaType.TEXT_PLAIN) public String getString(@Context ContainerRequest context) { return "Hello World!!! " + context.getProperty("custom.property"); }
private ServletContext getServletContext() { HttpServletRequest req = (HttpServletRequest)currentRequest.getProperty(JERSEY_SERVLET_REQUEST_PROPERTY); if (req == null) { throw new InternalServerErrorException("Could not find servlet request in context"); } ServletContext ctx = req.getServletContext(); return ctx; } }
public Object getProperty(String name) { return ContainerRequestCache.get().getProperty(name); }
public Object getProperty(String name) { return ContainerRequestCache.get().getProperty(name); }
@GET @Path("/requestInspect") public Map getRequestInfo(@QueryParam("requestUri") String requestUri, @Context ContainerRequestContext request) { ContainerRequest containerRequest = new ContainerRequest(request.getUriInfo().getBaseUri(), URI.create(requestUri), "GET", null, new MapPropertiesDelegate()); RoutingFilter routingFilter = GondolaApplication.getRoutingFilter(); routingFilter.extractShardAndBucketIdFromRequest(containerRequest); Map<Object, Object> map = new LinkedHashMap<>(); map.put("bucketId", containerRequest.getProperty("bucketId")); map.put("shardId", containerRequest.getProperty("shardId")); return map; }