Hi there,

I have an issue with the current implementation of SEO friendly urls in the 
trunk. Assume the following two Action Bean Urls:

@UrlBinding(value = "/foo/bar/{id}/fileName.htm")
private class SimpleUrl3 implements ActionBean{}

@UrlBinding(value = "/foo/bar/{id}/fileName2.htm")
private class SimpleUrl4 implements ActionBeanActionBean{}

When I now use the link tag to link to any of the action Beans the result is 
unpredicable. It happens that links to:

<stripes:link beanclass="SimpleUrl4"><stripes:param name="id" value="${id}" 
/>link</stripes:link>

results in the following url /foo/bar/id/fileName.htm (which is the url of 
SimpleUrl3 not SimpleUrl4).

See the attached testcase (jUnit, I never used TestNG before...): the url, 
returned by AnnotatedClassActionResolver is always the
same for SimpleUrl3 and SimpleUrl4. So I guess we need some changes in how the 
UrlBindingFactory returns the url and in how the
LinkTagSupport constructs the complete urls...

Any proposals on how to changes this?

btw: It would be no problem for me to check my testcase into SVN, if I only had 
commit rights ;-)

Regards

Kai

import junit.framework.Assert;
import junit.framework.TestCase;
import net.sourceforge.stripes.action.ActionBean;
import net.sourceforge.stripes.action.ActionBeanContext;
import net.sourceforge.stripes.action.UrlBinding;
import net.sourceforge.stripes.controller.AnnotatedClassActionResolver;

/**
 * Tests for correct handling of action bean url annotations
 *
 * @author Kai Grabfelder ([EMAIL PROTECTED])
 */
public class NameBasedActionResolverTest extends TestCase{
    private AnnotatedClassActionResolver resolver = new 
AnnotatedClassActionResolver();

    
    public void testWithAnnotatedClass() {
        String binding = this.resolver.getUrlBinding(SimpleUrl.class);
        Assert.assertEquals("/foo.do", binding);
        binding = this.resolver.getUrlBinding(SimpleUrl2.class);
        Assert.assertEquals("/foo2.do", binding);
        binding = this.resolver.getUrlBinding(SimpleUrl3.class);
        Assert.assertEquals("/foo/bar", binding);
        
        binding = this.resolver.getUrlBinding(SimpleUrl3.class);
        Assert.assertFalse(binding.equals("/foo/bar"));
        binding = this.resolver.getUrlBinding(SimpleUrl4.class);
        Assert.assertFalse(binding.equals("/foo/bar"));
    }
    
    @UrlBinding(value = "/foo.do")
    private class SimpleUrl extends AbstractTestActionBean{}
    
    @UrlBinding(value = "/foo2.do")
    private class SimpleUrl2 extends AbstractTestActionBean{}
    
    @UrlBinding(value = "/foo/bar/{id}/fileName.htm")
    private class SimpleUrl3 extends AbstractTestActionBean{}
    
    @UrlBinding(value = "/foo/bar/{id}/fileName2.htm")
    private class SimpleUrl4 extends AbstractTestActionBean{}
    
    private abstract class AbstractTestActionBean implements ActionBean{

                public ActionBeanContext getContext() {
                        return null;
                }

                public void setContext(ActionBeanContext context) {
                        
                }
    
    }
}

-------------------------------------------------------------------------
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

Reply via email to