----------------------------------------------------------------
BEFORE YOU POST, search the faq at <http://java.apache.org/faq/>
WHEN YOU POST, include all relevant version numbers, log files,
and configuration files.  Don't make us guess your problem!!!
----------------------------------------------------------------

        Hi,

    You can use ApJservAction to map certain file type to a servlet.
I have used like this in httpd.conf file for a virtual host:
ApJservAction .html /servlet/MyServlet.
Now You can protect all .html files.
In the servlet You can deside to serv the file or not.
You can get the exact file path of the file requested by
calling: request.getPathTranslated().
    BIG DISADVANTAGE is that in must be set to a whole virtual host it
cann't
be set for a certain directory only (as far as I know).
    I know know if i'm right but i think you ca nuse the .htaccess file too
and
the authentication made by apache. Sorry, i don't know how to do this.


Hope it helps.


Best wishes,

Balogh Andras - [EMAIL PROTECTED]
GraFX http://www.grafx.ro
Tel/Fax: 065-250660











----- Original Message -----
From: <[EMAIL PROTECTED]>
To: Java Apache Users <[EMAIL PROTECTED]>
Sent: Monday, February 14, 2000 5:17 PM
Subject: Re: Beginner question


> ----------------------------------------------------------------
> BEFORE YOU POST, search the faq at <http://java.apache.org/faq/>
> WHEN YOU POST, include all relevant version numbers, log files,
> and configuration files.  Don't make us guess your problem!!!
> ----------------------------------------------------------------
>
>  I have read about the apache authentification. But i have my users
> names and passwords in a database. so i need to redirect the request
> from the user (not log in) to the log in page using the servlet. What i
> do not understand is how can i said to the server : if someone call my
> page , execute my servlet (which check if the user is log in).
>
>  That is, i want to protect access to my page not to the serlet. The
> servlet should be execute when the user attempt to call my page.
>
> Thanks. Any help is appreciate.
>
> Stefanos Karasavvidis schrieb:
> >
> > ----------------------------------------------------------------
> > BEFORE YOU POST, search the faq at <http://java.apache.org/faq/>
> > WHEN YOU POST, include all relevant version numbers, log files,
> > and configuration files.  Don't make us guess your problem!!!
> > ----------------------------------------------------------------
> >
> > If I have understood you, you want your users authenticated through a
HTML
> > form where they have to fill in a login/password field.
> >
> > One possible solution is as follows
> >
> > - if the user tries to run a servlet which requires authentication and
he
> > has not logged in (you know this from the users session), redirect him
to
> > the login page with resp.sendRedirect("THE URL")    (the resp object is
got
> > through the service,doGet,doPost methods)
> > - use servlet sessions to track the users login status (logged in or
not)
> > - if the users login and password is correct, store an "loged in"
> > information to the users session so you know that this user has logged
in
> >
> > Read about session creation etc. in some servlet tutorial. If you need
more
> > info just ask
> >
> > Stefanos
> >
> > [EMAIL PROTECTED] wrote:
> >
> > > ----------------------------------------------------------------
> > > BEFORE YOU POST, search the faq at <http://java.apache.org/faq/>
> > > WHEN YOU POST, include all relevant version numbers, log files,
> > > and configuration files.  Don't make us guess your problem!!!
> > > ----------------------------------------------------------------
> > >
> > >         I am sorry but i am just i beginner and i feel confused.
> > >
> > > I want to authentificate my users. What i want to do is as follows: i
> > > want to check the access to a page  and if one  is not log in then
> > > redirect him to the log in page. To check the access i want to use a
> > > servlet (sessions). But for execute the servlet i need a form action
> > > and  the redirection should be performed when the user call the page
> > > without previous log in. How can i do it or where can i find
information
> > > about it?
> > >
> > >         i use apache web server 1.3.9 and Jserv 1.1b3
> > >
> > > Thanks in advance.
> > >
> > > --
> > > --------------------------------------------------------------
> > > Please read the FAQ! <http://java.apache.org/faq/>
> > > To subscribe:        [EMAIL PROTECTED]
> > > To unsubscribe:      [EMAIL PROTECTED]
> > > Archives and Other:  <http://java.apache.org/main/mail.html>
> > > Problems?:           [EMAIL PROTECTED]
> >
> > --
> > ======================================================================
> > Stefanos Karasavvidis
> > Electronics & Computer Engineer
> > e-mail : [EMAIL PROTECTED]
> >
> > Multimedia Systems Center S.A.
> > Kissamou 178
> > 73100 Chania - Crete - Hellas
> > http://www.multimedia-sa.gr
> >
> > Tel : +30 821 88447
> > Fax : +30 821 88427
> >
> > --
> > --------------------------------------------------------------
> > Please read the FAQ! <http://java.apache.org/faq/>
> > To subscribe:        [EMAIL PROTECTED]
> > To unsubscribe:      [EMAIL PROTECTED]
> > Archives and Other:  <http://java.apache.org/main/mail.html>
> > Problems?:           [EMAIL PROTECTED]
>
>
> --
> --------------------------------------------------------------
> Please read the FAQ! <http://java.apache.org/faq/>
> To subscribe:        [EMAIL PROTECTED]
> To unsubscribe:      [EMAIL PROTECTED]
> Archives and Other:  <http://java.apache.org/main/mail.html>
> Problems?:           [EMAIL PROTECTED]



--
--------------------------------------------------------------
Please read the FAQ! <http://java.apache.org/faq/>
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Archives and Other:  <http://java.apache.org/main/mail.html>
Problems?:           [EMAIL PROTECTED]

Reply via email to