Example usage for javax.servlet.http HttpServletRequest getRequestURI

List of usage examples for javax.servlet.http HttpServletRequest getRequestURI

Introduction

In this page you can find the example usage for javax.servlet.http HttpServletRequest getRequestURI.

Prototype

public String getRequestURI();

Source Link

Document

Returns the part of this request's URL from the protocol name up to the query string in the first line of the HTTP request.

Usage

From source file:at.ac.tuwien.dsg.cloud.utilities.test.kongtestservice.utilities.RequestLogInterceptor.java

@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
        throws Exception {

    logger.info("REQUEST: " + request.getRequestURI() + " FORWARD OF: "
            + request.getAttribute("javax.servlet.forward.request_uri"));

    return super.preHandle(request, response, handler);
}

From source file:de.accso.performancetesting.tools.PerformanceLogger.java

private String getCtxUrl() {
    String url = "";
    RequestAttributes ra = RequestContextHolder.getRequestAttributes();
    if (ra != null && ra instanceof ServletRequestAttributes) {
        HttpServletRequest r = ((ServletRequestAttributes) ra).getRequest();
        url = r.getRequestURI();
    }//from www.  j  a  va  2s .  c o  m
    return url;
}

From source file:es.ucm.fdi.dalgs.rest.web.WebhookController.java

/** 
 * Error if user try to access to any other url. 
 *//*  w  ww.  ja v a 2 s  . c o  m*/
@RequestMapping(value = "/api/**", method = RequestMethod.GET)
public void notExistsUrlHandler(HttpServletRequest request) {
    throw new IllegalArgumentException("Requested url not exists: " + request.getRequestURI());
}

From source file:com.beyondjservlet.gateway.servlet.HttpMappingRuleResolver.java

public HttpMappingResult findMappingRule(HttpServletRequest request) {
    String requestURI = request.getRequestURI();
    String contextPath = request.getParameter("__c");

    if (contextPath == null) {
        return null;
    }/*from   w  ww. j  a v  a  2s  .com*/

    if (!contextPath.equals("/") && !contextPath.startsWith("/")) {
        contextPath = "/" + contextPath;
    }

    MappingResult answer = null;
    if (contextPath != null && contextPath.length() > 0 && !contextPath.equals("/")) {
        answer = resolver.findWebContextMappingRule(contextPath);
    }
    if (answer == null) {
        // lets try the full request URI with the context path to see if that maps
        answer = resolver.findWebContextMappingRule(requestURI);
    }
    return answer != null ? new HttpMappingResult(answer) : null;
}

From source file:com.jayway.jaxrs.hateoas.web.RequestContextFilter.java

@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
        throws IOException, ServletException {

    final HttpServletRequest servletRequest = (HttpServletRequest) request;

    String requestURI = servletRequest.getRequestURI();
    requestURI = StringUtils.removeStart(requestURI,
            servletRequest.getContextPath() + servletRequest.getServletPath());
    String baseURL = StringUtils.removeEnd(servletRequest.getRequestURL().toString(), requestURI);
    UriBuilder uriBuilder = UriBuilder.fromUri(baseURL);

    RequestContext ctx = new RequestContext(uriBuilder,
            servletRequest.getHeader(RequestContext.HATEOAS_OPTIONS_HEADER));

    RequestContext.setRequestContext(ctx);
    try {/*ww  w . j  av  a 2 s.  c  o m*/
        chain.doFilter(request, response);
    } finally {
        RequestContext.clearRequestContext();
    }
}

From source file:edu.uiowa.icts.bluebutton.web.DefaultController.java

@ExceptionHandler
public ModelAndView error(HttpServletRequest request, Exception exception) {
    log.error("Error URI: " + request.getRequestURI());
    log.error("Error Username: " + getUsername());
    log.error("Error Message: " + exception.getMessage(), exception);
    ModelMap model = new ModelMap();
    model.addAttribute("exception", exception);
    return new ModelAndView("error", model);
}

From source file:com.thoughtworks.go.server.security.DenyGoCDAccessForArtifactsFilter.java

private boolean requestingAnArtifact(HttpServletRequest request) {
    String requestURI;/*w w w . j a v  a  2s .  c o m*/
    try {
        requestURI = new URI(request.getRequestURI()).normalize().toString();
    } catch (URISyntaxException e) {
        requestURI = request.getRequestURI();
    }
    return requestURI.startsWith("/go/files");
}

From source file:de.micromata.genome.tpsb.httpmockup.MockFilterChain.java

@Override
public void doFilter(final ServletRequest req, final ServletResponse resp)
        throws IOException, ServletException {
    HttpServletRequest hreq = (HttpServletRequest) req;
    String uri = hreq.getRequestURI();
    String localUri = uri;//from   w  ww  .  ja  v  a  2  s. co m
    if (StringUtils.isNotBlank(hreq.getServletPath()) && StringUtils.isNotBlank(hreq.getPathInfo()) == true) {
        localUri = hreq.getServletPath() + hreq.getPathInfo();
    }
    final MockFiltersConfig fc = this.mockupServletContext.getFiltersConfig();

    this.filterIndex = fc.getNextFilterMapDef(localUri, this.filterIndex, this.dispatcherFlag);
    if (this.filterIndex == -1) {
        this.mockupServletContext.serveServlet((HttpServletRequest) req, (HttpServletResponse) resp);
        return;
    }
    final Filter f = fc.getFilterMapping().get(this.filterIndex).getFilterDef().getFilter();
    ++this.filterIndex;
    if (log.isDebugEnabled() == true) {
        log.debug("Filter filter: " + f.getClass().getName());
    }
    f.doFilter(req, resp, this);

}

From source file:net.osxx.interceptor.DebugInterceptor.java

@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
        throws Exception {

    String urlString = request.getRequestURI();
    return true;/*from w  ww.  j av a2 s.c  om*/

}

From source file:com.thoughtworks.go.server.controller.PipelineStatusController.java

private boolean isForceBuildRequest(HttpServletRequest request) {
    return request.getRequestURI().contains(FORCE_URI);
}