Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jetty-users] URIUtil.equalsIgnoreEncodings not working on multi-byte characters?

This had been working with jetty 6.x,  when we switched to 9.2.2 it no longer worked.

I have a resource which is a file with Chinese characters in the name. Jetty encodes the file name with escaped hex characters. The chinese character   (29420) becomes %E7%8B%AC.  In new FileResource(uri) URIUtil.equalsIgnoreEncodings decodes only the first byte, and compares E7 (231) with 29420 and finds they are not equal. ( If all three encoded bytes are treated as a multi-byte character (http://tools.ietf.org/html/rfc3629), they decode to 29420.

In new FileResource(uri), when equalsIgnoreEncodings returns false, an alias is created, and therefore getResource() is subject to alias checks.  The only alias check in the ContextHandler is ApproveNonexistantDirectoryAliases - which rejects existing directories.  And the logic in the alias checks is that if there are checks, and none of them pass, getResource() returns null. So the net effect of having only ApproveNonexistantDirectoryAliases by itself, is to make anything else fail (?)


2015-04-16 16:17:37.358:WARN:oejw.WebAppContext:main: Failed startup of context o.o.@776b7fa2{/oraclediagent,file:/scratch/mreiche/view_storage/mreiche_odi_1/odi/sah/user_projects/domains/base_domain/system_components/ODI/%E7%8B%AC%E7%AB%8B%E4%BB%A3%E7%90%86/webapp/,STARTING}{file:/scratch/mreiche/view_storage/mreiche_odi_1/odi/sah/odi/agent/lib/./oraclediagent.war}
org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from ServletContext resource [/WEB-INF/ctx/agent.xml]; nested exception is java.io.FileNotFoundException: Could not open ServletContext resource [/WEB-INF/ctx/agent.xml]
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:341)
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302)
        at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:174)
        at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:209)
        at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:180)
        at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:125)
        at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:94)
        at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:131)
        at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:522)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:436)
        at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:384)
        at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:283)
        at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111)
        at org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized(ContextHandler.java:798)
        at org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized(ServletContextHandler.java:444)
        at org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:789)
        at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:294)
        at org.eclipse.jetty.webapp.WebAppContext.startWebapp(WebAppContext.java:1341)
        at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1334)
        at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:741)
        at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:497)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
        at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:132)
        at org.eclipse.jetty.server.Server.start(Server.java:380)
        at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:114)
        at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:61)
        at org.eclipse.jetty.server.Server.doStart(Server.java:347)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
        at oracle.odi.Agent.startAgent(Agent.java:452)
        at oracle.odi.Agent.main(Agent.java:854)
Caused by:
java.io.FileNotFoundException: Could not open ServletContext resource [/WEB-INF/ctx/agent.xml]
        at org.springframework.web.context.support.ServletContextResource.getInputStream(ServletContextResource.java:118)
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:328)
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302)
        at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:174)
        at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:209)
        at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:180)
        at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:125)
        at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:94)
        at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:131)
        at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:522)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:436)
        at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:384)
        at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:283)
        at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111)
        at org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized(ContextHandler.java:798)
        at org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized(ServletContextHandler.java:444)
        at org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:789)
        at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:294)
        at org.eclipse.jetty.webapp.WebAppContext.startWebapp(WebAppContext.java:1341)
        at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1334)
        at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:741)
        at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:497)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
        at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:132)
        at org.eclipse.jetty.server.Server.start(Server.java:380)
        at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:114)
        at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:61)
        at org.eclipse.jetty.server.Server.doStart(Server.java:347)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
        at oracle.odi.Agent.startAgent(Agent.java:452)
        at oracle.odi.Agent.main(Agent.java:854)

Back to the top