2 redirect

Oi ta dando um erro quando vou fazer o segundo redirect, é normal isso? não posso mudar o redirect depois de ter chamado ele uma vez?

exemplo:

		//define um redirect
		result.redirectTo(this.getClass()).deleta();
		//executa uma lógica...
		//e altera o redirect para outra tela.
		result.redirectTo(this.getClass()).lista();

erro:


10:40:30,490 ERROR [STDERR] br.com.caelum.vraptor.InterceptionException: an exception was raised while executing resource method

10:40:30,491 ERROR [STDERR] 	at br.com.caelum.vraptor.interceptor.ExecuteMethodInterceptor.intercept(ExecuteMethodInterceptor.java:86)

10:40:30,491 ERROR [STDERR] 	at br.com.caelum.vraptor.core.ToInstantiateInterceptorHandler.execute(ToInstantiateInterceptorHandler.java:54)

10:40:30,494 ERROR [STDERR] 	at br.com.caelum.vraptor.core.DefaultInterceptorStack.next(DefaultInterceptorStack.java:65)

10:40:30,494 ERROR [STDERR] 	at br.com.caelum.vraptor.core.ToInstantiateInterceptorHandler.execute(ToInstantiateInterceptorHandler.java:56)

10:40:30,494 ERROR [STDERR] 	at br.com.caelum.vraptor.core.DefaultInterceptorStack.next(DefaultInterceptorStack.java:65)

10:40:30,494 ERROR [STDERR] 	at br.com.caelum.vraptor.interceptor.ParametersInstantiatorInterceptor.intercept(ParametersInstantiatorInterceptor.java:77)

10:40:30,494 ERROR [STDERR] 	at br.com.caelum.vraptor.core.ToInstantiateInterceptorHandler.execute(ToInstantiateInterceptorHandler.java:54)

10:40:30,494 ERROR [STDERR] 	at br.com.caelum.vraptor.core.DefaultInterceptorStack.next(DefaultInterceptorStack.java:65)

10:40:30,495 ERROR [STDERR] 	at br.com.caelum.vraptor.interceptor.InstantiateInterceptor.intercept(InstantiateInterceptor.java:42)

10:40:30,495 ERROR [STDERR] 	at br.com.caelum.vraptor.core.InstantiatedInterceptorHandler.execute(InstantiatedInterceptorHandler.java:47)

10:40:30,495 ERROR [STDERR] 	at br.com.caelum.vraptor.core.DefaultInterceptorStack.next(DefaultInterceptorStack.java:65)

10:40:30,495 ERROR [STDERR] 	at br.com.bistex.erp.web.interceptor.DefaultInterceptor.intercept(DefaultInterceptor.java:56)

10:40:30,495 ERROR [STDERR] 	at br.com.caelum.vraptor.core.InstantiatedInterceptorHandler.execute(InstantiatedInterceptorHandler.java:47)

10:40:30,495 ERROR [STDERR] 	at br.com.caelum.vraptor.core.DefaultInterceptorStack.next(DefaultInterceptorStack.java:65)

10:40:30,495 ERROR [STDERR] 	at br.com.bistex.erp.web.interceptor.AuthorizationInterceptor.intercept(AuthorizationInterceptor.java:75)

10:40:30,495 ERROR [STDERR] 	at br.com.caelum.vraptor.core.InstantiatedInterceptorHandler.execute(InstantiatedInterceptorHandler.java:47)

10:40:30,496 ERROR [STDERR] 	at br.com.caelum.vraptor.core.DefaultInterceptorStack.next(DefaultInterceptorStack.java:65)

10:40:30,496 ERROR [STDERR] 	at br.com.caelum.vraptor.interceptor.InterceptorListPriorToExecutionExtractor.intercept(InterceptorListPriorToExecutionExtractor.java:46)

10:40:30,496 ERROR [STDERR] 	at br.com.caelum.vraptor.core.ToInstantiateInterceptorHandler.execute(ToInstantiateInterceptorHandler.java:54)

10:40:30,496 ERROR [STDERR] 	at br.com.caelum.vraptor.core.DefaultInterceptorStack.next(DefaultInterceptorStack.java:65)

10:40:30,496 ERROR [STDERR] 	at br.com.caelum.vraptor.interceptor.FlashInterceptor.intercept(FlashInterceptor.java:81)

10:40:30,496 ERROR [STDERR] 	at br.com.caelum.vraptor.core.ToInstantiateInterceptorHandler.execute(ToInstantiateInterceptorHandler.java:54)

10:40:30,496 ERROR [STDERR] 	at br.com.caelum.vraptor.core.DefaultInterceptorStack.next(DefaultInterceptorStack.java:65)

