Is there a way to read session from ResourceHandler like you can do it from ServletContextHandler?
Something like this:
request.getSession(true).setAttribute("test", test)
Asked
Active
Viewed 124 times
0

Shamannn Shamannn
- 51
- 5
1 Answers
1
The javax.servlet.http.HttpSession
is only present on contexts that belong to a javax.servlet.ServletContext
.
So no, you cannot access it from a ResourceHandler
.
Why do you need to do this for a static resource, and cannot just use the more complete static file serving feature-set of the DefaultServlet
found within a ServletContextHandler
?
And yes, you can have it serve static resources from alternate locations.

Joakim Erdfelt
- 46,896
- 7
- 86
- 136
-
because we use extension of ResourceHandler for access handling. And ServletContextHandler doesn't allow to override the handle method. – Shamannn Shamannn Apr 17 '20 at 16:07
-
1`ServletContextHandler` has it's own access controls built-in, and you can easily extend from `DefaultServlet.service()` to accomplish the same end goal. – Joakim Erdfelt Apr 17 '20 at 16:57