Class Answer

java.lang.Object
com.bea.wcp.diameter.Message
com.bea.wcp.diameter.Answer
Direct Known Subclasses:
ACA, CCA, Peer.CEA, RAA, SySLA, SySNA, SySTA

public class Answer extends Message
Diameter answer message. Answer extends Message with the ability to get and set the ResultCode for the answer.
Author:
Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
  • Constructor Details

    • Answer

      public Answer(Request req, ResultCode rc)
      Creates a new Answer for the specified Request and ResultCode.
      Parameters:
      req - the original Request
      rc - the ResultCode for the answer
    • Answer

      public Answer(ByteBuffer bb, com.bea.wcp.diameter.transport.Connection c)
      Creates a new Answer that is parsed from the specified message bytes.
      Parameters:
      bb - the message bytes
      c - the connection used to receive the answer message
  • Method Details

    • preValidate

      public void preValidate() throws MessageException
      Description copied from class: Message
      Performs initial validation of a message to include validation of AVPs required to determine if the request/answer should be forwarded. If we determine the message should be handled locally, 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
    • getResultCode

      public ResultCode getResultCode()
      Returns the ResultCode for this answer. This corresponds to either the Result-Code AVP or Experimental-Result AVP.
    • setResultCode

      public void setResultCode(ResultCode rc)
      Allows relay or proxy applications to modify result code of an answer message being forwarded. This is only possible if existing result code value does not already indicate an error. If result code is changed, and this host is different from the origin-host, then set the Error-Reporting-Host AVP as well. See RFC 3588 section 6.2.2 for more details.
    • send

      public void send() throws IOException
      If this Answer was created for a Request, then sends the answer using the connection from the associated Request.
      Specified by:
      send in class Message
      Throws:
      IOException - if an I/O error occurred while sending the answer
      IllegalStateException - if this Answer has no associated Request
    • commit

      public void commit() throws IOException
      Description copied from class: Message
      Commits a message currently being sent.
      Specified by:
      commit in class Message
      Throws:
      IOException
    • isCommitted

      public boolean isCommitted()
      Specified by:
      isCommitted in class Message
    • getRequest

      public Request getRequest()
      Returns the original Request used to create this Answer, or null if this answer was not originated by this node.
    • getSession

      public Session getSession()
      Description copied from class: Message
      Returns the Session associated with this message, or null if none.
      Specified by:
      getSession in class Message