Interface ExtendletContext

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      java.lang.String encodeRedirectURL​(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.String uri, java.util.Map params, int mode)
      Returns the encoded URL for send redirect.
      java.lang.String encodeURL​(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, java.lang.String uri)
      Returns the encoded URL.
      Locator getLocator()
      Returns the locator of this context used to locate resources.
      javax.servlet.RequestDispatcher getRequestDispatcher​(java.lang.String uri)  
      java.net.URL getResource​(java.lang.String uri)
      Returns the URL of the specified URI, or null if not found.
      java.io.InputStream getResourceAsStream​(java.lang.String uri)
      Returns the resource of the specified URI as input stream, or null if not found.
      javax.servlet.ServletContext getServletContext()
      Returns the servlet context.
      void include​(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.String uri, java.util.Map params)
      Includes the specified page.
      boolean shallCompress​(javax.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​(javax.servlet.ServletRequest request,
                                   javax.servlet.ServletResponse response,
                                   java.lang.String uri)
                            throws javax.servlet.ServletException,
                                   java.io.IOException
        Returns 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(javax.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:
        javax.servlet.ServletException
        java.io.IOException
      • encodeRedirectURL

        java.lang.String encodeRedirectURL​(javax.servlet.http.HttpServletRequest request,
                                           javax.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

        javax.servlet.RequestDispatcher getRequestDispatcher​(java.lang.String uri)
      • include

        void include​(javax.servlet.http.HttpServletRequest request,
                     javax.servlet.http.HttpServletResponse response,
                     java.lang.String uri,
                     java.util.Map params)
              throws javax.servlet.ServletException,
                     java.io.IOException
        Includes the specified page.

        Note: if you want to include the content into a different writer, you have to use BufferedResponse to 'wrap' the writer in the response.

        Throws:
        javax.servlet.ServletException
        java.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

        javax.servlet.ServletContext getServletContext()
        Returns the servlet context.
      • shallCompress

        boolean shallCompress​(javax.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.