Package org.rribbit.dispatching
Class HttpRequestDispatcher
java.lang.Object
org.rribbit.dispatching.HttpRequestDispatcher
- All Implemented Interfaces:
RequestDispatcher
This
RequestDispatcher
dispatches a Request
to an HttpRequestProcessorServlet
via HTTP. Failover and loadbalancing are not supported in this class,
as opposed to the RmiRequestDispatcher
. The reason for this is that failover and loadbalancing are typically done in another layer of the HTTP stack, which
does not apply to RMI.
This class uses Apache HTTPClient to make the connection to the HttpRequestProcessorServlet
. It uses the default functionality of Apache HTTPClient to do its work.
If you want to use more advanced functionality of Apache HTTPClient to make the connection, then it should be fairly straightforward to extend this class or implement your
own RequestDispatcher
implementation with this class as an example.- Author:
- G.J. Schouten
-
Field Summary
-
Constructor Summary
ConstructorDescriptionWhenever you use this constructor, be sure to set the url with the setter provided by this class.Creates anHttpRequestDispatcher
that will send theRequest
s to the specified URL. -
Method Summary
-
Field Details
-
url
-
-
Constructor Details
-
HttpRequestDispatcher
public HttpRequestDispatcher()Whenever you use this constructor, be sure to set the url with the setter provided by this class. If you don't, runtime exceptions will occur. -
HttpRequestDispatcher
Creates anHttpRequestDispatcher
that will send theRequest
s to the specified URL. AnHttpRequestProcessorServlet
is expected to be listening at this URL. The URL is a standard HTTP URL, such as "http://host:port/path". It can also be an HTTPS URL, beginning with 'https:'. This constructor is recommended, since it forces you to specify the url. Passing a null value for this will result in runtime exceptions whenever theHttpRequestDispatcher
is used.- Parameters:
url
-
-
-
Method Details
-
dispatchRequest
Description copied from interface:RequestDispatcher
- Specified by:
dispatchRequest
in interfaceRequestDispatcher
- Parameters:
request
- TheRequest
to be dispatched to aRequestProcessor
- Returns:
- The
Response
to be returned from theRequestProcessor
-
getUrl
-
setUrl
-