Convertendo um aplicativo Stripes para usar URLs amigáveis
Estou trabalhando no livro Stripes de Fred Daoud e tentando converter o aplicativo Hello World para usar URLs amigáveis, pois não sou muito fã de mapeamentos baseados em sufixos comohttp: // localhost: 8080 / getting_started / Hello.action.
Aqui está o antes ...
index.jsp:
<jsp:forward page="/Hello.action"/>
web.xml:
<servlet-mapping>
<servlet-name>DispatcherServlet</servlet-name>
<url-pattern>*.action</url-pattern>
</servlet-mapping>
e não tenho UrlBinding no meu HelloActionBean. Eu tenho o exemplo de livro funcionand
Estou imaginando se os exemplos de livros podem se adequar a uma versão anterior do Stripes, pois baixei a versão 1.5.1 e meu web.xml define o StripesFilter e StripesDispatcher, enquanto eu vi um DynamicMappingFilter usado em outro lugar, por exemplo. dentroEste artig por Fred no TheServerSid
e qualquer forma, fiz as seguintes alterações:
index.jsp:
<jsp:forward page="/hello"/>
web.xml:
<servlet-mapping>
<servlet-name>DispatcherServlet</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
HelloActionBean.java:
**@UrlBinding("/hello")**
public class HelloActionBean implements ActionBean
{
No entanto, quando tento carregar o aplicativo através dehttp: // localhost: 8080 / getting_started Vejo isso:
net.sourceforge.stripes.exception.ActionBeanNotFoundException: Could not locate an ActionBean that is bound to the URL [/]. Commons reasons for this include mis-matched URLs and forgetting to implement ActionBean in your class. Registered ActionBeans are: {/hello=class stripesbook.action.HelloActionBean, /controller/DefaultView.action=class net.sourceforge.stripes.controller.DefaultViewActionBean, /hello/=class stripesbook.action.HelloActionBean, /controller/DefaultView.action/=class net.sourceforge.stripes.controller.DefaultViewActionBean}
at net.sourceforge.stripes.controller.AnnotatedClassActionResolver.getActionBean(AnnotatedClassActionResolver.java:341)
e se eu acessá-lo através dehttp: // localhost: 8080 / getting_started / hello o servidor parece entrar em um loop, lançando uma exceção após a outr
Qualquer sugestão apreciada - obrigado.