Class Banner

java.lang.Object
com.nimbusds.common.jsonrpc2.Banner

public class Banner extends Object
Welcome banner for Connect2id JSON-RPC 2.0 services.

Example output:

 Use HTTP POST to submit your JSON-RPC 2.0 request

 Web service: LdapAuth, version 3.0.1 (2014-02-20)
 Vendor: Connect2id Ltd., https://connect2id.com
 
 Supported JSON-RPC 2.0 requests:
        * user.auth
        * user.get
        * ws.getName
        * ws.getTime
        * ws.getVersion
 
  • Constructor Details

    • Banner

      public Banner(String wsName, String wsVersion, String[] methods)
      Creates a new welcome banner for a Connect2id JSON-RPC 2.0 service.
      Parameters:
      wsName - The web service name. Must not be null.
      wsVersion - The web service version and build date. Must not be null.
      methods - The handled methods. Must not be null.
  • Method Details

    • getWsName

      public String getWsName()
      Gets the web service name.
      Returns:
      The web service name.
    • getWsVersion

      public String getWsVersion()
      Gets the web service version and build date.
      Returns:
      The web service version and build date.
    • getHandledJSONRPC2Methods

      Gets the handled JSON-RPC 2.0 methods.
      Returns:
      The handled JSON-RPC 2.0 methods, sorted.
    • composeMessage

      public static String composeMessage(String wsName, String wsVersion, String[] methods)
      Composes a banner message.
      Parameters:
      wsName - The web service name. Must not be null.
      wsVersion - The web service version and build date. Must not be null.
      methods - The handled methods. Must not be null.
      Returns:
      The banner message.
    • apply

      public void apply(jakarta.servlet.http.HttpServletResponse httpResponse) throws IOException
      Applies this banner to the specified HTTP servlet response.

      Appends a "X-Web-Service" HTTP header set to getWsName().

      Sets the "Content-Type" HTTP header to "text/plain;charset=utf-8".

      Prints a message with the following format:

       Use HTTP POST to submit your JSON-RPC 2.0 request
      
       Web service: [ws-name], [ws-version]
       Vendor: Connect2id Ltd., https://connect2id.com
       
       Supported JSON-RPC 2.0 requests:
              * [method-1]
            * [method-2]
            * [method-x]
       
      Parameters:
      httpResponse - The HTTP servlet response.
      Throws:
      IOException - If an I/O exception was encountered.