You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2011/12/14 12:16:53 UTC

DO NOT REPLY [Bug 52329] New: URI has a fragment component

https://issues.apache.org/bugzilla/show_bug.cgi?id=52329

             Bug #: 52329
           Summary: URI has a fragment component
           Product: Tomcat 7
           Version: 7.0.23
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: minor
          Priority: P2
         Component: Catalina
        AssignedTo: dev@tomcat.apache.org
        ReportedBy: ferdinand_dosser@yahoo.co.uk
    Classification: Unclassified


I have Tomcat 7 embedded in a application in which the jndi protocol is already
registered.
(see URL.setURLStreamHandlerFactory(URLStreamHandlerFactory fac) )

So, Tomcat fails to register his own and turns to protocol file:/ to lookup
resources.

The issue comes when there is a multiple level context (example: /test/myapp).
Tomcat expands the war under the directory webapps such as:
<tomcat_dir>/webapps/test#myapp/

When Tomcat looks up for resources, the url is malformed:
<tomat_dir>/webapps/test#myapp/WEB-INF/...
the part #myapp/WEB-INF/... is considered as a fragment

StackTrace:
java.lang.IllegalArgumentException: URI has a fragment component
    at java.io.File.<init>(Unknown Source)
    at
org.apache.catalina.startup.ContextConfig.processAnnotationsUrl(ContextConfig.java:1813)
    at
org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1203)
    at
org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:828)
    at
org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:302)
    at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
    at
org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
    at
org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5148)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)



My solution was to replace the FWD_SLASH_REPLACEMENT (#) by '~' in the
org.apache.catalina.util.ContextName class in catalina.jar

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 52329] URI has a fragment component

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52329

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |WONTFIX

--- Comment #1 from Mark Thomas <ma...@apache.org> 2011-12-14 22:04:10 UTC ---
The choice of '#' was a deliberate one as it can't legitimately appear in a
context path. '~' can so the work-around proposed can't be used.

Tomcat uses the jndi protocol internally. There is no easy way to avoid that.

There was some discussion of ripping out the DirContext abstraction for
resources (which would remove the need for Tomcat to use the jndi protocol) but
it has not been investigated.

Since you have a workaround that works for use, the bets option is for you to
carry on using it. It you wnated to look at removing the DirContext abstraction
that would be great but it is likely to be a lot of work (and may not even be
possible).

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org