You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Josh <jo...@isa.net.au> on 2002/08/16 05:53:25 UTC

Action before doGet / doPost??

Hi,
    I'm wondering if there's a way to get some code called before
doGet/doPost? I want to build a superclass for my JSP pages that checks for
some login stuff and redirects if it's not found, without having to put the
detect code in every page.

-Josh

"Rimmer, real dumplings, proper dumplings when they're properly
  cooked to perfection, proper dumplings, should not bounce."



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Root Context Problem

Posted by David Mossakowski <dm...@Instinet.Com>.
You should load the library once in init and put it into servlet context 
so that for each subsequent request you will use the loaded library.

d.

Taral Shah wrote:
> but suppose my two different servlets needs to load the library then what
> should i do.
> Also the same question stays there, Why am I able to execute the code if i
> write the context path in url(I mean i am able to load the dll second time)
> Also there isnt any method to unload the dll(as far as I know), then what
> should be the possible solution?
> 
> Thanks
> Taral Shah
> ----- Original Message -----
> From: "Craig R. McClanahan" <cr...@apache.org>
> To: "Tomcat Users List" <to...@jakarta.apache.org>; "Taral Shah"
> <ta...@contechsoftware.com>
> Sent: Friday, August 16, 2002 1:14 PM
> Subject: Re: Root Context Problem
> 
> 
> 
> 
> On Fri, 16 Aug 2002, Taral Shah wrote:
> 
> 
>>Date: Fri, 16 Aug 2002 13:08:23 +0530
>>From: Taral Shah <ta...@contechsoftware.com>
>>Reply-To: Tomcat Users List <to...@jakarta.apache.org>,
>>     Taral Shah <ta...@contechsoftware.com>
>>To: Tomcat Users List <to...@jakarta.apache.org>
>>Subject: Re: Root Context Problem
>>
>>You may be right but then as I wrote in the mail if i send request as
>>http://<ip>/network/cgi/tjs/myexe.exe?abc  then it works, loads dll and
>>displays the data.
>>
>>and if i send request as http://<ip>/cgi/tjs/myexe.exe?abc then it gives
>>error.
>>So i think its something with configuration problem for tomcat.
>>I have made network as my default web context.
>>
> 
> 
> The problem with that theory is that Tomcat *never* loads *any* DLL files
> on its own.  The only way that can happen is if your application does it,
> by calling Runtime.loadLibrary() or something like that.  Its up to your
> app to ensure that this happens once and only once for the lifetime of a
> JVM.
> 
> 
>>Thanks
>>Taral Shah
> 
> 
> Craig
> 
> 
> 
>>----- Original Message -----
>>From: "Craig R. McClanahan" <cr...@apache.org>
>>To: "Tomcat Users List" <to...@jakarta.apache.org>; "Taral Shah"
>><ta...@contechsoftware.com>
>>Cc: "Josh" <jo...@gfunk007.com>
>>Sent: Friday, August 16, 2002 12:58 PM
>>Subject: Re: Root Context Problem
>>
>>
>>
>>
>>On Fri, 16 Aug 2002, Taral Shah wrote:
>>
>>
>>>Date: Fri, 16 Aug 2002 09:36:23 +0530
>>>From: Taral Shah <ta...@contechsoftware.com>
>>>Reply-To: Tomcat Users List <to...@jakarta.apache.org>,
>>>     Taral Shah <ta...@contechsoftware.com>
>>>To: Tomcat Users List <to...@jakarta.apache.org>,
>>>     Josh <jo...@gfunk007.com>
>>>Subject: Root Context Problem
>>>
>>>Hi,
>>>I have posted this sort of problem before but didnt get any answer. Now
>>
> I
> 
>>>have found the root casue for my problem, I request you all to please
>>
>>guide
>>
>>>me.
>>>
>>>I am having a particular client requirement where he send the url as
>>
> shown
> 
>>>below:
>>>http://<ip>/cgi/tjs/myexe.exe?abc
>>>
>>>Now I am able to redirect /cgi/tjs/myexe.exe request to my servlet with
>>>servlet mapping but Here It gives me the dll error.
>>>My servlet is loading one dll, and when this code gets executed it gives
>>
>>me
>>
>>>error ...dll already loaded.
>>>
>>>My context is something like<network> and If i dont make it default
>>
>>context
>>
>>>and send request as
>>>http://<ip>/network/cgi/tjs/myexe.exe?abc then I dont get this error.
>>>but if i send request as shown at top then it fives me error. I tried to
>>
>>put
>>
>>>my servlet in the ROOT context but still getting same error.
>>>
>>>Does any one have any idea regarding this?
>>>
>>
>>This isn't a Tomcat issue -- it is a restriction of most Java JVMs that
>>you can only load a single DLL once in the lifetime of a JVM.  It is up to
>>your application to ensure that this restriction is met (or to ignore the
>>exception if your app tries to load a DLL more than once anyway).
>>
>>
>>>Thanks
>>>Taral Shah
>>>Software Engineer,
>>>Contech Software Ltd.
>>>tarals@contechsoftware.com
>>>
>>
> 
> 
> 
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
> 
> 
> 


