Package nablarch.fw.jaxrs
Class JaxbBodyConverter
java.lang.Object
nablarch.fw.jaxrs.BodyConverterSupport
nablarch.fw.jaxrs.JaxbBodyConverter
- All Implemented Interfaces:
BodyConverter
JAXBを使用してリクエスト/レスポンスの変換を行う
BodyConverter実装クラス。- Author:
- Naoki Yamamoto
-
Nested Class Summary
Nested classes/interfaces inherited from class nablarch.fw.jaxrs.BodyConverterSupport
BodyConverterSupport.ContentType -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidconfigure(jakarta.xml.bind.Marshaller marshaller) Marshallerに対するオプション設定を行う。protected voidconfigure(jakarta.xml.bind.Unmarshaller unmarshaller) Unmarshallerに対するオプション設定を行う。protected ObjectconvertRequest(HttpRequest request, ExecutionContext context) リクエストを変換する。protected HttpResponseconvertResponse(Object response, ExecutionContext context) レスポンスを変換する。booleanisConvertible(String mediaType) 指定されたメディアタイプを変換できるかどうか。Methods inherited from class nablarch.fw.jaxrs.BodyConverterSupport
getContentType, read, setDefaultEncoding, write
-
Constructor Details
-
JaxbBodyConverter
public JaxbBodyConverter()
-
-
Method Details
-
convertRequest
Description copied from class:BodyConverterSupportリクエストを変換する。- Specified by:
convertRequestin classBodyConverterSupport- Parameters:
request- リクエストcontext- 実行コンテキスト- Returns:
- 変換したオブジェクト
-
convertResponse
Description copied from class:BodyConverterSupportレスポンスを変換する。- Specified by:
convertResponsein classBodyConverterSupport- Parameters:
response- レスポンスオブジェクトcontext- 実行コンテキスト- Returns:
- 変換したオブジェクト
-
isConvertible
Description copied from interface:BodyConverter指定されたメディアタイプを変換できるかどうか。- Parameters:
mediaType- メディアタイプ- Returns:
- 変換できる場合は
true
-
configure
protected void configure(jakarta.xml.bind.Marshaller marshaller) throws jakarta.xml.bind.JAXBException Marshallerに対するオプション設定を行う。 このクラスではデフォルトで以下の設定でXMLの生成を行う。 設定を変更したい場合はサブクラス側で行う必要がある。- 改行、インデントを使用した形式にフォーマットする。
-
文字コードはリソースメソッドの
Producesに設定された文字コードを使用する。
文字コードが設定されていない場合はデフォルトエンコーディングを使用する。
- Parameters:
marshaller-Marshaller- Throws:
jakarta.xml.bind.JAXBException- オプション設定に失敗した場合
-
configure
protected void configure(jakarta.xml.bind.Unmarshaller unmarshaller) throws jakarta.xml.bind.JAXBException Unmarshallerに対するオプション設定を行う。 このクラスでは特に何も行わないので、オプション設定はサブクラス側で行う必要がある。- Parameters:
unmarshaller-Unmarshaller- Throws:
jakarta.xml.bind.JAXBException- オプション設定に失敗した場合
-