public abstract class JAXMServlet
extends javax.servlet.http.HttpServlet
JAXMServlet
object is notified of a message's arrival
using the HTTP-SOAP binding.
The JAXMServlet
class is a support/utility class and is
provided purely as a convenience. It is not a mandatory component, and
there is no requirement that it be implemented or extended.
Note that when a component that receives messages extends
JAXMServlet
, it also needs to implement either a
ReqRespListener
object or a
OnewayListener
object,
depending on whether the component is written for a request-response
style of interaction or for a one-way (asynchronous) style of interaction.
Modifier and Type | Field and Description |
---|---|
protected MessageFactory |
msgFactory
The
MessageFactory object that will be used internally
to create the SOAPMessage object to be passed to the
method onMessage . |
Constructor and Description |
---|
JAXMServlet() |
Modifier and Type | Method and Description |
---|---|
void |
doPost(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
Internalizes the given
HttpServletRequest object
and writes the reply to the given HttpServletResponse
object. |
protected static MimeHeaders |
getHeaders(javax.servlet.http.HttpServletRequest req)
Returns a
MimeHeaders object that contains the headers
in the given HttpServletRequest object. |
void |
init(javax.servlet.ServletConfig servletConfig)
Initializes this
JAXMServlet object using the given
ServletConfig object and initializing the
msgFactory field with a default
MessageFactory object. |
protected static void |
putHeaders(MimeHeaders headers,
javax.servlet.http.HttpServletResponse res)
Sets the given
HttpServletResponse object with the
headers in the given MimeHeaders object. |
void |
setMessageFactory(MessageFactory msgFactory)
Sets this
JAXMServlet object's msgFactory
field with the given MessageFactory object. |
doDelete, doGet, doHead, doOptions, doPut, doTrace, getLastModified, service, service
protected MessageFactory msgFactory
MessageFactory
object that will be used internally
to create the SOAPMessage
object to be passed to the
method onMessage
. This new message will contain the data
from the message that was posted to the servlet. Using the
MessageFactory
object that is the value for this field
to create the new message ensures that the correct profile is used.public void init(javax.servlet.ServletConfig servletConfig) throws javax.servlet.ServletException
JAXMServlet
object using the given
ServletConfig
object and initializing the
msgFactory
field with a default
MessageFactory
object.init
in interface javax.servlet.Servlet
init
in class javax.servlet.GenericServlet
servletConfig
- the ServletConfig
object to be
used in initializing this JAXMServlet
objectjavax.servlet.ServletException
public void setMessageFactory(MessageFactory msgFactory)
JAXMServlet
object's msgFactory
field with the given MessageFactory
object.
A MessageFactory
object for a particular profile needs to
be set before a message is received in order for the message to be
successfully internalized.msgFactory
- the MessageFactory
object that will
be used to create the SOAPMessage
object that
will be used to internalize the message that was posted to
the servletprotected static MimeHeaders getHeaders(javax.servlet.http.HttpServletRequest req)
MimeHeaders
object that contains the headers
in the given HttpServletRequest
object.req
- the HttpServletRequest
object that a
messaging provider sent to the servletMimeHeaders
object containing the headers
in the message sent to the servletprotected static void putHeaders(MimeHeaders headers, javax.servlet.http.HttpServletResponse res)
HttpServletResponse
object with the
headers in the given MimeHeaders
object.headers
- the MimeHeaders
object containing the
the headers in the message sent to the servletres
- the HttpServletResponse
object to which the
headers are to be writtengetHeaders(javax.servlet.http.HttpServletRequest)
public void doPost(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp) throws javax.servlet.ServletException, IOException
HttpServletRequest
object
and writes the reply to the given HttpServletResponse
object.
Note that the value for the msgFactory
field will be used to
internalize the message. This ensures that the message
factory for the correct profile is used.
doPost
in class javax.servlet.http.HttpServlet
req
- the HttpServletRequest
object containing the
message that was sent to the servletresp
- the HttpServletResponse
object to which the
response to the message will be writtenjavax.servlet.ServletException
- if there is a servlet errorIOException
- if there is an input or output errorCopyright (c) 2013, Oracle and/or its affiliates. All rights reserved.