List of usage examples for javax.servlet.http HttpServletRequest getRequestURI
public String getRequestURI();
From source file:edu.ucmerced.cas.authentication.principal.CasShibWebApplicationServiceImpl.java
public static CasShibWebApplicationServiceImpl createServiceFrom(final HttpServletRequest request, final HttpClient httpClient) { final String targetService = request.getParameter(CONST_PARAM_TARGET_SERVICE); final String method = request.getParameter(CONST_PARAM_METHOD); final String serviceToUse = StringUtils.hasText(targetService) ? targetService : request.getParameter(CONST_PARAM_SERVICE); if (!StringUtils.hasText(serviceToUse)) { return null; }// w w w. j av a2 s . c o m final String id = cleanupUrl(serviceToUse); final String artifactId = request.getParameter(CONST_PARAM_TICKET); // Extract the service passcode from url. // URLs should be in the following format: // /<contextPath>/shib/<appNameOrPasscode>/? String appNameOrPasscode = null; if ((request.getContextPath() != null ? request.getRequestURI().startsWith(request.getContextPath() + "/shib") : request.getRequestURI().startsWith("/shib"))) { String[] components = request.getRequestURI() .substring((request.getContextPath() != null ? request.getContextPath().length() : 0)) .split("/"); // 0 is the empty string before the first slash // 1 should be the shibX string // 2 should be the app name or passcode // 3... should be everything after the app name or passcode if (components.length > 3) { appNameOrPasscode = components[2]; log.debug("application name or passcode = " + appNameOrPasscode); } } else { log.debug("no application name or passcode detected in url"); } return new CasShibWebApplicationServiceImpl(id, serviceToUse, artifactId, "POST".equals(method) ? ResponseType.POST : ResponseType.REDIRECT, httpClient, appNameOrPasscode); }
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 w w. j a v a2 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:org.royrusso.mvc.controller.DefaultController.java
@RequestMapping("/**") public void unmappedRequest(HttpServletRequest request) { String uri = request.getRequestURI(); throw new UnknownResourceException("There is no resource for path " + uri); }
From source file:org.mifos.ui.core.controller.GenericController.java
public String getPageToDisplay(HttpServletRequest request) { return request.getRequestURI().replace("mifos/", "").replace("/", "").replace(".ftl", ""); }
From source file:com.snv.guard.DefaultHmacRequester.java
@Override public Boolean canVerify(HttpServletRequest request) { return request.getRequestURI().contains("/api") && !request.getRequestURI().contains("/api/users/login") && !request.getRequestURI().contains("/api/users/create"); }
From source file:com.hypersocket.ui.RedirectHandler.java
@Override public boolean handlesRequest(HttpServletRequest request) { return request.getRequestURI().equals("") || request.getRequestURI().equals("/") || request.getRequestURI().equals(server.getBasePath()) || request.getRequestURI().equals(server.getBasePath() + "/"); }
From source file:org.zols.web.exceptionhandling.ApiExceptionHandlerAdvice.java
/** * Handle exceptions thrown by handlers. * * @param exception/*from w ww. j a v a 2 s . c o m*/ * @param request * @return */ @ResponseStatus(HttpStatus.BAD_REQUEST) @ExceptionHandler(Exception.class) @ResponseBody ErrorInfo handleBadRequest(HttpServletRequest req, Exception ex) { return new ErrorInfo(req.getRequestURI(), ex); }
From source file:org.mitre.openid.connect.web.SAMLEntryPoint.java
private boolean processFilter(String filterName, HttpServletRequest request) { return (request.getRequestURI().contains(filterName)); }
From source file:web.logging.ExceptionLoggerAdvice.java
private String extractUrlFromRequest(HttpServletRequest request) { String url = request.getRequestURI(); String query = request.getQueryString(); if (StringUtils.hasText(query)) { url += "?" + request.getQueryString(); }/*from w ww. jav a2 s. co m*/ return url; }
From source file:eu.webtoolkit.jwt.servlet.WebRequest.java
private static String getPathInfo(HttpServletRequest request, String scriptName) { String pathInfo = request.getPathInfo(); // Jetty will report "/" as an internal path. Which totally makes no sense but is according // to the spec if (request.getServletPath().length() == 0) if (pathInfo != null && pathInfo.equals("/")) pathInfo = ""; if (pathInfo == null || pathInfo.length() == 0) { // Work around (jetty) bug where path info is not interpreted correctly for a URL // like /bla/hello;jsessionid=q0f2lqgeivq9uipxwk12gj6s/wt-resources/webkit-transitions.css String uri = request.getRequestURI(); if (uri.startsWith(scriptName + ";")) { int pathInfoStart = uri.indexOf('/', scriptName.length() + 1); if (pathInfoStart != -1) pathInfo = uri.substring(pathInfoStart); }/*from w w w.j a v a 2s .c om*/ } if (pathInfo == null) pathInfo = ""; return pathInfo; }