Giter Site home page Giter Site logo

Pluggable resource loaders about servlet HOT 17 OPEN

jakartaee avatar jakartaee commented on July 27, 2024
Pluggable resource loaders

from servlet.

Comments (17)

glassfishrobot avatar glassfishrobot commented on July 27, 2024

from servlet.

glassfishrobot avatar glassfishrobot commented on July 27, 2024

@glassfishrobot Commented
Reported by eirbjor

from servlet.

glassfishrobot avatar glassfishrobot commented on July 27, 2024

@glassfishrobot Commented
eirbjor said:
Discussion on [email protected] :

http://java.net/projects/servlet-spec/lists/users/archive/2011-06/thread/1

from servlet.

glassfishrobot avatar glassfishrobot commented on July 27, 2024

@glassfishrobot Commented
eirbjor said:
I now have a working implementation of this based on Glassfish trunk.

I'll upload a patch, but I need to review the code and do some more testing first.

For now, here's a summary of changes/additions made:


M deployment/schemas/src/main/resources/glassfish/lib/schemas/javaee_6.xsd
M deployment/schemas/src/main/resources/glassfish/lib/schemas/web-common_3_0.xsd

Added support for new XML syntax com.example..

(I know these will need to be moved to the 3.1 / jeee7 versions of these files, but I decided not to do that now after a few failed attempts.


A + deployment/dol/src/main/java/com/sun/enterprise/deployment/node/web/ResourceLoaderNode.java
M deployment/dol/src/main/java/com/sun/enterprise/deployment/node/web/WebCommonNode.java
M deployment/dol/src/main/java/com/sun/enterprise/deployment/node/DescriptorFactory.java
A + deployment/dol/src/main/java/com/sun/enterprise/deployment/AppResourceLoaderDescriptorImpl.java
A + deployment/dol/src/main/java/com/sun/enterprise/deployment/web/AppResourceLoaderDescriptor.java
M deployment/dol/src/main/java/com/sun/enterprise/deployment/WebBundleDescriptor.java
M deployment/dol/src/main/java/com/sun/enterprise/deployment/xml/WebTagNames.java

Changes related to parsing the new and nodes and representing them as an AppResourceLoaderDescriptor. I pretty much stole the code from since they're structurally the same.


M web/javax.servlet/src/main/java/javax/servlet/ServletContext.java
A web/javax.servlet/src/main/java/javax/servlet/ResourceLoader.java

Added the ResourceLoader interface and ServletContext.addResourceLoader.


M web/web-core/src/main/java/org/apache/catalina/core/StandardContext.java
M web/web-core/src/main/java/org/apache/catalina/core/ApplicationContext.java
M web/web-core/src/main/java/org/apache/catalina/core/ApplicationContextFacade.java
M web/web-core/src/main/java/org/apache/catalina/servlets/DefaultServlet.java
M web/web-core/src/main/java/org/apache/catalina/Context.java
M web/web-core/src/main/resources/org/apache/catalina/core/LocalStrings.properties

  • Added support for adding resource loaders, programmatically or from a class name given via XML
  • Consult resource loaders when looking up resources in ServletContext's getResource*, getRealPath methods.
  • Consult resource loaders when serving resources in DefaultServlet.serveResource

M web/web-glue/src/main/java/com/sun/enterprise/web/TomcatDeploymentConfig.java

Register the context's resource loaders by using the information available in AppResourceLoaderDescriptor

from servlet.

glassfishrobot avatar glassfishrobot commented on July 27, 2024

@glassfishrobot Commented
eirbjor said:
When adding support for resource loaders to DefaultServlet, I found the serveResource method to be hard to work with.

I've filed an issue in the Glassfish Jira for this, with some suggestions for improvements:

http://java.net/jira/browse/GLASSFISH-16871

from servlet.

glassfishrobot avatar glassfishrobot commented on July 27, 2024

@glassfishrobot Commented
eirbjor said:
Patch includes API changes to the Servlet spec and a working Glassfish implementation of the changes

from servlet.

glassfishrobot avatar glassfishrobot commented on July 27, 2024

@glassfishrobot Commented
eirbjor said:
Demo web application project. The webapp tests that the container implements resourceloader according to the specification.

The project also includes a demo of hot deployment of JSPs from OSGi bundles.

from servlet.

glassfishrobot avatar glassfishrobot commented on July 27, 2024

@glassfishrobot Commented
eirbjor said:
Including post to user list for reference:

Thinking about it, my resource loader proposal for Servlet 3.1 might
have a multi-tenancy story as well as a dynamic deployment story.

I initially focused on a single tenant being able to dynamically
(hot)deploy resources. However, being able to define custom resource
loaders will also enable resource sharing across multiple tenants
without having to use container specific hacks or custom builds of
webapps.

I've uploaded a patch to the Jira issue which adds the ResourceLoader
interface and the ServletContext.addResourceLoader method. The patch
also includes a working implementation of resource loader support in
Glassfish trunk.

Finally, I've also uploaded a proof-of-concept web application. This
application tests the container's implementation of the ResourceLoader
API. And just for fun, I threw in a ResourceLoader backed by OSGi
bundles using Apache Felix.

from servlet.

glassfishrobot avatar glassfishrobot commented on July 27, 2024

@glassfishrobot Commented
eirbjor said:
Updated poc with improved tests and getResourcePaths() implementation for OSGi

from servlet.

glassfishrobot avatar glassfishrobot commented on July 27, 2024

@glassfishrobot Commented
eirbjor said:
Patch implementing ResourceLoader support for Jetty 8

from servlet.

glassfishrobot avatar glassfishrobot commented on July 27, 2024

@glassfishrobot Commented
eirbjor said:
Updates to Jetty's 3.0 Servlet Spec module adding ResourceLoader

from servlet.

glassfishrobot avatar glassfishrobot commented on July 27, 2024

@glassfishrobot Commented
File: resourceloader-poc-2011-12-15.zip
Attached By: eirbjor

from servlet.

glassfishrobot avatar glassfishrobot commented on July 27, 2024

@glassfishrobot Commented
File: SERVLET_SPEC_2-2011-12-11.patch
Attached By: eirbjor

from servlet.

glassfishrobot avatar glassfishrobot commented on July 27, 2024

@glassfishrobot Commented
File: SERVLET_SPEC_2_JETTY_8_2011-12-15.patch
Attached By: eirbjor

from servlet.

glassfishrobot avatar glassfishrobot commented on July 27, 2024

@glassfishrobot Commented
File: SERVLET_SPEC_2_JETTY_servlet-spec_2011-12-15.patch
Attached By: eirbjor

from servlet.

glassfishrobot avatar glassfishrobot commented on July 27, 2024

@glassfishrobot Commented
This issue was imported from java.net JIRA SERVLET_SPEC-2

from servlet.

 avatar commented on July 27, 2024

@gregw I would favor for the deployment model to stick to WAR file or WAR file exploded in a directory to be the 2 ways that have to be supported. Any other really should be left up to the vendor.

from servlet.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.