Package io.inversion
Class Response
java.lang.Object
io.inversion.Response
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Chainprotected longprotected longprotected longprotected Stringprotected Stringprotected final StringBuilderprotected longprotected Throwableprotected Fileprotected Stringprotected JSNodeprotected StringBuilderprotected Stringprotected Requestprotected longprotected intprotected Stringprotected Stringprotected String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionassertDebug(String lineMatch, String... matches) assertStatus(int... statusCodes) assertStatus(String message, int... statusCodes) data()dump()voidfinalize()booleanfindBoolean(String path) intfindString(String path) getChain()longThis is the value returned from the server via the "Content-Length" header NOTE: this will not match file length, for partial downloads, consider also using ContentRangeSizelongThis value come from the "Content-Range" header and is the middle part Content-Range: unit range-start-range-end/sizelongThis value come from the "Content-Range" header and is the last part Content-Range: unit range-start-range-end/sizelongThis value come from the "Content-Range" header and is the first part Content-Range: unit range-start-range-end/sizeThis value come from the "Content-Range" header and is the unit part Content-Range: unit range-start-range-end/sizegetData()getDebug()longgetEndAt()getError()getFile()longintgetJson()getMeta()intintlongintgetText()getUrl()booleanhasStatus(int... statusCodes) booleannext()voidrethrow()voidrethrow(int statusCode) voidvoidtoString()protected voidwithChange(String method, String collectionKey, Object resourceKey) withChange(String method, String collectionKey, String... resourceKeys) withChanges(Collection<Change> changes) withContentType(String contentType) withEndAt(long endAt) withFoundRows(int foundRows) voidwithHeader(String key, String value) voidwithHeaders(org.apache.commons.collections4.multimap.ArrayListValuedHashMap headers) Sets the root output json document...you should use withData and withMeta instead unless you REALLY want to change to wrapper document structure.withOutput(String output) withPageCount(int pageCount) withPageNum(int pageNum) withPageSize(int pageSize) withRecord(Object record) withRecords(List records) withRedirect(String redirect) withRequest(Request request) withStartAt(long startAt) withStatus(String status) withStatusCode(int statusCode) withStatusMesg(String statusMesg) voidwrite(StringBuilder buff, Object... msgs) protected voidwrite0(StringBuilder buff, Object... msgs)
-
Field Details
-
startAt
protected long startAt -
endAt
protected long endAt -
request
-
headers
-
changes
-
debug
-
url
-
chain
-
statusCode
protected int statusCode -
statusMesg
-
redirect
-
contentType
-
out
-
json
-
text
-
fileName
-
file
-
error
-
contentRangeUnit
-
contentRangeStart
protected long contentRangeStart -
contentRangeEnd
protected long contentRangeEnd -
contentRangeSize
protected long contentRangeSize
-
-
Constructor Details
-
Response
public Response() -
Response
-
-
Method Details
-
getStartAt
public long getStartAt() -
withStartAt
-
getEndAt
public long getEndAt() -
withEndAt
-
hasStatus
public boolean hasStatus(int... statusCodes) -
withMeta
-
write
-
write0
-
withStatus
- Parameters:
status- - one of the SC constants ex "200 OK"- Returns:
- this
-
getStatus
-
withStatusCode
-
withStatusMesg
-
getChain
-
getEngine
-
withChain
-
debug
-
out
-
withOutput
-
getOutput
-
dump
-
getDebug
-
getHeader
-
getHeaders
- Returns:
- the headers
-
withHeaders
public void withHeaders(org.apache.commons.collections4.multimap.ArrayListValuedHashMap headers) -
withHeader
-
withJson
Sets the root output json document...you should use withData and withMeta instead unless you REALLY want to change to wrapper document structure.- Parameters:
json- the json to set- Returns:
- this
-
findString
-
findInt
-
findBoolean
-
findNode
-
findArray
-
find
-
validate
-
validate
-
data
-
getData
-
withData
-
withRecord
-
withRecords
-
getMeta
-
withMeta
-
withFoundRows
-
getFoundRows
public int getFoundRows() -
withPageSize
-
withPageNum
-
withPageCount
-
getPageSize
public int getPageSize() -
updatePageCount
protected void updatePageCount() -
getPageCount
public int getPageCount() -
next
-
withNext
-
getStatusMesg
- Returns:
- the statusMesg
-
getStatusCode
public int getStatusCode()- Returns:
- the statusCode
-
withText
-
getResourceKey
-
getRedirect
-
withRedirect
-
getContentType
-
withContentType
-
getChanges
-
withChanges
-
withChange
-
withChange
-
isSuccess
public boolean isSuccess() -
getError
-
getInputStream
- Throws:
IOException
-
getJson
- Returns:
- the json
-
getText
-
getContent
-
getErrorContent
-
getFileLength
public long getFileLength() -
withFile
-
getFile
-
getContentLength
public long getContentLength()This is the value returned from the server via the "Content-Length" header NOTE: this will not match file length, for partial downloads, consider also using ContentRangeSize- Returns:
- the value of the Content-Length header if it exists else 0
-
getContentRangeUnit
This value come from the "Content-Range" header and is the unit part Content-Range: unit range-start-range-end/size- Returns:
- the units from the content-range header
-
getContentRangeStart
public long getContentRangeStart()This value come from the "Content-Range" header and is the first part Content-Range: unit range-start-range-end/size- Returns:
- the start value from the content-range header
-
getContentRangeEnd
public long getContentRangeEnd()This value come from the "Content-Range" header and is the middle part Content-Range: unit range-start-range-end/size- Returns:
- then end value from the content-range header
-
getContentRangeSize
public long getContentRangeSize()This value come from the "Content-Range" header and is the last part Content-Range: unit range-start-range-end/size- Returns:
- then size value from the content-range header
-
withUrl
-
withError
-
getFileName
-
getUrl
-
withRequest
-
getRequest
-
toString
-
finalize
-
assertOk
-
rethrow
public void rethrow() -
rethrow
public void rethrow(int statusCode) -
rethrow
-
rethrow
-
assertStatus
-
assertStatus
-
assertDebug
-