Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [servlet-dev] Question about of Dynamic Registration


Dynamic servlet/filter registration is not a simple/cheap feature to add to the container in general:
  • There can be many requests arriving at context in parallel.  Must they all simultaneously see the same mapping of servlets/filters?  If so then there are overheads and/or contention that will be a cost for all requests, even if the webapp doesn't use dynamic registration.
  • How are request dispatchers handled? will they see the same mappings when dispatched as that which mapped the original request?
  • How are async requests handled? If an async request is dispatched under one version of the mappings, will it be dispatched via the same mappings by AsyncContext.dispatch?
  • If a new servlet/filter is added, but it's init method takes time to execute, are requests held up waiting for it to complete or do they continue based on previous mappings until the new sevlet/filter is finished initializing.
There are probably many more such issues and I doubt there is a one size fits all answer.   

Note that there is nothing stopping a framework using the Filter and Servlet APIs and calling them from a statically registered Filter/Servlet.  The framework can then answer all these kinds of questions in a way that is appropriate for their users, but without imposing extra complexity/locking/memory-boundaries on the majority of users that will not use such a feature.

If we were starting from scratch, having a versioned mapping of URIs that could be rolled forward/back would be an interesting feature to consider... but IMHO not for servlets.

cheers



On Mon, 26 Oct 2020 at 10:55, Jonathan Coustick <jonathan.coustick@xxxxxxxxxxx> wrote:
Hello,

+1 for being able to dynamically add servlets at runtime post-initalisation. ServletContext already has the addServlet method, just currently it states that it should throw an IllegalStateException if the servletContext has already been initialised.

Jonathan Coustick

On 25/10/2020 13:30, mamadou lamine Ba wrote:

Hello,

I'm currently building an open source project named GServlet which aims to use the Groovy language and its provided modules to simplify Servlet API web development.


The first release is scheduled for the upcoming days and it will target the Java EE Servlet API. You can read more about this project on its developer guide 


For the next versions, I want to target Jakarta EE and it would be awesome if in the upcoming version of Jakarta Servlet, we can have the possibility to register, or unregister a servlet, filter..., once the servlet context has been initialized to make a live development without restarting the container possible. For the moment, I'm able to reload any artifact once it is created through the use of a proxy but I can't register a new one, and also, I cannot alter the servlet registration if you add later a @ServletSecurity, or @MultipartConfig annotation 

Is this possibility on the radar for Jakarta Servlet 5.1?


Best Regards
Mamadou Lamine Ba

_______________________________________________
servlet-dev mailing list
servlet-dev@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/servlet-dev





AVG logo

This email has been checked for viruses by AVG antivirus software.
www.avg.com


_______________________________________________
servlet-dev mailing list
servlet-dev@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/servlet-dev


--

Back to the top