J2EE Professional | 11 Jan 2006 11:09
Picon
Favicon

manipulating the http requests.....

  Hi Guys,

  Right now i have a servlet which is doing some processing. This servlet is the main servlet of the
application or the entry point to my web application. Now what i want to do is that i want to change the entry
point to my web application from this mainServlet to a new servlet (say newServlet.java). So now, the
request should come to this new component and then should be delegated to the mainServlet....also the
response should be relayed thorugh newServlet only... How can i acheive this. 

  One way is that i can modify the web.xml and for the URL pattern of mainServlet i will invoke newServlet
instead. But then in this case how do i invoke the mainServlet from newServlet then....Or else i could have
a filter before the mainServlet. Actually, this newServlet need not be a servlet also...the requirement
dosent ask this to be a servlet. it could be a java class also...what the requirement says is that that the
entry point should be changed...and the response should also be changed...but i dont c any other way of
chaging the entry point...since its a web application it has to be a servlet or filter....

  Also, if i have newServlet, how do i invoke a method in mainServlet...say there is a foo() in mainServlet,
how do i invoke it from newServlet...

  Any ideas..?

  Best Regards

		
---------------------------------
To help you stay safe and secure online, we've developed the all new Yahoo! Security Centre.

[Non-text portions of this message have been removed]

Before posting a question, try to find your answer here: 
<http://www.egroups.com/links/advanced-servlets>
(Continue reading)

Nic Ferrier | 11 Jan 2006 11:54
Picon

Re: manipulating the http requests.....

J2EE Professional <javasubscriptions <at> yahoo.co.in> writes:

>   Hi Guys,
>    
>   Right now i have a servlet which is doing some processing. This
>   servlet is the main servlet of the application or the entry point
>   to my web application. Now what i want to do is that i want to
>   change the entry point to my web application from this mainServlet
>   to a new servlet (say newServlet.java). So now, the request should
>   come to this new component and then should be delegated to the
>   mainServlet....also the response should be relayed thorugh
>   newServlet only... How can i acheive this.
>    
>   One way is that i can modify the web.xml and for the URL pattern
>   of mainServlet i will invoke newServlet instead. But then in this
>   case how do i invoke the mainServlet from newServlet then....Or
>   else i could have a filter before the mainServlet. Actually, this
>   newServlet need not be a servlet also...the requirement dosent ask
>   this to be a servlet. it could be a java class also...what the
>   requirement says is that that the entry point should be
>   changed...and the response should also be changed...but i dont c
>   any other way of chaging the entry point...since its a web
>   application it has to be a servlet or filter....
>    
>   Also, if i have newServlet, how do i invoke a method in
>   mainServlet...say there is a foo() in mainServlet, how do i invoke
>   it from newServlet...

Why won't a RequestDispatcher work?

(Continue reading)

J2EE Professional | 12 Jan 2006 07:19
Picon
Favicon

Re: manipulating the http requests.....

how do we call a method of a servlet using RequestDispatcher. With request dispatcher we can call a second
servlet from one servlet, but if i want to call a foo() method inside the second servlet, how do i call it
(even after using RequestDispatcher)... thats my question

Nic Ferrier <nferrier <at> tapsellferrier.co.uk> wrote:  J2EE Professional writes:

> Hi Guys,
> 
> Right now i have a servlet which is doing some processing. This
> servlet is the main servlet of the application or the entry point
> to my web application. Now what i want to do is that i want to
> change the entry point to my web application from this mainServlet
> to a new servlet (say newServlet.java). So now, the request should
> come to this new component and then should be delegated to the
> mainServlet....also the response should be relayed thorugh
> newServlet only... How can i acheive this.
> 
> One way is that i can modify the web.xml and for the URL pattern
> of mainServlet i will invoke newServlet instead. But then in this
> case how do i invoke the mainServlet from newServlet then....Or
> else i could have a filter before the mainServlet. Actually, this
> newServlet need not be a servlet also...the requirement dosent ask
> this to be a servlet. it could be a java class also...what the
> requirement says is that that the entry point should be
> changed...and the response should also be changed...but i dont c
> any other way of chaging the entry point...since its a web
> application it has to be a servlet or filter....
> 
> Also, if i have newServlet, how do i invoke a method in
> mainServlet...say there is a foo() in mainServlet, how do i invoke
(Continue reading)

Raghavendra Samant | 12 Jan 2006 18:00
Favicon

RE: Digest Number 382

Try using a action variable in the URL request of the requestdispatcher   or set a variable in the session  and
then use the variable in teh invoked servlet's service () method

hope this helps
Samant

________________________________

From: advanced-servlets <at> yahoogroups.com [mailto:advanced-servlets <at> yahoogroups.com]
Sent: Thu 1/12/2006 7:51 AM
To: advanced-servlets <at> yahoogroups.com
Subject: [advanced-servlets] Digest Number 382

There is 1 message in this issue.

Topics in this digest:

      1. Re: manipulating the http requests.....
           From: J2EE Professional <javasubscriptions <at> yahoo.co.in>

________________________________________________________________________
________________________________________________________________________

Message: 1        
   Date: Thu, 12 Jan 2006 06:19:26 +0000 (GMT)
   From: J2EE Professional <javasubscriptions <at> yahoo.co.in>
Subject: Re: manipulating the http requests.....

how do we call a method of a servlet using RequestDispatcher. With request dispatcher we can call a second
servlet from one servlet, but if i want to call a foo() method inside the second servlet, how do i call it
(Continue reading)


Gmane