• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

Access a context bean from servlet in Jetty 8

 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am trying a simple servlet based on Jetty 8. In the main class where i create the server instance and add the servlet i want to fill and add a bean with configuration data which is read and stored in the bean at startup.

The bean is added using the addBean method of context.




Is it possible to access the bean from within the servlet ? I can get the ServletContext but have not found any clue how to retrieve the bean added to the context from within the servlet.



Any hints / Tips ?
Cheers,
Peter
 
Marshal
Posts: 67275
170
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is no addBean() method to the ServletContext, so it's not clear what context you are asking about.
 
Peter van Nes
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Bear,

I can add a bean to the ServletContextHandler to which a new servlet is added.



Now i want to access the bean added to the ServletContextHandler from the servlet.
I tried to access it through the servlet context from within the servlet.





 
Bear Bibeault
Marshal
Posts: 67275
170
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Never heard of ServletContextHandler. Apparently it's proprietary to Jetty. I've moved this to a more appropriate forum.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!