Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] ServletResponse with ProxyServlet.Transparent is empty

Thanks this looks good. Gave me some new ideas. Has anyone done anything with WebSocket proxying? 


On Sun, May 18, 2014 at 6:27 AM, John <johnnyenglish739@xxxxxxxxx> wrote:
Hi,

no problem. Here is the code: http://pastebin.com/k53LgfrW ... this proxy works quite good for me. I can intercept every request/response and modify it.

regards


2014-05-18 4:25 GMT+02:00 Mack Gerhardt <mack@xxxxxxxxxxxxxx>:

Care to share your working proxy. I was looking to do something similar. Thanks


On Sat, May 17, 2014 at 3:55 PM, John <johnnyenglish739@xxxxxxxxx> wrote:
Hi,

sry, there was a bug in my code. Everything is fine now :) thank you!

Another little question. I try to build a program that intercepts the http traffic between two nodes. Which means I try to verify every request and response. At the moment I intercept the request in a custom filter in the doFilter method. Is this the best point to intercept the message or would you recommend to use another method? For example override another method in the proxy servlet?

kind regards 


2014-05-17 21:25 GMT+02:00 Simone Bordet <sbordet@xxxxxxxxxxx>:

Hi,

On Sat, May 17, 2014 at 8:53 PM, John <johnnyenglish739@xxxxxxxxx> wrote:
> thanks for your answer! You are right, that works!
>
> Buy how exactly can I modify the content at this point? I tried this little
> example:
>
> String receivedContent = new String(buffer);
>
> LOG.info(">>> conent: "  + receivedContent);
>
> // <modify string here>
>
> super.onResponseContent(request, response, proxyResponse, buffer, offset,
> length);
>
>
> I didn't  modified the content yet. I only printed out the content, but then
> the program halts at this point. Do you have any Idea how i can modify the
> content at this point?

I don't know what you mean by "the program halts", I doubt it really halts :)

To modify the content, just allocate another byte[], fill it with what
you want, and pass that to the super.onResponseContent() call.

--
Simone Bordet
----
http://cometd.org
http://webtide.com
http://intalio.com
Developer advice, training, services and support
from the Jetty & CometD experts.
Intalio, the modern way to build business applications.
_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/jetty-users


_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/jetty-users



_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/jetty-users



_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/jetty-users



Back to the top