-- 
David Mossakowski              dmoss@instinet.com
Instinet Corporation                 212.310.7275



*******************************************************************************
<<Disclaimer>>

This message is intended only for the use of the Addressee and 
may contain information that is PRIVILEGED and/or
CONFIDENTIAL or both.

This email is intended only for the personal and confidential use
of the recipient(s) named above.

If the reader of this email is not an intended recipient, you have
received this email in error and any review, dissemination,
distribution or copying is strictly prohibited.

If you have received this email in error, please notify the sender
immediately by return mail and permanently deleting the copy
you received.

Thank you.

*******************************************************************************


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Root Context Problem

Posted by Taral Shah <ta...@contechsoftware.com>.
but suppose my two different servlets needs to load the library then what
should i do.
Also the same question stays there, Why am I able to execute the code if i
write the context path in url(I mean i am able to load the dll second time)
Also there isnt any method to unload the dll(as far as I know), then what
should be the possible solution?

Thanks
Taral Shah
----- Original Message -----
From: "Craig R. McClanahan" <cr...@apache.org>
To: "Tomcat Users List" <to...@jakarta.apache.org>; "Taral Shah"
<ta...@contechsoftware.com>
Sent: Friday, August 16, 2002 1:14 PM
Subject: Re: Root Context Problem




On Fri, 16 Aug 2002, Taral Shah wrote:

> Date: Fri, 16 Aug 2002 13:08:23 +0530
> From: Taral Shah <ta...@contechsoftware.com>
> Reply-To: Tomcat Users List <to...@jakarta.apache.org>,
>      Taral Shah <ta...@contechsoftware.com>
> To: Tomcat Users List <to...@jakarta.apache.org>
> Subject: Re: Root Context Problem
>
> You may be right but then as I wrote in the mail if i send request as
> http://<ip>/network/cgi/tjs/myexe.exe?abc  then it works, loads dll and
> displays the data.
>
> and if i send request as http://<ip>/cgi/tjs/myexe.exe?abc then it gives
> error.
> So i think its something with configuration problem for tomcat.
> I have made network as my default web context.
>

The problem with that theory is that Tomcat *never* loads *any* DLL files
on its own.  The only way that can happen is if your application does it,
by calling Runtime.loadLibrary() or something like that.  Its up to your
app to ensure that this happens once and only once for the lifetime of a
JVM.

> Thanks
> Taral Shah

Craig


>
> ----- Original Message -----
> From: "Craig R. McClanahan" <cr...@apache.org>
> To: "Tomcat Users List" <to...@jakarta.apache.org>; "Taral Shah"
> <ta...@contechsoftware.com>
> Cc: "Josh" <jo...@gfunk007.com>
> Sent: Friday, August 16, 2002 12:58 PM
> Subject: Re: Root Context Problem
>
>
>
>
> On Fri, 16 Aug 2002, Taral Shah wrote:
>
> > Date: Fri, 16 Aug 2002 09:36:23 +0530
> > From: Taral Shah <ta...@contechsoftware.com>
> > Reply-To: Tomcat Users List <to...@jakarta.apache.org>,
> >      Taral Shah <ta...@contechsoftware.com>
> > To: Tomcat Users List <to...@jakarta.apache.org>,
> >      Josh <jo...@gfunk007.com>
> > Subject: Root Context Problem
> >
> > Hi,
> > I have posted this sort of problem before but didnt get any answer. Now
I
> > have found the root casue for my problem, I request you all to please
> guide
> > me.
> >
> > I am having a particular client requirement where he send the url as
shown
> > below:
> > http://<ip>/cgi/tjs/myexe.exe?abc
> >
> > Now I am able to redirect /cgi/tjs/myexe.exe request to my servlet with
> > servlet mapping but Here It gives me the dll error.
> > My servlet is loading one dll, and when this code gets executed it gives
> me
> > error ...dll already loaded.
> >
> > My context is something like<network> and If i dont make it default
> context
> > and send request as
> > http://<ip>/network/cgi/tjs/myexe.exe?abc then I dont get this error.
> > but if i send request as shown at top then it fives me error. I tried to
> put
> > my servlet in the ROOT context but still getting same error.
> >
> > Does any one have any idea regarding this?
> >
>
> This isn't a Tomcat issue -- it is a restriction of most Java JVMs that
> you can only load a single DLL once in the lifetime of a JVM.  It is up to
> your application to ensure that this restriction is met (or to ignore the
> exception if your app tries to load a DLL more than once anyway).
>
> > Thanks
> > Taral Shah
> > Software Engineer,
> > Contech Software Ltd.
> > tarals@contechsoftware.com
> >
>

