Example usage for javax.servlet.http HttpServletRequest getContextPath

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

Introduction

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

Prototype

public String getContextPath();

Source Link

Document

Returns the portion of the request URI that indicates the context of the request.

Usage

From source file:com.thoughtworks.go.server.web.IgnoreResolver.java

private boolean isGoingToServerInfo(HttpServletRequest request) {
    return StringUtils.equals(request.getRequestURI(), request.getContextPath() + "/api/server.xml");
}

From source file:com.thoughtworks.go.server.web.IgnoreResolver.java

private boolean isDownloadAgentJar(HttpServletRequest request) {
    return StringUtils.equals(request.getRequestURI(), request.getContextPath() + "/admin/agent");
}

From source file:psiprobe.controllers.apps.AjaxReloadContextController.java

@Override
protected ModelAndView handleContext(String contextName, Context context, HttpServletRequest request,
        HttpServletResponse response) throws Exception {

    if (!request.getContextPath().equals(contextName) && context != null) {
        try {// w ww.j  a v a  2s  . co  m
            logger.info("{} requested RELOAD of {}", request.getRemoteAddr(), contextName);
            context.reload();
            // Logging action
            Authentication auth = SecurityContextHolder.getContext().getAuthentication();
            String name = auth.getName(); // get username logger
            logger.info(getMessageSourceAccessor().getMessage("probe.src.log.reload"), name, contextName);
        } catch (Exception e) {
            logger.error("Error during ajax request to RELOAD of '{}'", contextName, e);
        }
    }
    return new ModelAndView(getViewName(), "available",
            context != null && getContainerWrapper().getTomcatContainer().getAvailable(context));
}

From source file:net.codejava.spring.HomeController.java

@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
    System.out.println("Reached:--->" + req.getContextPath());
    req.getRequestDispatcher("/tools/url").forward(req, resp);
}

From source file:com.exedio.cope.live.ModificationMedia.java

String getURL(final HttpServletRequest request, final HttpServletResponse response) {
    return response.encodeURL(request.getContextPath() + request.getServletPath() + '/'
            + MediaServlet.makeURL(getFeature(), item));
}

From source file:com.thoughtworks.go.server.web.IgnoreResolver.java

private boolean isGoingToLogin(HttpServletRequest request) {
    return StringUtils.contains(request.getRequestURI(), request.getContextPath() + "/auth/");
}

From source file:com.thoughtworks.go.server.web.IgnoreResolver.java

private boolean isGoingToAbout(HttpServletRequest request) {
    return StringUtils.contains(request.getRequestURI(), request.getContextPath() + "/about");
}

From source file:com.thoughtworks.go.server.web.IgnoreResolver.java

private boolean isGoingToPlugin(HttpServletRequest request) {
    return StringUtils.contains(request.getRequestURI(), request.getContextPath() + "/plugin/interact/");
}

From source file:org.wallride.web.support.BlogLanguageRedirectStrategy.java

@Override
public void sendRedirect(HttpServletRequest request, HttpServletResponse response, String url)
        throws IOException {
    String redirectUrl = request.getContextPath() + url;

    BlogLanguageDataValueProcessor processor = new BlogLanguageDataValueProcessor();
    redirectUrl = processor.processUrl(request, redirectUrl);

    redirectUrl = response.encodeRedirectURL(redirectUrl);
    response.sendRedirect(redirectUrl);/*  w  ww .  j  av  a 2s .  com*/
}

From source file:io.dfox.junit.http.example.NoteServlet.java

private String getNoteName(final HttpServletRequest request) {
    return request.getRequestURI().substring(request.getContextPath().length() + 1);
}