BEA Systems, Inc.

BEA WebLogic SIP Server 3.1 API Reference


com.bea.wcp.diameter
Class Request

java.lang.Object
  extended bycom.bea.wcp.diameter.Message
      extended bycom.bea.wcp.diameter.Request
Direct Known Subclasses:
ACR, CCR, RAR

public class Request
extends Message

Diameter request message. Request extends Message with the ability to directly get and set the destination host, destination realm, and ApplicationId for the request.

Copyright © 2006 BEA Systems, Inc. All Rights Reserved.

Field Summary
 
Fields inherited from class com.bea.wcp.diameter.Message
FLAG_ERROR, FLAG_POTENTIALLY_RETRANSMITTED, FLAG_PROXIABLE, FLAG_REQUEST, FLAGS_MASK, HEADER_SIZE, VERSION
 
Constructor Summary
Request(java.nio.ByteBuffer bb, Connection c)
          y Creates a new Request decoded from the specified message bytes.
Request(Command cmd, Application app)
          Creates a new Request for the specified application and command.
Request(Command cmd, Session session)
          Creates a new Request for the specified session and command.
Request(Node node, Command cmd, int appId, java.lang.String sessionId)
          Creates a new Request for a given command, application, and optional session identifier.
 
Method Summary
 void cancel()
           
 void commit()
          Commits the request and sends it to the destination peer or realm.
 Answer createAnswer(ResultCode rc)
          Creates an Answer message for this request.
 Answer createAnswer(ResultCode rc, java.lang.String error)
          Creates a new Answer message for this request.
 Answer getAnswer()
           
 ApplicationId getApplicationId()
          Returns the ApplicationId for this request, or null if none.
 java.lang.String getDestinationHost()
          Returns the destination host for this request, or null if none.
 com.bea.wcp.diameter.Peer[] getDestinationPeers()
          Returns the destination peers for this request.
 java.lang.String getDestinationRealm()
          Returns the destination realm for this request.
 Session getSession()
          Returns the session associated with this request.
 boolean isAnswered()
          Returns true if this request has already been answered.
 boolean isCommitted()
          Returns true if the request has been committed.
 boolean isThreadWaiting()
           
 void preValidate()
          Perform initial validation of message to include validation of AVPs required to determine if the request/answer should be forwarded.
protected  void preValidateAvp(Avp avp)
          Fully decodes and validates the specified AVP.
 void send()
          Sends this Diameter message.
 void send(long timeout)
          Sends the request.
 Answer sendAndWait()
           
 Answer sendAndWait(long timeout)
           
 void sendError(java.lang.Throwable ex)
          Sends an error answer for this request and the specified exception.
 void setAnswer(Answer ans)
           
 void setApplicationId(ApplicationId id)
          Sets the ApplicationId for the request.
 void setDestinationHost(java.lang.String host)
          Sets the destination host for this request.
 void setDestinationRealm(java.lang.String realm)
          Sets the destination realm for the request.
static void setIsPotentiallyRetransmitted(java.nio.ByteBuffer bb)
           
 void setSession(Session session)
           
 void unsetDestinationHost()
          Unsets the destination host for this request and removes the Destination-Host AVP.
 
Methods inherited from class com.bea.wcp.diameter.Message
addAvp, addAvp, addAvp, decode, decodeAvps, encode, encode, getAppId, getAvp, getAvp, getAvpList, getCode, getCode, getCommand, getConnection, getEndToEndId, getHopByHopId, getLength, getOriginHost, getOriginRealm, getSessionId, getVersion, isAnswer, isError, isPotentiallyRetransmitted, isProxiable, isRequest, toLoggableString, toString, validate, validateAvp
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Request

public Request(java.nio.ByteBuffer bb,
               Connection c)
y Creates a new Request decoded from the specified message bytes.


Request

public Request(Command cmd,
               Application app)
Creates a new Request for the specified application and command.


Request

public Request(Command cmd,
               Session session)
Creates a new Request for the specified session and command.


Request

public Request(Node node,
               Command cmd,
               int appId,
               java.lang.String sessionId)
Creates a new Request for a given command, application, and optional session identifier.

Method Detail

cancel

public void cancel()

commit

public void commit()
            throws java.io.IOException
Commits the request and sends it to the destination peer or realm.

Specified by:
commit in class Message
Throws:
java.io.IOException - if an I/O error occurred while sending

createAnswer

public Answer createAnswer(ResultCode rc)
Creates an Answer message for this request. The relevant header fields and AVPs will be copied from the original request (see RFC 3588).

Parameters:
rc - the ResultCode for the answer
Returns:
the Answer message for the request

createAnswer

public Answer createAnswer(ResultCode rc,
                           java.lang.String error)