>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Root Context Problem

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Fri, 16 Aug 2002, Taral Shah wrote:

> Date: Fri, 16 Aug 2002 13:08:23 +0530
> From: Taral Shah <ta...@contechsoftware.com>
> Reply-To: Tomcat Users List <to...@jakarta.apache.org>,
>      Taral Shah <ta...@contechsoftware.com>
> To: Tomcat Users List <to...@jakarta.apache.org>
> Subject: Re: Root Context Problem
>
> You may be right but then as I wrote in the mail if i send request as
> http://<ip>/network/cgi/tjs/myexe.exe?abc  then it works, loads dll and
> displays the data.
>
> and if i send request as http://<ip>/cgi/tjs/myexe.exe?abc then it gives
> error.
> So i think its something with configuration problem for tomcat.
> I have made network as my default web context.
>

The problem with that theory is that Tomcat *never* loads *any* DLL files
on its own.  The only way that can happen is if your application does it,
by calling Runtime.loadLibrary() or something like that.  Its up to your
app to ensure that this happens once and only once for the lifetime of a
JVM.

> Thanks
> Taral Shah

Craig


>
> ----- Original Message -----
> From: "Craig R. McClanahan" <cr...@apache.org>
> To: "Tomcat Users List" <to...@jakarta.apache.org>; "Taral Shah"
> <ta...@contechsoftware.com>
> Cc: "Josh" <jo...@gfunk007.com>
> Sent: Friday, August 16, 2002 12:58 PM
> Subject: Re: Root Context Problem
>
>
>
>
> On Fri, 16 Aug 2002, Taral Shah wrote:
>
> > Date: Fri, 16 Aug 2002 09:36:23 +0530
> > From: Taral Shah <ta...@contechsoftware.com>
> > Reply-To: Tomcat Users List <to...@jakarta.apache.org>,
> >      Taral Shah <ta...@contechsoftware.com>
> > To: Tomcat Users List <to...@jakarta.apache.org>,
> >      Josh <jo...@gfunk007.com>
> > Subject: Root Context Problem
> >
> > Hi,
> > I have posted this sort of problem before but didnt get any answer. Now I
> > have found the root casue for my problem, I request you all to please
> guide
> > me.
> >
> > I am having a particular client requirement where he send the url as shown
> > below:
> > http://<ip>/cgi/tjs/myexe.exe?abc
> >
> > Now I am able to redirect /cgi/tjs/myexe.exe request to my servlet with
> > servlet mapping but Here It gives me the dll error.
> > My servlet is loading one dll, and when this code gets executed it gives
> me
> > error ...dll already loaded.
> >
> > My context is something like<network> and If i dont make it default
> context
> > and send request as
> > http://<ip>/network/cgi/tjs/myexe.exe?abc then I dont get this error.
> > but if i send request as shown at top then it fives me error. I tried to
> put
> > my servlet in the ROOT context but still getting same error.
> >
> > Does any one have any idea regarding this?
> >
>
> This isn't a Tomcat issue -- it is a restriction of most Java JVMs that
> you can only load a single DLL once in the lifetime of a JVM.  It is up to
> your application to ensure that this restriction is met (or to ignore the
> exception if your app tries to load a DLL more than once anyway).
>
> > Thanks
> > Taral Shah
> > Software Engineer,
> > Contech Software Ltd.
> > tarals@contechsoftware.com
> >
>
> Craig McClanahan
>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
>
>
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Root Context Problem

