List of usage examples for javax.servlet.http HttpServletRequest getRequestURI
public String getRequestURI();
From source file:org.uaa.security.core.LoginHandler.java
public boolean isLogin(HttpServletRequest request) { String uri = request.getRequestURI(); log.debug("context: " + request.getContextPath()); log.debug("uri: " + request.getRequestURI()); int pathParamIndex = uri.indexOf(';'); if (pathParamIndex > 0) { // strip everything from the first semi-colon uri = uri.substring(0, pathParamIndex); }/*w w w.ja va 2 s . c o m*/ int queryParamIndex = uri.indexOf('?'); if (queryParamIndex > 0) { // strip everything from the first question mark uri = uri.substring(0, queryParamIndex); } if ("".equals(request.getContextPath())) { return uri.endsWith(login_url); } return uri.endsWith(request.getContextPath() + login_url); }
From source file:com.surevine.alfresco.audit.listeners.MultiDocumentDeleteAuditEventListener.java
/** * The multi-document event is fired if the URI contains the designator and there is a parameter in the request * which has the key 'alf_method'./*from ww w. j a va 2 s . co m*/ * * @see com.surevine.alfresco.audit.listeners.PostAuditEventListener#isEventFired(javax.servlet.http.HttpServletRequest, * java.lang.String) */ @Override public boolean isEventFired(final HttpServletRequest request) { return (request.getRequestURI().contains(URI_DESIGNATOR) && "delete".equals(request.getParameter("alf_method"))); }
From source file:com.assemblade.rest.PathHandler.java
@Override public void handleRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String address = request.getRequestURI(); if (address.contains("/path")) { }//from w w w.j a v a 2 s.co m }
From source file:ar.com.zauber.commons.web.uri.UriJspFunctionsTest.java
/** Test que prueba si el pedido es en el mismo segmento ..*/ @Test//from ww w . j ava 2 s. c o m @Ignore(value = "ahora que no se envia el request...") public final void buildUriWithContext() { setException(true); PageContext ctx = getPc(); HttpServletRequest req = getReq(); Mockito.when(req.getRequestURI()).thenReturn("/app/bin/nada"); Mockito.when(req.getContextPath()).thenReturn("/app/bin"); Assert.assertEquals("./abc", UriJspFunctions.buildVarArgs(ctx, "abc", ctx.getRequest())); Assert.assertEquals("./abc", UriJspFunctions.buildVarArgs(ctx, "/abc", ctx.getRequest())); Mockito.when(req.getRequestURI()).thenReturn("/app/bin/nada/par"); Mockito.when(req.getContextPath()).thenReturn("/app/bin"); Assert.assertEquals("../par/abc", UriJspFunctions.buildVarArgs(ctx, "/par/abc", ctx.getRequest())); }
From source file:de.adorsys.oauth.authdispatcher.matcher.RememberMeAuthMatcher.java
@Override public ValveBase match(HttpServletRequest request, AuthorizationRequest authorizationRequest) { if (!request.getRequestURI().endsWith("/auth") || authorizationRequest == null || authorizationRequest.getClientID() == null) { return null; }// www . j a v a 2s. c o m if (!shouldRememberMe(request)) { return null; } Cookie cookieToken = getCookieToken(authorizationRequest.getClientID().getValue(), request); return cookieToken != null ? valve : null; }
From source file:com.thoughtworks.go.server.web.IgnoreResolver.java
private boolean isStaticFile(HttpServletRequest request) throws URISyntaxException { String path = new URI(request.getRequestURI()).getPath().toLowerCase(); for (String ext : STATIC_FILE_EXT) { if (path.endsWith(ext)) { return true; }/*from w w w .j av a 2 s .c om*/ } return false; }
From source file:org.uaa.security.core.ExceptionHandler.java
public void handle(Exception e, HttpServletRequest request, HttpServletResponse response) throws IOException { String uri = request.getRequestURI(); ResponseWithStatus res = null;/*w w w .java 2 s . com*/ if (e instanceof BadPrincipalsException) { res = new ResponseWithStatus(uri, "10004", ConfigUtil.getValue("10004")); } if (e instanceof BadCredentialsException) { res = new ResponseWithStatus(uri, "10005", ConfigUtil.getValue("10005")); } if (e instanceof NullAuthenticationException) { res = new ResponseWithStatus(uri, "10006", ConfigUtil.getValue("10006")); } if (e instanceof AccessDeniedException) { res = new ResponseWithStatus(uri, "10007", ConfigUtil.getValue("10007")); } response.setContentType("application/json;charset=UTF-8"); response.getOutputStream().write(res.toJson().getBytes()); return; }
From source file:br.com.munif.personalsecurity.aplicacao.autorizacao.GenericTokenApi.java
protected String[] getUrlParameters(HttpServletRequest request) { String paramters = request.getRequestURI().replaceFirst(url, ""); paramters = paramters.replaceFirst("/", ""); if (paramters.isEmpty()) { return new String[0]; }/*from www . j ava 2 s . co m*/ return paramters.split("/"); }
From source file:io.dropwizard.hystrix.path.tracker.filters.impl.PathTrackerFilter.java
public String identifyKey(ServletRequest servletRequest) { if (!Strings.isNullOrEmpty(key)) { return key; }/*from www.j a v a 2s .com*/ HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest; String uriPath = httpServletRequest.getRequestURI().split("\\?")[0]; return identifyPath(uriPath); }
From source file:com.kendo.interceptor.LoginInterceptor.java
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object hadler) throws Exception { String uri = request.getRequestURI(); //String previousUri=(String)request.getSession().getAttribute("PREVIOUS_URI"); // userId if (request.getSession().getAttribute("userInfo") == null) { log.info(" "); return true; } else {/*w w w .j a va 2 s.c o m*/ log.info(" "); return true; } }