webwork/src/main/webwork/view/taglib WebWorkTagSupport.java,1.1,1.2 WebWorkBodyTagSupport.java,1.2,1.3 URLTag.java,1.4,1.5 TextTag.java,1.3,1.4 PropertyTag.java,1.3,1.4 ParamTag.java,1.2,1.3 IteratorTag.java,1.1,1.2 IteratorStatus.java,1.1,1.2 IncludeTag.java,1.3,1.4 IfTag.java,1.4,1.5 I18nTag.java,1.2,1.3 ElseIfTag.java,1.3,1.4 BeanTag.java,1.1,1.2 ActionTag.java,1.4,1.5
[email protected] Wed, 08 May 2002 13:38:40 -0700
| Newsgroups | gmane.comp.java.webwork.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/webwork/webwork/src/main/webwork/view/taglib
In directory usw-pr-cvs1:/tmp/cvs-serv26052
Modified Files:
WebWorkTagSupport.java WebWorkBodyTagSupport.java URLTag.java
TextTag.java PropertyTag.java ParamTag.java IteratorTag.java
IteratorStatus.java IncludeTag.java IfTag.java I18nTag.java
ElseIfTag.java BeanTag.java ActionTag.java
Log Message:
protected attributes and made sure all attributes state is released
Index: WebWorkTagSupport.java
===================================================================
RCS file: /cvsroot/webwork/webwork/src/main/webwork/view/taglib/WebWorkTagSupport.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- WebWorkTagSupport.java 3 Mar 2002 04:11:48 -0000 1.1
+++ WebWorkTagSupport.java 8 May 2002 20:38:38 -0000 1.2
@@ -66,6 +66,11 @@
return bout.toString();
}
+ public void release()
+ {
+ super.release();
+ stack = null;
+ }
}
Index: WebWorkBodyTagSupport.java
===================================================================
RCS file: /cvsroot/webwork/webwork/src/main/webwork/view/taglib/WebWorkBodyTagSupport.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- WebWorkBodyTagSupport.java 26 Apr 2002 19:29:53 -0000 1.2
+++ WebWorkBodyTagSupport.java 8 May 2002 20:38:38 -0000 1.3
@@ -68,6 +68,11 @@
return bout.toString();
}
+ public void release()
+ {
+ super.release();
+ stack = null;
+ }
}
Index: URLTag.java
===================================================================
RCS file: /cvsroot/webwork/webwork/src/main/webwork/view/taglib/URLTag.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- URLTag.java 26 Apr 2002 19:29:53 -0000 1.4
+++ URLTag.java 8 May 2002 20:38:38 -0000 1.5
@@ -6,15 +6,20 @@
*/
package webwork.view.taglib;
+import org.apache.log4j.Category;
+
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.JspTagException;
import java.io.IOException;
import java.net.URLEncoder;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
+import webwork.util.TextUtil;
+
/**
* This tag is used to create a URL. You can use the "param" tag inside the body to provide
* additional request parameters.
@@ -27,11 +32,10 @@
extends WebWorkBodyTagSupport
implements ParamTag.Parametric {
// Attributes ----------------------------------------------------
- String page;
- String valueAttr;
- String value;
-
- Map params;
+ protected String page;
+ protected String valueAttr;
+ protected String value;
+ protected Map params;
// Public --------------------------------------------------------
/**
@@ -46,13 +50,19 @@
}
public void addParameter(String name, Object value) {
- if (params == null)
- params = new HashMap();
+ try {
+ if (params == null)
+ params = new HashMap();
- if (value == null)
- params.remove(name);
- else
- params.put(name, value.toString());
+ if (value == null)
+ params.remove(name);
+ else {
+ params.put(name, value.toString());
+ }
+ } catch (UnsupportedOperationException e) {
+ Category.getInstance(this.getClass().getName()).debug("addParameter: ", e);
+ throw e;
+ }
}
// BodyTag implementation ----------------------------------------
@@ -66,11 +76,13 @@
params = null;
+/*
if (value == null) {
// No particular page requested, so go to "same page"
// Add query params to parameters
- params = ((HttpServletRequest) pageContext.getRequest()).getParameterMap();
+ urlParams = ((HttpServletRequest) pageContext.getRequest()).getParameterMap();
}
+*/
return EVAL_BODY_TAG;
}
@@ -97,6 +109,11 @@
link.append(requestURI);
}
+ //if the body has not set our params, use the context
+ if (params==null && value==null) {
+ params = ((HttpServletRequest) pageContext.getRequest()).getParameterMap();
+ }
+
if (params != null && params.size() > 0) {
if (link.toString().indexOf("?") == -1) {
link.append('?');
@@ -130,6 +147,7 @@
String result;
try {
+ //Category.getInstance(this.getClass().getName()).debug(link.toString());
result = response.encodeURL(link.toString());
} catch (Exception e) {
// Could not encode URL for some reason
@@ -144,6 +162,15 @@
}
return EVAL_PAGE;
+ }
+
+ public void release()
+ {
+ super.release();
+ page = null;
+ valueAttr = null;
+ value = null;
+ params = null;
}
}
Index: TextTag.java
===================================================================
RCS file: /cvsroot/webwork/webwork/src/main/webwork/view/taglib/TextTag.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- TextTag.java 26 Apr 2002 19:29:53 -0000 1.3
+++ TextTag.java 8 May 2002 20:38:38 -0000 1.4
@@ -34,14 +34,14 @@
extends WebWorkBodyTagSupport
implements ParamTag.UnnamedParametric {
// Attributes ----------------------------------------------------
- String nameAttr;
- String value0Attr;
- String value1Attr;
- String value2Attr;
- String value3Attr;
+ protected String nameAttr;
+ protected String value0Attr;
+ protected String value1Attr;
+ protected String value2Attr;
+ protected String value3Attr;
- ArrayList values;
- WeakHashMap fmtCache = new WeakHashMap();
+ private ArrayList values;
+ private WeakHashMap fmtCache = new WeakHashMap();
// Public --------------------------------------------------------
public void setName(String aName) {
@@ -170,6 +170,16 @@
}
return EVAL_PAGE;
+ }
+
+ public void release()
+ {
+ super.release();
+ nameAttr = null;
+ value0Attr = null;
+ value1Attr = null;
+ value2Attr = null;
+ value3Attr = null;
}
}
Index: PropertyTag.java
===================================================================
RCS file: /cvsroot/webwork/webwork/src/main/webwork/view/taglib/PropertyTag.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- PropertyTag.java 8 May 2002 02:07:53 -0000 1.3
+++ PropertyTag.java 8 May 2002 20:38:38 -0000 1.4
@@ -29,9 +29,9 @@
extends WebWorkBodyTagSupport
{
// Attributes ----------------------------------------------------
- String valueAttr;
- Boolean escape;
- boolean hadBody;
+ protected String valueAttr;
+ protected Boolean escape;
+ protected boolean hadBody;
// Public --------------------------------------------------------
public void setValue(String aName)
@@ -129,8 +129,10 @@
public void release()
{
- escape = null;
super.release();
+ escape = null;
+ valueAttr = null;
+ hadBody = false;
}
}
Index: ParamTag.java
===================================================================
RCS file: /cvsroot/webwork/webwork/src/main/webwork/view/taglib/ParamTag.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- ParamTag.java 21 Mar 2002 18:56:15 -0000 1.2
+++ ParamTag.java 8 May 2002 20:38:38 -0000 1.3
@@ -23,8 +23,8 @@
extends WebWorkBodyTagSupport
{
// Attributes ----------------------------------------------------
- String nameAttr;
- String valueAttr;
+ protected String nameAttr;
+ protected String valueAttr;
public void setName(String aName)
{
@@ -71,8 +71,14 @@
parametricTag.addParameter(findValue(nameAttr).toString(), content);
}
}
-
return EVAL_PAGE;
+ }
+
+ public void release()
+ {
+ super.release();
+ nameAttr = null;
+ valueAttr = null;
}
// Inner classes -------------------------------------------------
Index: IteratorTag.java
===================================================================
RCS file: /cvsroot/webwork/webwork/src/main/webwork/view/taglib/IteratorTag.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- IteratorTag.java 3 Mar 2002 04:11:47 -0000 1.1
+++ IteratorTag.java 8 May 2002 20:38:38 -0000 1.2
@@ -24,15 +24,14 @@
extends WebWorkBodyTagSupport
{
// Attributes ----------------------------------------------------
- String valueAttr;
- String statusAttr;
-
- Object currentValue;
- Iterator iterator;
- IteratorStatus status;
- IteratorStatus.StatusState statusState;
- String statusName;
- Object oldStatus;
+ protected String valueAttr;
+ protected String statusAttr;
+ protected Object currentValue;
+ protected Iterator iterator;
+ protected IteratorStatus status;
+ protected IteratorStatus.StatusState statusState;
+ protected String statusName;
+ protected Object oldStatus;
// Public --------------------------------------------------------
@@ -189,6 +188,18 @@
}
}
+ public void release()
+ {
+ super.release();
+ valueAttr = null;
+ statusAttr = null;
+ currentValue = null;
+ iterator = null;
+ status = null;
+ statusState = null;
+ statusName = null;
+ oldStatus = null;
+ }
// Inner classes -------------------------------------------------
}
Index: IteratorStatus.java
===================================================================
RCS file: /cvsroot/webwork/webwork/src/main/webwork/view/taglib/IteratorStatus.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- IteratorStatus.java 3 Mar 2002 04:11:47 -0000 1.1
+++ IteratorStatus.java 8 May 2002 20:38:38 -0000 1.2
@@ -16,7 +16,7 @@
public class IteratorStatus
{
// Attributes ----------------------------------------------------
- StatusState state;
+ protected StatusState state;
// Static --------------------------------------------------------
@@ -61,6 +61,8 @@
{
return (state.index + 1) % operand;
}
+
+
// Package protected ---------------------------------------------
Index: IncludeTag.java
===================================================================
RCS file: /cvsroot/webwork/webwork/src/main/webwork/view/taglib/IncludeTag.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- IncludeTag.java 22 Mar 2002 13:36:02 -0000 1.3
+++ IncludeTag.java 8 May 2002 20:38:38 -0000 1.4
@@ -7,6 +7,7 @@
package webwork.view.taglib;
import org.apache.log4j.NDC;
+import org.apache.log4j.Category;
import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
@@ -47,8 +48,10 @@
NDC.push(resourcePath);
// Include the resource
- rd.include(aContext.getRequest(),
- new ServletResponseWrapperInclude(aContext.getResponse(), aContext.getOut()));
+ HttpServletResponse res = new ServletResponseWrapperInclude(
+ aContext.getResponse(),
+ aContext.getOut());
+ rd.include(aContext.getRequest(), res);
} finally
{
// Remove view from NDC stack
@@ -72,10 +75,9 @@
}
// Attributes ----------------------------------------------------
- String pageAttr;
- String valueAttr;
-
- Map params;
+ protected String pageAttr;
+ protected String valueAttr;
+ protected Map params;
// Public --------------------------------------------------------
@@ -198,12 +200,10 @@
*/
PrintWriter printWriter;
JspWriter jspWriter;
- ServletResponse response;
public ServletResponseWrapperInclude(ServletResponse response, JspWriter jspWriter)
{
super((HttpServletResponse) response);
- this.response = response;
this.jspWriter = jspWriter;
this.printWriter = new PrintWriter(jspWriter);
}
@@ -242,6 +242,14 @@
//System.out.println("Write bytes");
jspWriter.write(new String(b, off, len));
}
+ }
+
+ public void release()
+ {
+ super.release();
+ pageAttr = null;
+ valueAttr = null;
+ params = null;
}
}
Index: IfTag.java
===================================================================
RCS file: /cvsroot/webwork/webwork/src/main/webwork/view/taglib/IfTag.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- IfTag.java 26 Apr 2002 19:29:53 -0000 1.4
+++ IfTag.java 8 May 2002 20:38:38 -0000 1.5
@@ -18,8 +18,9 @@
extends WebWorkTagSupport {
// Attributes ----------------------------------------------------
public final static String ANSWER = "webwork.if.answer";
- String test;
- boolean answer;
+
+ protected String test;
+ protected boolean answer;
// Public --------------------------------------------------------
@@ -62,6 +63,7 @@
setId(null);
// Reset
test = null;
+ answer = false;
}
}
Index: I18nTag.java
===================================================================
RCS file: /cvsroot/webwork/webwork/src/main/webwork/view/taglib/I18nTag.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- I18nTag.java 12 Mar 2002 12:54:50 -0000 1.2
+++ I18nTag.java 8 May 2002 20:38:38 -0000 1.3
@@ -36,7 +36,7 @@
extends WebWorkTagSupport
{
// Attributes ----------------------------------------------------
- String nameAttr;
+ protected String nameAttr;
// Public --------------------------------------------------------
public void setName(String aName)
@@ -95,6 +95,12 @@
{
return bundle.getString(aName);
}
+ }
+
+ public void release()
+ {
+ super.release();
+ nameAttr = null;
}
}
Index: ElseIfTag.java
===================================================================
RCS file: /cvsroot/webwork/webwork/src/main/webwork/view/taglib/ElseIfTag.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- ElseIfTag.java 26 Apr 2002 19:29:53 -0000 1.3
+++ ElseIfTag.java 8 May 2002 20:38:38 -0000 1.4
@@ -17,8 +17,8 @@
public final class ElseIfTag
extends WebWorkTagSupport {
// Attributes ----------------------------------------------------
- String test;
- boolean answer;
+ protected String test;
+ protected boolean answer;
// Public --------------------------------------------------------
/**
@@ -63,6 +63,7 @@
// Reset
test = null;
+ answer = false;
}
public void release() {
Index: BeanTag.java
===================================================================
RCS file: /cvsroot/webwork/webwork/src/main/webwork/view/taglib/BeanTag.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- BeanTag.java 3 Mar 2002 04:11:47 -0000 1.1
+++ BeanTag.java 8 May 2002 20:38:38 -0000 1.2
@@ -87,6 +87,7 @@
{
getStack().popValue();
bean = null;
+ nameAttr = null;
return EVAL_PAGE;
}
}
Index: ActionTag.java
===================================================================
RCS file: /cvsroot/webwork/webwork/src/main/webwork/view/taglib/ActionTag.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- ActionTag.java 26 Apr 2002 19:29:53 -0000 1.4
+++ ActionTag.java 8 May 2002 20:38:38 -0000 1.5
@@ -29,13 +29,13 @@
* @version $Revision$
*/
public class ActionTag
- extends BeanTag
+ extends BeanTag
{
protected static Category log = Category.getInstance(ActionTag.class);
- String result = Action.SUCCESS;
- ActionContext oldContext;
- ActionContext context;
+ protected String result = Action.SUCCESS;
+ protected ActionContext oldContext;
+ protected ActionContext context;
// BodyTag implementation ----------------------------------------
@@ -44,29 +44,24 @@
// Create action
oldContext = ActionContext.getContext();
context = new ActionContext();
- context.setRequest((HttpServletRequest)pageContext.getRequest());
- context.setResponse((HttpServletResponse)pageContext.getResponse());
+ context.setRequest((HttpServletRequest) pageContext.getRequest());
+ context.setResponse((HttpServletResponse) pageContext.getResponse());
context.setServletContext(pageContext.getServletContext());
ActionContext.setContext(context);
- final String name = (String)findValue(nameAttr);
+ final String name = (String) findValue(nameAttr);
if (name == null)
- throw new JspException("No action named "+nameAttr+" found. Try putting quotes around name");
- try
- {
+ throw new JspException("No action named " + nameAttr + " found. Try putting quotes around name");
+ try {
bean = ActionFactory.getActionFactory().getAction(name);
- } catch (Exception e)
- {
- try
- {
+ } catch (Exception e) {
+ try {
e.printStackTrace();
pageContext.handlePageException(e);
- } catch (Exception ex)
- {
+ } catch (Exception ex) {
// Ignore
}
return SKIP_PAGE;
- } finally
- {
+ } finally {
// Reset context
ActionContext.setContext(oldContext);
}
@@ -76,16 +71,15 @@
{
boolean hasExecuted;
Object action = bean;
+
public Object getValue()
{
- if (!hasExecuted)
- {
- log.debug("Action:"+name);
+ if (!hasExecuted) {
+ log.debug("Action:" + name);
NDC.push(name);
ActionContext.setContext(context);
- try
- {
- result = ((Action)action).execute();
+ try {
+ result = ((Action) action).execute();
/* This doesn't work right now if (result.equals(Action.INPUT))
{
@@ -99,17 +93,13 @@
return SKIP_BODY;
} */
- if (result == null || !result.equals(Action.SUCCESS))
- {
- log.error("Actions used by the action tag may only return \"success\". \""+result+"\" was returned.");
+ if (result == null || !result.equals(Action.SUCCESS)) {
+ log.error("Actions used by the action tag may only return \"success\". \"" + result + "\" was returned.");
}
- } catch (Exception e)
- {
- try
- {
+ } catch (Exception e) {
+ try {
pc.handlePageException(e);
- } catch (Exception ex)
- {
+ } catch (Exception ex) {
// Ignore
}
} finally {
@@ -117,7 +107,6 @@
}
hasExecuted = true;
}
-
return action;
}
@@ -129,8 +118,7 @@
getStack().pushValue(holder);
// Store as attribute?
- if(getId() != null)
- {
+ if (getId() != null) {
pageContext.setAttribute(getId(), holder);
pageContext.setAttribute(getId(), holder, PageContext.REQUEST_SCOPE);
}
@@ -152,16 +140,19 @@
}
}
*/
- ValueStack.ValueHolder holder = (ValueStack.ValueHolder)getStack().popValue();
+ ValueStack.ValueHolder holder = (ValueStack.ValueHolder) getStack().popValue();
// If the action has not been executed yet, it will be now
holder.getValue();
return EVAL_PAGE;
}
- public void release() {
+ public void release()
+ {
+ super.release();
ActionContext.setContext(oldContext);
+ oldContext = null;
+ context = null;
bean = null;
- super.release();
}
}
_______________________________________________________________
Have big pipes? SourceForge.net is looking for download mirrors. We supply
the hardware. You get the recognition. Email Us: [email protected]