org.springframework.remoting.httpinvoker
Class AbstractHttpInvokerRequestExecutor

java.lang.Object
  extended byorg.springframework.remoting.httpinvoker.AbstractHttpInvokerRequestExecutor
All Implemented Interfaces:
HttpInvokerRequestExecutor
Direct Known Subclasses:
CommonsHttpInvokerRequestExecutor, SimpleHttpInvokerRequestExecutor

public abstract class AbstractHttpInvokerRequestExecutor
extends Object
implements HttpInvokerRequestExecutor

Abstract base implementation of the HttpInvokerRequestExecutor interface.

Preimplements serialization of RemoteInvocation objects and deserialization of RemoteInvocationResults objects.

Since:
1.1
Author:
Juergen Hoeller
See Also:
doExecuteRequest(org.springframework.remoting.httpinvoker.HttpInvokerClientConfiguration, java.io.ByteArrayOutputStream)

Field Summary
protected static String CONTENT_TYPE_SERIALIZED_OBJECT
           
protected static String HTTP_HEADER_CONTENT_LENGTH
           
protected static String HTTP_HEADER_CONTENT_TYPE
           
protected static String HTTP_METHOD_POST
           
protected  Log logger
           
 
Constructor Summary
AbstractHttpInvokerRequestExecutor()
           
 
Method Summary
protected abstract  RemoteInvocationResult doExecuteRequest(HttpInvokerClientConfiguration config, ByteArrayOutputStream baos)
          Execute a request to send the given serialized remote invocation.
 RemoteInvocationResult executeRequest(HttpInvokerClientConfiguration config, RemoteInvocation invocation)
          Execute a request to send the given remote invocation.
protected  ByteArrayOutputStream getByteArrayOutputStream(RemoteInvocation invocation)
          Serialize the given RemoteInvocation into a ByteArrayOutputStream.
protected  RemoteInvocationResult readRemoteInvocationResult(InputStream is)
          Deserialize a RemoteInvocationResult from the given InputStream.
protected  void writeRemoteInvocation(RemoteInvocation invocation, OutputStream os)
          Serialize the given RemoteInvocation to the given OutputStream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONTENT_TYPE_SERIALIZED_OBJECT

protected static final String CONTENT_TYPE_SERIALIZED_OBJECT
See Also:
Constant Field Values

HTTP_HEADER_CONTENT_TYPE

protected static final String HTTP_HEADER_CONTENT_TYPE
See Also:
Constant Field Values

HTTP_HEADER_CONTENT_LENGTH

protected static final String HTTP_HEADER_CONTENT_LENGTH
See Also:
Constant Field Values

HTTP_METHOD_POST

protected static final String HTTP_METHOD_POST
See Also:
Constant Field Values

logger

protected final Log logger
Constructor Detail

AbstractHttpInvokerRequestExecutor

public AbstractHttpInvokerRequestExecutor()
Method Detail

executeRequest

public final RemoteInvocationResult executeRequest(HttpInvokerClientConfiguration config,
                                                   RemoteInvocation invocation)
                                            throws IOException,
                                                   ClassNotFoundException
Description copied from interface: HttpInvokerRequestExecutor
Execute a request to send the given remote invocation.

Specified by:
executeRequest in interface HttpInvokerRequestExecutor
Parameters:
config - the HTTP invoker configuration that specifies the target service
invocation - the RemoteInvocation to execute
Returns:
the RemoteInvocationResult object
Throws:
IOException - if thrown by I/O operations
ClassNotFoundException - if thrown during deserialization

getByteArrayOutputStream

protected ByteArrayOutputStream getByteArrayOutputStream(RemoteInvocation invocation)
                                                  throws IOException
Serialize the given RemoteInvocation into a ByteArrayOutputStream.

Parameters:
invocation - the RemoteInvocation object
Returns:
a ByteArrayOutputStream with the serialized RemoteInvocation
Throws:
IOException - if thrown by I/O methods

writeRemoteInvocation

protected void writeRemoteInvocation(RemoteInvocation invocation,
                                     OutputStream os)
                              throws IOException
Serialize the given RemoteInvocation to the given OutputStream.

Parameters:
invocation - the RemoteInvocation object
os - the OutputStream to write to
Throws:
IOException - if thrown by I/O methods

doExecuteRequest

protected abstract RemoteInvocationResult doExecuteRequest(HttpInvokerClientConfiguration config,
                                                           ByteArrayOutputStream baos)
                                                    throws IOException,
                                                           ClassNotFoundException
Execute a request to send the given serialized remote invocation.

Implementations will usually call readRemoteInvocationResult to deserialize a returned RemoteInvocationResult object.

Parameters:
config - the HTTP invoker configuration that specifies the target service
baos - the ByteArrayOutputStream that contains the serialized RemoteInvocation object
Returns:
the RemoteInvocationResult object
Throws:
IOException - if thrown by I/O operations
ClassNotFoundException - if thrown during deserialization
See Also:
readRemoteInvocationResult(java.io.InputStream)

readRemoteInvocationResult

protected RemoteInvocationResult readRemoteInvocationResult(InputStream is)
                                                     throws IOException,
                                                            ClassNotFoundException
Deserialize a RemoteInvocationResult from the given InputStream.

Parameters:
is - the InputStream to read from
Returns:
the RemoteInvocationResult object
Throws:
IOException - if thrown by I/O methods
ClassNotFoundException


Copyright (C) 2003-2004 The Spring Framework Project.