Class SourceResponseHandler
java.lang.Object
org.apache.synapse.transport.netty.sender.SourceResponseHandler
SourceResponseHandler have utilities for creating and preparing an outbound response to be sent
to the HTTP client.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleancanOutboundResponseHaveContentTypeHeader(org.apache.axis2.context.MessageContext msgContext) static org.wso2.transport.http.netty.message.HttpCarbonMessagecreateOutboundResponseMsg(org.apache.axis2.context.MessageContext msgCtx, org.wso2.transport.http.netty.message.HttpCarbonMessage clientRequest) Creates outbound response to be sent back to the HTTP client using the axis2 message context and the original client request.static StringgetContentTypeForOutboundResponse(org.apache.axis2.context.MessageContext msgContext) static org.wso2.transport.http.netty.message.Http2PushPromisegetPushPromise(org.apache.axis2.context.MessageContext msgCtx) Retrieve the push promise received from the backend server.static booleanisPassThroughMessage(org.apache.axis2.context.MessageContext msgContext) The pass through (when message body is not built) status of the message.static voidpushPromise(org.wso2.transport.http.netty.message.Http2PushPromise http2PushPromise, org.wso2.transport.http.netty.message.HttpCarbonMessage clientRequest) Send the server push promise to the client.static voidpushResponse(org.apache.axis2.context.MessageContext msgCtx, org.wso2.transport.http.netty.message.Http2PushPromise http2PushPromise, org.wso2.transport.http.netty.message.HttpCarbonMessage outboundPushMsg, org.wso2.transport.http.netty.message.HttpCarbonMessage clientRequest) Send the server pushes to the client.static voidsendResponse(org.apache.axis2.context.MessageContext msgCtx, org.wso2.transport.http.netty.message.HttpCarbonMessage inboundRequestMsg, org.wso2.transport.http.netty.message.HttpCarbonMessage outboundResponseMsg) Writes the response headers and the response body to the client.
-
Constructor Details
-
SourceResponseHandler
public SourceResponseHandler()
-
-
Method Details
-
createOutboundResponseMsg
public static org.wso2.transport.http.netty.message.HttpCarbonMessage createOutboundResponseMsg(org.apache.axis2.context.MessageContext msgCtx, org.wso2.transport.http.netty.message.HttpCarbonMessage clientRequest) throws org.apache.axis2.AxisFault Creates outbound response to be sent back to the HTTP client using the axis2 message context and the original client request.- Parameters:
msgCtx- axis2 message contextclientRequest- original HTTP client request- Returns:
- the outbound response HttpCarbonMessage
- Throws:
org.apache.axis2.AxisFault- if something goes wrong when creating the outbound response
-
getPushPromise
public static org.wso2.transport.http.netty.message.Http2PushPromise getPushPromise(org.apache.axis2.context.MessageContext msgCtx) throws org.apache.axis2.AxisFault Retrieve the push promise received from the backend server.- Parameters:
msgCtx- axis2 message context- Returns:
- htttp2PushPromise Http2PushPromise
- Throws:
org.apache.axis2.AxisFault- if push promise is not available
-
canOutboundResponseHaveContentTypeHeader
public static boolean canOutboundResponseHaveContentTypeHeader(org.apache.axis2.context.MessageContext msgContext) -
getContentTypeForOutboundResponse
public static String getContentTypeForOutboundResponse(org.apache.axis2.context.MessageContext msgContext) throws org.apache.axis2.AxisFault - Throws:
org.apache.axis2.AxisFault
-
isPassThroughMessage
public static boolean isPassThroughMessage(org.apache.axis2.context.MessageContext msgContext) The pass through (when message body is not built) status of the message.- Returns:
- true if it is a pass through.
-
sendResponse
public static void sendResponse(org.apache.axis2.context.MessageContext msgCtx, org.wso2.transport.http.netty.message.HttpCarbonMessage inboundRequestMsg, org.wso2.transport.http.netty.message.HttpCarbonMessage outboundResponseMsg) throws org.apache.axis2.AxisFault Writes the response headers and the response body to the client.- Parameters:
msgCtx- axis2 message contextinboundRequestMsg- inbound request carbon messageoutboundResponseMsg- outbound response carbon message- Throws:
org.apache.axis2.AxisFault- if something goes wrong when sending out the response
-
pushPromise
public static void pushPromise(org.wso2.transport.http.netty.message.Http2PushPromise http2PushPromise, org.wso2.transport.http.netty.message.HttpCarbonMessage clientRequest) throws org.apache.axis2.AxisFault Send the server push promise to the client.- Parameters:
http2PushPromise- Http2PushPromiseclientRequest- HttpCarbonMessage- Throws:
org.apache.axis2.AxisFault- if error occurred while pushing responses.
-
pushResponse
public static void pushResponse(org.apache.axis2.context.MessageContext msgCtx, org.wso2.transport.http.netty.message.Http2PushPromise http2PushPromise, org.wso2.transport.http.netty.message.HttpCarbonMessage outboundPushMsg, org.wso2.transport.http.netty.message.HttpCarbonMessage clientRequest) throws org.apache.axis2.AxisFault Send the server pushes to the client.- Parameters:
msgCtx- axis2 message contexthttp2PushPromise- Http2PushPromiseoutboundPushMsg- HttpCarbonMessageclientRequest- HttpCarbonMessage- Throws:
org.apache.axis2.AxisFault- if error occurred while pushing responses.
-