package org.w3c.jigsaw.filters;
import java.io.*;
import org.w3c.tools.resources.*;
import org.w3c.jigsaw.http.*;
import org.w3c.jigsaw.resources.*;
public class DebugFilter extends ResourceFilter {
protected static int ATTR_ONOFF = -1 ;
static {
Attribute a = null ;
Class cls = null ;
try {
cls = Class.forName("org.w3c.jigsaw.filters.DebugFilter");
} catch (Exception ex) {
ex.printStackTrace() ;
System.exit(1) ;
}
a = new BooleanAttribute("onoff"
, Boolean.TRUE
, Attribute.EDITABLE) ;
ATTR_ONOFF = AttributeRegistry.registerAttribute(cls, a) ;
}
public boolean getOnOffFlag() {
return getBoolean(ATTR_ONOFF, true) ;
}
@param request@return
public ReplyInterface ingoingFilter(RequestInterface req) {
Request request = (Request) req;
if ( getOnOffFlag() )
request.dump(System.out);
return null;
}
@param request@param reply@exception HTTPException
public ReplyInterface outgoingFilter(RequestInterface req,
ReplyInterface rep)
{
Reply reply = (Reply) rep;
if ( getOnOffFlag() )
reply.dump(System.out);
return null ;
}
}