I'm looking to use pretty / clean URL's in my web app.
I would like the following URL:
http://mydomain.com/myapp/calculator
.. to resolve to:
com.mydomain.myapp.action.CalculatorActionBean
I tried overwriting the NameBasedActionResolver with:
public class CustomActionResolver extends NameBasedActionResolver {
public static final String DEFAULT_BINDING_SUFFIX = ".";
@Override
protected String getBindingSuffix() {
return DEFAULT_BINDING_SUFFIX;
}
@Override
protected List<String> getActionBeanSuffixes() {
List<String> suffixes = new ArrayList<String>(super.getActionBeanSuffixes());
suffixes.add(DEFAULT_BINDING_SUFFIX);
return suffixes;
}
}
And adding this to web.xml
:
<servlet-mapping>
<servlet-name>StripesDispatcher</servlet-name>
<url-pattern>*.</url-pattern>
</servlet-mapping>
Which gets me to:
http://mydomain.com/myapp/Calculator.
But:
- A stray "." is still neither pretty nor clean.
- The class name is still capitalized in the URL..?
- That still leaves me with
*.jsp
..? Is it even possible to get rid of both.action
and.jsp
?