Class RESTfulRequest

java.lang.Object
com.iizix.ws.engine.RESTfulRequest

public class RESTfulRequest extends Object
Class used to process a RESTful transaction for a defined Web Service transaction.
Author:
Christopher Mindus
  • Constructor Details

  • Method Details

    • createReply

      public RESTfulReply createReply() throws IOException
      Create the reply instance.
      Returns:
      The REST reply instance.
      Throws:
      IOException - If URLConenction is not a HTTP URL connection.
    • getAppSessionGyro

      public IAppSessionGyro getAppSessionGyro()
      Returns the application session gyro instance.
      Returns:
      The instance, or null for the Designer.
    • WebServiceProp

      public WebServiceProp WebServiceProp()
      Gets the Web Service property.
      Returns:
      The web service properties.
    • getEngine

      public IWebServiceEngine getEngine()
      Gets the Web Service Engine.
      Returns:
      The web service engine.
    • getInput

      public RESTfulInputProps getInput()
      Gets the Web Service RESTful input properties.
      Returns:
      The input properties (params, etc).
    • getOutput

      public OutputProps getOutput()
      Gets the Web Service output properties.
      Returns:
      The output properties, processors, variable mappings, etc.
    • getReadTimeout

      public int getReadTimeout()
      Gets the read timeout for the Socket.
      Returns:
      Read timeout in milliseconds.
    • setReadTimeout

      public void setReadTimeout(int readTimeout)
      Sets the read timeout.
      Parameters:
      readTimeout - Timeout in milliseconds for the Socket.
    • getMethod

      public Method getMethod()
      Gets the HTTP method for the request.
      Returns:
      The request method.
    • setMethod

      public void setMethod(Method method)
      Sets the HTTP method for the request.
      Parameters:
      method - The method to use.
      Throws:
      NullPointerException - If parameter is null.
    • getOverrideMethod

      public Method getOverrideMethod()
      Gets the override method used for "X-HTTP-Method-Override".
      Returns:
      null for none, otherwise GET, POST or PUT.
    • setOverrideMethod

      public void setOverrideMethod(Method overrideMethod)
      Sets the override method.
      Parameters:
      overrideMethod - The override method, null for none.
    • getWriteEncoding

      public String getWriteEncoding()
      Gets the String write encoding.
      Returns:
      The encoding, default "UTF-8".
    • setWriteEncoding

      public void setWriteEncoding(String writeEncoding) throws UnsupportedEncodingException
      Sets the String write encoding.
      Parameters:
      writeEncoding - The encoding, default "UTF-8".
      Throws:
      NullPointerException - If parameter is null.
      UnsupportedEncodingException - For unsupported encoding.
    • getReadEncoding

      public String getReadEncoding()
      Gets the String read encoding.
      Returns:
      The encoding, default "UTF-8".
    • setReadEncoding

      public void setReadEncoding(String readEncoding) throws UnsupportedEncodingException
      Sets the String output encoding.
      Parameters:
      readEncoding - The encoding, default "UTF-8".
      Throws:
      NullPointerException - If parameter is null.
      UnsupportedEncodingException - For unsupported encoding.
    • getURI

      public String getURI()
      Gets the URI for the request, without the Query parameters.
      Returns:
      The URI.
    • setURI

      public void setURI(String uri)
      Sets the URI for the request that will be used for the URL connection.
      Parameters:
      uri - The URI.
      Throws:
      NullPointerException - If parameter is null.
    • getProxy

      public Proxy getProxy()
      Gets the Proxy to use.
      Returns:
      The Proxy for the connection, null if not retrieved yet.
    • setProxy

      public void setProxy(Proxy proxy)
      Sets the proxy to use.
      Parameters:
      proxy - The proxy.
      Throws:
      NullPointerException - If parameter is null.
    • getHTTPRequestProperties

      public Map<String,String> getHTTPRequestProperties()
      Gets the HTTP request properties.
      Returns:
      A map with the property names as keys (e.g. "Content-Type", or "Accept-Charset") and their values.
    • getHTTPURLConnection

      public HttpURLConnection getHTTPURLConnection()
      Gets the HTTP(S) URLConnection.
      Returns:
      The HTTP(S) URLConnection, or null if not HTTP/HTTPS protocol.
    • reformatParameterizedURIPath

      public void reformatParameterizedURIPath(Map<String,String> params) throws URISyntaxException, UnsupportedEncodingException
      Parses and updates the URI path when the URI path is parameterized, e.g. a path such as "https://host.com/path/{param1}{param2}/{param3}". The variables found are taken from the list of parameters that must be of type "isURIPathParameter".
      Parameters:
      params - The parameters list map. The key is the parameter name and the value is a non-null String.
      Throws:
      URISyntaxException - If the URI is in error in regards to parameters.
      NullPointerException - If a parameter value is null.
      UnsupportedEncodingException - For unsupported encodings.
    • reformatParameterizedURIPath

      public static String reformatParameterizedURIPath(String uri, Map<String,String> params, String encoding) throws URISyntaxException, UnsupportedEncodingException
      Parses and updates the URI path when the URI path is parameterized, e.g. a path such as "https://host.com/path/{param1}{param2}/{param3}". The variables found are taken from the list of parameters that must be of type "isURIPathParameter".
      Parameters:
      params - The parameters list map. The key is the parameter name and the value is a non-null String.
      Returns:
      The new URI (if changed).
      Throws:
      URISyntaxException - If the URI is in error in regards to parameters.
      NullPointerException - If a parameter value is null.
      UnsupportedEncodingException - For unsupported encodings.