• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how can we stop at servlet for not processing request

 
kajal mukergi
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • 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.....
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • 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
  • 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 Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
Thank you very much friend
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic