(11)S2Flex2 ソースコードリーディング1
さて、前回、マクロな視点で説明しようとして失敗しましたが、
ちゃんと読まないとだめですね。
ちゃんと読んでみます。
まずサーブレット。
org.seasar.flex2.rpc.remoting.RemotingGateway
クライアントからのリクエストはすべてRemotingGatewayが受け付けます。
init()メソッドで
さっそくSingletonS2ContainerFactoryによってコンポーネントを呼び出しています。
呼び出すコンポーネントは、RemotingMessageProcessor。
doGet()メソッドで
"RemotingGateway is running on http ..."を出力しています。
ブラウザからこのサーブレットにリクエストしたら出てきます。
doPost()メソッドで
RemotingMessageProcessorのprocess()メソッドを実行しています。
また、responseのコンテントタイプを指定しています。"application/x-amf"です。
org.seasar.flex2.rpc.remoting.processor.impl.
RemotingMessageProcessorImpl implements RemotingMessageProcessorクラスを読みます。
process()メソッドで
を使用して、request,responseをそれぞれDataInputStream,OutputStreamUtilに変換しています。
その後、
MessageProcessor.process()メソッドを実行しています。
他にもMessageProcessorのセッターゲッターがありますが、これはDIのためのメソッドだと思います。
org.seasar.flex2.rpc.remoting.message.processor.impl.
MessageProcessorImpl implements MessageProcessorクラスを読みます。
process()メソッドで
DataInputStream型のメッセージを、org.seasar.flex2.rpc.remoting.message.data.Message型に変換しています。
実際に変換しているのは、org.seasar.flex2.rpc.remoting.message.io.reader.MessageReaderが行っているようです。
次に、
MessageHeaderProcessor,MessageBodyProcessorによってレスポンスメッセージを処理しています。
最後に、
生成したレスポンスメッセージをOutputStreamにflushして処理を終えています。
今回はここまで。。