Package io.inversion

Class Request

java.lang.Object
io.inversion.Request

public class Request extends Object
  • Field Details

    • COLLECTION_KEY

      public static final String COLLECTION_KEY
      See Also:
    • RESOURCE_KEY

      public static final String RESOURCE_KEY
      See Also:
    • RELATIONSHIP_KEY

      public static final String RELATIONSHIP_KEY
      See Also:
    • startAt

      protected long startAt
    • endAt

      protected long endAt
    • chain

      protected Chain chain
    • referrer

      protected String referrer
    • remoteAddr

      protected String remoteAddr
    • headers

      protected org.apache.commons.collections4.multimap.ArrayListValuedHashMap<String,String> headers
    • url

      protected Url url
    • method

      protected String method
    • engine

      protected Engine engine
    • api

      protected Api api
    • apiPath

      protected Path apiPath
    • apiMatchPath

      protected Path apiMatchPath
    • endpoint

      protected Endpoint endpoint
    • endpointPath

      protected Path endpointPath
    • endpointMatchPath

      protected Path endpointMatchPath
    • collection

      protected Collection collection
    • collectionPath

      protected Path collectionPath
    • collectionMatchPath

      protected Path collectionMatchPath
    • body

      protected String body
    • json

      protected JSNode json
    • uploader

      protected Request.Uploader uploader
    • retryMax

      protected int retryMax
  • Constructor Details

  • Method Details

    • getEngine

      public Engine getEngine()
    • withEngine

      public Request withEngine(Engine service)
    • withUrl

      public Request withUrl(String url)
    • getStartAt

      public long getStartAt()
    • withStartAt

      public Request withStartAt(long startAt)
    • getEndAt

      public long getEndAt()
    • withEndAt

      public Request withEndAt(long endAt)
    • withMethod

      public Request withMethod(String method)
    • withHeaders

      public Request withHeaders(String key, String value)
    • withHeaders

      public Request withHeaders(Map<String,String> headers)
    • getCollection

      public Collection getCollection()
    • hasCollectionKey

      public boolean hasCollectionKey(String... collectionKeys)
      Parameters:
      collectionKeys - the name of the collection to check for
      Returns:
      true if any of the collectionKeys case insensitive match collectoinKey
    • withCollection

      public Request withCollection(Collection collection)
    • withCollection

      public Request withCollection(Collection collection, Path collectionPath, Path collectionMatchPath)
    • getEndpoint

      public Endpoint getEndpoint()
    • withEndpoint

      public Request withEndpoint(Endpoint endpoint, Path endpointPath, Path endpointMatchPath)
    • isDebug

      public boolean isDebug()
    • isExplain

      public boolean isExplain()
    • withExplain

      public Request withExplain(boolean explain)
    • getBody

      public String getBody()
    • withBody

      public Request withBody(String body)
    • getJson

      public JSNode getJson() throws ApiException
      Throws:
      ApiException
    • getData

      public JSArray getData()
      Attempts to massage an inbound json body into an array.

      This is useful so actions can treat all inbound requests as if they are arrays instead of having to check.

      Conversion rules:

      1. if getBody() is a JSArray return it.
      2. if getBody() is a JSNode with a "data" array prop, return it
      3. if getBody() is a JSNode wrap it in an array and return it.
      4. if getBody() is not a JSNode and getBody() is null, return an empty array.
      Returns:
      the JSON boty messaged into an array
    • withJson

      public Request withJson(JSNode json)
    • getMethod

      public String getMethod()
      Returns:
      the method
    • isMethod

      public boolean isMethod(String... methods)
    • isPut

      public boolean isPut()
    • isPost

      public boolean isPost()
    • isPatch

      public boolean isPatch()
    • isGet

      public boolean isGet()
    • isDelete

      public boolean isDelete()
    • getReferrer

      public String getReferrer()
    • getHeader

      public String getHeader(String key)
    • removeHeader

      public void removeHeader(String key)
    • getHeaders

      public org.apache.commons.collections4.multimap.ArrayListValuedHashMap<String,String> getHeaders()
      Returns:
      the headers
    • withHeader

      public void withHeader(String key, String value)
    • getApi

      public Api getApi()
    • getChain

      public Chain getChain()
    • withChain

      public Request withChain(Chain chain)
    • getUrl

      public Url getUrl()
    • getPath

      public Path getPath()
      Returns:
      the request path with the apiPath subtracted from the beginning
    • getSubpath

      public Path getSubpath()
    • getCollectionKey

      public String getCollectionKey()
      Returns:
      the collectionKey
    • getResourceKey

      public String getResourceKey()
      Returns:
      the resourceKey
    • getEntityKey

      @Deprecated public String getEntityKey()
      Deprecated.
      Replaced by getResourceKey()
    • getRelationshipKey

      public String getRelationshipKey()
    • getSubCollectionKey

      @Deprecated public String getSubCollectionKey()
      Deprecated.
    • getParams

      @Deprecated public Map<String,String> getParams()
      Deprecated.
      Replaced by Url.getParams()
    • withApi

      public Request withApi(Api api, Path apiPath, Path apiMatchPath)
    • getApiUrl

      public String getApiUrl()
    • getApiPath

      public Path getApiPath()
    • getEndpointPath

      public Path getEndpointPath()
    • getApiMatchPath

      public Path getApiMatchPath()
    • getEndpointMatchPath

      public Path getEndpointMatchPath()
    • getCollectionPath

      public Path getCollectionPath()
    • getCollectionMatchPath

      public Path getCollectionMatchPath()
    • getRemoteAddr

      public String getRemoteAddr()
    • withRemoteAddr

      public Request withRemoteAddr(String remoteAddr)
    • getUploader

      public Request.Uploader getUploader()
    • withUploader

      public Request withUploader(Request.Uploader uploader)
    • validate

      public Request.Validation validate(String propOrJsonPath)
    • validate

      public Request.Validation validate(String propOrJsonPath, String customErrorMessage)
    • isLocalRequest

      public boolean isLocalRequest()
    • getRetryMax

      public int getRetryMax()
    • withRetryMax

      public Request withRetryMax(int retryMax)
    • getRetryCount

      public int getRetryCount()
    • incrementRetryCount

      public void incrementRetryCount()
    • getRetryFile

      public File getRetryFile()
    • setRetryFile

      public void setRetryFile(File retryFile)
    • getUploads

      public List<Request.Upload> getUploads()
    • buildPath

      public String buildPath(String path)
      Replaces path parameters with their corresponding request params