Interface ExtendletContext
-
public interface ExtendletContextThis interface defines an extended context thatServlets.getRequestDispatcher(jakarta.servlet.ServletContext, jakarta.servlet.ServletRequest, java.lang.String, java.util.Map, int)will try to resolve. WhenServlets.getRequestDispatcher(jakarta.servlet.ServletContext, jakarta.servlet.ServletRequest, java.lang.String, java.util.Map, int)is called, it detects whether ~xxx/ is specified. If specified, it looks up any extended context is registered as xxx. If found, the extend context is used. If not found, it looks up any servlet context called xxx.To registers an extended context, use
Servlets.addExtendletContext(jakarta.servlet.ServletContext, java.lang.String, org.zkoss.web.util.resource.ExtendletContext).- Author:
- tomyeh
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.lang.StringencodeRedirectURL(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, java.lang.String uri, java.util.Map params, int mode)Returns the encoded URL for send redirect.java.lang.StringencodeURL(jakarta.servlet.ServletRequest request, jakarta.servlet.ServletResponse response, java.lang.String uri)Returns the encoded URL.org.zkoss.util.resource.LocatorgetLocator()Returns the locator of this context used to locate resources.jakarta.servlet.RequestDispatchergetRequestDispatcher(java.lang.String uri)java.net.URLgetResource(java.lang.String uri)Returns the URL of the specified URI, or null if not found.java.io.InputStreamgetResourceAsStream(java.lang.String uri)Returns the resource of the specified URI as input stream, or null if not found.jakarta.servlet.ServletContextgetServletContext()Returns the servlet context.voidinclude(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, java.lang.String uri, java.util.Map params)Includes the specified page.booleanshallCompress(jakarta.servlet.ServletRequest request, java.lang.String ext)Tests whether to compress the specified extension, e.g, "js" and "css".
-
-
-
Method Detail
-
encodeURL
java.lang.String encodeURL(jakarta.servlet.ServletRequest request, jakarta.servlet.ServletResponse response, java.lang.String uri) throws jakarta.servlet.ServletException, java.io.IOExceptionReturns the encoded URL. The returned URL is also encoded with HttpServletResponse.encodeURL.It resolves "*" contained in URI, if any, to the proper Locale, and the browser code. Refer to
Servlets.locate(jakarta.servlet.ServletContext, ServletRequest, String, org.zkoss.util.resource.Locator)for details.- Parameters:
uri- it must be empty or starts with "/". It might contain "*" for current browser code and Locale.- Returns:
- the complete URL (excluding the machine name). It includes the context path and the servlet to interpret this extended resource.
- Throws:
jakarta.servlet.ServletExceptionjava.io.IOException
-
encodeRedirectURL
java.lang.String encodeRedirectURL(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, java.lang.String uri, java.util.Map params, int mode)Returns the encoded URL for send redirect. The URL is also encoded with HttpServletResposne.encodeRedirectURL.
-
getRequestDispatcher
jakarta.servlet.RequestDispatcher getRequestDispatcher(java.lang.String uri)
-
include
void include(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, java.lang.String uri, java.util.Map params) throws jakarta.servlet.ServletException, java.io.IOExceptionIncludes the specified page.Note: if you want to include the content into a different writer, you have to use
BufferedResponseto 'wrap' the writer in the response.- Throws:
jakarta.servlet.ServletExceptionjava.io.IOException- Since:
- 3.5.2
-
getResource
java.net.URL getResource(java.lang.String uri)
Returns the URL of the specified URI, or null if not found.Unlike
getLocator(),getResourceAsStream(java.lang.String)handles the JavaScript debugging. In other words, if the JavaScript debugging is turned on, it will try to load the non-compressed version.
-
getResourceAsStream
java.io.InputStream getResourceAsStream(java.lang.String uri)
Returns the resource of the specified URI as input stream, or null if not found.Unlike
getLocator(),getResourceAsStream(java.lang.String)handles the JavaScript debugging. In other words, if the JavaScript debugging is turned on, it will try to load the non-compressed version.
-
getServletContext
jakarta.servlet.ServletContext getServletContext()
Returns the servlet context.
-
getLocator
org.zkoss.util.resource.Locator getLocator()
Returns the locator of this context used to locate resources.Unlike
getResource(java.lang.String)andgetResourceAsStream(java.lang.String),getLocator()doesn't handle the JavaScript debugging.
-
shallCompress
boolean shallCompress(jakarta.servlet.ServletRequest request, java.lang.String ext)Tests whether to compress the specified extension, e.g, "js" and "css".It returns false if the request is included by other Servlets.
-
-