The proxy-servlet provides a base class to make it easy to create proxy servlets.
Download the jar from maven central. This can be done by adding a Maven dependency such as;
<dependency>
<groupId>org.realityforge.proxy-servlet</groupId>
<artifactId>proxy-servlet</artifactId>
<version>0.3.0</version>
</dependency>
A simple proxy that forwards to a url configured in JNDI.
@WebServlet( urlPatterns = { "/myservice/*" }, loadOnStartup = 1 )
public class MyServiceProxyServlet
extends AbstractProxyServlet
{
@Resource( lookup = "myservice/endpoint" )
private String _proxyURL;
@Override
protected String getProxyURL()
{
return _proxyURL;
}
}
This a customization of work done by David Smiley and he takes all the credit for the good parts of the library. All bugs are certainly Peter Donald's.