Update of /var/cvs/applications/taglib/src/org/mmbase/bridge/jsp/taglib/pageflow
In directory james.mmbase.org:/tmp/cvs-serv23585

Modified Files:
        Url.java UrlTag.java 
Log Message:
  MMB-1777


See also: 
http://cvs.mmbase.org/viewcvs/applications/taglib/src/org/mmbase/bridge/jsp/taglib/pageflow
See also: http://www.mmbase.org/jira/browse/MMB-1777


Index: Url.java
===================================================================
RCS file: 
/var/cvs/applications/taglib/src/org/mmbase/bridge/jsp/taglib/pageflow/Url.java,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -b -r1.52 -r1.53
--- Url.java    12 Jan 2009 14:08:55 -0000      1.52
+++ Url.java    20 Jan 2009 15:17:44 -0000      1.53
@@ -35,7 +35,7 @@
  * <p>
  * The creation of the URL is delegated to the MMBase framework.
  * </p>
- * @version $Id: Url.java,v 1.52 2009/01/12 14:08:55 michiel Exp $;
+ * @version $Id: Url.java,v 1.53 2009/01/20 15:17:44 michiel Exp $;
  * @since MMBase-1.9
  */
 public class Url implements Comparable, CharSequence, Casting.Unwrappable {
@@ -43,7 +43,7 @@
     private static  final Logger pageLog = 
Logging.getLoggerInstance(Logging.PAGE_CATEGORY);
 
     private final ContextReferrerTag tag;
-    private final String page;
+    private final CharSequence page;
     //private final Component component;
     protected final Map<String, Object> params;
     protected final Map<String, Object> frameworkParams;
@@ -60,7 +60,7 @@
     private boolean legacy = false;
 
     public Url(UrlTag t,
-               String p,
+               CharSequence p,
                Map<String, Object> framework,
                Map<String, Object> pars,
                boolean intern) throws JspTagException {
@@ -90,7 +90,7 @@
     }
 
 
-    public Url(ContextReferrerTag t, String p, String a) throws 
JspTagException {
+    public Url(ContextReferrerTag t, CharSequence p, String a) throws 
JspTagException {
         tag = t;
         abs = a;
         encodeUrl = true;
@@ -142,7 +142,7 @@
         if (log.isDebugEnabled()) {
             log.debug("legacy url " + page + m);
         }
-        String res = BasicUrlConverter.getUrl(page, m, 
(HttpServletRequest)tag.getPageContext().getRequest(), escapeamp).toString();
+        String res = BasicUrlConverter.getUrl(page.toString(), m, 
(HttpServletRequest)tag.getPageContext().getRequest(), escapeamp).toString();
         pageLog.service("getting legacy: " + page + " -> " + res);
         return res;
       }
@@ -182,21 +182,21 @@
             } else {
                 log.debug("Creating internal url link to page: " + page);
             }
-            result = framework.getInternalUrl(page, params, 
frameworkParameters);
+            result = framework.getInternalUrl(page.toString(), params, 
frameworkParameters);
             if (result == null) {
-                result = framework.getUrl(page, params, frameworkParameters, 
false);
+                result = framework.getUrl(page.toString(), params, 
frameworkParameters, false);
                 log.debug("No url gotten from framework, falled back to " + 
result);
             } else  {
                 log.debug("url gotten from framework " + result);
             }
         } else {
             if (process) {
-                result = framework.getProcessUrl(page, params, 
frameworkParameters, escapeamp);
+                result = framework.getProcessUrl(page.toString(), params, 
frameworkParameters, escapeamp);
                 if (log.isDebugEnabled()) {
                     log.debug("Created normal process url link to page: " + 
page + " " + params + " fw: " + frameworkParameters + " -> " + result);
                 }
             } else {
-                result = framework.getUrl(page, params, frameworkParameters, 
escapeamp);
+                result = framework.getUrl(page.toString(), params, 
frameworkParameters, escapeamp);
                 if (log.isDebugEnabled()) {
                     log.debug("Created normal url link to page: " + page + " " 
+ params + " fw: " + frameworkParameters + " -> " + result);
                 }


Index: UrlTag.java
===================================================================
RCS file: 
/var/cvs/applications/taglib/src/org/mmbase/bridge/jsp/taglib/pageflow/UrlTag.java,v
retrieving revision 1.124
retrieving revision 1.125
diff -u -b -r1.124 -r1.125
--- UrlTag.java 12 Jan 2009 14:20:23 -0000      1.124
+++ UrlTag.java 20 Jan 2009 15:17:44 -0000      1.125
@@ -30,7 +30,7 @@
  * A Tag to produce an URL with parameters. It can use 'context' parameters 
easily.
  *
  * @author Michiel Meeuwissen
- * @version $Id: UrlTag.java,v 1.124 2009/01/12 14:20:23 michiel Exp $
+ * @version $Id: UrlTag.java,v 1.125 2009/01/20 15:17:44 michiel Exp $
  */
 
 public class UrlTag extends CloudReferrerTag  implements  ParamHandler, 
FrameworkParamHandler {
@@ -145,7 +145,9 @@
      */
     protected String getUrl() throws JspTagException {
         try {
-            return url.get(escapeAmps.getBoolean(this, true));
+            String u = url.get(escapeAmps.getBoolean(this, true));
+            log.debug("Found url " + u);
+            return u;
         } catch (FrameworkException fe) {
             throw new JspTagException(fe);
         }
@@ -206,7 +208,19 @@
                 }
             }
         } else {
-            url = new Url(this, getPage(getPage()), frameworkParameters, 
parameters, internal);
+            url = new Url(this, new CharSequence() {
+                    public char charAt(int index) { return 
toString().charAt(index); }
+                    public int length() { return toString().length(); }
+                    public CharSequence subSequence(int start, int end) { 
return toString().subSequence(start, end); };
+                    public String toString() {
+                        try {
+                            return UrlTag.this.getPage(getPage());
+                        } catch (JspTagException je) {
+                            log.warn(je.getMessage(), je);
+                            return je.getMessage();
+                        }
+                    }
+                }, frameworkParameters, parameters, internal);
             if (process.getBoolean(this, false)) {
                 url.setProcess();
             }
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs

Reply via email to