0

So I have a Jersey REST service and I need to get access to a ServletConfig so that I can pull a param out of the web.xml. I can use @Context to wire one in but I don't think it will get me the params I need. Only the ones in the ServletContext.

Any ideas? I'm new to Jersey and this Provider isn't a Servelet. Perhaps I should start with trying to retrieve the servelet?

user447607
  • 5,149
  • 13
  • 33
  • 55

1 Answers1

2

@Context: annotation can be used to inject the following classes

  1. HttpServletRequest

  2. HttpServletResponse

  3. ServletContext

  4. ServletConfig

  5. WebConfig.

onto a root resource, provider and Application classes.

Java Doc of Servlet Container

Andreas
  • 154,647
  • 11
  • 152
  • 247
Velu
  • 1,681
  • 1
  • 22
  • 26
  • ACK! It does all 5?? That is unusual... and awesome. :-) – user447607 Mar 08 '14 at 19:38
  • What the dang thing is good for should be in the annotation JavaDocs but it ain't. :-| It seems their docs leave something to be desired. At the link you provided, I shouldn't be seeing this as if it were regular text without any link either: (@link PackagesResourceConfig#PROPERTY_PACKAGES} – user447607 Mar 08 '14 at 19:50