Revision: 577
http://svn.sourceforge.net/stripes/?rev=577&view=rev
Author: bengunter
Date: 2007-06-13 14:23:35 -0700 (Wed, 13 Jun 2007)
Log Message:
-----------
No longer hangs on to a reference to the ActionBean class when the constructor
that takes an ActionBean class is called. Instead it uses the ActionResolver to
look up the URL binding and sets the baseUrl to that value. Then when it
attempts to construct the base URL with parameters, it looks up the UrlBinding
by the path instead of by the class. This allows clean URLs to work when either
constructor is called.
Modified Paths:
--------------
trunk/stripes/src/net/sourceforge/stripes/util/UrlBuilder.java
Modified: trunk/stripes/src/net/sourceforge/stripes/util/UrlBuilder.java
===================================================================
--- trunk/stripes/src/net/sourceforge/stripes/util/UrlBuilder.java
2007-06-13 21:20:35 UTC (rev 576)
+++ trunk/stripes/src/net/sourceforge/stripes/util/UrlBuilder.java
2007-06-13 21:23:35 UTC (rev 577)
@@ -62,7 +62,6 @@
}
}
- private Class<? extends ActionBean> beanType;
private String baseUrl;
private String anchor;
private Locale locale;
@@ -126,7 +125,7 @@
*/
public UrlBuilder(Locale locale, Class<? extends ActionBean> beanType,
boolean isForPage) {
this(locale, isForPage);
- this.beanType = beanType;
+ this.baseUrl =
StripesFilter.getConfiguration().getActionResolver().getUrlBinding(beanType);
}
/**
@@ -345,22 +344,20 @@
}
/**
- * Get the base URL (without a query string). If an [EMAIL PROTECTED]
ActionBean} class was passed to
- * [EMAIL PROTECTED] #UrlBuilder(Locale, Class, boolean)}, then this
method will return the URL binding
- * that is mapped to that class, including any URI parameters that are
available. Otherwise, it
- * returns the URL string with which this object was initialized.
+ * Get the base URL (without a query string). If a [EMAIL PROTECTED]
UrlBinding} exists for the URL or
+ * [EMAIL PROTECTED] ActionBean} type that was passed into the
constructor, then this method will return
+ * the base URL after appending any URI parameters that have been added
with a call to
+ * [EMAIL PROTECTED] #addParameter(String, Object[])} or [EMAIL PROTECTED]
#addParameters(Map)}. Otherwise, it
+ * returns the original base URL.
*
* @return the base URL, without a query string
* @see #UrlBuilder(Locale, Class, boolean)
* @see #UrlBuilder(Locale, String, boolean)
*/
protected String getBaseURL() {
- if (beanType == null)
+ UrlBinding binding =
UrlBindingFactory.getInstance().getBindingPrototype(baseUrl);
+ if (binding == null || binding.getParameters().size() == 0) {
return baseUrl;
-
- UrlBinding binding =
UrlBindingFactory.getInstance().getBindingPrototype(beanType);
- if (binding == null) {
- return
StripesFilter.getConfiguration().getActionResolver().getUrlBinding(beanType);
}
Map<String, Parameter> map = new HashMap<String, Parameter>();
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development