|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.remoting.support.RemoteExporter org.springframework.remoting.support.RemoteInvocationBasedExporter org.springframework.remoting.httpinvoker.HttpInvokerServiceExporter
public class HttpInvokerServiceExporter
Web controller that exports the specified service bean as HTTP invoker service endpoint, accessible via an HTTP invoker proxy.
Deserializes remote invocation objects and serializes remote invocation result objects. Uses Java serialization just like RMI, but provides the same ease of setup as Caucho's HTTP-based Hessian and Burlap protocols.
HTTP invoker is the recommended protocol for Java-to-Java remoting. It is more powerful and more extensible than Hessian and Burlap, at the expense of being tied to Java. Nevertheless, it is as easy to set up as Hessian and Burlap, which is its main advantage compared to RMI.
HttpInvokerClientInterceptor
,
HttpInvokerProxyFactoryBean
,
RmiServiceExporter
,
HessianServiceExporter
,
BurlapServiceExporter
Field Summary | |
---|---|
protected static String |
CONTENT_TYPE_SERIALIZED_OBJECT
|
Fields inherited from class org.springframework.remoting.support.RemoteExporter |
---|
logger |
Constructor Summary | |
---|---|
HttpInvokerServiceExporter()
|
Method Summary | |
---|---|
void |
afterPropertiesSet()
Invoked by a BeanFactory after it has set all bean properties supplied (and satisfied BeanFactoryAware and ApplicationContextAware). |
protected ObjectInputStream |
createObjectInputStream(InputStream is)
Create an ObjectInputStream for the given InputStream. |
protected ObjectOutputStream |
createObjectOutputStream(OutputStream os)
Create an ObjectOutputStream for the given OutputStream. |
protected InputStream |
decorateInputStream(HttpServletRequest request,
InputStream is)
Return the InputStream to use for reading remote invocations, potentially decorating the given original InputStream. |
protected OutputStream |
decorateOutputStream(HttpServletRequest request,
HttpServletResponse response,
OutputStream os)
Return the OutputStream to use for writing remote invocation results, potentially decorating the given original OutputStream. |
protected RemoteInvocation |
doReadRemoteInvocation(ObjectInputStream ois)
Perform the actual reading of an invocation result object from the given ObjectInputStream. |
protected void |
doWriteRemoteInvocationResult(RemoteInvocationResult result,
ObjectOutputStream oos)
Perform the actual writing of the given invocation result object to the given ObjectOutputStream. |
ModelAndView |
handleRequest(HttpServletRequest request,
HttpServletResponse response)
Read a remote invocation from the request, execute it, and write the remote invocation result to the response. |
protected RemoteInvocation |
readRemoteInvocation(HttpServletRequest request)
Read a RemoteInvocation from the given HTTP request. |
protected RemoteInvocation |
readRemoteInvocation(HttpServletRequest request,
InputStream is)
Deserialize a RemoteInvocation object from the given InputStream. |
protected void |
writeRemoteInvocationResult(HttpServletRequest request,
HttpServletResponse response,
RemoteInvocationResult result)
Write the given RemoteInvocationResult to the given HTTP response. |
protected void |
writeRemoteInvocationResult(HttpServletRequest request,
HttpServletResponse response,
RemoteInvocationResult result,
OutputStream os)
Serialize the given RemoteInvocation to the given OutputStream. |
Methods inherited from class org.springframework.remoting.support.RemoteInvocationBasedExporter |
---|
getRemoteInvocationExecutor, invoke, invokeAndCreateResult, setRemoteInvocationExecutor |
Methods inherited from class org.springframework.remoting.support.RemoteExporter |
---|
checkService, checkServiceInterface, getExporterName, getProxyForService, getService, getServiceInterface, isRegisterTraceInterceptor, setRegisterTraceInterceptor, setService, setServiceInterface |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final String CONTENT_TYPE_SERIALIZED_OBJECT
Constructor Detail |
---|
public HttpInvokerServiceExporter()
Method Detail |
---|
public void afterPropertiesSet()
InitializingBean
This method allows the bean instance to perform initialization only possible when all bean properties have been set and to throw an exception in the event of misconfiguration.
afterPropertiesSet
in interface InitializingBean
public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws IOException, ClassNotFoundException
handleRequest
in interface Controller
request
- current HTTP requestresponse
- current HTTP response
null
if handled directly
IOException
ClassNotFoundException
readRemoteInvocation(HttpServletRequest)
,
RemoteInvocationBasedExporter.invokeAndCreateResult(org.springframework.remoting.support.RemoteInvocation, java.lang.Object)
,
writeRemoteInvocationResult(HttpServletRequest, HttpServletResponse, RemoteInvocationResult)
protected RemoteInvocation readRemoteInvocation(HttpServletRequest request) throws IOException, ClassNotFoundException
readRemoteInvocation(InputStream)
with the servlet request's input stream.
request
- current HTTP request
IOException
- if thrown by operations on the request
ClassNotFoundException
- if thrown by deserializationreadRemoteInvocation(HttpServletRequest, java.io.InputStream)
,
ServletRequest.getInputStream()
protected RemoteInvocation readRemoteInvocation(HttpServletRequest request, InputStream is) throws IOException, ClassNotFoundException
Gives decorateInputStream
a chance to decorate the stream
first (for example, for custom encryption or compression). Creates a
CodebaseAwareObjectInputStream
and calls
doReadRemoteInvocation
to actually read the object.
Can be overridden for custom serialization of the invocation.
request
- current HTTP requestis
- the InputStream to read from
IOException
- if thrown by I/O methods
ClassNotFoundException
- if thrown during deserializationdecorateInputStream(javax.servlet.http.HttpServletRequest, java.io.InputStream)
,
doReadRemoteInvocation(java.io.ObjectInputStream)
protected InputStream decorateInputStream(HttpServletRequest request, InputStream is) throws IOException
The default implementation returns the given stream as-is. Can be overridden, for example, for custom encryption or compression.
request
- current HTTP requestis
- the original InputStream
IOException
protected ObjectInputStream createObjectInputStream(InputStream is) throws IOException
Spring's CodebaseAwareObjectInputStream is used to explicitly resolve primitive class names. This is done by the standard ObjectInputStream on JDK 1.4+, but needs to be done explicitly on JDK 1.3.
is
- the InputStream to read from
IOException
- if creation of the ObjectInputStream failedCodebaseAwareObjectInputStream
protected RemoteInvocation doReadRemoteInvocation(ObjectInputStream ois) throws IOException, ClassNotFoundException
The default implementation simply calls readObject
.
Can be overridden for deserialization of a custom wrapper object rather
than the plain invocation, for example an encryption-aware holder.
ois
- the ObjectInputStream to read from
IOException
- if thrown by I/O methods
ClassNotFoundException
ObjectOutputStream.writeObject(java.lang.Object)
protected void writeRemoteInvocationResult(HttpServletRequest request, HttpServletResponse response, RemoteInvocationResult result) throws IOException
Note that a request argument was introduced for Spring 1.1.3, which is not backwards-compatible for subclasses that override this method.
request
- current HTTP requestresponse
- current HTTP responseresult
- the RemoteInvocationResult object
IOException
- if thrown by operations on the responseprotected void writeRemoteInvocationResult(HttpServletRequest request, HttpServletResponse response, RemoteInvocationResult result, OutputStream os) throws IOException
The default implementation gives decorateOutputStream
a chance
to decorate the stream first (for example, for custom encryption or compression).
Creates an ObjectOutputStream
for the final stream and calls
doWriteRemoteInvocationResult
to actually write the object.
Can be overridden for custom serialization of the invocation.
request
- current HTTP requestresponse
- current HTTP responseresult
- the RemoteInvocationResult objectos
- the OutputStream to write to
IOException
- if thrown by I/O methodsdecorateOutputStream(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, java.io.OutputStream)
,
doWriteRemoteInvocationResult(org.springframework.remoting.support.RemoteInvocationResult, java.io.ObjectOutputStream)
protected OutputStream decorateOutputStream(HttpServletRequest request, HttpServletResponse response, OutputStream os) throws IOException
The default implementation returns the given stream as-is. Can be overridden, for example, for custom encryption or compression.
request
- current HTTP requestresponse
- current HTTP responseos
- the original OutputStream
IOException
protected ObjectOutputStream createObjectOutputStream(OutputStream os) throws IOException
os
- the OutputStream to write to
IOException
- if creation of the ObjectOutputStream failedprotected void doWriteRemoteInvocationResult(RemoteInvocationResult result, ObjectOutputStream oos) throws IOException
The default implementation simply calls writeObject
.
Can be overridden for serialization of a custom wrapper object rather
than the plain invocation, for example an encryption-aware holder.
result
- the RemoteInvocationResult objectoos
- the ObjectOutputStream to write to
IOException
- if thrown by I/O methodsObjectOutputStream.writeObject(java.lang.Object)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |