Spring Web Services Framework

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
 void clearResponse()
          Removes the response message, if any.
 boolean containsProperty(String name)
          Check if this message context contains a property with the given name.
 Object getProperty(String name)
          Gets the value of a specific property from the MessageContext.
 String[] getPropertyNames()
          Return the names of all properties in this MessageContext.
 WebServiceMessage getRequest()
          Returns the request message.
 WebServiceMessage getResponse()
          Returns the response message.
 boolean hasResponse()
          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 the MessageContext.
 void setProperty(String name, Object value)
          Sets the name and value of a property associated with the MessageContext.
 void setResponse(WebServiceMessage response)
          Sets the response message.
 

Method Detail

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:
hasResponse()

setResponse

void setResponse(WebServiceMessage response)
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

void readResponse(InputStream inputStream)
                  throws IOException
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 errors
IllegalStateException - if a response has already been created

setProperty

void setProperty(String name,
                 Object value)
Sets the name and value of a property associated with the MessageContext. If the MessageContext contains a value of the same property, the old value is replaced.

Parameters:
name - name of the property associated with the value
value - value of the property

getProperty

Object getProperty(String name)
Gets the value of a specific property from the MessageContext.

Parameters:
name - name of the property whose value is to be retrieved
Returns:
value of the property

removeProperty

void removeProperty(String name)
Removes a property from the MessageContext.

Parameters:
name - name of the property to be removed

containsProperty

boolean containsProperty(String name)
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 the MessageContext contains the property; false otherwise

getPropertyNames

String[] getPropertyNames()
Return the names of all properties in this MessageContext.

Returns:
the names of all properties in this context, or an empty array if none defined

Spring Web Services Framework

Copyright © 2005-2010 The Spring Web Services Framework. All Rights Reserved.