static String buildApplicationIdentifier(final ServletRequestContext attachment) { ServletRequest servletRequest = attachment.getServletRequest(); return servletRequest.getServletContext().getVirtualServerName() + " " + servletRequest.getServletContext().getContextPath(); }
/** * <p> * Builds the JASPIC application context. * </p> * * @return a {@code String} representing the application context. */ private String buildAppContext() { final ServletRequestContext requestContext = exchange.getAttachment(ServletRequestContext.ATTACHMENT_KEY); ServletRequest servletRequest = requestContext.getServletRequest(); return servletRequest.getServletContext().getVirtualServerName() + " " + servletRequest.getServletContext().getContextPath(); }
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { LoggerContext context = (LoggerContext) request.getServletContext().getAttribute(Red5LoggerFactory.LOGGER_CONTEXT_ATTRIBUTE); // get the selector ContextSelector selector = Red5LoggerFactory.getContextSelector(); if (context != null) { // set the thread local ref ((LoggingContextSelector) selector).setLocalContext(context); } else { System.err.printf("No context named %s was found%n", contextName); } chain.doFilter(request, response); // remove the thread local ref so that log contexts dont use the wrong contextName ((LoggingContextSelector) selector).removeLocalContext(); }
/** * Gets the servlet context to which the wrapped servlet request was last * dispatched. * * @return the servlet context to which the wrapped servlet request was * last dispatched * * @since Servlet 3.0 */ public ServletContext getServletContext() { return request.getServletContext(); }
/** * Get the servlet context the request-response pair was last dispatched through. * * @return the latest ServletContext on the dispatch chain. * @since 3.0 */ public ServletContext getServletContext() { return this.request.getServletContext(); }
public class ResteasyCleanupFilter implements Filter { @Override public void init(FilterConfig filterConfig) throws ServletException { // TODO Auto-generated method stub } @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { request.getServletContext().setAttribute(ResteasyProviderFactory.class.getName(), null); request.getServletContext().setAttribute(Dispatcher.class.getName(), null); chain.doFilter(request, response); } @Override public void destroy() { // TODO Auto-generated method stub } }
/** * Gets the servlet context to which the wrapped servlet request was last * dispatched. * * @return the servlet context to which the wrapped servlet request was * last dispatched * * @since Servlet 3.0 */ public ServletContext getServletContext() { return request.getServletContext(); }
@Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) { ServletContext context = request.getServletContext(); // ... }
/** * Gets the servlet context to which the wrapped servlet request was last * dispatched. * * @return the servlet context to which the wrapped servlet request was * last dispatched * * @since Servlet 3.0 */ public ServletContext getServletContext() { return request.getServletContext(); }
/** * Get the servlet context the request-response pair was last dispatched through. * * @return the latest ServletContext on the dispatch chain. * @since 3.0 */ public ServletContext getServletContext() { return this.request.getServletContext(); }
/** * Gets the servlet context to which the wrapped servlet request was last * dispatched. * * @return the servlet context to which the wrapped servlet request was * last dispatched * * @since Servlet 3.0 */ public ServletContext getServletContext() { return request.getServletContext(); }
public class UrlBasedAuthzFilter extends AuthorizationFilter { @Override public boolean isAccessAllowed(ServletRequest request, ServletResponse response, Object mappedValue) throws IOException { if (request.getServletContext().getContextPath().startsWith("/rest"){ return false; } return super.isAccessAllowed(request, response, mappedValue); } }
/** * The default behavior of this method is to return getServletContext() on * the wrapped request object. * * @since Servlet 3.0 */ @Override public ServletContext getServletContext() { return request.getServletContext(); }
public class AuthenticationTokenProcessingFilter extends GenericFilterBean { private MyServices service; @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { if(service==null){ ServletContext servletContext = request.getServletContext(); WebApplicationContext webApplicationContext = WebApplicationContextUtils.getWebApplicationContext(servletContext); service = webApplicationContext.getBean(MyServices.class); } your code ... } }
public static PwmApplication getPwmApplication( final ServletRequest request ) throws PwmUnrecoverableException { final PwmApplication appInRequest = ( PwmApplication ) request.getAttribute( PwmConstants.REQUEST_ATTR_PWM_APPLICATION ); if ( appInRequest != null ) { return appInRequest; } final PwmApplication pwmApplication = getPwmApplication( request.getServletContext() ); request.setAttribute( PwmConstants.REQUEST_ATTR_PWM_APPLICATION, pwmApplication ); return pwmApplication; }
@Override public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { AbstractRoninServlet roninServlet = (AbstractRoninServlet) servletRequest.getServletContext().getAttribute(RoninServletWrapper.RONIN_SERVLET_SLOT); roninServlet.getFilter().doFilter(servletRequest, servletResponse, filterChain); }
protected String extractJspName() { final ServletRequest request = getRequest(); if (HttpServletRequest.class.isInstance(request)) { return HttpServletRequest.class.cast(request).getRequestURI(); } return request.getServletContext().getContextPath(); }
/** * <p> * Builds the JASPIC application context. * </p> * * @return a {@code String} representing the application context. */ private String buildAppContext() { final ServletRequestContext requestContext = exchange.getAttachment(ServletRequestContext.ATTACHMENT_KEY); ServletRequest servletRequest = requestContext.getServletRequest(); return servletRequest.getServletContext().getVirtualServerName() + " " + servletRequest.getServletContext().getContextPath(); }
@Override public void dispatch(String path) { check(); dispatch(getRequest().getServletContext(), path); }
@Override public void dispatch(String path) { check(); dispatch(getRequest().getServletContext(), path); }