[
https://issues.redhat.com/browse/WFLY-13067?page=com.atlassian.jira.plugi...
]
Bartosz Baranowski commented on WFLY-13067:
-------------------------------------------
[
https://docs.oracle.com/cd/E12839_01/web.1111/e13712/configurewebapp.htm#...]
?? However, the contents of the {{WEB-INF}} directory are visible to servlet code using
the {{getResource}} and {{getResourceAsStream()}} method calls on
the {{ServletContext}} or includes/forwards using the RequestDispatcher. ??
Servlet spec 4.0, section 4.6
??The ServletContext interface provides direct access only to the hierarchy of static
content documents that are part of the Web application, including HTML, GIF, and JPEG
files, via the following methods of the ServletContext interface: 4-42 Java Servlet
Specification • July 2017??
?? ■ getResource ??
??■ getResourceAsStream ??
??The getResource and getResourceAsStream methods take a String with a leading “/” as an
argument that gives the path of the resource relative to the root of the context or
relative to the META-INF/resources directory of a JAR file inside the web application’s
WEB-INF/lib directory. If there is a WEB-INF entry inside the META-INF/resources entry of
a JAR file in WEB-INF/lib, then it and all child entries are available only as static
resources. No classes or jars will be placed on the context classpath from such a WEB-INF
entry, and no Servlet specific descriptors will be processed. These methods will first
search the root of the web application context for the requested resource before looking
at any of the JAR files in the WEB-INF/lib directory. The order in which the JAR files in
the WEB-INF/lib directory are scanned is undefined. This hierarchy of documents may exist
in the server’s file system, in a Web application archive file, on a remote server, or at
some other location.??
Cannot load properties from servlet classpath
---------------------------------------------
Key: WFLY-13067
URL:
https://issues.redhat.com/browse/WFLY-13067
Project: WildFly
Issue Type: Bug
Components: Web (Undertow)
Reporter: Thomas Diesler
Assignee: Bartosz Baranowski
Priority: Major
With the latest master I can no longer load resources from
{code}
ClassLoader loader = SimpleServlet.class.getClassLoader();
URL propsA = loader.getResource("/psetA.properties");
{code}
nor from
{code}
ClassLoader loader = SimpleServlet.class.getClassLoader();
URL propsA = loader.getResource("/WEB-INF/psetA.properties");
{code}
CrossRef:
https://github.com/wildfly-extras/wildfly-camel/issues/2944
--
This message was sent by Atlassian Jira
(v7.13.8#713008)