10:40:30,496 ERROR [STDERR] 	at br.com.caelum.vraptor.interceptor.ResourceLookupInterceptor.intercept(ResourceLookupInterceptor.java:67)

10:40:30,497 ERROR [STDERR] 	at br.com.caelum.vraptor.core.ToInstantiateInterceptorHandler.execute(ToInstantiateInterceptorHandler.java:54)

10:40:30,509 ERROR [STDERR] 	at br.com.caelum.vraptor.core.DefaultInterceptorStack.next(DefaultInterceptorStack.java:65)

10:40:30,509 ERROR [STDERR] 	at br.com.caelum.vraptor.core.ToInstantiateInterceptorHandler.execute(ToInstantiateInterceptorHandler.java:56)

10:40:30,509 ERROR [STDERR] 	at br.com.caelum.vraptor.core.DefaultInterceptorStack.next(DefaultInterceptorStack.java:65)

10:40:30,509 ERROR [STDERR] 	at br.com.caelum.vraptor.core.DefaultRequestExecution.execute(DefaultRequestExecution.java:70)

10:40:30,518 ERROR [STDERR] 	at br.com.caelum.vraptor.VRaptor$1.insideRequest(VRaptor.java:92)

10:40:30,518 ERROR [STDERR] 	at br.com.caelum.vraptor.ioc.spring.SpringProvider.provideForRequest(SpringProvider.java:56)

10:40:30,518 ERROR [STDERR] 	at br.com.caelum.vraptor.VRaptor.doFilter(VRaptor.java:89)

10:40:30,518 ERROR [STDERR] 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:274)

10:40:30,518 ERROR [STDERR] 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:242)

10:40:30,518 ERROR [STDERR] 	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:276)

10:40:30,519 ERROR [STDERR] 	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)

10:40:30,519 ERROR [STDERR] 	at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:183)

10:40:30,519 ERROR [STDERR] 	at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:95)

10:40:30,519 ERROR [STDERR] 	at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)

10:40:30,519 ERROR [STDERR] 	at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)

10:40:30,519 ERROR [STDERR] 	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)

10:40:30,519 ERROR [STDERR] 	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)

10:40:30,519 ERROR [STDERR] 	at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)

10:40:30,519 ERROR [STDERR] 	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)

10:40:30,520 ERROR [STDERR] 	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368)

10:40:30,520 ERROR [STDERR] 	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:872)

10:40:30,520 ERROR [STDERR] 	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:653)

10:40:30,520 ERROR [STDERR] 	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:951)

10:40:30,520 ERROR [STDERR] 	at java.lang.Thread.run(Unknown Source)

10:40:30,520 ERROR [STDERR] Caused by: java.lang.IllegalStateException

10:40:30,521 ERROR [STDERR] 	at org.apache.catalina.connector.ResponseFacade.sendRedirect(ResponseFacade.java:436)

10:40:30,521 ERROR [STDERR] 	at javax.servlet.http.HttpServletResponseWrapper.sendRedirect(HttpServletResponseWrapper.java:170)

10:40:30,521 ERROR [STDERR] 	at br.com.caelum.vraptor.http.VRaptorResponse.sendRedirect(VRaptorResponse.java:46)

10:40:30,521 ERROR [STDERR] 	at br.com.caelum.vraptor.view.DefaultLogicResult$2.intercept(DefaultLogicResult.java:122)

10:40:30,522 ERROR [STDERR] 	at br.com.caelum.vraptor.proxy.AbstractCglibProxifier$2.intercept(AbstractCglibProxifier.java:56)

10:40:30,522 ERROR [STDERR] 	at br.com.bistex.erp.web.controller.core.PaisController$$EnhancerByCGLIB$$e5284efc.lista(<generated>)

10:40:30,522 ERROR [STDERR] 	at br.com.bistex.erp.web.controller.core.PaisController.remove(PaisController.java:133)

10:40:30,522 ERROR [STDERR] 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

10:40:30,522 ERROR [STDERR] 	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

10:40:30,522 ERROR [STDERR] 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

10:40:30,522 ERROR [STDERR] 	at java.lang.reflect.Method.invoke(Unknown Source)

10:40:30,523 ERROR [STDERR] 	at br.com.caelum.vraptor.interceptor.ExecuteMethodInterceptor.intercept(ExecuteMethodInterceptor.java:57)

qdo vc chama o redirectTo, o vraptor já executa o redirecionamento… então não dá pra chamar ele duas vezes…

vc deveria chamar o redirectTo só no final da sua lógica