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 <[email protected]>: > Care to share your working proxy. I was looking to do something similar. > Thanks > > > On Sat, May 17, 2014 at 3:55 PM, John <[email protected]> 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 <[email protected]>: >> >> Hi, >>> >>> On Sat, May 17, 2014 at 8:53 PM, John <[email protected]> >>> 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 >>> [email protected] >>> https://dev.eclipse.org/mailman/listinfo/jetty-users >>> >> >> >> _______________________________________________ >> jetty-users mailing list >> [email protected] >> https://dev.eclipse.org/mailman/listinfo/jetty-users >> >> > > _______________________________________________ > jetty-users mailing list > [email protected] > https://dev.eclipse.org/mailman/listinfo/jetty-users > >
_______________________________________________ jetty-users mailing list [email protected] https://dev.eclipse.org/mailman/listinfo/jetty-users
