Jian,
I think you are approaching this wrong.  I am not exactly sure what you
mean by 'secured'.

If you mean that the identity of the user needs to be checked before the
page is returned, then you mean 'access control'  In this case, you should
probably use the web server's access control capabilities to control this.
(What web server are you using?) If the list of valid users changes more
dynamically or is restricted to only your particular servlet, then you
should have the servlet access a file or DB of valid users and enforce the
access control itself.  In this case you would still not do this in the
init() method but do it in the service method (or doGet() or doPost()).

If you intend 'secure' to mean that no one else can intercept the data sent
back in the response, then you mean you want to encrypt the response.  In
that case, you would then need a SSL library such as what Brad suggested in
order to SSL encrypt the response.

In either case, you don't need to send a response from the init() method
itself.


Regards,

Richard
At 10:06 AM 7/20/01 -0400, you wrote:
>Thanks Richard.
>
>My project requires all and every pages be secured. So I have to check the
>user before display any pages, even the index.html page.
>
>I do not get what you said. Can you be more specific? My problem is that
>response is not available in the init method.
>
>Jian
>
>-----Original Message-----
>From: Richard Yee [mailto:[EMAIL PROTECTED]]
>Sent: Friday, July 20, 2001 9:50 AM
>To: [EMAIL PROTECTED]
>Subject: Re: initial html page from init() method
>
>
>Jian,
>Can you tell us why you need to return a page directly from the init
>method?  You could just set a flag in one of your service methods that
>causes it to return the proper page after the init method is first called.
>
>Regards,
>
>Richard
>
>At 09:32 AM 7/20/01 -0400, you wrote:
>>Hi
>>
>>Can any body share with how to send a html page to the browser with in the
>>init() method in a servlet?
>>
>>Thanks.
>>
>>Jian
>>
>>___________________________________________________________________________
>>To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
>>of the message "signoff SERVLET-INTEREST".
>>
>>Archives: http://archives.java.sun.com/archives/servlet-interest.html
>>Resources: http://java.sun.com/products/servlet/external-resources.html
>>LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>>
>>
>
>___________________________________________________________________________
>To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
>of the message "signoff SERVLET-INTEREST".
>
>Archives: http://archives.java.sun.com/archives/servlet-interest.html
>Resources: http://java.sun.com/products/servlet/external-resources.html
>LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>
>___________________________________________________________________________
>To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
>of the message "signoff SERVLET-INTEREST".
>
>Archives: http://archives.java.sun.com/archives/servlet-interest.html
>Resources: http://java.sun.com/products/servlet/external-resources.html
>LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>
>

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to