List of usage examples for org.springframework.web.util UrlPathHelper UrlPathHelper
UrlPathHelper
From source file:com.pcms.core.util.UrlUtil.java
public static String getURI(HttpServletRequest request) { UrlPathHelper helper = new UrlPathHelper(); String uri = helper.getOriginatingRequestUri(request); String ctx = helper.getOriginatingContextPath(request); if (!StringUtils.isBlank(ctx)) { return uri.substring(ctx.length()); } else {// w ww.j a v a 2s . co m return uri; } }
From source file:at.ac.univie.isc.asio.security.UriAuthenticationFilter.java
/** * Create the filter with default settings. *//* w w w. j a v a2 s . c om*/ public static UriAuthenticationFilter create() { final UrlPathHelper pathHelper = new UrlPathHelper(); pathHelper.setRemoveSemicolonContent(true); pathHelper.setUrlDecode(true); return new UriAuthenticationFilter(pathHelper); }
From source file:com.pcms.core.util.UrlUtil.java
/** * ?/*from w w w .j a va2 s .c om*/ * * @param request * @return */ public static PageInfo getPageInfo(HttpServletRequest request) { UrlPathHelper helper = new UrlPathHelper(); String uri = helper.getOriginatingRequestUri(request); String queryString = helper.getOriginatingQueryString(request); return getPageInfo(uri, queryString); }
From source file:arena.utils.ServletUtils.java
public static String getURIFromRequest(HttpServletRequest request) { UrlPathHelper urlPathHelper = new UrlPathHelper(); return urlPathHelper.getPathWithinApplication(request); }
From source file:com.acc.storefront.filters.btg.support.impl.DefaultUrlParsingStrategy.java
@Override public void afterPropertiesSet() { if (urlPathHelper == null) { urlPathHelper = new UrlPathHelper(); }/*from ww w. j av a 2 s . c o m*/ Assert.hasLength(regex); pattern = Pattern.compile(regex); }
From source file:org.wallride.web.support.BlogLanguageDataValueProcessor.java
@Override public String processUrl(HttpServletRequest request, String url) { UrlPathHelper urlPathHelper = new UrlPathHelper(); String contextPath = urlPathHelper.getContextPath(request); if (!url.startsWith(contextPath + "/")) { return url; }// ww w .j a va 2 s . c o m BlogLanguage blogLanguage = (BlogLanguage) request .getAttribute(BlogLanguageMethodArgumentResolver.BLOG_LANGUAGE_ATTRIBUTE); if (blogLanguage == null || blogLanguage.getBlog().getLanguages().size() <= 1) { return url; } String path = url.substring(contextPath.length()); String processedUrl = contextPath + "/" + blogLanguage.getLanguage() + path; logger.debug(url + " => " + processedUrl); return processedUrl; }
From source file:org.wallride.web.support.BlogLanguageRewriteMatch.java
@Override public boolean execute(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { UrlPathHelper urlPathHelper = new UrlPathHelper(); String originalPath = urlPathHelper.getLookupPathForRequest(request); String rewritePath = originalPath.replaceAll("^/" + blogLanguage.getLanguage() + "/", "/"); matchingUrl = rewritePath;/* w ww . j a v a 2 s . c o m*/ logger.debug(originalPath + " => " + rewritePath); request.setAttribute(BlogLanguageMethodArgumentResolver.BLOG_LANGUAGE_ATTRIBUTE, blogLanguage); RequestDispatcher rd = request.getRequestDispatcher(urlPathHelper.getServletPath(request) + rewritePath); rd.forward(request, response); return true; }
From source file:org.wallride.web.support.SetupRedirectInterceptor.java
private String getRequestPath(HttpServletRequest request) { UrlPathHelper urlPathHelper = new UrlPathHelper(); return urlPathHelper.getPathWithinApplication(request); // return (String) request.getAttribute(HandlerMapping.PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE); }
From source file:org.wallride.web.support.BlogLanguageRewriteRule.java
@Override public RewriteMatch matches(HttpServletRequest request, HttpServletResponse response) { UrlPathHelper urlPathHelper = new UrlPathHelper(); String servletPath = urlPathHelper.getOriginatingServletPath(request); if (ObjectUtils.nullSafeEquals(servletPath, WallRideServletConfiguration.ADMIN_SERVLET_PATH)) { return null; }/*from w w w . j av a 2 s .co m*/ String lookupPath = urlPathHelper.getLookupPathForRequest(request); Blog blog = blogService.getBlogById(Blog.DEFAULT_ID); if (blog == null) { return null; } BlogLanguage matchedBlogLanguage = null; for (BlogLanguage blogLanguage : blog.getLanguages()) { if (lookupPath.startsWith("/" + blogLanguage.getLanguage() + "/")) { matchedBlogLanguage = blogLanguage; break; } } if (matchedBlogLanguage == null) { matchedBlogLanguage = blog.getLanguage(blog.getDefaultLanguage()); } return new BlogLanguageRewriteMatch(matchedBlogLanguage); }
From source file:org.zalando.zmon.actuator.ZmonMetricsFilter.java
@Override protected void doFilterInternal(final HttpServletRequest request, final HttpServletResponse response, final FilterChain chain) throws ServletException, IOException { StopWatch stopWatch = new StopWatch(); stopWatch.start();/*from w ww .j a va2 s . c om*/ String path = new UrlPathHelper().getPathWithinApplication(request); int status = HttpStatus.INTERNAL_SERVER_ERROR.value(); try { chain.doFilter(request, response); status = getStatus(response); } finally { stopWatch.stop(); metricsWrapper.recordClientRequestMetrics(request, path, status, stopWatch.getTotalTimeMillis()); } }