HttpServletRequest.getServletPath() returns wrong information
-------------------------------------------------------------

                 Key: MAGNOLIA-3751
                 URL: http://jira.magnolia-cms.com/browse/MAGNOLIA-3751
             Project: Magnolia
          Issue Type: Bug
    Affects Versions: 4.4.4
         Environment: Tomcat 6, Magnolia 4.4
            Reporter: Philipp Gaschütz
            Priority: Major


A magnolia instance is mounted on /magnoliaAuthor/

When implementing a Voter for a CachePolicy I realised, that 
HttpServletRequest.getServletPath() returns the URI AFTER /magnoliaAuthor/

Example:
Request URL is http://localhost:8080/magnoliaAuthor/Home/SomePage.html
HttpServletRequest.getServletPath() yields "/Home/SomePage.html"
As I understand the documentation, this should return "/magnoliaAuthor"

I didn't look into this in detail, but guess it has something to do with 
RequestWrapping?

Test class:

public class NoCacheVoter extends AbstractBoolVoter {
        
        @Override
        protected boolean boolVote(Object value) {
        HttpServletRequest request;
        if (value instanceof HttpServletRequest) {
            request = (HttpServletRequest) value;
        }
        else {
            if (MgnlContext.isWebContext()) {
                request = MgnlContext.getWebContext().getRequest();
            }
            else {
                return false;
            }
        }
        
        System.out.println("getRequestURI: " + request.getRequestURI());
        System.out.println("getServletPath: " + request.getServletPath());
        
        if(request.getRequestURI().startsWith( request.getServletPath() + 
"/Home/system/")) {
                if(logger.isInfoEnabled()) {
                        logger.info("Not caching request {}", 
request.getRequestURI());
                }
                return true;
        }
        
        return false;
        }
}


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.magnolia-cms.com/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




----------------------------------------------------------------
For list details see
http://www.magnolia-cms.com/community/mailing-lists.html
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------

Reply via email to