Interface MessageBody

  • All Superinterfaces:
    Cloneable, DiameterAvp, GroupedAvp

    public interface MessageBody
    extends GroupedAvp
    Defines an interface representing the Message-Body grouped AVP type. From the Diameter Ro Reference Point Protocol Details (3GPP TS 32.299 V9.6.0) specification:
     7.2.103      Message-Body AVP
     
     The Message-Body AVP (AVP Code 889) is of type Grouped AVP and holds
     information about the message bodies including user-to-user data.
     It has the following ABNF grammar:
     
           Message-Body ::= < AVP Header: 889 >
                             { Content-Type }
                             { Content-Length }
                             [ Content-Disposition ]
                             [ Originator ]
     
    Note:
    The support for extension AVPs is present even thou the ABNF grammar for this AVP does not contain the "* [ AVP ]" line. Be aware that adding any extension AVPs may result in interoperability problems with products that strongly validate the incoming diameter message for it's adherence to the specification.
    • Method Detail

      • hasContentType

        boolean hasContentType()
        Returns true if the Content-Type AVP is present in the Message-Body AVP.
      • getContentType

        String getContentType()
        Returns the value of the Content-Type AVP, of type UTF8String.
        Returns:
        the value of the Content-Type AVP, or null if it has not been set.
      • setContentType

        void setContentType​(String contentType)
        Sets the value of the Content-Type AVP, of type UTF8String.
        Throws:
        NullPointerException - if contentType is null.
      • removeContentType

        void removeContentType()
        Removes the Content-Type AVP from the Message-Body AVP. If the Content-Type AVP is not present, this method returns silently.
      • hasContentLength

        boolean hasContentLength()
        Returns true if the Content-Length AVP is present in the Message-Body AVP.
      • getContentLength

        long getContentLength()
        Returns the value of the Content-Length AVP, of type Unsigned32. Use hasContentLength() to check the existence of this AVP.
        Returns:
        the value of the Content-Length AVP
        Throws:
        IllegalStateException - if the Content-Length AVP has not been set.
      • setContentLength

        void setContentLength​(long contentLength)
        Sets the value of the Content-Length AVP, of type Unsigned32.
      • removeContentLength

        void removeContentLength()
        Removes the Content-Length AVP from the Message-Body AVP. If the Content-Length AVP is not present, this method returns silently.
      • hasContentDisposition

        boolean hasContentDisposition()
        Returns true if the Content-Disposition AVP is present in the Message-Body AVP.
      • getContentDisposition

        String getContentDisposition()
        Returns the value of the Content-Disposition AVP, of type UTF8String.
        Returns:
        the value of the Content-Disposition AVP, or null if it has not been set.
      • setContentDisposition

        void setContentDisposition​(String contentDisposition)
        Sets the value of the Content-Disposition AVP, of type UTF8String.
        Throws:
        NullPointerException - if contentDisposition is null.
      • removeContentDisposition

        void removeContentDisposition()
        Removes the Content-Disposition AVP from the Message-Body AVP. If the Content-Disposition AVP is not present, this method returns silently.
      • hasOriginator

        boolean hasOriginator()
        Returns true if the Originator AVP is present in the Message-Body AVP.
      • getOriginator

        Originator getOriginator()
        Returns the value of the Originator AVP, of type Enumerated.
        Returns:
        the value of the Originator AVP, or null if it has not been set.
      • setOriginator

        void setOriginator​(Originator originator)
        Sets the value of the Originator AVP, of type Enumerated.
        Throws:
        NullPointerException - if originator is null.
      • removeOriginator

        void removeOriginator()
        Removes the Originator AVP from the Message-Body AVP. If the Originator AVP is not present, this method returns silently.
      • getExtensionAvps

        DiameterAvp[] getExtensionAvps()
        Returns the set of extension AVPs. The returned array contains the extension AVPs in the order they appear in the Message-Body AVP. A return value of null implies that no extensions AVPs have been set.
      • setExtensionAvps

        void setExtensionAvps​(DiameterAvp[] avps)
                       throws AvpNotAllowedException
        Sets the set of extension AVPs with all the values in the given array. The AVPs will be added to Message-Body AVP in the order in which they appear in the array. Note: the array must not be altered by the caller following this call, and getExtensionAvps() is not guaranteed to return the same array instance, e.g. an "==" check would fail.
        Throws:
        AvpNotAllowedException - if an AVP is encountered of a type already known to this class (i.e. an AVP for which get/set methods already appear in this class)
        NullPointerException - if avps is null.
      • removeExtensionAvps

        void removeExtensionAvps()
        Removes all extension AVPs from the Message-Body AVP. If no extension AVPs are present, this method returns silently.