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:com.navercorp.pinpoint.web.servlet.RewriteForV2Filter.java

public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
        throws IOException, ServletException {
    if (enable) {
        HttpServletRequest req = (HttpServletRequest) request;
        String requestURI = req.getRequestURI();

        if (isRedirectTarget(requestURI)) {
            HttpServletRequestWrapper wrapper = new HttpServletRequestWrapper((HttpServletRequest) request);
            RequestDispatcher dispatcher = wrapper.getRequestDispatcher("/v2/index.html");

            dispatcher.forward(request, response);
        } else {//from   w  ww.  j a v  a2  s .  co m
            chain.doFilter(request, response);
        }
    } else {
        chain.doFilter(request, response);
    }

}

From source file:com.enonic.cms.web.webdav.SimpleDavServlet.java

private boolean isHidden(final HttpServletRequest request) {
    final String uri = request.getRequestURI();
    final String name = FilenameUtils.getName(uri);
    return this.configuration.isHidden(name);
}

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

@ExceptionHandler(Exception.class)
public ModelAndView exceptionHandler(HttpServletRequest request, Exception exception) {
    ModelMap model = new ModelMap();
    log.error("Error URI: " + request.getRequestURI());
    log.error(exception.getMessage(), exception);
    model.addAttribute("exception", exception);
    model.addAttribute("pageTitle", "Error");
    return new ModelAndView("/error/display", model);
}

From source file:com.cpjit.swagger4j.support.servlet.ApiServlet.java

@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
    String uri = req.getRequestURI();
    if (uri.matches(".*/api/index(/?)(!/)*")) {
        toIndex(req, resp);//from   ww w  .j a  v a2  s .c  o m
    } else if (uri.matches(".*/api/statics/.+")) {
        queryStatic(req, resp);
    } else {
        try {
            queryApi(req, resp);
        } catch (Exception e) {
            throw new ServletException(e);
        }
    }
}

From source file:uk.org.rbc1b.roms.controller.RequestLoggerInterceptor.java

@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
        throws Exception {
    LOGGER.info("Start: {}", request.getRequestURI());
    return true;/*from w ww  .j  a v a 2 s  . c  om*/
}

From source file:com.surevine.alfresco.audit.listeners.DownloadDocumentAuditEventListener.java

@Override
public void setSpecificAuditMetadata(final Auditable audit, final HttpServletRequest request)
        throws JSONException {

    setMetadataFromNodeRef(audit, nodeRefResolver.getNodeRef(request.getRequestURI()));
}

From source file:org.uaa.security.core.AuthorizationManager.java

public void decide(UsernamePasswordToken token, HttpServletRequest request) throws AccessDeniedException {
    String action = request.getMethod().toUpperCase();
    String uri = request.getRequestURI();
    String context = request.getContextPath();
    log.debug(uri.replace(context, ""));

    List<Integer> roles = token.getRoles();

    if (!SecuritySupport.isAllowed(action, uri.replace(context, ""), roles)) {
        log.info("you don't have needed authorities to access this resource");
        throw new AccessDeniedException("you don't have needed authorities to access this resource");
    }//from   www .j ava 2  s. co  m
}

From source file:com.kdgregory.pathfinder.test.scan.controller.ControllerA.java

@RequestMapping(value = "/foo")
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   ww w . j a v  a2 s  .  c o m
}

From source file:com.googlesource.gerrit.plugins.github.oauth.OAuthFilter.java

private boolean isStaticResource(HttpServletRequest httpRequest) {
    String pathExt = StringUtils.substringAfterLast(httpRequest.getRequestURI(), ".");
    if (StringUtils.isEmpty(pathExt)) {
        return false;
    }/* w w  w .j  a  va  2 s. c om*/

    return GERRIT_STATIC_RESOURCES_EXTS.contains(pathExt.toLowerCase());
}

From source file:com.kdgregory.pathfinder.test.scan.controller.ControllerB.java

@RequestMapping(value = "/bar", method = RequestMethod.GET)
protected ModelAndView getBar(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 ww .  j  ava2s .com*/
}