• Post Reply Bookmark Topic Watch Topic
  • New Topic

Jetty + Servlet + HttpSession: how?

 
PetriJ Airio
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My simple code to fire up Jetty and simple Servlet for that:



Now when HttpSession is tried to get in line:

HttpSession session = req.getSession();

I got Exception:



What do I have to do to get sessions work correctly?
Googling only finds some instructions for setups via XML conffiiguration
but none how to do it directly in code.

Thanks!
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why are you trying to start Jetty from inside a servlet class?

Jetty is a web server - it must be running FIRST before any request is made.

What is the sequence of events you are trying to create?

Bill
 
There's a way to do it better - find it. -Edison. A better tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!