Process an HTML get or post.
@exception ServletException From inherited class.
@exception IOException From inherited class.
428089
public void doProcess(BasicServlet servlet, HttpServletRequest req, HttpServletResponse res, PrintWriter outExt) 
        throws ServletException, IOException
    {
    	ScreenModel screen = this.doProcessInput(servlet, req, res);
    	this.doProcessOutput(servlet, req, res, outExt, screen);
    }
2099
@Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        preProcessRequest(request);

        DefaultServerDolphin serverDolphin = resolveServerDolphin(request);

        String input = readInput(request);
        if (LOG.isLoggable(Level.FINEST)) {
            LOG.finest("received json: " + input);
        }

        List<Command> commands = decodeInput(serverDolphin.getServerConnector().getCodec(), input);

        List<Command> results = handleCommands(serverDolphin.getServerConnector(), commands);

        String output = encodeOutput(serverDolphin.getServerConnector().getCodec(), results);

        writeHeaders(request, response, results);

        if (LOG.isLoggable(Level.FINEST)) {
            LOG.finest("sending json response: " + output);
        }
        writeOutput(response, output);

        postProcessResponse(response);
    }
297718
public int doEndTag() throws JspException
    {
        ServletRequest req = pageContext.getRequest();

        // Create an appropriate "input" element based on our parameters
        if (_password) {
            _state.type = INPUT_PASSWORD;
        }
        else {
            _state.type = INPUT_TEXT;
        }


        // Create the state for the input tag
        ByRef ref = new ByRef();
        nameHtmlControl(_state, ref);

        _state.disabled = isDisabled();

        // Create the text value of the TextBox
        Object textObject = evaluateDataSource();
        if ((textObject == null) || (textObject.toString().length() == 0)) {
            textObject = _defaultValue;
        }

        // Get the text value for the textbox, the result
        String text = null;
        if (textObject != null) {
            text = formatText(textObject);
            InternalStringBuilder sb = new InternalStringBuilder(text.length() + 16);
            StringBuilderRenderAppender sbAppend = new StringBuilderRenderAppender(sb);
            HtmlUtils.filter(text, sbAppend);
            text = sb.toString();
        }
        _state.value = text;

        // if there were format errors then report them
        if (_formatErrors) {
            if (bodyContent != null) {
                String value = bodyContent.getString().trim();
                bodyContent.clearBody();
                write(value);
            }
        }

        if (hasErrors())
            return reportAndExit(EVAL_PAGE);

        // create the input tag.
        WriteRenderAppender writer = new WriteRenderAppender(pageContext);
        TagRenderingBase br = TagRenderingBase.Factory.getRendering(TagRenderingBase.INPUT_TEXT_TAG, req);
        assert(br != null);

        br.doStartTag(writer, _state);
        br.doEndTag(writer);

        // write any script that needs to be written
        if (!ref.isNull())
            write((String) ref.getRef());

        localRelease();
        return EVAL_PAGE;
    }
1173298
public void service(HttpServletRequest req, HttpServletResponse res) 
        throws ServletException, IOException
    {
        String browser = this.getBrowser(req);
        String queryString = req.getQueryString();
        String path = req.getPathInfo();
        if (path == null)
        	path = "";
        String target = this.getProperty(browser);
        if (target == null)
            target = this.getProperty(TARGET);
        if (target == null)
            target = req.getParameter(TARGET);
        if (queryString != null)
        {
            char delimiter = '?';
            if (target.indexOf('?') != -1)
                delimiter = '&';
            target = target + delimiter + queryString;
        }

        if (logger != null)
        	logger.info("Redirect to " + target);
        String match = this.getProperty(MATCH);
        if ((target != null) && ((match == null) || path.matches(match)))
        	res.sendRedirect(target);
        else
        	super.service(req, res);
    }
719639
@Override
    public void handleException(HttpServletRequest req, HttpServletResponse rsp, Throwable wse) throws ServletException, IOException, ClassCastException {
        WebReply reply = ((WebSecurityCollaboratorException) (wse)).getWebReply();
        int sc = reply.getStatusCode();

        // Throw an exception if an error
        if (sc == HttpServletResponse.SC_INTERNAL_SERVER_ERROR) {
            String method = null;
            if (req != null) {
                method = req.getMethod();
            }
            String url = getRequestURL(req);

            final ServletException ex = new ServletException(TraceNLS.getFormattedMessage(
                                                                                          this.getClass(),
                                                                                          TraceConstants.MESSAGE_BUNDLE,
                                                                                          "SEC_WEB_INTERNAL_SERVER_ERROR",
                                                                                          new Object[] { method, url },
                                                                                          "CWWKS9115E: The server encountered an unexpected condition which prevented it from fulfilling the request of method {0} for URL {1}. Review the server logs for more information."), wse);
            throw ex;
        }
        reply.writeResponse(rsp);
    }
