Example usage for javax.servlet.http HttpServletRequest getServletPath

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

Introduction

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

Prototype

public String getServletPath();

Source Link

Document

Returns the part of this request's URL that calls the servlet.

Usage

From source file:net.nobien.springsocial.examples.foursquare.user.UserInterceptor.java

private void handleSignOut(HttpServletRequest request, HttpServletResponse response) {
    if (SecurityContext.userSignedIn() && request.getServletPath().startsWith("/signout")) {
        connectionRepository.createConnectionRepository(SecurityContext.getCurrentUser().getId())
                .removeConnections("foursquare");
        userCookieGenerator.removeCookie(response);
        SecurityContext.remove();/*from w  w w.  j  a va2  s .c om*/
    }
}

From source file:com.cloud.servlet.StaticResourceServlet.java

private File getRequestedFile(final HttpServletRequest req) {
    return new File(getServletContext().getRealPath(req.getServletPath()));
}

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:net.gustavohenrique.tutorial.social.UserInterceptor.java

private void handleSignOut(HttpServletRequest request, HttpServletResponse response) {
    if (SecurityContext.userSignedIn() && request.getServletPath().startsWith("/signout")) {
        connectionRepository.createConnectionRepository(SecurityContext.getCurrentUser().getStringId())
                .removeConnections("facebook");
        userCookieGenerator.removeCookie(response);
        SecurityContext.remove();/*from w  ww  .  j a va2 s.c o  m*/
    }
}

From source file:de.techdev.user.UserInterceptor.java

private void handleSignOut(HttpServletRequest request, HttpServletResponse response) {
    if (SecurityContext.userSignedIn() && request.getServletPath().startsWith("/signout")) {
        connectionRepository.createConnectionRepository(SecurityContext.getCurrentUser().getId())
                .removeConnections("wunderlist");
        userCookieGenerator.removeCookie(response);
        SecurityContext.remove();/*from  ww  w. j ava 2s. c om*/
    }
}

From source file:com.cloudfoundry.samples.spring.user.UserInterceptor.java

private void handleSignOut(HttpServletRequest request, HttpServletResponse response) {
    if (SecurityContext.userSignedIn() && request.getServletPath().startsWith("/signout")) {
        connectionRepository.createConnectionRepository(SecurityContext.getCurrentUser().getId())
                .removeConnections("facebook");
        userCookieGenerator.removeCookie(response);
        SecurityContext.remove();//from   w  w  w .  ja  v a  2s .  c  o  m
    }
}

From source file:com.apress.progwt.server.web.controllers.ErrorController.java

@Override
protected ModelAndView handleRequestInternal(HttpServletRequest req, HttpServletResponse arg1)
        throws Exception {

    log.error("\nErrorController reqServ " + req.getServletPath() + " PathInfo:" + req.getPathInfo()
            + " Param: " + req.getParameterNames().toString() + " Q: " + req.getQueryString() + "</>");

    //        if(log.isDebugEnabled()){
    //            for(Object s :req.getParameterMap().keySet()){
    //                log.debug("param "+s);
    //            }
    //            Enumeration attrs = req.getAttributeNames();
    //            while(attrs.hasMoreElements()){
    //                String attr = (String) attrs.nextElement();
    //                log.debug("attr: "+attr+" "+req.getAttribute(attr));
    //            }
    //        }/* w  w w  .j  a  v  a 2s  .  c om*/

    ModelAndView m = super.handleRequestInternal(req, arg1);
    String code = req.getParameter("code");
    if (code != null) {
        Object uri = req.getAttribute("javax.servlet.error.request_ uri");
        m.addObject("message", code + " error for page " + uri);
    }
    return m;
}

From source file:org.jasig.portlet.attachment.filter.LocalAttachmentFilter.java

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

    HttpServletRequest httpServletRequest = (HttpServletRequest) request;
    String relative = httpServletRequest.getServletPath();
    String path = httpServletRequest.getSession().getServletContext().getRealPath(relative);
    File file = new File(path);

    if (!file.exists()) {
        String[] parts = path.split("/");
        int guidIndex = parts.length - 2;
        String guid = parts[guidIndex];

        Attachment attachment = attachmentService.get(guid, httpServletRequest);
        if (attachment != null) {
            if (log.isDebugEnabled()) {
                log.debug("Restoring the following  attachment to the server file system:  " + path);
            }//from w w w  .  j  av  a  2s .c o  m
            byte[] content = DataUtil.decode(attachment.getData());
            FileUtil.write(path, content);
        } else {
            if (log.isInfoEnabled()) {
                log.info("Attachment not found:  " + path);
            }
        }
    }

    chain.doFilter(request, response);

}

From source file:net.zouabimourad.springsocialjira.auth.UserInterceptor.java

private void handleSignOut(HttpServletRequest request, HttpServletResponse response) {
    if (SecurityContext.userSignedIn() && request.getServletPath().startsWith("/signout")) {
        connectionRepository.createConnectionRepository(SecurityContext.getCurrentUser().getId())
                .removeConnections("jira");
        userCookieGenerator.removeCookie(response);
        SecurityContext.remove();/*from w  ww. j a  v a2s .c  o  m*/
    }
}

From source file:org.selfiepro.client.user.UserInterceptor.java

private void handleSignOut(HttpServletRequest request, HttpServletResponse response) {
    if (SecurityContext.userSignedIn() && request.getServletPath().startsWith("/signout")) {
        ConnectionRepository conRep = connectionRepository
                .createConnectionRepository(SecurityContext.getCurrentUser().getId());
        conRep.removeConnections("facebook");
        userCookieGenerator.removeCookie(response);
        SecurityContext.remove();//ww w  . j ava2 s  .  co m
    }
}