Package com.nimbusds.common.jsonrpc2
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., http://connect2id.com Supported JSON-RPC 2.0 requests: * user.auth * user.get * ws.getName * ws.getTime * ws.getVersion
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
apply(javax.servlet.http.HttpServletResponse httpResponse)
Applies this banner to the specified HTTP servlet response.static String
composeMessage(String wsName, String wsVersion, String[] methods)
Composes a banner message.String[]
getHandledJSONRPC2Methods()
Gets the handled JSON-RPC 2.0 methods.String
getWsName()
Gets the web service name.String
getWsVersion()
Gets the web service version and build date.
-
-
-
Constructor Detail
-
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 benull
.wsVersion
- The web service version and build date. Must not benull
.methods
- The handled methods. Must not benull
.
-
-
Method Detail
-
getWsVersion
public String getWsVersion()
Gets the web service version and build date.- Returns:
- The web service version and build date.
-
getHandledJSONRPC2Methods
public String[] 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 benull
.wsVersion
- The web service version and build date. Must not benull
.methods
- The handled methods. Must not benull
.- Returns:
- The banner message.
-
apply
public void apply(javax.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., http://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.
-
-