Class RestRequestHelper
- java.lang.Object
-
- de.xima.fc.api.rest.impl.common.util.RestRequestHelper
-
public class RestRequestHelper extends Object
Helper class for working with requests.- Since:
- 8.2.0
- Author:
- XIMA MEDIA GmbH
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
getContentType(javax.ws.rs.core.MultivaluedMap<String,String> headers)
static String
getFileName(javax.ws.rs.core.MultivaluedMap<String,String> headers)
static String
getHeader(javax.ws.rs.core.MultivaluedMap<String,String> headers, String headerName)
static List<String>
getHeaderValues(javax.ws.rs.core.MultivaluedMap<String,String> headers, String headerName)
static Locale
getLocale(javax.servlet.http.HttpServletRequest servletRequest)
static Locale
getLocale(org.pac4j.core.context.WebContext webContext)
static List<? extends IScannedFileItem>
getUnsafeFileItems(javax.servlet.http.HttpServletRequest servletRequest)
Checks the currentMultipartPreservingRequest
(if available) for unsafe file uploads
-
-
-
Method Detail
-
getLocale
public static Locale getLocale(javax.servlet.http.HttpServletRequest servletRequest)
-
getContentType
public static String getContentType(javax.ws.rs.core.MultivaluedMap<String,String> headers)
-
getFileName
public static String getFileName(javax.ws.rs.core.MultivaluedMap<String,String> headers)
-
getHeader
public static String getHeader(javax.ws.rs.core.MultivaluedMap<String,String> headers, String headerName)
- Parameters:
headers
- the map with the available headersheaderName
- the field name of the desired header value- Returns:
- If there's exactly one value for the provided header field name, this value will be returned. Otherwise (more than one value or no value at all) null is returned.
-
getHeaderValues
public static List<String> getHeaderValues(javax.ws.rs.core.MultivaluedMap<String,String> headers, String headerName)
- Parameters:
headers
- the map with the available headersheaderName
- the field name of the desired header values- Returns:
- the list of values mapped to the provided header field name (possibly empty but not null)
-
getLocale
public static Locale getLocale(org.pac4j.core.context.WebContext webContext)
-
getUnsafeFileItems
public static List<? extends IScannedFileItem> getUnsafeFileItems(javax.servlet.http.HttpServletRequest servletRequest)
Checks the currentMultipartPreservingRequest
(if available) for unsafe file uploads- Parameters:
servletRequest
- the servlet request to get the desiredMultipartPreservingRequest
from- Returns:
- a list containing the unsafe file items, possibly empty but never null
-
-