public abstract class AbstractHttpInvokerRequestExecutor extends ObjectSE implements HttpInvokerRequestExecutor, BeanClassLoaderAware
RemoteInvocation オブジェクトのシリアライゼーションと RemoteInvocationResults オブジェクトのデシリアライゼーションを事前に実装します。
doExecuteRequest(org.springframework.remoting.httpinvoker.HttpInvokerClientConfiguration, java.io.ByteArrayOutputStream)
修飾子と型 | フィールドと説明 |
---|---|
static StringSE | CONTENT_TYPE_SERIALIZED_OBJECT デフォルトのコンテンツ型: "application/x-java-serialized-object". |
protected static StringSE | ENCODING_GZIP |
protected static StringSE | HTTP_HEADER_ACCEPT_ENCODING |
protected static StringSE | HTTP_HEADER_ACCEPT_LANGUAGE |
protected static StringSE | HTTP_HEADER_CONTENT_ENCODING |
protected static StringSE | HTTP_HEADER_CONTENT_LENGTH |
protected static StringSE | HTTP_HEADER_CONTENT_TYPE |
protected static StringSE | HTTP_METHOD_POST |
protected Log | logger |
コンストラクターと説明 |
---|
AbstractHttpInvokerRequestExecutor() |
修飾子と型 | メソッドと説明 |
---|---|
protected ObjectInputStreamSE | createObjectInputStream(InputStreamSE is, StringSE codebaseUrl) 指定された InputStream とコードベースの ObjectInputStream を作成します。 |
protected InputStreamSE | decorateInputStream(InputStreamSE is) リモート呼び出し結果の読み取りに使用する InputStream を返します。指定された元の InputStream を装飾する可能性があります。 |
protected OutputStreamSE | decorateOutputStream(OutputStreamSE os) リモート呼び出しの記述に使用する OutputStream を返します。指定された元の OutputStream を装飾する可能性があります。 |
protected abstract RemoteInvocationResult | doExecuteRequest(HttpInvokerClientConfiguration config, ByteArrayOutputStreamSE baos) リクエストを実行して、指定された直列化されたリモート呼び出しを送信します。 |
protected RemoteInvocationResult | doReadRemoteInvocationResult(ObjectInputStreamSE ois) 指定された ObjectInputStream から呼び出しオブジェクトの実際の読み取りを実行します。 |
protected void | doWriteRemoteInvocation(RemoteInvocation invocation, ObjectOutputStreamSE oos) 指定された ObjectOutputStream への指定された呼び出しオブジェクトの実際の書き込みを実行します。 |
RemoteInvocationResult | executeRequest(HttpInvokerClientConfiguration config, RemoteInvocation invocation) リクエストを実行して、指定されたリモート呼び出しを送信します。 |
protected ClassLoaderSE | getBeanClassLoader() このエグゼキュータが使用することになっている Bean ClassLoader を返します。 |
protected ByteArrayOutputStreamSE | getByteArrayOutputStream(RemoteInvocation invocation) 指定された RemoteInvocation を ByteArrayOutputStream に直列化します。 |
StringSE | getContentType() HTTP インボーカーリクエストの送信に使用するコンテンツ型を返します。 |
boolean | isAcceptGzipEncoding() GZIP エンコーディングを受け入れるかどうか、つまり "gzip" を値として HTTP の "Accept-Encoding" ヘッダーを送信するかどうかを返します。 |
protected RemoteInvocationResult | readRemoteInvocationResult(InputStreamSE is, StringSE codebaseUrl) 指定された InputStream から RemoteInvocationResult オブジェクトを逆直列化します。 |
void | setAcceptGzipEncoding(boolean acceptGzipEncoding) GZIP エンコードを受け入れるかどうか、つまり "gzip" を値として HTTP の "Accept-Encoding" ヘッダーを送信するかどうかを設定します。 |
void | setBeanClassLoader(ClassLoaderSE classLoader) Bean class loader SE を Bean インスタンスに提供するコールバック。 |
void | setContentType(StringSE contentType) HTTP インボーカーリクエストの送信に使用するコンテンツ型を指定します。 |
protected void | writeRemoteInvocation(RemoteInvocation invocation, OutputStreamSE os) 指定された RemoteInvocation を指定された OutputStream に直列化します。 |
cloneSE, equalsSE, finalizeSE, getClassSE, hashCodeSE, notifySE, notifyAllSE, toStringSE, waitSE, waitSE, waitSE
public static final StringSE CONTENT_TYPE_SERIALIZED_OBJECT
protected static final StringSE HTTP_HEADER_ACCEPT_LANGUAGE
protected static final StringSE HTTP_HEADER_ACCEPT_ENCODING
protected static final StringSE HTTP_HEADER_CONTENT_ENCODING
protected final Log logger
public void setContentType(StringSE contentType)
デフォルトは "application/x-java-serialized-object" です。
public StringSE getContentType()
public void setAcceptGzipEncoding(boolean acceptGzipEncoding)
デフォルトは "true" です。HTTP サーバーで有効になっている場合でも GZIP レスポンス圧縮が不要な場合は、このフラグをオフにします。
public boolean isAcceptGzipEncoding()
public void setBeanClassLoader(ClassLoaderSE classLoader)
BeanClassLoaderAware
class loader
SE を Bean インスタンスに提供するコールバック。 通常の Bean プロパティの設定後、ただし InitializingBean's
InitializingBean.afterPropertiesSet()
メソッドやカスタム init-method などの初期化コールバックの前に呼び出されます。
BeanClassLoaderAware
の setBeanClassLoader
classLoader
- 所有クラスローダー @Nullable protected ClassLoaderSE getBeanClassLoader()
public final RemoteInvocationResult executeRequest(HttpInvokerClientConfiguration config, RemoteInvocation invocation) throws ExceptionSE
HttpInvokerRequestExecutor
HttpInvokerRequestExecutor
の executeRequest
config
- ターゲットサービスを指定する HTTP インボーカー構成 invocation
- 実行する RemoteInvocationIOExceptionSE
- I/O 操作によってスローされた場合 ClassNotFoundExceptionSE
- 逆直列化中にスローされた場合 ExceptionSE
- 一般的なエラーの場合 protected ByteArrayOutputStreamSE getByteArrayOutputStream(RemoteInvocation invocation) throws IOExceptionSE
invocation
- RemoteInvocation オブジェクト IOExceptionSE
- I/O メソッドによってスローされた場合 protected void writeRemoteInvocation(RemoteInvocation invocation, OutputStreamSE os) throws IOExceptionSE
デフォルトの実装では、decorateOutputStream
が最初にストリームを装飾する機会が与えられます(たとえば、カスタムの暗号化または圧縮のため)。最終ストリームの ObjectOutputStream
を作成し、doWriteRemoteInvocation
を呼び出して実際にオブジェクトを書き込みます。
呼び出しのカスタム直列化のためにオーバーライドできます。
invocation
- RemoteInvocation オブジェクト os
- 書き込む OutputStreamIOExceptionSE
- I/O メソッドによってスローされた場合 decorateOutputStream(java.io.OutputStream)
, doWriteRemoteInvocation(org.springframework.remoting.support.RemoteInvocation, java.io.ObjectOutputStream)
protected OutputStreamSE decorateOutputStream(OutputStreamSE os) throws IOExceptionSE
デフォルトの実装は、指定されたストリームをそのまま返します。たとえば、カスタムの暗号化や圧縮のためにオーバーライドできます。
os
- オリジナルの OutputStreamIOExceptionSE
protected void doWriteRemoteInvocation(RemoteInvocation invocation, ObjectOutputStreamSE oos) throws IOExceptionSE
デフォルトの実装では、単に writeObject
を呼び出します。暗号化対応ホルダーなどの単純な呼び出しではなく、カスタムラッパーオブジェクトの直列化のためにオーバーライドできます。
invocation
- RemoteInvocation オブジェクト oos
- 書き込む ObjectOutputStreamIOExceptionSE
- I/O メソッドによってスローされた場合 ObjectOutputStream.writeObject(java.lang.Object)
SEprotected abstract RemoteInvocationResult doExecuteRequest(HttpInvokerClientConfiguration config, ByteArrayOutputStreamSE baos) throws ExceptionSE
実装は通常、readRemoteInvocationResult
を呼び出して、返された RemoteInvocationResult オブジェクトを逆直列化します。
config
- ターゲットサービスを指定する HTTP インボーカー構成 baos
- 直列化された RemoteInvocation オブジェクトを含む ByteArrayOutputStreamIOExceptionSE
- I/O 操作によってスローされた場合 ClassNotFoundExceptionSE
- 逆直列化中にスローされた場合 ExceptionSE
- 一般的なエラーの場合 readRemoteInvocationResult(java.io.InputStream, String)
protected RemoteInvocationResult readRemoteInvocationResult(InputStreamSE is, @Nullable StringSE codebaseUrl) throws IOExceptionSE, ClassNotFoundExceptionSE
decorateInputStream
に最初にストリームを装飾する機会を与えます(たとえば、カスタム暗号化または圧縮のため)。createObjectInputStream
を介して ObjectInputStream
を作成し、doReadRemoteInvocationResult
を呼び出して実際にオブジェクトを読み取ります。
呼び出しのカスタム直列化のためにオーバーライドできます。
is
- 読み込み元の InputStreamcodebaseUrl
- ローカルに見つからない場合にクラスをロードするコードベース URLIOExceptionSE
- I/O メソッドによってスローされた場合 ClassNotFoundExceptionSE
- 逆直列化中にスローされた場合 decorateInputStream(java.io.InputStream)
, createObjectInputStream(java.io.InputStream, java.lang.String)
, doReadRemoteInvocationResult(java.io.ObjectInputStream)
protected InputStreamSE decorateInputStream(InputStreamSE is) throws IOExceptionSE
デフォルトの実装は、指定されたストリームをそのまま返します。たとえば、カスタムの暗号化や圧縮のためにオーバーライドできます。
is
- オリジナルの InputStreamIOExceptionSE
protected ObjectInputStreamSE createObjectInputStream(InputStreamSE is, @Nullable StringSE codebaseUrl) throws IOExceptionSE
is
- 読み込み元の InputStreamcodebaseUrl
- ローカルに見つからない場合にクラスをロードするコードベース URL (null
にすることができます)IOExceptionSE
- ObjectInputStream の作成が失敗した場合 CodebaseAwareObjectInputStream
protected RemoteInvocationResult doReadRemoteInvocationResult(ObjectInputStreamSE ois) throws IOExceptionSE, ClassNotFoundExceptionSE
デフォルトの実装では、単に readObject
を呼び出します。暗号化対応ホルダーなどの単純な呼び出しではなく、カスタムラッパーオブジェクトの逆直列化のためにオーバーライドできます。
ois
- 読み込み元の ObjectInputStreamIOExceptionSE
- I/O メソッドによってスローされた場合 ClassNotFoundExceptionSE
- 直列化されたオブジェクトのクラス名を解決できなかった場合 ObjectOutputStream.writeObject(java.lang.Object)
SE