public final class ServletUtils extends Object
Modifier and Type | Field and Description |
---|---|
static int |
ERR |
static org.slf4j.Logger |
LOG |
Modifier and Type | Method and Description |
---|---|
static Object |
checkForDate(Object value)
Falls übergebener Wert kein Datums-String im erwarteten Format ist, wird der Original-Wert zurückgegeben, ansonsten
das entsprechende
java.util.Date . |
static SimpleDateFormat |
dateFormatter() |
static int |
getIntParam(String param) |
static String |
getRequestTrace(javax.servlet.http.HttpServletRequest req)
Schreibt Request-Header raus
|
static int |
getUrlIntParam(javax.servlet.http.HttpServletRequest req,
int idx)
Auslesen eines Int-Parameters aus einer ServletUrl.
|
static String |
getUrlParam(javax.servlet.http.HttpServletRequest req,
int idx)
Auslesen eines Parameter aus einer ServletUrl.
|
static void |
logRequestTrace(javax.servlet.http.HttpServletRequest req,
org.slf4j.Logger logger) |
static Map<String,List<String>> |
parseForMultipleParameters(javax.servlet.http.HttpServletRequest request,
Long limit)
Assumes there are no file uploads.
|
static Map<String,String> |
parseForSingleParameters(javax.servlet.http.HttpServletRequest request,
Long limit)
Assumes there are no file uploads.
|
static String |
pn(String... attribs) |
static String |
pn2ul(String str) |
static String |
readJSONFromPayLoad(InputStream is)
InputStream in einen String umwandeln.
|
static void |
setAccessControlHeader(javax.servlet.http.HttpServletResponse resp) |
static void |
setDefaultEncodings(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp) |
static void |
setFormAccessControllHeaders(javax.servlet.http.HttpServletResponse resp) |
static void |
setFormAccessControllHeaders(javax.servlet.http.HttpServletResponse resp,
String allowOrigin) |
static void |
setNoCacheHeaders(javax.servlet.http.HttpServletResponse resp) |
static String |
ul2pn(String str) |
public static final org.slf4j.Logger LOG
public static final int ERR
public static String getRequestTrace(javax.servlet.http.HttpServletRequest req)
public static void logRequestTrace(javax.servlet.http.HttpServletRequest req, org.slf4j.Logger logger)
public static String getUrlParam(javax.servlet.http.HttpServletRequest req, int idx)
req
- HttpServletRequest mit Parameteridx
- Index des Parameterspublic static int getUrlIntParam(javax.servlet.http.HttpServletRequest req, int idx)
public static int getIntParam(String param)
public static Map<String,String> parseForSingleParameters(javax.servlet.http.HttpServletRequest request, Long limit) throws org.apache.commons.fileupload.FileUploadException, IOException
http://example.com?foo=bar&foo=baz
),
only one value is returned. Also handles the case of form encoded requests with different methods such as
DELETE
or PUT
.request
- Request to be parsedlimit
- Limit in bytes for a multipart request. Set to 0
or null
for no limit.org.apache.commons.fileupload.FileUploadException
- When the request is a multipart request and could not be parsed.IOException
- When the body of the HTTP request could not be read.public static Map<String,List<String>> parseForMultipleParameters(javax.servlet.http.HttpServletRequest request, Long limit) throws org.apache.commons.fileupload.FileUploadException, IOException
DELETE
or
PUT
.request
- Request to be parsedlimit
- Limit in bytes for a multipart request. Set to 0
or null
for no limit.org.apache.commons.fileupload.FileUploadException
- When the request is a multipart request and could not be parsed.IOException
- When the body of the HTTP request could not be read.public static String readJSONFromPayLoad(InputStream is)
is
- InputStreampublic static final void setDefaultEncodings(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp) throws UnsupportedEncodingException
UnsupportedEncodingException
public static final void setNoCacheHeaders(javax.servlet.http.HttpServletResponse resp)
public static final void setFormAccessControllHeaders(javax.servlet.http.HttpServletResponse resp)
public static final void setFormAccessControllHeaders(javax.servlet.http.HttpServletResponse resp, String allowOrigin)
public static final void setAccessControlHeader(javax.servlet.http.HttpServletResponse resp)
public static final String pn(String... attribs)
public static final String pn2ul(String str)
public static final String ul2pn(String str)
public static SimpleDateFormat dateFormatter()
SimpleDateFormat
auf Basis des Standardformats für DatumsangabenCopyright © 2021 XIMA MEDIA GmbH. All rights reserved.