• 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

how can we stop at servlet for not processing request

 
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hello friends

small doubt

how can we make a servlet not processing.. the request....

i came to know that it is linked with... init() method...so can any tell me how exactly it can be done...


and my 2nd doubt is..

when will we override the init() method and what circumstances we will do it...

Thank you very much..
bye.....
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

i came to know that it is linked with... init() method...so can any tell me how exactly it can be done...


In that case, it's not about preventing a request to be processed, but about preventing a servlet to be loaded. If you throw an UnavailableException in the init method, the servlet will not be serviced, so no request will be processed.

when will we override the init() method and what circumstances we will do it...


You usually override it when you want to do some specific initializations, or to check something to prevent the servlet from getting into service.
 
kajal mukergi
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Christophe

ok..

then
when we will overide the init(Parameter); method....can you tell reason also

as..

is it true that the config will not be available to the service method until we override init(param) method

but till my knowledge init() also has config so.. the config is available....to the sevlet...

can any one explain this.....

bye,,,,,,
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

when we will overide the init(Parameter); method....can you tell reason also


For the same reason as above. But you have access to the ServletConfig as well. You can keep it and store it in an instance variable, or call super.init(config).

is it true that the config will not be available to the service method until we override init(param) method


No. Overriding the init method is optional. The default implementation of the HttpSerlvet will store the ServletConfig.
 
kajal mukergi
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you very much friend
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic