public class APIEndpointUtil extends Object
Modifier and Type | Field and Description |
---|---|
protected static org.slf4j.Logger |
log |
Constructor and Description |
---|
APIEndpointUtil() |
Modifier and Type | Method and Description |
---|---|
static ResponseResult |
call(APIEndpoint.Request r,
NoteBoard nb,
Match match,
String contextPath,
MultiMap<String,String> queryParams)
Utility method for calling an endpoint when given a pretty much
untrammelled collection of arguments.
|
static Renderer |
getRenderer(APIEndpoint ep,
String name,
List<MediaType> types)
Answer the renderer particular to the endpoint
ep . |
public static ResponseResult call(APIEndpoint.Request r, NoteBoard nb, Match match, String contextPath, MultiMap<String,String> queryParams)
r
- The request objectnb
- match
- the (endpoint, bindings) pair for this invocationcontextPath
- queryParams
- map from parameter names to stringy valuespublic static Renderer getRenderer(APIEndpoint ep, String name, List<MediaType> types)
Answer the renderer particular to the endpoint ep
. If name is
not null, then the renderer is the one with that name in the endpoint itself.
Otherwise, if the endpoint has any renderers with a media type in the list
types
, it picks the first such renderer. Otherwise it falls
back to the default renderer (which, by default, is JSON).
Epimorphic extension:
If the endpoint's spec has a binding other than "no" for the variable
_suppress_media_type
, then the search of media types is
not done, so that name=null will fall through to the default renderer.
Copyright © 2014. All Rights Reserved.