public class Request extends Message
FLAG_ERROR, FLAG_POTENTIALLY_RETRANSMITTED, FLAG_PROXIABLE, FLAG_REQUEST, FLAGS_MASK, HEADER_SIZE, VERSION
Constructor and Description |
---|
Request(ByteBuffer bb,
com.bea.wcp.diameter.transport.Connection c)
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,
String sessionId)
Creates a new Request for a given command, application, and optional
session identifier.
|
Modifier and Type | Method and Description |
---|---|
boolean |
attemptFailover() |
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,
String error)
Creates a new Answer message for this request.
|
Answer |
getAnswer() |
ApplicationId |
getApplicationId()
Returns the ApplicationId for this request, or null if none.
|
String |
getDestinationHost()
Returns the destination host for this request, or null if none.
|
Peer[] |
getDestinationPeers()
Returns the destination peers for this request.
|
String |
getDestinationRealm()
Returns the destination realm for this request.
|
Node |
getNode() |
boolean |
getRetrySupported() |
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()
Performs initial validation of a 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.
|
void |
send()
Sends this Diameter message.
|
void |
send(long timeout)
Sends the request.
|
Answer |
sendAndWait() |
Answer |
sendAndWait(long timeout) |
void |
sendError(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(String host)
Sets the destination host for this request.
|
void |
setDestinationRealm(String realm)
Sets the destination realm for the request.
|
static void |
setIsPotentiallyRetransmitted(ByteBuffer bb) |
void |
setRetrySupported(boolean canRetry) |
void |
setSession(Session session) |
void |
unsetDestinationHost()
Unsets the destination host for this request and removes the
Destination-Host AVP.
|
addAvp, addAvp, addAvp, appendXml, decode, decodeAvps, encode, encode, extractAndSetSessionIdAvp, getAppId, 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
public Request(Node node, Command cmd, int appId, String sessionId)
node
- the Diameter Node originating the requestcmd
- the request commandappId
- the message header application identifiersessionId
- the session identifier AVP value, or null if nonepublic Request(Command cmd, Application app)
cmd
- the Command for the requestapp
- the Application for the requestpublic Request(Command cmd, Session session)
session
- the Diameter session for this requestcmd
- the Request command namepublic Request(ByteBuffer bb, com.bea.wcp.diameter.transport.Connection c)
bb
- the message bytesc
- the connection used to receive the messagepublic Node getNode()
public void preValidate() throws MessageException
Message
preValidate
in class Message
MessageException
- if validation failedprotected void preValidateAvp(Avp avp) throws AvpException
Message
preValidateAvp
in class Message
avp
- the AVP to be validatedAvpException
- if the AVP was invalidpublic Answer createAnswer(ResultCode rc)
rc
- the ResultCode for the answerpublic Answer createAnswer(ResultCode rc, String error)
rc
- the ResultCode for the answererror
- the error message or null if nonepublic void sendError(Throwable ex) throws IOException
ex
- the exception that caused the errorIOException
- if the answer could not be sentpublic String getDestinationHost()
public String getDestinationRealm()
public ApplicationId getApplicationId()
public void setDestinationHost(String host)
host
- the destination hostIllegalStateException
- if the destination host has already been setpublic void unsetDestinationHost()
public void setDestinationRealm(String realm)
realm
- the destination realmIllegalStateException
- if the destination realm has already been setpublic void setApplicationId(ApplicationId id)
id
- the ApplicationId for the requestIllegalStateException
- if the application id has already been setpublic void setSession(Session session)
public Session getSession()
getSession
in class Message
public void commit() throws IOException
commit
in class Message
IOException
- if an I/O error occurred while sendingpublic boolean isCommitted()
isCommitted
in class Message
public void send(long timeout) throws IOException
IOException
- if an I/O error has occurredpublic void send() throws IOException
Message
send
in class Message
IOException
- if an I/O error occurred while sendingpublic Answer sendAndWait(long timeout) throws IOException
timeout
- IOException
public Answer sendAndWait() throws IOException
IOException
public boolean attemptFailover()
public boolean getRetrySupported()
public void setRetrySupported(boolean canRetry)
public boolean isThreadWaiting()
public void setAnswer(Answer ans)
public Answer getAnswer()
public boolean isAnswered()
public void cancel()
public Peer[] getDestinationPeers() throws IOException
IOException
- if no destination peers are availablepublic void pushProxyInfo()
public static void setIsPotentiallyRetransmitted(ByteBuffer bb)