public function service(ServletRequestInterface $servletRequest, ServletResponseInterface $servletResponse)
    {

        // pre-initialize the X-POWERED-BY header
        $poweredBy = $this->getPoweredBy();

        // append an existing X-POWERED-BY header if available
        if ($servletResponse->hasHeader(HttpProtocol::HEADER_X_POWERED_BY)) {
            $poweredBy = $servletResponse->getHeader(HttpProtocol::HEADER_X_POWERED_BY) . ', ' . $poweredBy;
        }

        // set the X-POWERED-BY header
        $servletResponse->addHeader(HttpProtocol::HEADER_X_POWERED_BY, $poweredBy);

        // servlet path === relative path to the template name
        $template = $servletRequest->getServletPath();

        // check if the template is available
        if (!file_exists($pathToTemplate = $this->getWebappPath() . $template)) {
            if (!file_exists($pathToTemplate = $this->getAppBase() . $template)) {
                if (!file_exists($pathToTemplate = $this->getBaseDirectory() . $template)) {
                    throw new ServletException(sprintf('Can\'t load requested template \'%s\'', $template));
                }
            }
        }

        // process the template
        ob_start();
        require $pathToTemplate;

        // add the servlet name to the response
        $servletResponse->appendBodyStream(ob_get_clean());
    }
public function service(ServletRequestInterface $servletRequest, ServletResponseInterface $servletResponse)
    {

        // pre-initialize the X-POWERED-BY header
        $poweredBy = $this->getPoweredBy();

        // append an existing X-POWERED-BY header if available
        if ($servletResponse->hasHeader(HttpProtocol::HEADER_X_POWERED_BY)) {
            $poweredBy = $servletResponse->getHeader(HttpProtocol::HEADER_X_POWERED_BY) . ', ' . $poweredBy;
        }

        // set the X-POWERED-BY header
        $servletResponse->addHeader(HttpProtocol::HEADER_X_POWERED_BY, $poweredBy);

        // servlet path === relative path to the template name
        $template = $servletRequest->getServletPath();

        // check if the template is available
        if (!file_exists($pathToTemplate = $this->getWebappPath() . $template)) {
            if (!file_exists($pathToTemplate = $this->getAppBase() . $template)) {
                if (!file_exists($pathToTemplate = $this->getBaseDirectory() . $template)) {
                    throw new ServletException(sprintf('Can\'t load requested template \'%s\'', $template));
                }
            }
        }

        // process the template
        ob_start();
        require $pathToTemplate;

        // add the servlet name to the response
        $servletResponse->appendBodyStream(ob_get_clean());
    }
public function service ( ServletRequestInterface $ servletRequest , ServletResponseInterface $ servletResponse ) { // pre-initialize the X-POWERED-BY header $ poweredBy = $ this -> getPoweredBy ( ) ; // append an existing X-POWERED-BY header if available if ( $ servletResponse -> hasHeader ( HttpProtocol :: HEADER_X_POWERED_BY ) ) { $ poweredBy = $ servletResponse -> getHeader ( HttpProtocol :: HEADER_X_POWERED_BY ) . ', ' . $ poweredBy ; } // set the X-POWERED-BY header $ servletResponse -> addHeader ( HttpProtocol :: HEADER_X_POWERED_BY , $ poweredBy ) ; // servlet path === relative path to the template name $ template = $ servletRequest -> getServletPath ( ) ; // check if the template is available if ( ! file_exists ( $ pathToTemplate = $ this -> getWebappPath ( ) . $ template ) ) { if ( ! file_exists ( $ pathToTemplate = $ this -> getAppBase ( ) . $ template ) ) { if ( ! file_exists ( $ pathToTemplate = $ this -> getBaseDirectory ( ) . $ template ) ) { throw new ServletException ( sprintf ( 'Can\'t load requested template \'%s\'' , $ template ) ) ; } } } // process the template ob_start ( ) ; require $ pathToTemplate ; // add the servlet name to the response $ servletResponse -> appendBodyStream ( ob_get_clean ( ) ) ; }
Processes the DHTML file specified as servlet name.

@param \AppserverIo\Psr\Servlet\ServletRequestInterface  $servletRequest  The request instance
@param \AppserverIo\Psr\Servlet\ServletResponseInterface $servletResponse The response sent back to the client

@return void

@throws \AppserverIo\Psr\Servlet\ServletException If no action has been found for the requested path
Processes the DHTML file specified as servlet name .