Previous: Transport and Channel API | Up: Transports | Next: JMS Transport |
The core of the HTTP Transport takes place in the XFireServletController. Your own servlets can delegate appropriate requests to this class or you can use one of XFire's internal servlet classes. The XFireServlet is just a thin wrapper for the controller. The XFireServletController provides an xml configuration layer on top of this.
XFire also provides the XFireConfigurableServlet which reads the services.xml format automatically for you and the XFireSpringServlet which provides Sprign integration.
The HttpServletRequest/HttpServletResponse can be accessed via the XFireServletController.
HttpServletRequest request = XFireServletController.getRequest(); HttpServletResponse response = XFireServletController.getResponse();
This method will work all the XFire servlets (XFireServlet, XFireConfigurableServlet, XFireSpringServlet).
The Apache Jakarta HttpClient is used under the covers to provide HTTP client support. There are two ways which you can override the HttpClient settings:
// Create your client Client client = ....; // Or get it from your proxy Client client = ((XFireProxy) Proxy.getInvocationHandler(myClientProxy)).getClient(); client.setProperty(Channel.USERNAME, "username"); client.setProperty(Channel.PASSWORD, "pass");
client.setProperty(CommonsHttpMessageSender.HTTP_CLIENT_PARAMS, myParams);
The HTTPClient javadocs provide information on how to configure the HttpClientParams.
Proxy support looks very similar to the username/password scenario:
// Create your client Client client = ....; // Or get it from your proxy Client client = ((XFireProxy) Proxy.getInvocationHandler(myClientProxy)).getClient(); client.setProperty(CommonsHttpMessageSender.HTTP_PROXY_HOST, "host"); client.setProperty(CommonsHttpMessageSender.HTTP_PROXY_PORT, "8080");
Previous: Transport and Channel API | Up: Transports | Next: JMS Transport |