• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Clear servlet thread

 
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I would like to initialize a Servlet when it is called.
Will this clear any sessions and threads?
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Completely unnecessary. What are you actually trying to accomplish?
 
Dan Parsons
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am using Servlet as a controller for my form entries.

If I send them to the Servlet with or without sessions it wont show anything after the servlet forwards to a JSP. I am encoding with sun.misc.BASE64Encoder in another Servlet and it seems to be effecting all my Servlets for this webapp. If I take out the sun.misc.BASE64Encoder in the other servlet, the form entries will work in my servlet and show up in the forwarded jsp. I was hoping to somehow clear or eliminate any threads that were created from another Servlet in my webapp that has the sun.misc.BASE64Encoder.
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have no idea what's up with all the Base64 encoding (perhaps you can explain that), but there's no such thing as left-over threads that could be affecting other servlet invocations, and therefore need "resetting".

Let's back up a bit, explain why you are Base64 encoding stuff (really? why?), and what makes you think that it's affecting other threads.
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Dan Parsons wrote:I am encoding with sun.misc.BASE64Encoder [...]


I never recommend using internal libraries--they're not guaranteed to be present in any JRE.
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I would like to initialize a Servlet when it is called.



When the init() method is called by the servlet container, this is guaranteed to be before any request has been sent to the servlet so there is no concept of a current request and thus a current session.

Any sessions associated with the web applications would have to be left over from the last time the application was running. The only way they would be used is if the client browser still has a cookie for the sessionid and the session has not been timed out.

Bill

 
On top of spaghetti all covered in cheese, there was this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic