public class VitamRequestIterator<T> extends Object implements VitamAutoCloseable, Iterator<T>
Constructor and Description |
---|
VitamRequestIterator(MockOrRestClient client,
String method,
String path,
Class<T> responseType,
javax.ws.rs.core.MultivaluedHashMap<String,Object> headers,
com.fasterxml.jackson.databind.JsonNode request)
Constructor
Note: if of type AbstractMockClient or derived, request will be the returned unique result.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
static String |
getCursorId(javax.ws.rs.core.HttpHeaders headers)
Helper for server side to get the cursor Id
|
boolean |
hasNext() |
static boolean |
isEndOfCursor(boolean xcursor,
String xcursorId)
Helper for server side to check if this is a ending of cursor
|
static boolean |
isEndOfCursor(javax.ws.rs.core.HttpHeaders headers)
Helper for server side to check if this is a end of cursor
|
static boolean |
isNewCursor(boolean xcursor,
String xcursorId)
Helper for server side to check if this is a creation of cursor
|
static boolean |
isNewCursor(javax.ws.rs.core.HttpHeaders headers)
Helper for server side to check if this is a creation of cursor
|
T |
next() |
static javax.ws.rs.core.Response.ResponseBuilder |
setHeaders(javax.ws.rs.core.Response.ResponseBuilder builder,
boolean active,
String xcursorId)
Helper for server and client to set the needed headers
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEachRemaining, remove
public VitamRequestIterator(MockOrRestClient client, String method, String path, Class<T> responseType, javax.ws.rs.core.MultivaluedHashMap<String,Object> headers, com.fasterxml.jackson.databind.JsonNode request)
client
- the client to usemethod
- the method to usepath
- the path to useresponseType
- the type of the response to be returnedheaders
- the headers to use, could be nullrequest
- the request to use, could be nullIllegalArgumentException
- if one of mandatory arguments is null or emptypublic void close()
close
in interface VitamAutoCloseable
close
in interface AutoCloseable
public boolean hasNext()
public static boolean isEndOfCursor(javax.ws.rs.core.HttpHeaders headers)
headers
- IllegalStateException
- if the headers are not consistentpublic static boolean isEndOfCursor(boolean xcursor, String xcursorId)
xcursor
- xcursorId
- public static boolean isNewCursor(javax.ws.rs.core.HttpHeaders headers)
headers
- IllegalStateException
- if the headers are not consistentpublic static boolean isNewCursor(boolean xcursor, String xcursorId)
xcursor
- xcursorId
- public static String getCursorId(javax.ws.rs.core.HttpHeaders headers)
headers
- public static javax.ws.rs.core.Response.ResponseBuilder setHeaders(javax.ws.rs.core.Response.ResponseBuilder builder, boolean active, String xcursorId)
builder
- the current ResponseBuilderactive
- True for create or continue, False for inactive (X-Cursor)xcursorId
- may be null, else contains the current X-Cursor-IdCopyright © 2018 Vitam. All rights reserved.