Package org.springframework.ws.context
Interface MessageContext
- All Known Implementing Classes:
AbstractMessageContext
,DefaultMessageContext
public interface MessageContext
Context holder for message requests.
Contains both the message request as well as the response. Response message are usually lazily created (but do not have to be).
Also contains properties, which can be used to by interceptors
to pass information on to
endpoints.
- Since:
- 1.0.0
- Author:
- Arjen Poutsma
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Removes the response message, if any.boolean
containsProperty
(String name) Check if this message context contains a property with the given name.getProperty
(String name) Gets the value of a specific property from theMessageContext
.String[]
Return the names of all properties in thisMessageContext
.Returns the request message.Returns the response message.boolean
Indicates whether this context has a response.void
readResponse
(InputStream inputStream) Reads a response message from the given input stream.void
removeProperty
(String name) Removes a property from theMessageContext
.void
setProperty
(String name, Object value) Sets the name and value of a property associated with theMessageContext
.void
setResponse
(WebServiceMessage response) Sets the response message.
-
Method Details
-
getRequest
WebServiceMessage getRequest()Returns the request message.- Returns:
- the request message
-
hasResponse
boolean hasResponse()Indicates whether this context has a response.- Returns:
true
if this context has a response;false
otherwise
-
getResponse
WebServiceMessage getResponse()Returns the response message. Creates a new response if no response is present.- Returns:
- the response message
- See Also:
-
setResponse
Sets the response message.- Parameters:
response
- the response message- Throws:
IllegalStateException
- if a response has already been created- Since:
- 1.5.0
-
clearResponse
void clearResponse()Removes the response message, if any.- Since:
- 1.5.0
-
readResponse
Reads a response message from the given input stream.- Parameters:
inputStream
- the stream to read the response from- Throws:
IOException
- in case of I/O errorsIllegalStateException
- if a response has already been created
-
setProperty
Sets the name and value of a property associated with theMessageContext
. If theMessageContext
contains a value of the same property, the old value is replaced.- Parameters:
name
- name of the property associated with the valuevalue
- value of the property
-
getProperty
Gets the value of a specific property from theMessageContext
.- Parameters:
name
- name of the property whose value is to be retrieved- Returns:
- value of the property
-
removeProperty
Removes a property from theMessageContext
.- Parameters:
name
- name of the property to be removed
-
containsProperty
Check if this message context contains a property with the given name.- Parameters:
name
- the name of the property to look for- Returns:
true
if theMessageContext
contains the property;false
otherwise
-
getPropertyNames
String[] getPropertyNames()Return the names of all properties in thisMessageContext
.- Returns:
- the names of all properties in this context, or an empty array if none defined
-