| Author |
how can we stop at servlet for not processing request
|
kajal mukergi
Ranch Hand
Joined: Mar 22, 2007
Posts: 102
|
|
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
Joined: Nov 24, 2005
Posts: 14685
|
|
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.
|
[My Blog]
All roads lead to JavaRanch
|
 |
kajal mukergi
Ranch Hand
Joined: Mar 22, 2007
Posts: 102
|
|
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
Joined: Nov 24, 2005
Posts: 14685
|
|
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
Joined: Mar 22, 2007
Posts: 102
|
|
|
Thank you very much friend
|
 |
 |
|
|
subject: how can we stop at servlet for not processing request
|
|
|