|
What this is
Other links
The source code/* * Sun Public License Notice * * The contents of this file are subject to the Sun Public License * Version 1.0 (the "License"). You may not use this file except in * compliance with the License. A copy of the License is available at * http://www.sun.com/ * * The Original Code is NetBeans. The Initial Developer of the Original * Code is Sun Microsystems, Inc. Portions Copyright 1997-2003 Sun * Microsystems, Inc. All Rights Reserved. */ package org.netbeans.modules.web.monitor.data; import org.w3c.dom.*; import org.netbeans.modules.schema2beans.*; import java.beans.*; import java.util.*; import java.io.*; public class RequestData extends BaseBean { static Vector comparators = new Vector(); static public final String PARAM = "Param"; //NOI18N static public final String HEADERS = "Headers"; //NOI18N static public final String REQUESTATTRIBUTESIN = "RequestAttributesIn"; //NOI18N static public final String REQUESTATTRIBUTESOUT = "RequestAttributesOut"; //NOI18N static public final String REQUESTDATA = "RequestData"; //NOI18N public final static String JSESSIONID = "JSESSIONID"; // NOI18N public final static String COOKIE = "cookie"; // NOI18N static private final boolean debug = false; public RequestData() { this(Common.USE_DEFAULT_VALUES); } public RequestData(Node doc, int options) { super(RequestData.comparators, new org.netbeans.modules.schema2beans.Version(1, 0, 6)); if (doc == null) { doc = GraphManager.createRootElementNode(REQUESTDATA); if (doc == null) throw new RuntimeException("failed to create a new DOM root!"); //NOI18N } Node n = GraphManager.getElementNode(REQUESTDATA, doc); if (n == null) throw new RuntimeException("doc root not found in the DOM graph!"); //NOI18N this.graphManager.setXmlDocument(doc); // Entry point of the createBeans() recursive calls this.createBean(n, this.graphManager()); this.initialize(options); } public RequestData(int options) { super(RequestData.comparators, new org.netbeans.modules.schema2beans.Version(1, 0, 6)); // Properties (see root bean comments for the bean graph) this.createProperty("Headers", HEADERS, //NOI18N Common.TYPE_1 | Common.TYPE_BEAN | Common.TYPE_KEY, Headers.class); this.createProperty("RequestAttributesIn", REQUESTATTRIBUTESIN, //NOI18N Common.TYPE_1 | Common.TYPE_BEAN | Common.TYPE_KEY, RequestAttributesIn.class); this.createProperty("RequestAttributesOut", REQUESTATTRIBUTESOUT, //NOI18N Common.TYPE_1 | Common.TYPE_BEAN | Common.TYPE_KEY, RequestAttributesOut.class); this.createProperty("Param", PARAM, //NOI18N Common.TYPE_0_N | Common.TYPE_BEAN | Common.TYPE_KEY, Param.class); this.createAttribute(PARAM, "name", "Name", //NOI18N AttrProp.CDATA | AttrProp.REQUIRED, null, null); this.createAttribute(PARAM, "value", "Value", //NOI18N AttrProp.CDATA | AttrProp.IMPLIED, null, null); this.initialize(options); } // Setting the default values of the properties void initialize(int options) { } // This attribute is mandatory public void setHeaders(Headers value) { this.setValue(HEADERS, value); } // public Headers getHeaders() { return (Headers)this.getValue(HEADERS); } // This attribute is mandatory public void setRequestAttributesIn(RequestAttributesIn value) { this.setValue(REQUESTATTRIBUTESIN, value); } // public RequestAttributesIn getRequestAttributesIn() { return (RequestAttributesIn)this.getValue(REQUESTATTRIBUTESIN); } // This attribute is mandatory public void setRequestAttributesOut(RequestAttributesOut value) { this.setValue(REQUESTATTRIBUTESOUT, value); } // public RequestAttributesOut getRequestAttributesOut() { return (RequestAttributesOut)this.getValue(REQUESTATTRIBUTESOUT); } // This attribute is an array, possibly empty public void setParam(int index, Param value) { this.setValue(PARAM, index, value); } // public Param getParam(int index) { return (Param)this.getValue(PARAM, index); } // This attribute is an array, possibly empty public void setParam(Param[] value) { if(debug) log("setParam(Param[] value)"); //NOI18N try { this.setValue(PARAM, value); } catch(Exception ex) { ex.printStackTrace(); } } // public Param[] getParam() { return (Param[])this.getValues(PARAM); } // Return the number of properties public int sizeParam() { return this.size(PARAM); } // Add a new element returning its index in the list public int addParam(Param value) { return this.addValue(PARAM, value); } // // Remove an element using its reference // Returns the index the element had in the list // public int removeParam(Param value) { return this.removeValue(PARAM, value); } /* Methods for manipulating the session cookie */ public void setReplaceSessionCookie(boolean value) { this.setAttributeValue("replace", String.valueOf(value)); // NOI18N } public boolean getReplaceSessionCookie() { try { if(this.getAttributeValue("replace").equals("true")) // NOI18N return true; } catch(NullPointerException npe) { // do nothing } return false; } public String getSessionID() { return findSessionID(getCookieString()); } public String getCookieString() { Param[] headers = getHeaders().getParam(); StringBuffer cookieStr = new StringBuffer(); int len = headers.length; for(int j=0; j |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.