Package org.openxava.web.servlets
Class Servlets
java.lang.Object
org.openxava.web.servlets.Servlets
Utilities to work with servlets.
- Author:
- Javier Paniza
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Stringstatic InputStreamgetURIAsStream(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, String uri) From a uri return the resource (dynamic or static) in InputStream format.static InputStreamgetURIAsStream(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, String uri, String encoding) From a uri return the resource (dynamic or static) in InputStream format.static StringgetURIAsString(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, String uri) From a uri return the resource (dynamic or static) in String format.static voidsetCharacterEncoding(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) Try to set the system encoding as encoding for the request and response.
-
Constructor Details
-
Servlets
public Servlets()
-
-
Method Details
-
setCharacterEncoding
public static void setCharacterEncoding(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) Try to set the system encoding as encoding for the request and response.The system encoding is obtained from
XSystem.getEncoding().
If fails a log messages is produced, but no exception is thrown. -
getCookie
-
getURIAsStream
public static InputStream getURIAsStream(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, String uri) throws javax.servlet.ServletException, IOException From a uri return the resource (dynamic or static) in InputStream format.Suitable for binary streams.
- Parameters:
request- request of the current servletresponse- response of the current servlet. This method does not write to ituri- And uri, for example /mypage.jsp- Returns:
- The stream with the content of the resource in uri.
- Throws:
IOExceptionjavax.servlet.ServletException
-
getURIAsStream
public static InputStream getURIAsStream(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, String uri, String encoding) throws javax.servlet.ServletException, IOException From a uri return the resource (dynamic or static) in InputStream format.Suitable for characters streams.
- Parameters:
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 response- Returns:
- The stream with the content of the resource in uri
- Throws:
IOExceptionjavax.servlet.ServletException
-
getURIAsString
public static String getURIAsString(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, String uri) throws javax.servlet.ServletException, IOException From a uri return the resource (dynamic or static) in String format.- Parameters:
request- request of the current servletresponse- response of the current servlet. This method does not write to ituri- And uri, for example /mypage.jsp- Returns:
- The string with the content of the resource in uri
- Throws:
IOExceptionjavax.servlet.ServletException
-