| java.lang.Object org.zkoss.web.servlet.Servlets org.zkoss.web.servlet.http.Https
Https | public class Https extends Servlets (Code) | | The Servlet-related utilities.
author: tomyeh |
Method Summary | |
final public static String | encodeRedirectURL(ServletContext ctx, HttpServletRequest request, HttpServletResponse response, String uri, Map params, int mode) Encodes an URL such that it can be used with HttpServletResponse.sendRedirect. | final public static String | getCompleteContext(HttpServletRequest hreq) Gets the complete context path, including protocol, server, ports, and
context. | final public static String | getCompleteServerName(HttpServletRequest hreq) Gets the complete server name, including protocol, server, and ports. | final public static String | getCookieValue(HttpServletRequest request, String name) Gets the value of the specified cookie, or null if not found. | final public static String | getOriginContextPath(ServletRequest request) Gets the original context path regardless of being forwarded or not. | final public static String | getOriginFullRequest(ServletRequest request) Returns the request uri + query string. | final public static String | getOriginFullServlet(ServletRequest request) Returns the servlet path + path info + query string.
Because the path info is decoded, the return string can be considered
as decoded. | final public static String | getOriginPathInfo(ServletRequest request) Gets the path info regardless of being forwarded or not. | final public static String | getOriginQueryString(ServletRequest request) Gets the query string regardless of being forwarded or not. | final public static String | getOriginRequestURI(ServletRequest request) Gets the request URI regardless of being forwarded or not. | final public static String | getOriginServletPath(ServletRequest request) Gets the original servlet path regardless of being forwarded or not. | final public static String | getServletURI(HttpServletRequest request) Returns the servlet uri of the request. | final public static String | getThisContextPath(ServletRequest request) Gets the context path of this page. | final public static String | getThisPathInfo(ServletRequest request) Gets the path info of this page. | final public static String | getThisQueryString(ServletRequest request) Gets the query string of this page. | final public static String | getThisRequestURI(ServletRequest request) Gets the request URI of this page. | final public static String | getThisServletPath(ServletRequest request) Gets the servlet path of this page. | final public static byte[] | gzip(HttpServletRequest request, HttpServletResponse response, InputStream content1, byte[] content2) Compresses the content into an byte array, or null
if the browser doesn't support the compression (accept-encoding).
Parameters: content1 - the first part of the content to compress; null to ignore.If you have multiple input streams, use java.io.SequenceInputStreamto concatenate them Parameters: content2 - the second part of the content to compress; null to ignore. | final public static void | sendRedirect(ServletContext ctx, HttpServletRequest request, HttpServletResponse response, String uri, Map params, int mode) Redirects to another URL by prefixing the context path and
encoding with encodeRedirectURL.
It encodes the URI automatically (encodeRedirectURL).
Parameters are encoded by
Encodes.setToQueryString(StringBufferMap) .
Like
Encodes.encodeURL , the servlet context is
prefixed if uri starts with "/". | final public static Date | toDate(String sdate) Converts a date string to a Date instance. | final public static String | toString(Date date) Converts a data to a string complaint to HTTP protocol. |
getCompleteContext | final public static String getCompleteContext(HttpServletRequest hreq)(Code) | | Gets the complete context path, including protocol, server, ports, and
context.
Example, http://mysite.com:8080/we
|
getCompleteServerName | final public static String getCompleteServerName(HttpServletRequest hreq)(Code) | | Gets the complete server name, including protocol, server, and ports.
Example, http://mysite.com:8080
|
getCookieValue | final public static String getCookieValue(HttpServletRequest request, String name)(Code) | | Gets the value of the specified cookie, or null if not found.
Parameters: name - the cookie's name |
getOriginContextPath | final public static String getOriginContextPath(ServletRequest request)(Code) | | Gets the original context path regardless of being forwarded or not.
Unlike getContextPath, it won't be affected by forwarding.
|
getOriginFullRequest | final public static String getOriginFullRequest(ServletRequest request)(Code) | | Returns the request uri + query string.
Unlik
Https.getOriginFullServlet , this is in the encoded form
(e.g., %nn still exists, if any).
Note: request uri = context path + servlet path + path info.
|
getOriginPathInfo | final public static String getOriginPathInfo(ServletRequest request)(Code) | | Gets the path info regardless of being forwarded or not.
Unlike getPathInfo, it won't be affected by forwarding.
|
getOriginQueryString | final public static String getOriginQueryString(ServletRequest request)(Code) | | Gets the query string regardless of being forwarded or not.
Unlike getQueryString, it won't be affected by forwarding.
|
getOriginRequestURI | final public static String getOriginRequestURI(ServletRequest request)(Code) | | Gets the request URI regardless of being forwarded or not.
Unlike HttpServletRequest.getRequestURI,
it won't be affected by forwarding.
|
getOriginServletPath | final public static String getOriginServletPath(ServletRequest request)(Code) | | Gets the original servlet path regardless of being forwarded or not.
Unlike getServletPath, it won't be affected by forwarding.
|
getServletURI | final public static String getServletURI(HttpServletRequest request)(Code) | | Returns the servlet uri of the request.
A servlet uri is getServletPath() + getPathInfo().
In other words, a servlet uri is a request uri without the context path.
However, HttpServletRequest.getRequestURI returns in encoded format,
while this method returns in decode format (i.e., %nn is converted).
|
getThisContextPath | final public static String getThisContextPath(ServletRequest request)(Code) | | Gets the context path of this page.
Unlike getContextPath, it detects whether the current page is included.
"/" if request is not a http request |
getThisPathInfo | final public static String getThisPathInfo(ServletRequest request)(Code) | | Gets the path info of this page.
Unlike getPathInfo, it detects whether the current page is included.
null if request is not a http request |
getThisQueryString | final public static String getThisQueryString(ServletRequest request)(Code) | | Gets the query string of this page.
Unlike getQueryString, it detects whether the current page is included.
null if request is not a http request |
getThisRequestURI | final public static String getThisRequestURI(ServletRequest request)(Code) | | Gets the request URI of this page.
Unlike getRequestURI, it detects whether the current page is included.
"/" if request is not a http request |
getThisServletPath | final public static String getThisServletPath(ServletRequest request)(Code) | | Gets the servlet path of this page.
Unlike getServletPath, it detects whether the current page is included.
"/" if request is not a http request |
gzip | final public static byte[] gzip(HttpServletRequest request, HttpServletResponse response, InputStream content1, byte[] content2) throws IOException(Code) | | Compresses the content into an byte array, or null
if the browser doesn't support the compression (accept-encoding).
Parameters: content1 - the first part of the content to compress; null to ignore.If you have multiple input streams, use java.io.SequenceInputStreamto concatenate them Parameters: content2 - the second part of the content to compress; null to ignore. the compressed result in an byte array,null if the browser doesn't support the compression. since: 2.4.1 |
sendRedirect | final public static void sendRedirect(ServletContext ctx, HttpServletRequest request, HttpServletResponse response, String uri, Map params, int mode) throws IOException, ServletException(Code) | | Redirects to another URL by prefixing the context path and
encoding with encodeRedirectURL.
It encodes the URI automatically (encodeRedirectURL).
Parameters are encoded by
Encodes.setToQueryString(StringBufferMap) .
Like
Encodes.encodeURL , the servlet context is
prefixed if uri starts with "/". In other words, to redirect other
application, the complete URL must be used, e.g., http://host/other.
Also, HttpServletResponse.encodeRedirectURL is called automatically.
Parameters: request - the request; used only if params is not null Parameters: response - the response Parameters: uri - the redirect uri (not encoded; not including context-path),or null to denote Https.getOriginFullServletIt is OK to relevant (without leading '/').If starts with "/", the context path of request is assumed.To reference to foreign context, use "~ctx/" where ctx is thecontext path of the foreign context (without leading '/'). Parameters: params - the attributes that will be set when the redirectionis back; null to ignore; format: (String, Object) Parameters: mode - one of Https.OVERWRITE_URI, Https.IGNORE_PARAM,and Https.APPEND_PARAM. It defines how to handle if both uriand params contains the same parameter. |
toDate | final public static Date toDate(String sdate) throws ParseException(Code) | | Converts a date string to a Date instance.
The format of the giving date string must be complaint
to HTTP proptocol.
exception: ParseException - if the string is not valid |
toString | final public static String toString(Date date)(Code) | | Converts a data to a string complaint to HTTP protocol.
|
Methods inherited from org.zkoss.web.servlet.Servlets | final public static ExtendletContext addExtendletContext(ServletContext ctx, String name, ExtendletContext extctx)(Code)(Java Doc) final public static void forward(ServletContext ctx, ServletRequest request, ServletResponse response, String uri, Map params, int mode) throws IOException, ServletException(Code)(Java Doc) final public static void forward(ServletContext ctx, ServletRequest request, ServletResponse response, String uri) throws IOException, ServletException(Code)(Java Doc) final public static String generateURI(String uri, Map params, int mode)(Code)(Java Doc) final public static List getContextPaths()(Code)(Java Doc) final public static ExtendletContext getExtendletContext(ServletContext ctx, String name)(Code)(Java Doc) final public static String getExtension(String path)(Code)(Java Doc) final public static String getLimitTimeOffer()(Code)(Java Doc) final public static RequestDispatcher getRequestDispatcher(ServletContext ctx, ServletRequest request, String uri, Map params, int mode) throws ServletException(Code)(Java Doc) final public static URL getResource(ServletContext ctx, String uri) throws MalformedURLException(Code)(Java Doc) final public static InputStream getResourceAsStream(ServletContext ctx, String uri)(Code)(Java Doc) final public static String getUserAgent(ServletRequest req)(Code)(Java Doc) final public static void include(ServletContext ctx, ServletRequest request, ServletResponse response, String uri, Map params, int mode) throws IOException, ServletException(Code)(Java Doc) final public static void include(ServletContext ctx, ServletRequest request, ServletResponse response, String uri) throws IOException, ServletException(Code)(Java Doc) final public static boolean isExplorer(ServletRequest req)(Code)(Java Doc) final public static boolean isExplorer7(ServletRequest req)(Code)(Java Doc) final public static boolean isForwarded(ServletRequest request)(Code)(Java Doc) final public static boolean isGecko(ServletRequest req)(Code)(Java Doc) final public static boolean isHilDevice(ServletRequest req)(Code)(Java Doc) final public static boolean isIncluded(ServletRequest request)(Code)(Java Doc) final public static boolean isMilDevice(ServletRequest req)(Code)(Java Doc) final public static boolean isOfferExpired(String lto, int timeout)(Code)(Java Doc) final public static boolean isOpera(ServletRequest req)(Code)(Java Doc) final public static boolean isRobot(ServletRequest req)(Code)(Java Doc) final public static boolean isSafari(ServletRequest req)(Code)(Java Doc) final public static boolean isServlet23()(Code)(Java Doc) final public static boolean isServlet24()(Code)(Java Doc) final public static boolean isUniversalURL(String uri)(Code)(Java Doc) final public static String locate(ServletContext ctx, ServletRequest request, String pgpath, Locator locator) throws ServletException(Code)(Java Doc) final public static ExtendletContext removeExtendletContext(ServletContext ctx, String name)(Code)(Java Doc)
|
|
|