Utils

public class Utils

Utility functions of this framework

Methods

requestLocalServer

public static HttpResponse requestLocalServer(String method, String url, Map<String, String> params, String contentType, byte[] data, String scheme, String user)

Send a signed request to other internal applications. If the application makes the request without using this method, those request will be seen as anonymous request by the receiving application.

Parameters:
  • method – The HTTP method
  • url – The URL path
  • params – Key-Value map of url parmeters
  • contentType – Type of the content to be sent with the request
  • data – Data to be sent with the request
  • scheme – URL scheme like http, https, http+unix, etc
  • user – The email id of the user on whose behalf this request is sent.

requestLocalServer

public static HttpResponse requestLocalServer(String method, String url, Map<String, String> params, String contentType, byte[] data)

Send a signed request to other internal applications. If the application makes the request without using this method, those request will be seen as anonymous request by the receiving application.

Parameters:
  • method – The HTTP method
  • url – The URL path
  • params – Key-Value map of url parmeters
  • contentType – Type of the content to be sent with the request
  • data – Data to be sent with the request

requestLocalServer

public static HttpResponse requestLocalServer(String method, String url, Map<String, String> params)

Send a signed request to other internal applications. If the application makes the request without using this method, those request will be seen as anonymous request by the receiving application.

Parameters:
  • method – The HTTP method
  • url – The URL path
  • params – Key-Value map of url parmeters

signAndSend

public static HttpResponse signAndSend(String prefix, String signatureKey, String method, String host, String path, Map<String, String> params, String contentType, byte[] data, String scheme)

Send a signed request. Use requestLocalServer methods instead of this.

Parameters:
  • prefix – The prefix for the signature. This will be identified as from() in the request.auth object of the receiver
  • signatureKey – The header value in which the signature will be put in the response
  • method – The HTTP method
  • path – The URL path
  • host – The host to send the request to. The host can verify the signature only if this app’s public key is present in it.
  • params – Key-Value map of url parmeters
  • contentType – Type of the content to be sent with the request
  • data – Data to be sent with the request
  • scheme – URL scheme like http, https, http+unix, etc