Interface ViewService

    • Method Detail

      • handleRequest

        void handleRequest​(javax.servlet.http.HttpServletRequest req,
                           javax.servlet.http.HttpServletResponse resp)
                    throws ViewException
        Handles a HTTP request. This method is usually invoked from a servlet.
        Parameters:
        req - HttpServletRequest
        resp - HttpServletResponse
        Throws:
        ViewException - if the request could not be handled
      • buildPath

        String buildPath​(PathContext context,
                         String view,
                         PathType type)
        Builds an URL path to a view that is able to render the provided data.
        Parameters:
        context - PathContext containing all the data for the path
        view - name of the view to build a path to
        type - PathType to be built
        Returns:
        the URL path that was built, or null if no view was found to be able to render the provided data
      • invokeView

        String invokeView​(String path)
                   throws ViewException
        Analyzes the given path, and invokes a view handler for processing the request.
        Parameters:
        path - the requested path
        Returns:
        String returned by the view handler, usually the name of a JSP template to forward the request to. May be null if the handler already took care for the response itself.
        Throws:
        PageNotFoundException - if no view was matching the given path
        ViewException - if the view handler could not be invoked or could not handle the request
      • getTemplatePath

        @Nonnull
        String getTemplatePath​(String template)
        Gets the path to a template resource with the given name. It is not checked if the template actually exists.
        Parameters:
        template - Template name
        Returns:
        Template path