public class RequestResponseUtils
extends java.lang.Object
RequestResponseUtils contains utilities used in request and response message flow.| Constructor and Description |
|---|
RequestResponseUtils() |
| Modifier and Type | Method and Description |
|---|---|
static org.apache.axis2.context.MessageContext |
convertCarbonMsgToAxis2MsgCtx(org.wso2.transport.http.netty.message.HttpCarbonMessage incomingCarbonMsg,
SourceConfiguration sourceConfiguration)
Create an Axis2 message context for the given HttpCarbonMessage.
|
static org.apache.axis2.addressing.EndpointReference |
getDestinationEPR(org.apache.axis2.context.MessageContext msgContext)
Get the EPR for the message passed in.
|
static java.lang.String |
getHostName(java.net.InetAddress address)
This method tries to determine the hostname of the given InetAddress without
triggering a reverse DNS lookup.
|
static org.wso2.transport.http.netty.contract.config.ListenerConfiguration |
getListenerConfig(SourceConfiguration sourceConfiguration,
boolean sslEnabled)
Returns Listener configuration instance populated with source configuration.
|
static java.lang.String |
getListenerInterface(java.lang.String host,
int port) |
static java.lang.String |
getRestUrlPostfix(java.lang.String uri,
java.lang.String servicePath)
Generate the REST_URL_POSTFIX from the request URI.
|
static java.lang.String |
getValueOfElementWithLocalName(org.apache.axiom.om.OMElement element,
java.lang.String localName) |
static void |
handleException(java.lang.String msg) |
static void |
handleException(java.lang.String s,
java.lang.Exception e) |
static boolean |
isHTTPAccessLoggerEnabled() |
static boolean |
isHttpCarbonMessagePresent(org.apache.axis2.context.MessageContext msgContext)
Check if the HTTP_CARBON_MESSAGE is present in the message context.
|
static boolean |
isHTTPTraceLoggerEnabled() |
static boolean |
isMultipartContent(java.lang.String contentType)
Check whether the content type is multipart or not.
|
static boolean |
isRESTRequest(org.apache.axis2.context.MessageContext msgContext,
java.lang.String contentType,
int soapVersion,
java.lang.String soapActionHeader)
Checks if the request should be considered as REST.
|
static boolean |
isRESTSupportedMediaType(java.lang.String contentType)
Checks if the HTTP request is REST based on the given Content-Type header.
|
static void |
populateKeyStoreConfigs(org.apache.axiom.om.OMElement keyStoreEl,
org.wso2.transport.http.netty.contract.config.SslConfiguration sslConfiguration,
org.wso2.securevault.SecretResolver secretResolver) |
static int |
populateSOAPVersion(org.apache.axis2.context.MessageContext msgContext,
java.lang.String contentType)
Populates the SOAP version based on the given Content-Type.
|
static void |
populateTrustStoreConfigs(org.apache.axiom.om.OMElement trustStoreEl,
org.wso2.transport.http.netty.contract.config.SslConfiguration sslConfiguration,
org.wso2.securevault.SecretResolver secretResolver) |
static void |
setInboundMgsSizeValidationConfig(int maxInitialLineLength,
int maxHeaderSize,
int maxEntityBodySize,
org.wso2.transport.http.netty.contract.config.InboundMsgSizeValidationConfig sizeValidationConfig)
Sets the configuration for the inbound request and response size validation.
|
static org.wso2.transport.http.netty.contract.config.ListenerConfiguration |
setSslConfig(org.apache.axis2.description.TransportInDescription transportIn,
org.wso2.transport.http.netty.contract.config.ListenerConfiguration listenerConfiguration,
BaseConfiguration sourceConfiguration) |
static boolean |
shouldInvokeFormatterToWriteBody(org.apache.axis2.context.MessageContext msgContext)
Checks if the request/response body should be written using the appropriate message
formatter.
|
public static org.apache.axis2.context.MessageContext convertCarbonMsgToAxis2MsgCtx(org.wso2.transport.http.netty.message.HttpCarbonMessage incomingCarbonMsg,
SourceConfiguration sourceConfiguration)
incomingCarbonMsg - the http carbon message to be used to create the corresponding Axis2 message contextsourceConfiguration - source configurationpublic static java.lang.String getHostName(java.net.InetAddress address)
InetAddress.getHostName()
triggers a reverse DNS lookup which can be very costly in cases where reverse
DNS fails. Tries to parse a symbolic hostname from InetAddress.toString(),
which is documented to return a String of the form "hostname / literal IP address"
with 'hostname' blank if not already computed & stored in address.
If the hostname cannot be determined from InetAddress.toString(),
the value of InetAddress.getHostAddress() is returned.address - The InetAddress whose hostname has to be determinedpublic static boolean isHttpCarbonMessagePresent(org.apache.axis2.context.MessageContext msgContext)
msgContext - axis2 message contextpublic static boolean shouldInvokeFormatterToWriteBody(org.apache.axis2.context.MessageContext msgContext)
msgContext - axis2 message contextpublic static boolean isMultipartContent(java.lang.String contentType)
contentType - value of the content typepublic static java.lang.String getRestUrlPostfix(java.lang.String uri,
java.lang.String servicePath)
uri - the Request URI as a stringservicePath - service pathpublic static boolean isRESTSupportedMediaType(java.lang.String contentType)
contentType - Content-Type headerpublic static int populateSOAPVersion(org.apache.axis2.context.MessageContext msgContext,
java.lang.String contentType)
msgContext - axis2 message contextcontentType - Content type of the request.public static boolean isRESTRequest(org.apache.axis2.context.MessageContext msgContext,
java.lang.String contentType,
int soapVersion,
java.lang.String soapActionHeader)
msgContext - axis2 message contextcontentType - content-type of the requestsoapVersion - SOAP versionsoapActionHeader - SOAPAction headerpublic static org.apache.axis2.addressing.EndpointReference getDestinationEPR(org.apache.axis2.context.MessageContext msgContext)
msgContext - the message contextpublic static org.wso2.transport.http.netty.contract.config.ListenerConfiguration getListenerConfig(SourceConfiguration sourceConfiguration, boolean sslEnabled) throws org.apache.axis2.AxisFault
sourceConfiguration - source configurationorg.apache.axis2.AxisFaultpublic static boolean isHTTPTraceLoggerEnabled()
public static boolean isHTTPAccessLoggerEnabled()
public static org.wso2.transport.http.netty.contract.config.ListenerConfiguration setSslConfig(org.apache.axis2.description.TransportInDescription transportIn,
org.wso2.transport.http.netty.contract.config.ListenerConfiguration listenerConfiguration,
BaseConfiguration sourceConfiguration)
throws org.apache.axis2.AxisFault
org.apache.axis2.AxisFaultpublic static void populateKeyStoreConfigs(org.apache.axiom.om.OMElement keyStoreEl,
org.wso2.transport.http.netty.contract.config.SslConfiguration sslConfiguration,
org.wso2.securevault.SecretResolver secretResolver)
throws org.apache.axis2.AxisFault
org.apache.axis2.AxisFaultpublic static void populateTrustStoreConfigs(org.apache.axiom.om.OMElement trustStoreEl,
org.wso2.transport.http.netty.contract.config.SslConfiguration sslConfiguration,
org.wso2.securevault.SecretResolver secretResolver)
throws org.apache.axis2.AxisFault
org.apache.axis2.AxisFaultpublic static void setInboundMgsSizeValidationConfig(int maxInitialLineLength,
int maxHeaderSize,
int maxEntityBodySize,
org.wso2.transport.http.netty.contract.config.InboundMsgSizeValidationConfig sizeValidationConfig)
throws org.apache.axis2.AxisFault
maxInitialLineLength - The maximum length of the initial line (e.g. "GET / HTTP/1.0"
or "HTTP/1.0 200 OK")maxHeaderSize - The maximum length of all headers.maxEntityBodySize - The maximum length of the content or each chunk.sizeValidationConfig - instance that represents the configuration for the inbound request and
response size validation.org.apache.axis2.AxisFault - when the given values are invalid.public static java.lang.String getValueOfElementWithLocalName(org.apache.axiom.om.OMElement element,
java.lang.String localName)
public static java.lang.String getListenerInterface(java.lang.String host,
int port)
public static void handleException(java.lang.String s,
java.lang.Exception e)
throws org.apache.axis2.AxisFault
org.apache.axis2.AxisFaultpublic static void handleException(java.lang.String msg)
throws org.apache.axis2.AxisFault
org.apache.axis2.AxisFaultCopyright © 2005-2022 Apache Software Foundation. All Rights Reserved.