webwork/src/main/webwork/view/taglib URLTag.java,1.22,1.23

[email protected] Thu, 08 Jan 2004 09:13:46 -0800
Newsgroups gmane.comp.java.open-symphony.cvs
Message-ID <[email protected]>
Update of /cvsroot/opensymphony/webwork/src/main/webwork/view/taglib
In directory sc8-pr-cvs1:/tmp/cvs-serv13961/src/main/webwork/view/taglib

Modified Files:
	URLTag.java 
Log Message:
Fix for ww-208


Index: URLTag.java
===================================================================
RCS file: /cvsroot/opensymphony/webwork/src/main/webwork/view/taglib/URLTag.java,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- URLTag.java	1 Nov 2003 22:41:55 -0000	1.22
+++ URLTag.java	8 Jan 2004 17:13:44 -0000	1.23
@@ -37,6 +37,8 @@
    protected String value;
    protected String includeParamsAttr;
    protected Map params;
+	 protected boolean includeContext = true;
+	 protected boolean encodeResult = true;
 
    // Public --------------------------------------------------------
    /**
@@ -67,6 +69,14 @@
       includeParamsAttr = aName;
    }
 
+	 public void setEncode(boolean encode) {
+		  encodeResult = encode;
+	 }
+
+	 public void setIncludeContext(boolean includeContext) {
+		  this.includeContext = includeContext;
+	 }
+
    public void addParameter(String name, Object value) {
       if (params == null)
          params = new HashMap();
@@ -140,7 +150,7 @@
       if (value != null) {
          // Check if context path needs to be added
          // Add path to absolute links
-         if (value.startsWith("/")) {
+         if (value.startsWith("/") && includeContext) {
             link.append(request.getContextPath());
          }
 
@@ -199,7 +209,7 @@
       String result;
       try {
          //Category.getInstance(this.getClass().getName()).debug(link.toString());
-         result = response.encodeURL(link.toString());
+         result = encodeResult ? response.encodeURL(link.toString()) : link.toString();
       } catch (Exception e) {
          // Could not encode URL for some reason
          // Use it unchanged




-------------------------------------------------------
This SF.net email is sponsored by: Perforce Software.
Perforce is the Fast Software Configuration Management System offering
advanced branching capabilities and atomic changes on 50+ platforms.
Free Eval! http://www.perforce.com/perforce/loadprog.html