980807
@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);
    }
414717
@ReadOperation
	public void report() throws ServletException, IOException {
		final ServletRequestAttributes currentRequestAttributes = (ServletRequestAttributes) RequestContextHolder
				.currentRequestAttributes();
		final HttpServletRequest httpServletRequest = currentRequestAttributes.getRequest();
		final HttpServletResponse httpResponse = currentRequestAttributes.getResponse();

		reportServlet.service(httpServletRequest, httpResponse);
	}
478191
private void responseEntity(String html, HttpServletResponse servletResponse)
            throws IOException {
        PrintWriter printWriter = servletResponse.getWriter();
        try {
            printWriter.write(html);
            printWriter.flush();
        } finally {
            closeQuietly(printWriter);
        }
    }
1298327
@Override
	final protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		resp.setBufferSize(BUFFER_SIZE);
		getCount.incrementAndGet();
		try {
			reportingDoGet(req, resp);
		} catch (ThreadDeath t) {
			throw t;
		} catch (RuntimeException | ServletException | IOException e) {
			getLogger().log(Level.SEVERE, null, e);
			throw e;
		} catch (SQLException t) {
			getLogger().log(Level.SEVERE, null, t);
			throw new ServletException(t);
		}
	}
587529
public void doGet(HttpServletRequest req, HttpServletResponse res) 
		throws ServletException, IOException
	{
		this.doProcess(req, res);
	}
321533
public void handleRequest(ServletRequest req, ServletResponse res) throws Exception
	{
	    IServletWrapper target = this.cacheTarget;

	    if (target != null) {
	        try {
	            webapp.getFilterManager().invokeFilters((HttpServletRequest) req, (HttpServletResponse) res, webapp, target, CollaboratorHelper.allCollabEnum);
	        } catch (Throwable th){
	            if((com.ibm.ws.webcontainer.osgi.WebContainer.getServletContainerSpecLevel() >= 31) && th instanceof IOException){
	                if((th.getMessage()!= null) && th.getMessage().contains("SRVE0918E")){
	                    // dont do anything
	                    // we have already given chance to servlet and filters to handle it
	                    // this is application error but should not be returned to client.
	                    logger.logp(Level.FINE, CLASS_NAME, "handleRequest", "donothandleexception SRVE0918E");   
	                    return;
	                }
	            }
	            WebApp webapp = this.webapp;
	            if (webapp == null) {
	                FFDCFilter.processException(th, getClass().getName(), "83");
	            } else {
	                webapp.handleException(th, req, res, this);
	            }
	        }
	    }
	    else
	        throw InvalidCacheTargetException.instance();

	}
1184810
public void doTag()
            throws JspException
    {
        // First look for the exception in the pageflow/struts request attribute.  If it's not there,
        // look for it in the request attribute the container provides for web.xml-configured error
        // pages.
        InternalStringBuilder results = new InternalStringBuilder(128);
        PageContext pageContext = getPageContext();
        Throwable e = (Throwable) pageContext.getAttribute(Globals.EXCEPTION_KEY, PageContext.REQUEST_SCOPE);

        if (e == null) {
            ServletRequest req = pageContext.getRequest();
            e = (Throwable) req.getAttribute("javax.servlet.error.exception");
            if (e == null) {
                e = (Throwable) req.getAttribute("javax.servlet.jsp.jspException");
            }
        }

        if (!_showStackTrace && _showDevModeStackTrace) {
            boolean devMode = !AdapterManager.getServletContainerAdapter(pageContext.getServletContext()).isInProductionMode();
            if (devMode)
                _showStackTrace = true;
        }

        if (e != null) {
            if (_showMessage) {
                String msg = e.getMessage();
                // if we have message lets output the exception name and the name of the
                if ((msg != null) && (msg.length() > 0)) {
                    if (!_showStackTrace)
                        msg = e.getClass().getName() + ": " + msg;
                    results.append(HtmlExceptionFormatter.format(msg, e, _showStackTrace));
                }
                else {
                    results.append(HtmlExceptionFormatter.format(e.getClass().getName(), e, _showStackTrace));
                }
            }
            else {
                results.append(HtmlExceptionFormatter.format(null, e, _showStackTrace));
            }
            ResponseUtils.write(pageContext, results.toString());
        }
    }