Posted by Taral Shah <ta...@contechsoftware.com>.
You may be right but then as I wrote in the mail if i send request as
http://<ip>/network/cgi/tjs/myexe.exe?abc  then it works, loads dll and
displays the data.

and if i send request as http://<ip>/cgi/tjs/myexe.exe?abc then it gives
error.
So i think its something with configuration problem for tomcat.
I have made network as my default web context.

Thanks
Taral Shah

----- Original Message -----
From: "Craig R. McClanahan" <cr...@apache.org>
To: "Tomcat Users List" <to...@jakarta.apache.org>; "Taral Shah"
<ta...@contechsoftware.com>
Cc: "Josh" <jo...@gfunk007.com>
Sent: Friday, August 16, 2002 12:58 PM
Subject: Re: Root Context Problem




On Fri, 16 Aug 2002, Taral Shah wrote:

> Date: Fri, 16 Aug 2002 09:36:23 +0530
> From: Taral Shah <ta...@contechsoftware.com>
> Reply-To: Tomcat Users List <to...@jakarta.apache.org>,
>      Taral Shah <ta...@contechsoftware.com>
> To: Tomcat Users List <to...@jakarta.apache.org>,
>      Josh <jo...@gfunk007.com>
> Subject: Root Context Problem
>
> Hi,
> I have posted this sort of problem before but didnt get any answer. Now I
> have found the root casue for my problem, I request you all to please
guide
> me.
>
> I am having a particular client requirement where he send the url as shown
> below:
> http://<ip>/cgi/tjs/myexe.exe?abc
>
> Now I am able to redirect /cgi/tjs/myexe.exe request to my servlet with
> servlet mapping but Here It gives me the dll error.
> My servlet is loading one dll, and when this code gets executed it gives
me
> error ...dll already loaded.
>
> My context is something like<network> and If i dont make it default
context
> and send request as
> http://<ip>/network/cgi/tjs/myexe.exe?abc then I dont get this error.
> but if i send request as shown at top then it fives me error. I tried to
put
> my servlet in the ROOT context but still getting same error.
>
> Does any one have any idea regarding this?
>

This isn't a Tomcat issue -- it is a restriction of most Java JVMs that
you can only load a single DLL once in the lifetime of a JVM.  It is up to
your application to ensure that this restriction is met (or to ignore the
exception if your app tries to load a DLL more than once anyway).

> Thanks
> Taral Shah
> Software Engineer,
> Contech Software Ltd.
> tarals@contechsoftware.com
>

Craig McClanahan


--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Root Context Problem

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Fri, 16 Aug 2002, Taral Shah wrote:

> Date: Fri, 16 Aug 2002 09:36:23 +0530
> From: Taral Shah <ta...@contechsoftware.com>
> Reply-To: Tomcat Users List <to...@jakarta.apache.org>,
>      Taral Shah <ta...@contechsoftware.com>
> To: Tomcat Users List <to...@jakarta.apache.org>,
>      Josh <jo...@gfunk007.com>
> Subject: Root Context Problem
>
> Hi,
> I have posted this sort of problem before but didnt get any answer. Now I
> have found the root casue for my problem, I request you all to please guide
> me.
>
> I am having a particular client requirement where he send the url as shown
> below:
> http://<ip>/cgi/tjs/myexe.exe?abc
>
> Now I am able to redirect /cgi/tjs/myexe.exe request to my servlet with
> servlet mapping but Here It gives me the dll error.
> My servlet is loading one dll, and when this code gets executed it gives me
> error ...dll already loaded.
>
> My context is something like<network> and If i dont make it default context
> and send request as
> http://<ip>/network/cgi/tjs/myexe.exe?abc then I dont get this error.
> but if i send request as shown at top then it fives me error. I tried to put
> my servlet in the ROOT context but still getting same error.
>
> Does any one have any idea regarding this?
>

This isn't a Tomcat issue -- it is a restriction of most Java JVMs that
you can only load a single DLL once in the lifetime of a JVM.  It is up to
your application to ensure that this restriction is met (or to ignore the
exception if your app tries to load a DLL more than once anyway).

> Thanks
> Taral Shah
> Software Engineer,
> Contech Software Ltd.
> tarals@contechsoftware.com
>

Craig McClanahan


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Root Context Problem

Posted by Taral Shah <ta...@contechsoftware.com>.
Hi,
I have posted this sort of problem before but didnt get any answer. Now I
have found the root casue for my problem, I request you all to please guide
me.

I am having a particular client requirement where he send the url as shown
below:
http://<ip>/cgi/tjs/myexe.exe?abc