Creates a new Answer message for this request. An Error-Message AVP will be included if the specified error message is not null.

Parameters:
rc - the ResultCode for the answer
error - the error message or null if none
Returns:
the Answer message for the request

getAnswer

public Answer getAnswer()

getApplicationId

public ApplicationId getApplicationId()
Returns the ApplicationId for this request, or null if none. This corresponds to one of the Auth-Application-Id, Acct-Application-Id, or Vendor-Specific-Application-Id AVPs. A different application id can be specified in the message header itself.


getDestinationHost

public java.lang.String getDestinationHost()
Returns the destination host for this request, or null if none. This corresponds to the value of the Destination-Host AVP.


getDestinationPeers

public com.bea.wcp.diameter.Peer[] getDestinationPeers()
                           throws java.io.IOException
Returns the destination peers for this request. If Destination-Host AVP is present and is a configured peer, then returns a list with just that peer. Otherwise, returns list of available peers according to Destination-Route AVP (realm-based routing).

Returns:
list of destination peers
Throws:
java.io.IOException - if no destination peers are available

getDestinationRealm

public java.lang.String getDestinationRealm()
Returns the destination realm for this request. This corresponds to the value of the Destination-Realm AVP.


getSession

public Session getSession()
Returns the session associated with this request.

Specified by:
getSession in class Message
Returns:
the Session for this Request, or null if none

isAnswered

public boolean isAnswered()
Returns true if this request has already been answered.


isCommitted

public boolean isCommitted()
Returns true if the request has been committed.

Specified by:
isCommitted in class Message
Returns:
true if committed, false otherwise

isThreadWaiting

public boolean isThreadWaiting()

preValidate

public void preValidate()
                 throws MessageException
Description copied from class: Message
Perform initial validation of message to include validation of AVPs required to determine if the request/answer should be forwarded. If we determine the message should be locally handled, then the remaining AVPs will be validated by 'validate()'.

Overrides:
preValidate in class Message
Throws:
MessageException - if validation failed

preValidateAvp

protected void preValidateAvp(Avp avp)
                       throws AvpException
Description copied from class: Message
Fully decodes and validates the specified AVP. Message implementations can override this to provide additional validation or to cache AVP results.

Overrides:
preValidateAvp in class Message
Parameters:
avp - the AVP to be validated
Throws:
AvpException - if the AVP was invalid

send

public void send()
          throws java.io.IOException
Description copied from class: Message
Sends this Diameter message.

Specified by:
send in class Message
Throws:
java.io.IOException - if an I/O error occurred while sending

send

public void send(long timeout)
          throws java.io.IOException
Sends the request. If the destination host has been set, then the request will be sent directly to the peer associated with the host. Otherwise, the message will be routed based on destination realm and application identifier.

Throws:
java.io.IOException - if an I/O error has occurred

sendAndWait

public Answer sendAndWait()
                   throws java.io.IOException
Throws:
java.io.IOException

sendAndWait

public Answer sendAndWait(long timeout)
                   throws java.io.IOException
Throws:
java.io.IOException

sendError

public void sendError(java.lang.Throwable ex)
               throws java.io.IOException
Sends an error answer for this request and the specified exception.

Parameters:
ex - the exception that caused the error
Throws:
java.io.IOException - if the answer could not be sent

setAnswer

public void setAnswer(Answer ans)

setApplicationId

public void setApplicationId(ApplicationId id)
Sets the ApplicationId for the request. This will result in one of the Auth-Application-Id, Acct-Application-Id, or Vendor-Specific-Application-Id AVPs being added to the request. The ApplicationId can be different from the application id specified in the message header. The ApplicationId can only be set once, and must be set if the request is proxiable.

Parameters:
id - the ApplicationId for the request
Throws:
java.lang.IllegalStateException - if the application id has already been set

setDestinationHost

public void setDestinationHost(java.lang.String host)
Sets the destination host for this request. This will result in the Destination-Host AVP being added to the request.

Parameters:
host - the destination host
Throws:
java.lang.IllegalStateException - if the destination host has already been set

setDestinationRealm

public void setDestinationRealm(java.lang.String realm)
Sets the destination realm for the request. This will result in the Destination-Realm AVP being added to the request. The destination realm can only be set once, and must be set if the request is proxiable.

Parameters:
realm - the destination realm
Throws:
java.lang.IllegalStateException - if the destination realm has already been set

setIsPotentiallyRetransmitted

public static void setIsPotentiallyRetransmitted(java.nio.ByteBuffer bb)

setSession

public void setSession(Session session)

unsetDestinationHost

public void unsetDestinationHost()
Unsets the destination host for this request and removes the Destination-Host AVP.


Documentation is available at
http://e-docs.bea.com/wlcp/wlss31/
Copyright 2007 BEA Systems Inc.