I have Jersey resource class A calling a method in resource class B.Both classes have a @Context ServletContext servletContext at the class level. When I instantiate class B to call it from resource class A using its empty constructor, servletContext is null in the class B method being called. Is there any Jersey framework way I can call class B and yet have the servletContext retain its values/attributes from class A.
相关问题
- What uses more memory in c++? An 2 ints or 2 funct
- How Does WebSphere Choose the Classloading Order i
- Store data and global variables using the Applicat
- PHP Adding stylesheets to header
- Change value of R.string programmatically?
相关文章
- NameError: name 'self' is not defined, eve
- How to check Android Asset resource?
- Are resource files compiled as UNICODE or ANSI cod
- .NET - how to make a class such that only one othe
- Issue creating ImmutableMap with Class<?> as
- Why ContextClassLoader returns path with exclamati
- JAX-RS (Jersey) ExceptionMapper - @Context injecti
- How to return new instance of subclass while initi
You can instantiate class B using ResourceContext. I.e. in class A you can have:
And then in you can instantiate resource B as follows:
See ResourceContext javadoc for more info.