1002080
public void doProcessOutput(BasicServlet servlet, HttpServletRequest req, HttpServletResponse res, PrintWriter outExt, ScreenModel screen) 
        throws ServletException, IOException
    {
        PrintWriter out = outExt;
        if (screen == null)
        {
        	if (out != null)
        		out.println("Error: default screen not available");
        }
        else
        {
            try
            { // create and execute the query
                // if no parameters, just print the form
                String strDatatype = this.getProperty(DBParams.DATATYPE); // Raw data (such as in image from the DB)
                if (strDatatype == null)
                {
                    if (out == null)
                        out = servlet.getOutputStream(res); // Always
                    ((ScreenModel)screen).printReport(out);
                }
                else
                {       // Raw data output
                    ((ScreenModel)screen).getScreenFieldView().sendData(req, res);
                }
                screen.free();
                screen = null;
            }
            catch (DBException ex) {
                if (out != null)
                {
                    out.println("<hr>*** SQLException caught ***<p>");
                    out.println("Message:  " + ex.getMessage() + "<br>");
                    ex.printStackTrace(out);
                }
                ex.printStackTrace();
            }
            catch (java.lang.Exception ex) {
                ex.printStackTrace();
            } finally {
            	if (outExt == null)
            		if (out != null)
            			out.close();
            }
        }
    }
847319
@Override
	final protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		resp.setBufferSize(BUFFER_SIZE);
		postCount.incrementAndGet();
		try {
			reportingDoPost(req, resp);
		} catch (ThreadDeath t) {
			throw t;
		} catch (RuntimeException | ServletException | IOException e) {
			getLogger().log(Level.SEVERE, null, e);
			throw e;
		} catch (SQLException t) {
			getLogger().log(Level.SEVERE, null, t);
			throw new ServletException(t);
		}
	}
194614
public void doGet(HttpServletRequest request, HttpServletResponse response) 
        throws ServletException, IOException
    {
        response.setContentType("text/html");
        response.setHeader("Pragma", "no-cache");
        response.setHeader("Cache-Control", "no-cache,no-store");

        String url=request.getParameter("URL");
        if (url!=null && url.length()>0)
        {
            response.sendRedirect(url);
        }
        else
        {
            PrintWriter pout = response.getWriter();
            Page page=null;
            
            try{
                page = new Page();
                page.title("SendRedirect Servlet");     
                
                page.add(new Heading(1,"SendRedirect Servlet"));
                
                page.add(new Heading(1,"Form to generate Dump content"));
                TableForm tf = new TableForm
                    (response.encodeURL(URI.addPaths(request.getContextPath(),
                                                     request.getServletPath())+
                                        "/action"));
                tf.method("GET");
                tf.addTextField("URL","URL",40,request.getContextPath()+"/dump");
                tf.addButton("Redirect","Redirect");
                page.add(tf);
                page.write(pout);
                pout.close();
            }
            catch (Exception e)
            {
                log.warn(LogSupport.EXCEPTION,e);
            }
        }
    }
