Oracle

weblogic.wsee.jws
Interface JwsContext

All Superinterfaces:
Serializable

public interface JwsContext
extends Serializable

Provides access to container services that support web services (JWS files). Represents the execution context of the web service. Methods in this interface can be used to access out-of-band data for communication with other web service architectures and to manage conversations.

For more information on building web services, see Accessing Runtime Information about a Web Service Using the JwsContext.


Method Summary
 void finishConversation()
          Marks the current conversation instance as requiring removal after the currently executing method or event handler returns.
 Principal getCallerPrincipal()
          Returns the security principal associated with the current method invocation if authentication was performed.
 long getCurrentAge()
          Returns the conversation's current age (in seconds).
 long getCurrentIdleTime()
          Gets the number of seconds since the last client request, or since the conversation's maximum idle time was reset.
 Element[] getInputHeaders()
          Returns the SOAP headers that arrived with the current method invocation message.
 Logger getLogger(String name)
          Deprecated. use java.util.logging
 long getMaxAge()
          Gets the time representing the longest the conversation may remain active before finishing.
 long getMaxIdleTime()
          Gets the number of seconds that the conversation can remain idle before finishing due to client inactivity.
 MessageContext getMessageContext()
          Return the message context currently being processed.
 Protocol getProtocol()
          Gets the protocol of the current request.
 ServiceHandle getService()
          Returns a ServiceHandle instance for the currently active service instance.
 boolean getUnderstoodInputHeaders()
          Returns the value most recently set by a call to
 boolean isCallerInRole(String roleName)
          Returns true if the authenticated principal is within the specified security role.
 boolean isFinished()
          Returns whether or not this conversation instance has had finish() called on it (indicating that code has requested termination of this conversation instance).
 void resetIdleTime()
          Resets the timer measuring the number of seconds since the last activity for the current conversation.
 void setMaxAge(Date date)
          Sets a new maximum age for the conversation to an absolute Date.
 void setMaxAge(String duration)
          Sets a conversation's maximum age by specifying a duration as a string.
 void setMaxIdleTime(long seconds)
          Sets the number of seconds that the conversation can remain idle before finishing due to client inactivity.
 void setMaxIdleTime(String duration)
          Sets the number of seconds (as a String) that the conversation can remain idle before finishing due to client inactivity.
 void setOutputHeaders(Element[] headers)
          Set the SOAP headers to be sent with outgoing messages to the client.
 void setUnderstoodInputHeaders(boolean understood)
          Indicates whether input headers were understood.
 

Method Detail

isFinished

boolean isFinished()
Returns whether or not this conversation instance has had finish() called on it (indicating that code has requested termination of this conversation instance).

You can finish a conversation by calling the finishConversation method on the conversation instance.

Returns:
true if the conversation has finished; false if it hasn't.

finishConversation

void finishConversation()
Marks the current conversation instance as requiring removal after the currently executing method or event handler returns.

Call this method to force removal of the conversation instance as an alternative to waiting for it to be removed by WebLogic Server when the conversation times out or its "finish" method is reached. Calling this method from within another method is equivalent to marking the calling method with the @conversation phase="finish" tag.


setMaxAge

void setMaxAge(Date date)
               throws IllegalStateException,
                      IllegalArgumentException
Sets a new maximum age for the conversation to an absolute Date. If the date parameter is in the past, the conversation will finish immediately.

Calling this method from a web service's code sets the maximum conversation age (relative to the current time) for that service instance. The date parameter marks the time after which WebLogic Server will be allowed to finish this conversation. Note that setting the maximum age with this method overrides the default setting or the setting given in the service's JWS file. This is an absolute age that isn't affected by network traffic.

Parameters:
date - The time after which the conversation should finish; null to disable the age timeout.
Throws:
IllegalStateException - if the method is called from a service instance that is not conversational.
IllegalArgumentException - If this method has passed an illegal or inappropriate argument.

setMaxAge

void setMaxAge(String duration)
               throws IllegalStateException,
                      IllegalArgumentException
Sets a conversation's maximum age by specifying a duration as a string.

Call this method to set the maximum conversation age (relative to the current time) for the conversation. The duration parameter marks the time after which the WebLogic Server will be allowed to finish this conversation. Note that setting the maximum age with this method overrides the default setting or the setting given in the service's JWS file. This is an absolute age that isn't affected by network traffic.

If the duration value results in zero seconds, the maximum age timeout will be disabled. If the duration value is in the past, the conversation will finish immediately.

The duration value is considered to be relative to the current time, not to the start of the conversation.

Parameters:
duration - The period after which the conversation will finish.
Throws:
IllegalStateException - if the method is called from a service instance that is not conversational.
IllegalArgumentException - If this method has passed an illegal or inappropriate argument.

getMaxAge

long getMaxAge()
               throws IllegalStateException
Gets the time representing the longest the conversation may remain active before finishing.

Returns:
The number of seconds since the conversation started before which it will finish.
Throws:
IllegalStateException - if the method is called from a service instance that is not conversational.

getCurrentAge

long getCurrentAge()
                   throws IllegalStateException
Returns the conversation's current age (in seconds).

Returns:
The number of seconds that have passed since the conversation started.
Throws:
IllegalStateException - If the method is called from a service instance that is not conversational.

resetIdleTime

void resetIdleTime()
                   throws IllegalStateException
