Package io.inversion
Class Request
java.lang.Object
io.inversion.Request
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic interfaceImplemented by different runtimes, for example a servlet vs a lambda, to enable different file upload mechanisms.static classUtility designed to make it easy to validate request properties or request body json values while you are retrieving them. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Apiprotected Pathprotected Pathprotected Stringprotected Chainprotected Collectionstatic final Stringprotected Pathprotected Pathprotected longprotected Endpointprotected Pathprotected Pathprotected Engineprotected JSNodeprotected Stringprotected Stringstatic final Stringprotected Stringstatic final Stringprotected intprotected longprotected Request.Uploaderprotected Url -
Constructor Summary
ConstructorsConstructorDescriptionRequest()Request(String method, String url, String body, Map<String, String> params, org.apache.commons.collections4.multimap.ArrayListValuedHashMap<String, String> headers, int retryMax) Request(String method, String url, String body, org.apache.commons.collections4.multimap.ArrayListValuedHashMap<String, String> headers, int retryAttempts) Request(String method, String url, Map<String, String> headers, Map<String, String> params, String body) -
Method Summary
Modifier and TypeMethodDescriptionReplaces path parameters with their corresponding request paramsgetApi()getBody()getChain()getData()Attempts to massage an inbound json body into an array.longgetEndAt()Deprecated.getJson()Deprecated.Replaced byUrl.getParams()getPath()intintlongDeprecated.Replaced bygetRelationshipKey()getUrl()booleanhasCollectionKey(String... collectionKeys) voidbooleanisDebug()booleanisDelete()booleanbooleanisGet()booleanbooleanbooleanisPatch()booleanisPost()booleanisPut()voidremoveHeader(String key) voidsetRetryFile(File retryFile) withCollection(Collection collection) withCollection(Collection collection, Path collectionPath, Path collectionMatchPath) withEndAt(long endAt) withEndpoint(Endpoint endpoint, Path endpointPath, Path endpointMatchPath) withEngine(Engine service) withExplain(boolean explain) voidwithHeader(String key, String value) withHeaders(String key, String value) withHeaders(Map<String, String> headers) withMethod(String method) withRemoteAddr(String remoteAddr) withRetryMax(int retryMax) withStartAt(long startAt) withUploader(Request.Uploader uploader)
-
Field Details
-
COLLECTION_KEY
- See Also:
-
RESOURCE_KEY
- See Also:
-
RELATIONSHIP_KEY
- See Also:
-
startAt
protected long startAt -
endAt
protected long endAt -
chain
-
referrer
-
remoteAddr
-
headers
-
url
-
method
-
engine
-
api
-
apiPath
-
apiMatchPath
-
endpoint
-
endpointPath
-
endpointMatchPath
-
collection
-
collectionPath
-
collectionMatchPath
-
body
-
json
-
uploader
-
retryMax
protected int retryMax
-
-
Constructor Details
-
Request
public Request() -
Request
-
Request
-
Request
-
Request
-
Request
-
Request
-
-
Method Details
-
getEngine
-
withEngine
-
withUrl
-
getStartAt
public long getStartAt() -
withStartAt
-
getEndAt
public long getEndAt() -
withEndAt
-
withMethod
-
withHeaders
-
withHeaders
-
getCollection
-
hasCollectionKey
- Parameters:
collectionKeys- the name of the collection to check for- Returns:
- true if any of the
collectionKeyscase insensitive matchcollectoinKey
-
withCollection
-
withCollection
-
getEndpoint
-
withEndpoint
-
isDebug
public boolean isDebug() -
isExplain
public boolean isExplain() -
withExplain
-
getBody
-
withBody
-
getJson
- Throws:
ApiException
-
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:
- if getBody() is a JSArray return it.
- if getBody() is a JSNode with a "data" array prop, return it
- if getBody() is a JSNode wrap it in an array and return it.
- if getBody() is not a JSNode and getBody() is null, return an empty array.
- Returns:
- the JSON boty messaged into an array
-
withJson
-
getMethod
- Returns:
- the method
-
isMethod
-
isPut
public boolean isPut() -
isPost
public boolean isPost() -
isPatch
public boolean isPatch() -
isGet
public boolean isGet() -
isDelete
public boolean isDelete() -
getReferrer
-
getHeader
-
removeHeader
-
getHeaders
- Returns:
- the headers
-
withHeader
-
getApi
-
getChain
-
withChain
-
getUrl
-
getPath
- Returns:
- the request path with the apiPath subtracted from the beginning
-
getSubpath
-
getCollectionKey
- Returns:
- the collectionKey
-
getResourceKey
- Returns:
- the resourceKey
-
getEntityKey
Deprecated.Replaced bygetResourceKey() -
getRelationshipKey
-
getSubCollectionKey
Deprecated.Replaced bygetRelationshipKey() -
getParams
Deprecated.Replaced byUrl.getParams() -
withApi
-
getApiUrl
-
getApiPath
-
getEndpointPath
-
getApiMatchPath
-
getEndpointMatchPath
-
getCollectionPath
-
getCollectionMatchPath
-
getRemoteAddr
-
withRemoteAddr
-
getUploader
-
withUploader
-
validate
-
validate
-
isLocalRequest
public boolean isLocalRequest() -
getRetryMax
public int getRetryMax() -
withRetryMax
-
getRetryCount
public int getRetryCount() -
incrementRetryCount
public void incrementRetryCount() -
getRetryFile
-
setRetryFile
-
getUploads
-
buildPath
Replaces path parameters with their corresponding request params
-
getResourceKey()