1322690
public void doGet(HttpServletRequest request,
                      HttpServletResponse response) 
        throws ServletException, IOException
    {
        if (request.getQueryString()!=null &&
            request.getQueryString().length()>0)
        {
            String target=doAction(request);
            response.sendRedirect(request.getContextPath()+
                                  request.getServletPath()+
                                  (request.getPathInfo()!=null
                                   ?request.getPathInfo():"")+
                                  (target!=null?("#"+target):""));
            return;
        }
        
        Page page= new Page();
        page.title(getServletInfo());
        page.addHeader("");
        page.attribute("text","#000000");
        page.attribute(Page.BGCOLOR,"#FFFFFF");
        page.attribute("link","#606CC0");
        page.attribute("vlink","#606CC0");
        page.attribute("alink","#606CC0");

        page.add(new Block(Block.Bold).add(new Font(3,true).add(getServletInfo())));
        page.add(Break.rule);
        Form form=new Form(request.getContextPath()+
                           request.getServletPath()+
                           "?A=exit");
        form.method("GET");
        form.add(new Input(Input.Submit,"A","Exit All Servers"));
        page.add(form);
        page.add(Break.rule);
        page.add(new Heading(3,"Components:"));

        List sList=new List(List.Ordered);
        page.add(sList);
        
        String id1;
        int i1=0;
        Iterator s=_servers.iterator();
        while(s.hasNext())
        {
            id1=""+i1++;
            HttpServer server=(HttpServer)s.next();            
            Composite sItem = sList.newItem();
            sItem.add("<B>HttpServer&nbsp;");
            sItem.add(lifeCycle(request,id1,server));
            sItem.add("</B>");
            sItem.add(Break.line);
            sItem.add("<B>Listeners:</B>");
            List lList=new List(List.Unordered);
            sItem.add(lList);

            HttpListener[] listeners=server.getListeners();
            for (int i2=0;i2<listeners.length;i2++)
            {
                HttpListener listener = listeners[i2];
                String id2=id1+":"+listener;
                lList.add(lifeCycle(request,id2,listener));
            }

            Map hostMap = server.getHostMap();
            
            sItem.add("<B>Contexts:</B>");
            List hcList=new List(List.Unordered);
            sItem.add(hcList);
            Iterator i2=hostMap.entrySet().iterator();
            while(i2.hasNext())
            {
                Map.Entry hEntry=(Map.Entry)(i2.next());
                String host=(String)hEntry.getKey();

                PathMap contexts=(PathMap)hEntry.getValue();
                Iterator i3=contexts.entrySet().iterator();
                while(i3.hasNext())
                {
                    Map.Entry cEntry=(Map.Entry)(i3.next());
                    String contextPath=(String)cEntry.getKey();
                    java.util.List contextList=(java.util.List)cEntry.getValue();
                    
                    Composite hcItem = hcList.newItem();
                    if (host!=null)
                        hcItem.add("Host="+host+":");
                    hcItem.add("ContextPath="+contextPath);
                    
                    String id3=id1+":"+host+":"+
                        (contextPath.length()>2
                         ?contextPath.substring(0,contextPath.length()-2)
                         :contextPath);
                    
                    List cList=new List(List.Ordered);
                    hcItem.add(cList);
                    for (int i4=0;i4<contextList.size();i4++)
                    {
                        String id4=id3+":"+i4;
                        Composite cItem = cList.newItem();
                        HttpContext hc=
                            (HttpContext)contextList.get(i4);
                        cItem.add(lifeCycle(request,id4,hc));
                        cItem.add("<BR>ResourceBase="+hc.getResourceBase());
                        cItem.add("<BR>ClassPath="+hc.getClassPath());

                    
                        List hList=new List(List.Ordered);
                        cItem.add(hList);
                        int handlers = hc.getHandlers().length;
                        for(int i5=0;i5<handlers;i5++)
                        {
                            String id5=id4+":"+i5;
                            HttpHandler handler = hc.getHandlers()[i5];
                            Composite hItem=hList.newItem();
                            hItem.add(lifeCycle(request,
                                                id5,
                                                handler,
                                                handler.getName()));
                            if (handler instanceof ServletHandler)
                            {
                                hItem.add("<BR>"+
                                          ((ServletHandler)handler)
                                          .getServletMap());
                            }
                        }
                    }
                }
            }
            sItem.add("<P>");
        }


        response.setContentType("text/html");
        response.setHeader("Pragma", "no-cache");
        response.setHeader("Cache-Control", "no-cache,no-store");
        Writer writer=response.getWriter();
        page.write(writer);
        writer.flush();
    }
886941
protected void doGet(HttpServletRequest request,
                         HttpServletResponse response)
        throws ServletException, IOException
    {
        if (processStatus(request, response)) {
            return;
        }
        
        if (!isRunning()) {
            int errorCode = mProperties.getInt("startup.codes.error", 503);
            response.sendError(errorCode);
            return;
        }
        
        if (mUseSpiderableRequest) {
            request = new SpiderableRequest(request,
                                            mQuerySeparator,
                                            mParameterSeparator,
                                            mValueSeparator);
        }

        // start transaction
        TeaServletTransaction tsTrans = 
            getEngine().createTransaction(request, response, true);
    
        // load associated request/response
        ApplicationRequest appRequest = tsTrans.getRequest();
        ApplicationResponse appResponse = tsTrans.getResponse();

        // process template
        processTemplate(appRequest, appResponse);
        appResponse.finish();
        
        // flush the output
        response.flushBuffer();
    }