net.lightbody.bmp.proxy.jetty.servlet.Debug Maven / Gradle / Ivy
// ===========================================================================
// Copyright (c) 1996 Mort Bay Consulting Pty. Ltd. All rights reserved.
// $Id: Debug.java,v 1.10 2005/08/13 00:01:28 gregwilkins Exp $
// ---------------------------------------------------------------------------
package net.lightbody.bmp.proxy.jetty.servlet;
import net.lightbody.bmp.proxy.jetty.html.*;
import net.lightbody.bmp.proxy.jetty.log.LogFactory;
import net.lightbody.bmp.proxy.jetty.log.LogImpl;
import net.lightbody.bmp.proxy.jetty.log.LogSink;
import net.lightbody.bmp.proxy.jetty.log.OutputStreamLogSink;
import org.apache.commons.logging.Log;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.Writer;
/* ------------------------------------------------------------ */
// Don't write servlets like this one :-)
public class Debug extends HttpServlet
{
/* ------------------------------------------------------------ */
public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException
{
Page page= new Page();
page.title(getServletInfo());
page.attribute("text","#000000");
page.attribute(Page.BGCOLOR,"#FFFFFF");
page.attribute("link","#606CC0");
page.attribute("vlink","#606CC0");
page.attribute("alink","#606CC0");
Log l = LogFactory.getLog(Debug.class);
if (!(l instanceof LogImpl))
return;
LogImpl log = (LogImpl) l;
TableForm tf = new TableForm(request.getRequestURI());
page.add(tf);
tf.table().newRow().addCell(new Block(Block.Bold)
.add(new Font(3,true).add(getServletInfo()))).cell().attribute("COLSPAN","2");
tf.table().add(Break.rule);
tf.addCheckbox("D","Debug On",log.getDebug());
tf.addTextField("V","Verbosity Level",6,""+log.getVerbose());
tf.addTextField("P","Debug Patterns",40,log.getDebugPatterns());
tf.addCheckbox("W","Suppress Warnings",log.getSuppressWarnings());
LogSink[] sinks = log.getLogSinks();
for (int s=0;sinks!=null && sLog Sink "+s+":0)
log.setVerbose(Integer.parseInt(v));
else
log.setVerbose(0);
log.setDebugPatterns(request.getParameter("P"));
LogSink[] sinks = log.getLogSinks();
for (int s=0;sinks!=null && s
© 2015 - 2025 Weber Informatics LLC | Privacy Policy