.. java:import:: java.io DataInputStream .. java:import:: java.io InputStreamReader .. java:import:: java.io File .. java:import:: java.io FileInputStream .. java:import:: java.io FileNotFoundException .. java:import:: java.io IOException .. java:import:: java.security InvalidKeyException .. java:import:: java.security KeyFactory .. java:import:: java.security MessageDigest .. java:import:: java.security NoSuchAlgorithmException .. java:import:: java.security PrivateKey .. java:import:: java.security Signature .. java:import:: java.security SignatureException .. java:import:: java.security.spec InvalidKeySpecException .. java:import:: java.security.spec PKCS8EncodedKeySpec .. java:import:: java.util Map .. java:import:: java.util HashMap .. java:import:: java.util Iterator .. java:import:: io.netty.handler.codec.http QueryStringEncoder .. java:import:: io.netty.handler.codec.http HttpHeaders .. java:import:: org.apache.commons.codec.binary Base64 .. java:import:: org.bouncycastle.util.io.pem PemObject .. java:import:: org.bouncycastle.util.io.pem PemReader Utils ===== .. java:package:: io.aalam.common :noindex: .. java:type:: public class Utils Utility functions of this framework Methods ------- requestLocalServer ^^^^^^^^^^^^^^^^^^ .. java:method:: public static HttpResponse requestLocalServer(String method, String url, Map params, String contentType, byte[] data, String scheme, String user) :outertype: Utils 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. :param method: The HTTP method :param url: The URL path :param params: Key-Value map of url parmeters :param contentType: Type of the content to be sent with the request :param data: Data to be sent with the request :param scheme: URL scheme like http, https, http+unix, etc :param user: The email id of the user on whose behalf this request is sent. requestLocalServer ^^^^^^^^^^^^^^^^^^ .. java:method:: public static HttpResponse requestLocalServer(String method, String url, Map params, String contentType, byte[] data) :outertype: Utils 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. :param method: The HTTP method :param url: The URL path :param params: Key-Value map of url parmeters :param contentType: Type of the content to be sent with the request :param data: Data to be sent with the request requestLocalServer ^^^^^^^^^^^^^^^^^^ .. java:method:: public static HttpResponse requestLocalServer(String method, String url, Map params) :outertype: Utils 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. :param method: The HTTP method :param url: The URL path :param params: Key-Value map of url parmeters signAndSend ^^^^^^^^^^^ .. java:method:: public static HttpResponse signAndSend(String prefix, String signatureKey, String method, String host, String path, Map params, String contentType, byte[] data, String scheme) :outertype: Utils Send a signed request. Use requestLocalServer methods instead of this. :param prefix: The prefix for the signature. This will be identified as from() in the request.auth object of the receiver :param signatureKey: The header value in which the signature will be put in the response :param method: The HTTP method :param path: The URL path :param 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. :param params: Key-Value map of url parmeters :param contentType: Type of the content to be sent with the request :param data: Data to be sent with the request :param scheme: URL scheme like http, https, http+unix, etc