You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by Aurelien Pernoud <ap...@sopragroup.com> on 2003/02/18 11:29:18 UTC

Servlet communication (was Re : Bug 13463)

Michael Becke a ecrit :

> This patch should take care of the problems discovered by Aurelien.
> Now all connections returned from the
> MultiThreadedHttpConnectionManager are wrapped in an adapter class.
> This class ensures that a connection cannot be reused once released.
> Please let me know you think.
>
> Thanks Aurelien for finding this one and helping to test. Also thanks
> to Eric for suggesting this solution.
>
> Mike

Your largely welcome ! Thx for fixing it.

BTW, I have a question that has nothing to do with the bug, and nearly
nothing to do with httpclient, but with my webapp :

I'm making two distants servlet interact using httpclient. I get the stream
and "strip" what is unnecessary, rewrite some tags, and locations href, well
I'm making changes to the HTML returned.

Imagine now the two servlets are on the same server, it works fine (I make
call to localhost), but I know it could be much faster and more reliable
making servlet interacts directly. So I took a look at the way to do the
things I do (get the stream from another servlet, work with it and write in
the stream of another servlet) and the only thing I found are :

- include() method on servletrequestdispatcher, and forward()

But I can't simply include the response, I have to work with it before
including it in the response. Any way to do it without breaking the working
of the distant servlet ?

Sorry for asking here, but I don't know where to post this kind of
questions... Sun forums ?

Thx for any pointers,
Aurelien


Re: Servlet communication (was Re : Bug 13463)

Posted by Eric Johnson <er...@tibco.com>.
Aurelien,

Aurelien Pernoud wrote:

>I'm making two distants servlet interact using httpclient. I get the stream
>and "strip" what is unnecessary, rewrite some tags, and locations href, well
>I'm making changes to the HTML returned.
>
>Imagine now the two servlets are on the same server, it works fine (I make
>call to localhost), but I know it could be much faster and more reliable
>making servlet interacts directly. So I took a look at the way to do the
>things I do (get the stream from another servlet, work with it and write in
>the stream of another servlet) and the only thing I found are :
>
>- include() method on servletrequestdispatcher, and forward()
>  
>
You could use the "include" function, but create your own implementation 
of the HttpServletRequest and HttpServletResponse interfaces.  As for 
"more reliable", you might find it more reliable to "decouple" the two 
servlets by using a URL, rather than trying to tightly couple them via a 
RequestDispatcher.  In other words, keep your existing solution.  In 
that way, if you decide later that "more reliable" means better 
performance, you could put the two servlets on two different machines, 
and get twice the performance.

>But I can't simply include the response, I have to work with it before
>including it in the response. Any way to do it without breaking the working
>of the distant servlet ?
>
>Sorry for asking here, but I don't know where to post this kind of
>questions... Sun forums ?
>  
>
You might try the Tomcat lists.

>Thx for any pointers,
>Aurelien
>
-Eric Johnson


>  
>