Package nablarch.fw.jaxrs
Class BodyConverterSupport
java.lang.Object
nablarch.fw.jaxrs.BodyConverterSupport
- All Implemented Interfaces:
BodyConverter
- Direct Known Subclasses:
FormUrlEncodedConverter,JacksonBodyConverterSupport,JaxbBodyConverter
@Published(tag="architect")
public abstract class BodyConverterSupport
extends Object
implements BodyConverter
BodyConverterの実装クラスをサポートするクラス。-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classContentTypeを表すクラス。 -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract ObjectconvertRequest(HttpRequest request, ExecutionContext context) リクエストを変換する。protected abstract HttpResponseconvertResponse(Object response, ExecutionContext context) レスポンスを変換する。protected BodyConverterSupport.ContentTypegetContentType(String mediaType) メディアタイプからContent-Typeを取得する。read(HttpRequest request, ExecutionContext executionContext) メディアタイプに応じてリクエストボディ部を読み込み、Beanオブジェクトに変換する。voidsetDefaultEncoding(String name) デフォルトエンコーディングを設定する。write(Object response, ExecutionContext executionContext) Beanオブジェクトをメディアタイプに応じて変換し、レスポンスボディ部へ書き込む。Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface nablarch.fw.jaxrs.BodyConverter
isConvertible
-
Constructor Details
-
BodyConverterSupport
public BodyConverterSupport()
-
-
Method Details
-
setDefaultEncoding
デフォルトエンコーディングを設定する。- Parameters:
name- エンコーディング名
-
read
Description copied from interface:BodyConverterメディアタイプに応じてリクエストボディ部を読み込み、Beanオブジェクトに変換する。- Specified by:
readin interfaceBodyConverter- Parameters:
request- HTTPリクエストexecutionContext- 実行コンテキスト- Returns:
- Beanオブジェクト
-
convertRequest
リクエストを変換する。- Parameters:
request- リクエストcontext- 実行コンテキスト- Returns:
- 変換したオブジェクト
-
write
Description copied from interface:BodyConverterBeanオブジェクトをメディアタイプに応じて変換し、レスポンスボディ部へ書き込む。- Specified by:
writein interfaceBodyConverter- Parameters:
response- BeanオブジェクトexecutionContext- 実行コンテキスト- Returns:
- HTTPレスポンス
-
convertResponse
レスポンスを変換する。- Parameters:
response- レスポンスオブジェクトcontext- 実行コンテキスト- Returns:
- 変換したオブジェクト
-
getContentType
メディアタイプからContent-Typeを取得する。 メディアタイプにcharsetが含まれている場合は、エンコーディング名の正当性を確認し、 問題がなければ、指定されたメディアタイプをそのままContent-Typeの値とする。 エンコーディング名が不正な場合は実行時例外を送出する。 メディアタイプにcharsetが含まれていない場合は、デフォルトのエンコーディングを メディアタイプに付けたものをContent-Typeの値とする。- Parameters:
mediaType- メディアタイプ- Returns:
BodyConverterSupport.ContentType
-