List of usage examples for javax.servlet.http HttpServletRequest getRequestURL
public StringBuffer getRequestURL();
From source file:io.kamax.mxisd.controller.profile.v1.ProfileController.java
private String resolveProxyUrl(HttpServletRequest req) { URI target = URI.create(req.getRequestURL().toString() + (Objects.isNull(req.getQueryString()) ? "" : "?" + req.getQueryString())); URIBuilder builder = dns.transform(target); String urlToLogin = builder.toString(); log.info("Proxy resolution: {} to {}", target.toString(), urlToLogin); return urlToLogin; }
From source file:it.greenvulcano.gvesb.adapter.http.utils.DumpUtils.java
public static void dump(HttpServletRequest request, StringBuffer log) throws IOException { String hN;//from w ww .ja v a 2 s . co m log.append("-- DUMP HttpServletRequest START").append("\n"); log.append("Method : ").append(request.getMethod()).append("\n"); log.append("RequestedSessionId : ").append(request.getRequestedSessionId()).append("\n"); log.append("Scheme : ").append(request.getScheme()).append("\n"); log.append("IsSecure : ").append(request.isSecure()).append("\n"); log.append("Protocol : ").append(request.getProtocol()).append("\n"); log.append("ContextPath : ").append(request.getContextPath()).append("\n"); log.append("PathInfo : ").append(request.getPathInfo()).append("\n"); log.append("QueryString : ").append(request.getQueryString()).append("\n"); log.append("RequestURI : ").append(request.getRequestURI()).append("\n"); log.append("RequestURL : ").append(request.getRequestURL()).append("\n"); log.append("ContentType : ").append(request.getContentType()).append("\n"); log.append("ContentLength : ").append(request.getContentLength()).append("\n"); log.append("CharacterEncoding : ").append(request.getCharacterEncoding()).append("\n"); log.append("---- Headers START\n"); Enumeration<String> headerNames = request.getHeaderNames(); while (headerNames.hasMoreElements()) { hN = headerNames.nextElement(); log.append("[" + hN + "]="); Enumeration<String> headers = request.getHeaders(hN); while (headers.hasMoreElements()) { log.append("[" + headers.nextElement() + "]"); } log.append("\n"); } log.append("---- Headers END\n"); log.append("---- Body START\n"); log.append(IOUtils.toString(request.getInputStream())).append("\n"); log.append("---- Body END\n"); log.append("-- DUMP HttpServletRequest END \n"); }
From source file:eionet.meta.filters.DDCORSFilter.java
@Override public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain) throws IOException, ServletException { HttpServletResponse response = (HttpServletResponse) resp; HttpServletRequest request = (HttpServletRequest) req; String requestUrl = request.getRequestURL().toString(); // filter only if request ends with /json int lastIndexOfSlash = StringUtils.lastIndexOf(requestUrl, "/"); String subString = StringUtils.substring(requestUrl, lastIndexOfSlash); if (StringUtils.startsWith(subString, "/json")) { response.setHeader("Access-Control-Allow-Origin", "*"); response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE"); response.setHeader("Access-Control-Max-Age", "3600"); response.setHeader("Access-Control-Allow-Headers", "x-requested-with"); }/*from ww w. j a v a 2 s. c o m*/ chain.doFilter(req, resp); }
From source file:eu.openanalytics.rpooli.web.BaseUriInjectionFilter.java
@Override public void doFilter(final ServletRequest request, final ServletResponse response, final FilterChain chain) throws IOException, ServletException { final HttpServletRequest req = (HttpServletRequest) request; final String baseUri = StringUtils.replace(req.getRequestURL().toString(), req.getRequestURI(), req.getContextPath());//from w ww. j a va2 s. c o m request.setAttribute("baseUri", baseUri); chain.doFilter(request, response); }
From source file:com.mycompany.controller.account.ManageCustomerAddressesController.java
@RequestMapping(method = RequestMethod.GET) public String viewCustomerAddresses(HttpServletRequest request, Model model) { LOG.info("NHANVO_LOG " + request.getRequestURL()); return super.viewCustomerAddresses(request, model); }
From source file:net.fenyo.mail4hotspot.web.OAuthServlet.java
@Override protected String getRedirectUri(HttpServletRequest req) throws ServletException, IOException { GenericUrl url = new GenericUrl(req.getRequestURL().toString()); url.setRawPath("/mail4hotspot/oauthcb"); return url.build(); }
From source file:net.duckling.ddl.web.interceptor.access.VWBDenyListener.java
private String getRequestURL(HttpServletRequest request) { String url = request.getRequestURL().toString(); if (url.endsWith("/")) { url = url.substring(0, url.length() - 1); }/*from w ww .java2s . co m*/ if (request.getQueryString() != null) { url = url + "?" + request.getQueryString(); } return url; }
From source file:org.owasp.webgoat.service.BaseService.java
/** * <p>handleException.</p>//from w w w. j a v a 2s.co m * * @param request a {@link javax.servlet.http.HttpServletRequest} object. * @param ex a {@link java.lang.Exception} object. * @return a {@link org.owasp.webgoat.service.ExceptionInfo} object. */ @ExceptionHandler(Exception.class) @ResponseStatus(value = HttpStatus.I_AM_A_TEAPOT) public @ResponseBody ExceptionInfo handleException(HttpServletRequest request, Exception ex) { String url = request.getRequestURL().toString(); logger.error("Exception handler for service caught exception when processing: " + url, ex); ExceptionInfo response = new ExceptionInfo(); response.setUrl(url); response.setMessage(getStringStackTrace(ex)); return response; }
From source file:edu.usu.sdl.openstorefront.web.init.ShiroAdjustedFilter.java
@Override protected void doFilterInternal(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain chain) throws ServletException, IOException { if (servletRequest instanceof HttpServletRequest) { HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest; String url = httpServletRequest.getRequestURL().toString(); if (url.contains("Login.action") && url.contains(";")) { HttpServletResponse response = (HttpServletResponse) servletResponse; response.sendRedirect(httpServletRequest.getContextPath()); return; }//from w w w . j av a 2 s . com if (url.endsWith("Login.action") == false && url.contains("/api/") == false && url.contains("/apidoc/") == false) { String queryString = httpServletRequest.getQueryString(); if (StringUtils.isNotBlank(queryString)) { url = url + "?" + queryString; } httpServletRequest.getSession().setAttribute(REFERENCED_FILTER_URL_ATTRIBUTE, url); } } super.doFilterInternal(servletRequest, servletResponse, chain); }