public class ResourceHandlerHelper extends Object
Modifier and Type | Field and Description |
---|---|
static String |
PARAM_ATTACHMENTS_SESSION_ID
Name for the attachments attribute within the session .
|
Constructor and Description |
---|
ResourceHandlerHelper() |
Modifier and Type | Method and Description |
---|---|
static Map<String,Object> |
generateMetaDataForPaging(Integer pageOffset,
Integer pageMaxCount,
int numberOfElements)
Get meta data for paging
|
static Locale |
getCurrentUserLocale(javax.ws.rs.core.Request request)
Get the locale of the current user
|
static QueryParametersParameterNameProvider |
getNameProvider(javax.ws.rs.core.Request request)
Returns the name provider to use.
|
protected <T> String |
getText(javax.ws.rs.core.Request request,
String messageKey,
Object... arguments)
Get text of message key with consideration of locale and replace arguments
|
static Set<Long> |
getUploadedAttachmentsFromSession(javax.ws.rs.core.Request request,
String attribute)
Returns a set with attachment IDs uploaded in the current session.
|
static ResourceHandlerHelper |
instance() |
static void |
removeUploadedAttachmentsFromSession(javax.ws.rs.core.Request request,
String attribute)
Removes the attachment IDs set from the current session.
|
public static final String PARAM_ATTACHMENTS_SESSION_ID
public static Map<String,Object> generateMetaDataForPaging(Integer pageOffset, Integer pageMaxCount, int numberOfElements)
pageOffset
- offset of pagepageMaxCount
- max cound of elements in pagenumberOfElements
- number of found elementspublic static Locale getCurrentUserLocale(javax.ws.rs.core.Request request)
request
- Request
Locale
public static QueryParametersParameterNameProvider getNameProvider(javax.ws.rs.core.Request request)
request
- The requestQueryParametersParameterNameProvider
for this request, default is
FilterRestApiParameterNameProvider
.public static Set<Long> getUploadedAttachmentsFromSession(javax.ws.rs.core.Request request, String attribute)
PARAM_ATTACHMENTS_SESSION_ID
. If the parameter is not provided null is returned. If
the list is not yet in the session it will be put there.request
- Request
attribute
- The attribute to use. If null, the attribute will be extracted from the request
using PARAM_ATTACHMENTS_SESSION_ID
public static ResourceHandlerHelper instance()
public static void removeUploadedAttachmentsFromSession(javax.ws.rs.core.Request request, String attribute)
request
- Request
attribute
- The attribute to use. If null, the attribute will be extracted from the request
using PARAM_ATTACHMENTS_SESSION_ID
protected <T> String getText(javax.ws.rs.core.Request request, String messageKey, Object... arguments)
T
- type of resourcerequest
- Request
messageKey
- key of messagearguments
- elements witch should replace in message textCopyright © 2019 Communote team. All rights reserved.