Re: Action before doGet / doPost??

2002-08-16 Thread Craig R. McClanahan



On Fri, 16 Aug 2002, Nikola Milutinovic wrote:

 Date: Fri, 16 Aug 2002 07:18:38 +0200
 From: Nikola Milutinovic [EMAIL PROTECTED]
 Reply-To: Tomcat Users List [EMAIL PROTECTED]
 To: Tomcat Users List [EMAIL PROTECTED],
  Josh [EMAIL PROTECTED]
 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:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




Action before doGet / doPost??

2002-08-15 Thread Josh

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:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




Re: Action before doGet / doPost??

2002-08-15 Thread Nikola Milutinovic

 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.



Re: Action before doGet / doPost??

2002-08-15 Thread Josh

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 [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]; Josh
[EMAIL PROTECTED]
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:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




Re: Action before doGet / doPost??

2002-08-15 Thread Jacob Kjome

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 [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]; Josh
[EMAIL PROTECTED]
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:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]



Re: Action before doGet / doPost??

2002-08-15 Thread Josh

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 [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
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 [EMAIL PROTECTED]
 To: Tomcat Users List [EMAIL PROTECTED]; Josh
 [EMAIL PROTECTED]
 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:
mailto:[EMAIL PROTECTED]
 For additional commands, e-mail:
mailto:[EMAIL PROTECTED]



--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




Re: Action before doGet / doPost??

2002-08-15 Thread Nikola Milutinovic

 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: doGet - doPost

2001-03-28 Thread Bo Xu

Sunil Chandurkar wrote:

 Hello All..

 Though i'm working on servlets from couple of months
 i'm getting confused between doGet and doPost whenever i'm trying to do 
Applet-Servlet Communication.

 My Problem is :

 On particular event my Applet is sending one string to Servlet and inresponse 
servlet is sending one Vector to applet.
 If i will keep on performing Applet - Servlet communication,hardly i can perform 2-3 
transactions.
 On 4th request from applet to servlet .. my browser gets hung.
 I have written entire code in doPost of servlet.

 I am very much confused where shall i write the code on servlet side in doGet or in 
doPost.. and one more thing.. i have tried by writing code into doGet also.

 I have already visited lots of sites from where i could get this solution.. and 
according to their samples. i did everything. but still problem is there only.

 If anybody is having perfect solution on this Applet-Servlet communication please 
let me know...

 Regards
 Sunil
 [...]

haha :-)  I think I know a little about it, I find it is interesting :-)  but I am
not sure, the following is just as a reference:

*  I use:
- standalone Java Appllication: JDK1.3 + winnt40
- Servlet:  jakarta-tomcat-4.0-b1(standalone, JDK1.3, winnt40)

* I guess Applet-Servlet communication is similar with Application-Servlet
   communication.

*  normally, it is Appllication-side who starts one Appllication-Servlet communication:

*  client First Read style:
in Appllication-side, if we first Read something from Servlet,  then no matter
 we will continue to Write something to Servlet or not,  doGet will be
 invoked

*  client First Write style:
in Appllication side, if we first Write something to Servlet, then:
   - if we don't continue to Read somwthing from Servlet, then neither doGet
 now doPost will be invoked :-)
   - if we continue to Read something from Servlet, then doPost will be invoked :-)
   - if we want to Write something, we need: uc.setDoOutput(true),  otherwise I
 got a java.net.ProtocalException

*
   - if we want to Read something, we need: uc.setDoInput(true),  otherwise I
 got a java.net.ProtocalException
   - if we want to Write something, we need: uc.setDoOutput(true),  otherwise I
 got a java.net.ProtocalException

*  we can use both URLConnection and HttpURLConnection. but I remember
HttpURLConnection is not in NN4.7 and IE4.x(perhaps I remember wrong)



Bo
Mar.28, 2001





doGet - doPost

2001-03-27 Thread Sunil Chandurkar

Hello All..

Though i'm working on servlets from couple of months
i'm getting confused between doGet and doPost whenever i'm trying to do Applet-Servlet 
Communication.

My Problem is :

On particular event my Applet is sending one string to Servlet and inresponse servlet 
is sending one Vector to applet.
If i will keep on performing Applet - Servlet communication,hardly i can perform 2-3 
transactions.
On 4th request from applet to servlet .. my browser gets hung.
I have written entire code in doPost of servlet.

I am very much confused where shall i write the code on servlet side in doGet or in 
doPost.. and one more thing.. i have tried by writing code into doGet also.

I have already visited lots of sites from where i could get this solution.. and 
according to their samples. i did everything. but still problem is there only.

If anybody is having perfect solution on this Applet-Servlet communication please let 
me know...

Regards
Sunil




_
Get LifeTime Free email Visit  --- http://www.nagpurcity.net