@Override @Path("{pathSegment}") public Object consumePathSegment(@PathParam("pathSegment") String pathSegment) { logger.debug("Publishing securityUtils in OGNL context"); OgnlContext ognlContext = ElementsThreadLocals.getOgnlContext(); ognlContext.put("securityUtils", new SecurityUtilsBean()); logger.debug("Publishing textProvider in OGNL context"); ognlContext.put("textProvider", new TextProviderBean(ElementsThreadLocals.getTextProvider())); FileObject child = children.get(pathSegment); if(child != null) { return consumePathSegment(pathSegment, child, resourceResolver); } return super.consumePathSegment(pathSegment); }
ognlContext.put("securityUtils", new SecurityUtilsBean());
@Override public void filter(ContainerRequestContext requestContext) { UriInfo uriInfo = requestContext.getUriInfo(); if(uriInfo.getMatchedResources().isEmpty()) { return; } Object resource = uriInfo.getMatchedResources().get(0); if(resourceInfo == null || resourceInfo.getResourceClass() == null) { return; } if(resource.getClass() != resourceInfo.getResourceClass()) { throw new RuntimeException("Inconsistency: matched resource is not of the right type, " + resourceInfo.getResourceClass()); } fillMDC(); logger.debug("Publishing securityUtils in OGNL context"); OgnlContext ognlContext = ElementsThreadLocals.getOgnlContext(); ognlContext.put("securityUtils", new SecurityUtilsBean()); if(resource instanceof PageAction) { PageAction pageAction = (PageAction) resource; pageAction.prepareForExecution(); } checkAuthorizations(requestContext, resource); accessLogger.info(requestContext.getMethod()); }
logger.debug("Publishing securityUtils in OGNL context"); OgnlContext ognlContext = ElementsThreadLocals.getOgnlContext(); ognlContext.put("securityUtils", new SecurityUtilsBean()); logger.debug("Publishing textProvider in OGNL context"); ognlContext.put("textProvider", new TextProviderBean(ElementsThreadLocals.getTextProvider()));