Now I am able to redirect /cgi/tjs/myexe.exe request to my servlet with
servlet mapping but Here It gives me the dll error.
My servlet is loading one dll, and when this code gets executed it gives me
error ...dll already loaded.

My context is something like<network> and If i dont make it default context
and send request as
http://<ip>/network/cgi/tjs/myexe.exe?abc then I dont get this error.
but if i send request as shown at top then it fives me error. I tried to put
my servlet in the ROOT context but still getting same error.

Does any one have any idea regarding this?

Thanks
Taral Shah
Software Engineer,
Contech Software Ltd.
tarals@contechsoftware.com

Experience is what you get when you were expecting something else.


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Action before doGet / doPost??

Posted by Nikola Milutinovic <Ni...@ev.co.yu>.
> I am using tomcat's session object, but i store a magic string in the
> session that i need to decode to see if it's a valid magic string and
> populate a LoginSession object if they're logged in... i was just hoping to
> do it without having some code at the top of every page, but it's not
> looking too possible atm... :(

Well, I'm not really deep into that stuff, but there are two things you can add/modify: Filters and Authentication mechanisms. Tomcat allows you to define filters that filter requests, they can do your "before doGet/doPost" action. Since you've opted for non-standard way of authenticating, you might need a non-standard authentication mechanism, since both Basic and Form authentication really switch to HTTP Authentication (HTTP Headers), while you would like your own magic string in session.

If you do it like that, you should have a modular solution, where your servlets/JSPs would still call HttpRequest.isUserInRole() method, defined in Servlet specification and it gets information from what was placed by the Filter. That way your web application will be portable to any container and any authentication mechanism. If you have a good reason for using *that* particular mechanism, then implement it on the container side - don't introduce it to your Servlets and JSPs. Not just to avoid repeating code.

Nix.

Re: Action before doGet / doPost??

Posted by Josh <jo...@isa.net.au>.
Hmm cheers, I'll check it out

-Josh

"Rimmer, real dumplings, proper dumplings when they're properly
  cooked to perfection, proper dumplings, should not bounce."

----- Original Message -----
From: "Jacob Kjome" <ho...@visi.com>
To: "Tomcat Users List" <to...@jakarta.apache.org>
Sent: Friday, August 16, 2002 3:38 PM
Subject: Re: Action before doGet / doPost??


> Have you thought about using a Filter?  filters can do pre and post
> processing on requests/responses and you can map it to any set of servlets
> or jsp's you want meaning that all your logic is in a single place and
none
> of the servlets/jsp's even know it is there so you don't even have to
> account for it in your servlets/jsps.  Also, you could use an
> HttpSessionListener to run code at the start or the end of a session.
>
> Jake
>
> At 03:22 PM 8/16/2002 +1000, you wrote:
> >I am using tomcat's session object, but i store a magic string in the
> >session that i need to decode to see if it's a valid magic string and
> >populate a LoginSession object if they're logged in... i was just hoping
to
> >do it without having some code at the top of every page, but it's not
> >looking too possible atm... :(
> >
> >-Josh
> >
> >"Rimmer, real dumplings, proper dumplings when they're properly
> >   cooked to perfection, proper dumplings, should not bounce."
> >
> >----- Original Message -----
> >From: "Nikola Milutinovic" <Ni...@ev.co.yu>
> >To: "Tomcat Users List" <to...@jakarta.apache.org>; "Josh"
> ><jo...@gfunk007.com>
> >Sent: Friday, August 16, 2002 3:18 PM
> >Subject: Re: Action before doGet / doPost??
> >
> >
> > > > Hi,
> > > >     I'm wondering if there's a way to get some code called before
> > > > doGet/doPost? I want to build a superclass for my JSP pages that
checks
> >for
> > > > some login stuff and redirects if it's not found, without having to
put
> >the
> > > > detect code in every page.
> > >
> > > That is a job for Servlet Container (Tomcat in this case). Servlets
and
> >JSPs can implement their own auth/login service, via sessions, but why
> >re-invent the wheel?
> > >
> > > Nix.
> > >
> >
> >
> >--
> >To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> >For additional commands, e-mail:
<ma...@jakarta.apache.org>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Action before doGet / doPost??

Posted by Jacob Kjome <ho...@visi.com>.
Have you thought about using a Filter?  filters can do pre and post 
processing on requests/responses and you can map it to any set of servlets 
or jsp's you want meaning that all your logic is in a single place and none 
of the servlets/jsp's even know it is there so you don't even have to 
account for it in your servlets/jsps.  Also, you could use an 
HttpSessionListener to run code at the start or the end of a session.

Jake

At 03:22 PM 8/16/2002 +1000, you wrote:
>I am using tomcat's session object, but i store a magic string in the
>session that i need to decode to see if it's a valid magic string and
>populate a LoginSession object if they're logged in... i was just hoping to
>do it without having some code at the top of every page, but it's not
>looking too possible atm... :(
>
>-Josh
>
>"Rimmer, real dumplings, proper dumplings when they're properly
>   cooked to perfection, proper dumplings, should not bounce."
>
>----- Original Message -----
>From: "Nikola Milutinovic" <Ni...@ev.co.yu>
>To: "Tomcat Users List" <to...@jakarta.apache.org>; "Josh"
><jo...@gfunk007.com>
>Sent: Friday, August 16, 2002 3:18 PM
>Subject: Re: Action before doGet / doPost??
>
>
> > > Hi,
> > >     I'm wondering if there's a way to get some code called before
> > > doGet/doPost? I want to build a superclass for my JSP pages that checks
>for
> > > some login stuff and redirects if it's not found, without having to put
>the
> > > detect code in every page.
> >
> > That is a job for Servlet Container (Tomcat in this case). Servlets and
>JSPs can implement their own auth/login service, via sessions, but why
>re-invent the wheel?
> >
> > Nix.
> >
>
>
>--
>To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>

Re: Action before doGet / doPost??

Posted by Josh <jo...@isa.net.au>.
I am using tomcat's session object, but i store a magic string in the
session that i need to decode to see if it's a valid magic string and
populate a LoginSession object if they're logged in... i was just hoping to
do it without having some code at the top of every page, but it's not
looking too possible atm... :(

-Josh

"Rimmer, real dumplings, proper dumplings when they're properly
  cooked to perfection, proper dumplings, should not bounce."

----- Original Message -----
From: "Nikola Milutinovic" <Ni...@ev.co.yu>
To: "Tomcat Users List" <to...@jakarta.apache.org>; "Josh"
<jo...@gfunk007.com>
Sent: Friday, August 16, 2002 3:18 PM
Subject: Re: Action before doGet / doPost??


> > Hi,
> >     I'm wondering if there's a way to get some code called before
> > doGet/doPost? I want to build a superclass for my JSP pages that checks
for
> > some login stuff and redirects if it's not found, without having to put
the
> > detect code in every page.
>
> That is a job for Servlet Container (Tomcat in this case). Servlets and
JSPs can implement their own auth/login service, via sessions, but why
re-invent the wheel?
>
> Nix.
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Action before doGet / doPost??

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Fri, 16 Aug 2002, Nikola Milutinovic wrote:

> Date: Fri, 16 Aug 2002 07:18:38 +0200
> From: Nikola Milutinovic <Ni...@ev.co.yu>
> Reply-To: Tomcat Users List <to...@jakarta.apache.org>
> To: Tomcat Users List <to...@jakarta.apache.org>,
>      Josh <jo...@gfunk007.com>
> Subject: Re: Action before doGet / doPost??
>
> > Hi,
> >     I'm wondering if there's a way to get some code called before
> > doGet/doPost? I want to build a superclass for my JSP pages that checks for
> > some login stuff and redirects if it's not found, without having to put the
> > detect code in every page.
>
> That is a job for Servlet Container (Tomcat in this case). Servlets and
> JSPs can implement their own auth/login service, via sessions, but why
> re-invent the wheel?
>

This kind of thing sounds like a good use for one of the following
technologies:

* If you use container managed security (i.e. you put
  <security-constraint> elements in your web.xml file) you don't
  need to worry about this at all -- the container will take care
  of it for you.

* If you insist on doing your own authentication and access control,
  read up on Filters.  This is one of the things they are designed
  to support.

> Nix.
>

Craig



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Action before doGet / doPost??

Posted by Nikola Milutinovic <Ni...@ev.co.yu>.
> Hi,
>     I'm wondering if there's a way to get some code called before
> doGet/doPost? I want to build a superclass for my JSP pages that checks for
> some login stuff and redirects if it's not found, without having to put the
> detect code in every page.

That is a job for Servlet Container (Tomcat in this case). Servlets and JSPs can implement their own auth/login service, via sessions, but why re-invent the wheel?

Nix.