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:org.opensprout.osaf.web.interceptor.SessionAttributeNameInterceptor.java

@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
        throws Exception {
    request.setAttribute(SESSION_ATTR_PREFIX, request.getRequestURI());
    return super.preHandle(request, response, handler);
}

From source file:org.jamwiki.authentication.JAMWikiAuthenticationProcessingFilter.java

/**
 * Indicates whether this filter should attempt to process a login request
 * for the current invocation./*from ww  w.  j  a va 2 s . c  o m*/
 *
 * It strips any parameters from the "path" section of the request URL
 * (such as the jsessionid parameter in
 * http://host/myapp/index.html;jsessionid=blah) before matching against
 * the filterProcessesUrl property.
 *
 * FIXME - This method is needed due to the fact that different virtual
 * wikis may be used.
 */
protected boolean requiresAuthentication(HttpServletRequest request, HttpServletResponse response) {
    String uri = request.getRequestURI();
    // FIXME - move the "strip after semicolon" code to WikiUtil
    int pathParamIndex = uri.indexOf(';');
    if (pathParamIndex > 0) {
        // strip everything after the first semi-colon
        uri = uri.substring(0, pathParamIndex);
    }
    String virtualWiki = WikiUtil.getVirtualWikiFromURI(request);
    return uri.endsWith(request.getContextPath() + "/" + virtualWiki + this.getFilterProcessesUrl());
}

From source file:com.kdgregory.pathfinder.test.spring3.pkg1.ControllerA.java

@RequestMapping(value = "/foo.html")
protected ModelAndView getFoo(HttpServletRequest request, HttpServletResponse response) throws Exception {
    ModelAndView mav = new ModelAndView("simple");
    mav.addObject("reqUrl", request.getRequestURI());
    mav.addObject("controller", getClass().getName());
    return mav;//from   www . j a va2 s .c om
}

From source file:org.geoserver.ows.ClasspathPublisher.java

@Override
protected URL getUrl(HttpServletRequest request) {
    String ctxPath = request.getContextPath();
    String reqPath = request.getRequestURI();
    reqPath = reqPath.substring(ctxPath.length());

    // try a few lookups
    URL url = clazz.getResource(reqPath);
    if (url == null && !reqPath.startsWith("/")) {
        url = clazz.getResource("/");
    }// w w  w .  j a  v a2  s  . co m
    if (url == null && (reqPath.length() > 1) && reqPath.startsWith("/")) {
        url = clazz.getResource(reqPath.substring(1));
    }
    return url;
}

From source file:com.enonic.cms.web.portal.instanttrace.InstantTraceResourceHandler.java

private void handleResource(HttpServletRequest request, HttpServletResponse response) throws Exception {
    final String fileName = FilenameUtils.getName(request.getRequestURI());
    final String mimeType = mimeTypeResolver.getMimeType(fileName);
    final InputStream inputStream = this.resourceLoader.getResource("WEB-INF/itrace/" + fileName)
            .getInputStream();/*from   ww  w  .  java  2 s  . c om*/
    final ServletOutputStream outputStream = response.getOutputStream();

    HttpServletUtil.copyNoCloseOut(inputStream, outputStream);
    response.setContentType(mimeType);
}

From source file:foo.domaintest.action.RequestModule.java

/** Provides the request path. */
@Provides// ww  w .j  av  a2  s  .  c  o m
@RequestData("path")
String provideRequestPath(HttpServletRequest request) {
    return request.getRequestURI(); // Poorly named, but this gives the path.
}

From source file:es.itecban.deployment.executionmanager.web.controller.UnitInverseDependenciesController.java

private String getXMLDependencyGraphURL(DeploymentUnitType unit, HttpServletRequest request) throws Exception {
    String file = request.getRequestURI();
    if (request.getQueryString() != null) {
        file += '?' + request.getQueryString() + "&justGraph=true";
    }/*w ww.  j av a 2 s .  c  om*/
    URL reconstructedURL = new URL(request.getScheme(), request.getServerName(), request.getServerPort(), file);
    return reconstructedURL.toString();
}

From source file:com.kdgregory.pathfinder.test.spring3.pkg2.ControllerC.java

@RequestMapping(method = RequestMethod.GET)
protected ModelAndView getC(HttpServletRequest request, HttpServletResponse response) throws Exception {
    ModelAndView mav = new ModelAndView("simple");
    mav.addObject("reqUrl", request.getRequestURI());
    mav.addObject("controller", getClass().getName());
    return mav;/*from  w  w w.j  a  va 2s  .c o  m*/
}

From source file:org.apache.cxf.fediz.spring.web.FederationAuthenticationFilter.java

/**
 * //www. j a  va2s  . c  o  m
 */
@Override
protected boolean requiresAuthentication(final HttpServletRequest request, final HttpServletResponse response) {
    final boolean result = request.getRequestURI().contains(getFilterProcessesUrl());

    if (logger.isDebugEnabled()) {
        logger.debug("requiresAuthentication = " + result);
    }
    return result;
}

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   ww  w. ja  v a  2  s  .c om*/
    request.setAttribute("baseUri", baseUri);

    chain.doFilter(request, response);
}