/** Construct a literal JSON instance for use by {@link JSON#toString(Object)}. * If {@link Log#isDebugEnabled()} is true, the JSON will be parsed to check validity * @param json A literal JSON string. */ public Literal(String json) { if (Log.isDebugEnabled()) parse(json); _json=json; }
public static void debug(Throwable th) { if (!isDebugEnabled()) return; __log.debug(EXCEPTION,th); unwind(th); }
public URL getAlias() { if (__checkAliases && !_aliasChecked) { try { String abs=_file.getAbsolutePath(); String can=_file.getCanonicalPath(); if (abs.length()!=can.length() || !abs.equals(can)) _alias=new File(can).toURI().toURL(); _aliasChecked=true; if (_alias!=null && Log.isDebugEnabled()) { Log.debug("ALIAS abs="+abs); Log.debug("ALIAS can="+can); } } catch(Exception e) { Log.warn(Log.EXCEPTION,e); return getURL(); } } return _alias; }
public static void extract(Resource resource, File directory, boolean deleteOnExit) throws IOException if(Log.isDebugEnabled())Log.debug("Extract "+resource+" to "+directory); boolean subEntryIsDir = (subEntryName != null && subEntryName.endsWith("/")?true:false); if (Log.isDebugEnabled()) Log.debug("Extracting entry = "+subEntryName+" from jar "+jarFileURL); if (Log.isDebugEnabled()) Log.debug("Skipping entry: "+entryName); continue;
/** Add a parent child relationship * @param parent * @param child * @param relationship */ private void add(Object parent, Object child, String relationship) { if (Log.isDebugEnabled()) Log.debug("Container "+parent+" + "+child+" as "+relationship); if (_listeners!=null) { Relationship event=new Relationship(this,parent,child,relationship); for (int i=0; i<LazyList.size(_listeners); i++) ((Listener)LazyList.get(_listeners, i)).add(event); } }
/** remove a parent child relationship * @param parent * @param child * @param relationship */ private void remove(Object parent, Object child, String relationship) { if (Log.isDebugEnabled()) Log.debug("Container "+parent+" - "+child+" as "+relationship); if (_listeners!=null) { Relationship event=new Relationship(this,parent,child,relationship); for (int i=0; i<LazyList.size(_listeners); i++) ((Listener)LazyList.get(_listeners, i)).remove(event); } }
/** * Get a name to object binding from this Context * * @param name as a String * @return null or the Binding */ protected Binding getBinding (String name) { if(Log.isDebugEnabled())Log.debug("Looking up binding for "+name+" for context="+_name); return (Binding) _bindings.get(name); }
protected void removeBinding (Name name) { String key = name.toString(); if (Log.isDebugEnabled()) Log.debug("Removing binding with key="+key); _bindings.remove(key); }
/** * Get a name to object binding from this Context * * @param name a <code>Name</code> value * @return a <code>Binding</code> value */ protected Binding getBinding (Name name) { if(Log.isDebugEnabled())Log.debug("Looking up binding for "+name.toString()+" for context="+_name); return (Binding) _bindings.get(name.toString()); }
/** * Get a name to object binding from this Context * * @param name as a String * @return null or the Binding */ protected Binding getBinding (String name) { if(Log.isDebugEnabled())Log.debug("Looking up binding for "+name+" for context="+_name); return (Binding) _bindings.get(name); }
protected void removeBinding (Name name) { String key = name.toString(); if (Log.isDebugEnabled()) Log.debug("Removing binding with key="+key); _bindings.remove(key); }
protected void notFound(HttpServletRequest request, HttpServletResponse response) throws IOException { if(Log.isDebugEnabled())Log.debug("Not Found "+request.getRequestURI()); response.sendError(HttpServletResponse.SC_NOT_FOUND); }
/** * Parse File. */ public synchronized Node parse(File file) throws IOException, SAXException { if (Log.isDebugEnabled()) Log.debug("parse: " + file); return parse(new InputSource(file.toURL().toString())); }
/** * Add a name to object binding to this Context. * * @param name a <code>Name</code> value * @param obj an <code>Object</code> value */ protected void addBinding (Name name, Object obj) { String key = name.toString(); if(Log.isDebugEnabled())Log.debug("Adding binding with key="+key+" obj="+obj+" for context="+_name); _bindings.put (key, new Binding (key, obj)); }
/** * Parse String URL. */ public synchronized Node parse(String url) throws IOException, SAXException { if (Log.isDebugEnabled()) Log.debug("parse: " + url); return parse(new InputSource(url)); }
public String toString() { if (Log.isDebugEnabled()) return "ContextLoader@" + _name + "(" + LazyList.array2List(getURLs()) + ") / " + _parent; return "ContextLoader@" + _name; }
private void put(Object obj, XmlParser.Node node) throws Exception { if (!(obj instanceof Map)) throw new IllegalArgumentException("Object for put is not a Map: " + obj); Map map = (Map) obj; String name = node.getAttribute("name"); Object value = value(obj, node); map.put(name, value); if (Log.isDebugEnabled()) Log.debug("XML "+obj + ".put(" + name + "," + value + ")"); }
public void valueUnbound(HttpSessionBindingEvent event) { if(Log.isDebugEnabled())Log.debug("Logout "+_jUserName); if(_realm instanceof SSORealm) ((SSORealm)_realm).clearSingleSignOn(_jUserName); if(_realm!=null && _userPrincipal!=null) _realm.logout(_userPrincipal); }
protected void initContextParam(XmlParser.Node node) { String name=node.getString("param-name",false,true); String value=node.getString("param-value",false,true); if(Log.isDebugEnabled()) Log.debug("ContextParam: "+name+"="+value); getWebAppContext().getInitParams().put(name, value); }
public void handle(HttpConnection connection) throws IOException, ServletException { String target=connection.getRequest().getPathInfo(); if (Log.isDebugEnabled()) { Log.debug("REQUEST "+target+" on "+connection); handle(target, connection.getRequest(), connection.getResponse(), Handler.REQUEST); Log.debug("RESPONSE "+target+" "+connection.getResponse().getStatus()); } else handle(target, connection.getRequest(), connection.getResponse(), Handler.REQUEST); }