Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 370495 - Making ProxyServlet even more extensible
Summary: Making ProxyServlet even more extensible
Status: RESOLVED FIXED
Alias: None
Product: Jetty
Classification: RT
Component: server (show other bugs)
Version: 7.6.1   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: 9.0.0.RC1   Edit
Assignee: Simone Bordet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-02-02 15:52 EST by Michael Gorovoy CLA
Modified: 2013-02-13 09:30 EST (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Gorovoy CLA 2012-02-02 15:52:27 EST
This enhancement will allow using a custom HttpExchange object. This is needed to rewrite the URLs in the header and body of the response in a reverse proxy servlet.
Comment 1 Jesse McConnell CLA 2012-02-02 20:48:38 EST
Could you explain what your planning to do here a bit more?

I am curious how your planning on doing it :)
Comment 2 Michael Gorovoy CLA 2012-02-03 10:24:55 EST
My original idea was to make the anonymous HttpExchange subclass into an inner class and create a createHttpExchange() method that would actually create the object of this inner class, so that I could subclass that inner class and override behavior of some methods. However when I started doing a proof of concept last night, I realized that there is a very tight integration between the exchange object and the continuation handling that could be easily upset by using a subclass.

I'm currently thinking about following the pattern that was introduced earlier by creating methods handleRequestCommitted(), handleRequestComplete(), handleResponseStatus(), handleResponseHeader(), handleResponseHeaderComplete(), handleResponseContent(), handleResponseComplete() in the ProxyServlet class that will all have HttpServletRequest and HttpServletResponse parameters  in addition to the parameters that are passed to the respective HttpExchange methods, and will contain the code that is currently located in the respective HttpExchange methods except for the logging part that will stay where it currently is.
Comment 3 Jesse McConnell CLA 2012-02-03 10:29:27 EST
What behavior of the http exchange do you need to override/modify?  maybe that will help tease out a good mechanic for this
Comment 4 Simone Bordet CLA 2013-02-13 09:30:01 EST
This is currently implemented in Jetty 9's ProxyServlet.
It features hooks to rewrite URLs, to customize the request before it is sent, and to customize various response steps via onResponse*() methods.