/** * Merely returns * <code>WebUtils.{@link org.apache.shiro.web.util.WebUtils#getPathWithinApplication(javax.servlet.http.HttpServletRequest) getPathWithinApplication(request)}</code> * and can be overridden by subclasses for custom request-to-application-path resolution behavior. * * @param request the incoming {@code ServletRequest} * @return the request's path within the appliation. */ protected String getPathWithinApplication(ServletRequest request) { return WebUtils.getPathWithinApplication(WebUtils.toHttp(request)); } }
/** * Returns the context path within the application based on the specified <code>request</code>. * <p/> * This implementation merely delegates to * {@link WebUtils#getPathWithinApplication(javax.servlet.http.HttpServletRequest) WebUtils.getPathWithinApplication(request)}, * but can be overridden by subclasses for custom logic. * * @param request the incoming <code>ServletRequest</code> * @return the context path within the application. */ protected String getPathWithinApplication(ServletRequest request) { return WebUtils.getPathWithinApplication(WebUtils.toHttp(request)); }
public FilterChain getChain(ServletRequest request, ServletResponse response, final FilterChain originalChain) { String path = WebUtils.getPathWithinApplication(WebUtils.toHttp(request)); for (final String pathPattern : chains.keySet()) { if (patternMatcher.matches(pathPattern, path)) { final Iterator<Key<? extends Filter>> chain = Arrays.asList(chains.get(pathPattern)).iterator(); return new SimpleFilterChain(originalChain, new Iterator<Filter>() { public boolean hasNext() { return chain.hasNext(); } public Filter next() { return injector.getInstance(chain.next()); } public void remove() { throw new UnsupportedOperationException(); } }); } } return null; }
static List<AuthzHandler> getJdbcAuthzHandler(HttpServletRequest request) { /* if(authzMaps.containsKey(controllerClassName)){ return true; }*/ List<AuthzHandler> result = new ArrayList<AuthzHandler>(); String url = WebUtils.getPathWithinApplication(request); for (String key : authzJdbcMaps.keySet()) { if (antPathMatcher.match(key, url)) { result.add(authzJdbcMaps.get(key)); if (!and) break; } } return result; }
static List<AuthzHandler> getJdbcAuthzHandler(HttpServletRequest request) { /* if(authzMaps.containsKey(controllerClassName)){ return true; }*/ List<AuthzHandler> result = new ArrayList<AuthzHandler>(); String url = WebUtils.getPathWithinApplication(request); for (String key : authzJdbcMaps.keySet()) { if (antPathMatcher.match(key, url)) { result.add(authzJdbcMaps.get(key)); if (!and) break; } } return result; }
public String getResourceStorePath(ServletRequest request) { String path = WebUtils.getPathWithinApplication((HttpServletRequest) request); if (getPathPrefix() != null) { Matcher m = this.getPathPrefixPattern().matcher(path); if (m.matches()) { path = getPathReplacement(); // TODO: hardcoded currently if (path.contains("@1")) { path = path.replaceAll("@1", Matcher.quoteReplacement(m.group(1))); } if (path.contains("@2")) { path = path.replaceAll("@2", Matcher.quoteReplacement(m.group(2))); } // and so on... this will be reworked to be dynamic } else { throw new IllegalArgumentException( "The request path does not matches the incoming request? This is misconfiguration in web.xml!"); } } return path; }
public String getResourceStorePath( ServletRequest request ) { String path = WebUtils.getPathWithinApplication( (HttpServletRequest) request ); if ( getPathPrefix() != null ) { Matcher m = this.getPathPrefixPattern().matcher( path ); if ( m.matches() ) { path = getPathReplacement(); // TODO: hardcoded currently if ( path.contains( "@1" ) ) { path = path.replaceAll( "@1", Matcher.quoteReplacement( m.group( 1 ) ) ); } if ( path.contains( "@2" ) ) { path = path.replaceAll( "@2", Matcher.quoteReplacement( m.group( 2 ) ) ); } // and so on... this will be reworked to be dynamic } else { throw new IllegalArgumentException( "The request path does not matches the incoming request? This is misconfiguration in web.xml!" ); } } return path; }
public FilterChain getChain(ServletRequest request, ServletResponse response, final FilterChain originalChain) { String path = WebUtils.getPathWithinApplication(WebUtils.toHttp(request)); for (final String pathPattern : chains.keySet()) { if (patternMatcher.matches(pathPattern, path)) { final Iterator<Key<? extends Filter>> chain = Arrays.asList(chains.get(pathPattern)).iterator(); return new SimpleFilterChain(originalChain, new Iterator<Filter>() { public boolean hasNext() { return chain.hasNext(); } public Filter next() { return injector.getInstance(chain.next()); } public void remove() { throw new UnsupportedOperationException(); } }); } } return null; }