Resets the timer measuring the number of seconds since the last activity for the current conversation. You can use this method to reset the timer for other service activity beyond client requests.

Throws:
IllegalStateException - if the method is called from a service instance that is not conversational.

setMaxIdleTime

void setMaxIdleTime(long seconds)
                    throws IllegalStateException,
                           IllegalArgumentException
Sets the number of seconds that the conversation can remain idle before finishing due to client inactivity.

Conversation idle time is the amount of time that can pass between incoming messages before the service instance is finished due to client inactivity. You can initialize a conversation's idle time to a default through the setting given at the top of the JWS file, but each instance can be set to a different idle time value through the setMaxIdleTime or setMaxIdleTime method.

To disable idle time expiration, set the maximum idle time value to zero.

The timer associated with tracking the idle time will automatically reset whenever a request is received from a web service's client or when resetIdleTime method is called.

Parameters:
seconds - The number of seconds the conversation can remain idle before it will expire.
Throws:
IllegalStateException - if the method is called from a service instance that is not conversational.
IllegalArgumentException - If this method has passed an illegal or inappropriate argument.

setMaxIdleTime

void setMaxIdleTime(String duration)
                    throws IllegalStateException,
                           IllegalArgumentException
Sets the number of seconds (as a String) that the conversation can remain idle before finishing due to client inactivity.

Conversation idle time is the amount of time that can pass between incoming messages before the service instance is finished due to client inactivity. You can initialize a conversation's idle time to a default through the setting given at the top of the JWS file, but each instance can be set to a different idle time value through the setMaxIdleTime or setMaxIdleTime method.

To disable idle time expiration, set the maximum idle time value to zero.

The timer associated with tracking the idle time will automatically reset whenever a request is received from a web service's client or when resetIdleTime method is called.

Parameters:
duration - The number of seconds the conversation can remain idle before it will expire.
Throws:
IllegalStateException - if the method is called from a service instance that is not conversational.
IllegalArgumentException - If this method has passed an illegal or inappropriate argument.

getMaxIdleTime

long getMaxIdleTime()
                    throws IllegalStateException
Gets the number of seconds that the conversation can remain idle before finishing due to client inactivity. A conversation is idle if the service is not receiving incoming messages through an operation method. Note that messages received through callback handlers do not reset a conversation idle time.

Returns:
The number of seconds that the conversation can remain idle before finishing due to client inactivity.
Throws:
IllegalStateException - if the method is called from a service instance that is not conversational.

getCurrentIdleTime

long getCurrentIdleTime()
                        throws IllegalStateException
Gets the number of seconds since the last client request, or since the conversation's maximum idle time was reset.

Returns:
The number of seconds since the last activity affecting the conversation.
Throws:
IllegalStateException - if the method is called from a service instance that is not conversational.

getCallerPrincipal

Principal getCallerPrincipal()
Returns the security principal associated with the current method invocation if authentication was performed.

Returns:
The Principal that was produced by authentication.

isCallerInRole

boolean isCallerInRole(String roleName)
Returns true if the authenticated principal is within the specified security role.

Parameters:
roleName - The name of the security role against which to check the authenticated principal.
Returns:
true if the principal is within the specified security role; false if they are not.

getService

ServiceHandle getService()
Returns a ServiceHandle instance for the currently active service instance. You can use this handle to query service information such as the conversation ID, the protocol scheme initiating the current request, and the URL of the service.

Returns:
A com.bea.jws.ServiceHandle object representing the current web service.

getLogger

@Deprecated
Logger getLogger(String name)
Deprecated. use java.util.logging

The logger class uses WebLogic Server's NonCatalogLogger

Parameters:
name - The name of the category by which log messages should be grouped.
Returns:
A Logger class that may be used to send messages to the application log.

getInputHeaders

Element[] getInputHeaders()
Returns the SOAP headers that arrived with the current method invocation message. The SOAP headers used by WebLogic Workshop to manage conversations are included in the list of headers returned.

Returns:
An array of org.w3c.dom.Element objects containing the SOAP headers that arrived with the current method invocation.

setUnderstoodInputHeaders

void setUnderstoodInputHeaders(boolean understood)
Indicates whether input headers were understood. If any input headers are marked with the mustUnderstand attribute value of "1" or "true" and this method is not called with the value true, then a SOAP fault will be generated.

Parameters:
understood - true to indicate that "mustUnderstand" headers were understood; false to indicate they weren't.

getUnderstoodInputHeaders

boolean getUnderstoodInputHeaders()
Returns the value most recently set by a call to

Returns:
The value most recently set by a call to JwsContext.setUnderstoodInputHeaders(); false if JwsContext.setUnderstoodInputHeaders() has not been called.

setOutputHeaders

void setOutputHeaders(Element[] headers)
Set the SOAP headers to be sent with outgoing messages to the client.

Parameters:
headers - An array of org.w3c.dom.Element objects containing valid SOAP headers.

getProtocol

Protocol getProtocol()
Gets the protocol of the current request.

Returns:
The protocol of the current request.

getMessageContext

MessageContext getMessageContext()
Return the message context currently being processed. NOTE: this is not the actual message context, but a filter over the real one. Only the message context properties can be manipulated via this object.

Returns:
a message contextc

Documentation is available at
http://edocs.bea.com/wls/docs103
Copyright 2008 Oracle