Class ScriptRemoteConnector


  • public final class ScriptRemoteConnector
    extends java.lang.Object
    Describes a connector to a remote endpoint. This is a wrapper around the true connector object and it provides Script-style interfaces for working with buffered response strings and the like.
    Author:
    muzquiano, kevinr
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Response call​(java.lang.String uri)
      Invokes a URI on the endpoint via a GET request.
      Response del​(java.lang.String uri)
      Invokes a URI on a remote service as DELETE request.
      Response get​(java.lang.String uri)
      Invokes a GET request URI on the endpoint.
      RemoteConfigElement.EndpointDescriptor getDescriptor()  
      java.lang.String getEndpoint()
      Returns the endpoint string
      Response post​(java.lang.String uri, java.lang.String body)
      Invokes a URI on a remote service, passing the supplied body as a POST request.
      Response post​(java.lang.String uri, java.lang.String body, java.lang.String contentType)
      Invokes a URI on a remote service, passing the supplied body as a POST request.
      Response put​(java.lang.String uri, java.lang.String body)
      Invokes a URI on a remote service, passing the supplied body as a PUT request.
      Response put​(java.lang.String uri, java.lang.String body, java.lang.String contentType)
      Invokes a URI on a remote service, passing the supplied body as a PUT request.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ScriptRemoteConnector

        public ScriptRemoteConnector​(Connector connector,
                                     RemoteConfigElement.EndpointDescriptor descriptor)
        Constructor
        Parameters:
        connector - The Connector to wrap
        descriptor - The description of the endpoint this connector is managing
    • Method Detail

      • call

        public Response call​(java.lang.String uri)
        Invokes a URI on the endpoint via a GET request.
        Parameters:
        uri - the uri
        Returns:
        Response object from the call Response
      • get

        public Response get​(java.lang.String uri)
        Invokes a GET request URI on the endpoint.
        Parameters:
        uri - the uri
        Returns:
        Response object from the call Response
      • post

        public Response post​(java.lang.String uri,
                             java.lang.String body)
        Invokes a URI on a remote service, passing the supplied body as a POST request.
        Parameters:
        uri - Uri to call on the endpoint
        body - Body of the POST request.
        Returns:
        Response object from the call Response
      • post

        public Response post​(java.lang.String uri,
                             java.lang.String body,
                             java.lang.String contentType)
        Invokes a URI on a remote service, passing the supplied body as a POST request.
        Parameters:
        uri - Uri to call on the endpoint
        body - Body of the POST request.
        contentType - Content mimetype of the request body
        Returns:
        Response object from the call Response
      • put

        public Response put​(java.lang.String uri,
                            java.lang.String body)
        Invokes a URI on a remote service, passing the supplied body as a PUT request.
        Parameters:
        uri - Uri to call on the endpoint
        body - Body of the PUT request.
        Returns:
        Response object from the call Response
      • put

        public Response put​(java.lang.String uri,
                            java.lang.String body,
                            java.lang.String contentType)
        Invokes a URI on a remote service, passing the supplied body as a PUT request.
        Parameters:
        uri - Uri to call on the endpoint
        body - Body of the PUT request.
        contentType - Content mimetype of the request
        Returns:
        Response object from the call Response
      • del

        public Response del​(java.lang.String uri)
        Invokes a URI on a remote service as DELETE request. NOTE: the name of the method is 'del' not 'delete' so as to not interfere with JavaScript Object.delete() method.
        Parameters:
        uri - Uri to call on the endpoint
        Returns:
        Response object from the call Response
      • getEndpoint

        public java.lang.String getEndpoint()
        Returns the endpoint string
        Returns:
        endpoint