Revision: 1013
          http://stripes.svn.sourceforge.net/stripes/?rev=1013&view=rev
Author:   bengunter
Date:     2008-11-26 18:50:32 +0000 (Wed, 26 Nov 2008)

Log Message:
-----------
Fixed STS-597, sort of. Because of the way the API works I added a 
parseUrlBinding(Class, String) instead of parseUrlBinding(String). A UrlBinding 
must be associated with an ActionBean class.

Modified Paths:
--------------
    trunk/stripes/src/net/sourceforge/stripes/controller/UrlBindingFactory.java

Modified: 
trunk/stripes/src/net/sourceforge/stripes/controller/UrlBindingFactory.java
===================================================================
--- trunk/stripes/src/net/sourceforge/stripes/controller/UrlBindingFactory.java 
2008-11-25 21:01:05 UTC (rev 1012)
+++ trunk/stripes/src/net/sourceforge/stripes/controller/UrlBindingFactory.java 
2008-11-26 18:50:32 UTC (rev 1013)
@@ -522,21 +522,35 @@
     }
 
     /**
-     * Parse a binding pattern and create a [EMAIL PROTECTED] UrlBinding} 
object.
+     * Look for a binding pattern for the given [EMAIL PROTECTED] ActionBean} 
class, specified by the
+     * [EMAIL PROTECTED] net.sourceforge.stripes.action.UrlBinding} 
annotation. If the annotation is found,
+     * create and return a [EMAIL PROTECTED] UrlBinding} object for the class. 
Otherwise, return null.
      * 
-     * @param beanType the [EMAIL PROTECTED] ActionBean} type whose binding is 
to be parsed
-     * @return a [EMAIL PROTECTED] UrlBinding}
-     * @throws ParseException if the pattern cannot be parsed
+     * @param beanType The [EMAIL PROTECTED] ActionBean} type whose binding is 
to be parsed
+     * @return A [EMAIL PROTECTED] UrlBinding} if one is specified, or null if 
not.
+     * @throws ParseException If the pattern cannot be parsed
      */
-    protected static UrlBinding parseUrlBinding(Class<? extends ActionBean> 
beanType) {
+    public static UrlBinding parseUrlBinding(Class<? extends ActionBean> 
beanType) {
         // check that class is annotated
         net.sourceforge.stripes.action.UrlBinding annotation = beanType
                 
.getAnnotation(net.sourceforge.stripes.action.UrlBinding.class);
         if (annotation == null)
             return null;
+        else
+            return parseUrlBinding(beanType, annotation.value());
+    }
 
+    /**
+     * Parse the binding pattern and create a [EMAIL PROTECTED] UrlBinding} 
object for the [EMAIL PROTECTED] ActionBean}
+     * class. If pattern is null or zero-length, then return null.
+     * 
+     * @param beanType The [EMAIL PROTECTED] ActionBean} type to be mapped to 
the pattern.
+     * @param pattern The URL binding pattern to parse.
+     * @return A [EMAIL PROTECTED] UrlBinding} or null if the pattern is null 
or zero-length
+     * @throws ParseException If the pattern cannot be parsed
+     */
+    public static UrlBinding parseUrlBinding(Class<? extends ActionBean> 
beanType, String pattern) {
         // check that value is not null or empty
-        String pattern = annotation.value();
         if (pattern == null || pattern.length() < 1)
             return null;
 
@@ -624,7 +638,7 @@
      * @return a parameter object
      * @throws ParseException if the pattern cannot be parsed
      */
-    protected static UrlBindingParameter parseUrlBindingParameter(
+    public static UrlBindingParameter parseUrlBindingParameter(
             Class<? extends ActionBean> beanClass, String string) {
         char[] chars = string.toCharArray();
         char c = 0;


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 the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development

Reply via email to