Package ubic.gemma.rest.util
Class Responders
java.lang.Object
ubic.gemma.rest.util.Responders
Handles setting of the response status code and composing a proper payload structure.
- Author:
- tesarst
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceA functional interface matching the signature of a paginating service method. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> QueriedAndFilteredResponseDataObject<T> static <T> FilteredResponseDataObject<T> Produce all results.static <T> PaginatedResponseDataObject<T> Paginate results.static <T> QueriedAndFilteredAndPaginatedResponseDataObject<T> Paginate results with a filter and a full-text query.static <T> FilteredAndPaginatedResponseDataObject<T> Paginate results with a filter.static <T> FilteredAndPaginatedResponseDataObject<T> paginate(Responders.FilterMethod<T> filterMethod, Filters filters, String[] groupBy, Sort sort, int offset, int limit) Paginate results with a filter using a callback to produce the payload.static <T> ResponseDataObject<T> respond(T payload) Produce aResponseDataObjectthat wraps the given argument.static javax.ws.rs.core.Response.ResponseBuilderstatic <T> FilteredAndLimitedResponseDataObject<T> Produce top results.
-
Constructor Details
-
Responders
public Responders()
-
-
Method Details
-
sendfile
-
respond
public static <T> ResponseDataObject<T> respond(@Nullable T payload) throws javax.ws.rs.NotFoundException Produce aResponseDataObjectthat wraps the given argument.- Parameters:
payload- an object to be wrapped and published to the API- Returns:
- a
ResponseDataObjectcontaining the argument - Throws:
javax.ws.rs.NotFoundException- if the argument is null, a suitableResponseErrorObjectwill be subsequently produced byNotFoundExceptionMapper
-
all
public static <T> FilteredResponseDataObject<T> all(List<T> payload, @Nullable Filters filters, String[] groupBy, @Nullable Sort sort) Produce all results. -
all
-
top
public static <T> FilteredAndLimitedResponseDataObject<T> top(List<T> payload, @Nullable Filters filters, String[] groupBy, @Nullable Sort sort, Integer limit) Produce top results. -
paginate
Paginate results. -
paginate
public static <T> FilteredAndPaginatedResponseDataObject<T> paginate(Slice<T> payload, @Nullable Filters filters, String[] groupBy) Paginate results with a filter. -
paginate
public static <T> FilteredAndPaginatedResponseDataObject<T> paginate(Responders.FilterMethod<T> filterMethod, @Nullable Filters filters, String[] groupBy, @Nullable Sort sort, int offset, int limit) Paginate results with a filter using a callback to produce the payload. -
paginate
public static <T> QueriedAndFilteredAndPaginatedResponseDataObject<T> paginate(Slice<T> payload, String query, @Nullable Filters filters, String[] groupBy) Paginate results with a filter and a full-text query.
-