Situation:

I want to have a servlet that in servlet engine is mapped to run when ever
any request comes in for any other servlet in my system. I then want this
front servlet(A) to call the intended servlet(B) and read the output of (B)
into a string. I will then use this string else where but this is
irrelevant. Once i have this string i then want to return the response
(which will be the string) to the user.

So how do i do this eloquently. The way i see it the servlet api has
migrated to make this very hard to achieve in a neat way.

I do it like this currently:

Servlet A = the front servlet that captures all requests
Servlet B = any servlet that the user has requested

1. servlet(A) captures the request servlet(B). Servlet(A) then gets the path
and parameter info for the requested servlet (B) from the request.

2. servlet(A) then opens a URL connection to the same request it captured
(eg the call to servlet B ).

3. the output from this connection is then read into a string.

4. this string is then sent else where (not really important where)

5. servlet(A) then returns the string to the user who requested the servlet
B.


Then immediate problem here is that with opening a connection (2) to the
same servlet that servlet A captured will obviously mean servlet(A) will be
called again due to the mapping in the servlet engine. So you get a kind of
recursive loop. To get around this i make servlet(A) capture all requests
that start with. "/catch/". Then when i open the connection in (2) i strip
this from the begging and the real servlet is called.

I think this is a "shit" way of doing things so i challenge anyone here to
come up with a better solution using servlets.

The problem is servlets do not handle piping in the current spec !!!

___________________________________________________________________________
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