Skip navigation links

Oracle Communications Converged Application Server Java API Reference
5.0

E18767-01


com.bea.wcp.diameter
Class Request

java.lang.Object
  extended by com.bea.wcp.diameter.Message
      extended by com.bea.wcp.diameter.Request

Direct Known Subclasses:
ACR, CCR, Peer.CER, 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.


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, com.bea.wcp.diameter.transport.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.
 Peer[] getDestinationPeers()
          Returns the destination peers for this request.
 java.lang.String getDestinationRealm()
          Returns the destination realm for this request.
 Node getNode()
           
 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 pushProxyInfo()
          Adds proxy info AVP to the list representing the current node additionally, allocates new hop-by-hop identifier for this request
 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, appendXml, decode, decodeAvps, encode, encode, getAppId, getAvp, getAvp, getAvpList, getCode, getCode, getCommand, getConnection, getEffectiveSessionId, getEndToEndId, getHopByHopId, getLength, getOriginHost, getOriginRealm, getSessionId, getVersion, isAnswer, isError, isPotentiallyRetransmitted, isProxiable, isRequest, popProxyInfo, 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(Node node,
               Command cmd,
               int appId,
               java.lang.String sessionId)
Creates a new Request for a given command, application, and optional session identifier.
Parameters:
node - the Diameter Node originating the request
cmd - the request command
appId - the message header application identifier
sessionId - the session identifier AVP value, or null if none

Request

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

Request

public Request(Command cmd,
               Session session)
Creates a new Request for the specified session and command.
Parameters:
session - the Diameter session for this request
cmd - the Request command name

Request

public Request(java.nio.ByteBuffer bb,
               com.bea.wcp.diameter.transport.Connection c)
y Creates a new Request decoded from the specified message bytes.
Parameters:
bb - the message bytes
c - the connection used to receive the message

Method Detail

getNode

public Node getNode()

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

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

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

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.

getDestinationRealm

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

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.

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

unsetDestinationHost

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

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

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

setSession

public void setSession(Session session)

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

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

isCommitted

public boolean isCommitted()
Returns true if the request has been committed.
Specified by:
isCommitted in class Message
Returns:
true if committed, false otherwise

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

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

sendAndWait

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

sendAndWait

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

isThreadWaiting

public boolean isThreadWaiting()

setAnswer

public void setAnswer(Answer ans)

getAnswer

public Answer getAnswer()

isAnswered

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

cancel

public void cancel()

getDestinationPeers

public 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

pushProxyInfo

public void pushProxyInfo()
Adds proxy info AVP to the list representing the current node additionally, allocates new hop-by-hop identifier for this request

setIsPotentiallyRetransmitted

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

Skip navigation links

Oracle Communications Converged Application Server Java API Reference
5.0

E18767-01


Copyright © 2005, 2010, Oracle and/or its affiliates. All rights reserved.