public class Servlets
extends java.lang.Object
Constructor and Description |
---|
Servlets() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
getCookie(HttpServletRequest request,
java.lang.String name) |
static java.io.InputStream |
getURIAsStream(HttpServletRequest request,
HttpServletResponse response,
java.lang.String uri)
From a uri return the resource (dynamic or static) in InputStream format.
|
static java.io.InputStream |
getURIAsStream(HttpServletRequest request,
HttpServletResponse response,
java.lang.String uri,
java.lang.String encoding)
From a uri return the resource (dynamic or static) in InputStream format.
|
static java.lang.String |
getURIAsString(HttpServletRequest request,
HttpServletResponse response,
java.lang.String uri)
From a uri return the resource (dynamic or static) in String format.
|
static void |
setCharacterEncoding(HttpServletRequest request,
HttpServletResponse response)
Try to set the system encoding as encoding for the request and response.
|
public static void setCharacterEncoding(HttpServletRequest request, HttpServletResponse response)
The system encoding is obtained from XSystem.getEncoding()
.
If fails a log messages is produced, but no exception is thrown.
public static java.lang.String getCookie(HttpServletRequest request, java.lang.String name)
public static java.io.InputStream getURIAsStream(HttpServletRequest request, HttpServletResponse response, java.lang.String uri) throws ServletException, java.io.IOException
Suitable for binary streams.
request
- request of the current servletresponse
- response of the current servlet. This method does not write to ituri
- And uri, for example /mypage.jspjava.io.IOException
ServletException
public static java.io.InputStream getURIAsStream(HttpServletRequest request, HttpServletResponse response, java.lang.String uri, java.lang.String encoding) throws ServletException, java.io.IOException
Suitable for characters streams.
request
- request of the current servletresponse
- response of the current servlet. This method does not write to ituri
- And uri, for example /mypage.jspencoding
- Character encoding for the responsejava.io.IOException
ServletException
public static java.lang.String getURIAsString(HttpServletRequest request, HttpServletResponse response, java.lang.String uri) throws ServletException, java.io.IOException
request
- request of the current servletresponse
- response of the current servlet. This method does not write to ituri
- And uri, for example /mypage.jspjava.io.IOException
ServletException