@Override
    public void service(HttpServletRequest req, HttpServletResponse res) 
        throws ServletException, IOException
    {
        ServletTask servletTask = new ServletTask(this, BasicServlet.SERVLET_TYPE.COCOON);
        try {
            this.addBrowserProperties(req, servletTask);
    		ScreenModel screen = servletTask.doProcessInput(this, req, null);
    		
            Transformer transformer = getTransformer(req, servletTask, screen); // Screen can't be freed when I call this.
    
            PipedReader in = new PipedReader();
            PipedWriter out = new PipedWriter(in);
            
            new ProcessOutputThread(this, out, servletTask, req, screen, true).start();
            // Note: Print Thread frees the servlettask when it is done.
    
            StreamSource source = new StreamSource(in);
    
            ServletOutputStream outStream = res.getOutputStream();
            res.setContentType("text/html");	// Always for servlets/screens
            Result result = new StreamResult(outStream);

            synchronized (transformer)
            {
                transformer.transform(source, result);  // Get the data from the pipe (thread) and transform it to http
            }
        } catch (TransformerException ex) {
            ex.printStackTrace();
            servletTask.free();
        } catch (ServletException ex) {
            servletTask.free();
            throw ex;
        } catch (IOException ex) {
            servletTask.free();
            throw ex;
        } catch (Exception ex) {
            servletTask.free();
        }
	
    	//x Don't call super.service(req, res);
    }
@ Override public void service ( HttpServletRequest req , HttpServletResponse res ) throws ServletException , IOException { ServletTask servletTask = new ServletTask ( this , BasicServlet . SERVLET_TYPE . COCOON ) ; try { this . addBrowserProperties ( req , servletTask ) ; ScreenModel screen = servletTask . doProcessInput ( this , req , null ) ; Transformer transformer = getTransformer ( req , servletTask , screen ) ; PipedReader in = new PipedReader ( ) ; PipedWriter out = new PipedWriter ( in ) ; new ProcessOutputThread ( this , out , servletTask , req , screen , true ) . start ( ) ; StreamSource source = new StreamSource ( in ) ; ServletOutputStream outStream = res . getOutputStream ( ) ; res . setContentType ( "text/html" ) ; Result result = new StreamResult ( outStream ) ; synchronized ( transformer ) { transformer . transform ( source , result ) ; } } catch ( TransformerException ex ) { ex . printStackTrace ( ) ; servletTask . free ( ) ; } catch ( ServletException ex ) { servletTask . free ( ) ; throw ex ; } catch ( IOException ex ) { servletTask . free ( ) ; throw ex ; } catch ( Exception ex ) { servletTask . free ( ) ; } }
process an HTML get or post.
@exception ServletException From inherited class.
@exception IOException From inherited class.