How to remove the file suffix/extension (.jsp and .action) using the Stripes Framework?
Posted
by Dolph Mathews
on Stack Overflow
See other posts from Stack Overflow
or by Dolph Mathews
Published on 2010-02-16T02:14:19Z
Indexed on
2010/04/29
1:37 UTC
Read the original article
Hit count: 369
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
?
© Stack Overflow or respective owner