Pessoal estou usando o Vraptor jpa etc. a dúvida é a seguinte tenho um interceptor ele esta funcionando legal, não deixa ir para as outras paginas se nao estiver logado, porem da um erro no console e gostaria de resolver. Toda vez que clico em uma URL para ir para uma outra lógica aparece esse erro.
09:06:27,205 DEBUG [DefaultLogicResult ] redirecting to class UsuariosController
09:06:27,205 DEBUG [CglibProxifier ] a proxy for class br.com.dental.controller.UsuariosController is created as class br.com.dental.controller.UsuariosController$$EnhancerByCGLIB$$3b30d6f4
09:06:27,206 DEBUG [DefaultLogicResult ] redirecting to /dental/login
09:06:27,225 DEBUG [DefaultLogicResult ] redirecting to class UsuariosController
09:06:27,226 DEBUG [CglibProxifier ] a proxy for class br.com.dental.controller.UsuariosController is created as class br.com.dental.controller.UsuariosController$$EnhancerByCGLIB$$3b30d6f4
09:06:27,226 DEBUG [DefaultLogicResult ] redirecting to /dental/login
09:06:27,227 DEBUG [DefaultLogicResult ] redirecting to class UsuariosController
09:06:27,228 DEBUG [CglibProxifier ] a proxy for class br.com.dental.controller.UsuariosController is created as class br.com.dental.controller.UsuariosController$$EnhancerByCGLIB$$3b30d6f4
09:06:27,228 DEBUG [DefaultLogicResult ] redirecting to /dental/login
Mar 15, 2012 9:06:27 AM org.apache.catalina.core.StandardWrapperValve invoke
Grave: Servlet.service() for servlet [default] in context with path [/dental] threw exception
java.lang.IllegalStateException: Cannot call sendRedirect() after the response has been committed
at org.apache.catalina.connector.ResponseFacade.sendRedirect(ResponseFacade.java:473)
at javax.servlet.http.HttpServletResponseWrapper.sendRedirect(HttpServletResponseWrapper.java:138)
at br.com.caelum.vraptor.http.VRaptorResponse.sendRedirect(VRaptorResponse.java:46)
at br.com.caelum.vraptor.view.DefaultLogicResult$2.intercept(DefaultLogicResult.java:132)
at br.com.caelum.vraptor.proxy.CglibProxifier$2.intercept(CglibProxifier.java:95)
at br.com.dental.controller.UsuariosController$$EnhancerByCGLIB$$3b30d6f4.loginForm(<generated>)
at br.com.dental.interceptor.LoginInterceptor.intercept(LoginInterceptor.java:35)
at br.com.caelum.vraptor.core.ToInstantiateInterceptorHandler.execute(ToInstantiateInterceptorHandler.java:54)
at br.com.caelum.vraptor.core.DefaultInterceptorStack.next(DefaultInterceptorStack.java:54)
at br.com.caelum.vraptor.interceptor.InstantiateInterceptor.intercept(InstantiateInterceptor.java:48)
at br.com.caelum.vraptor.core.ToInstantiateInterceptorHandler.execute(ToInstantiateInterceptorHandler.java:54)
at br.com.caelum.vraptor.core.DefaultInterceptorStack.next(DefaultInterceptorStack.java:54)
at br.com.caelum.vraptor.interceptor.FlashInterceptor.intercept(FlashInterceptor.java:83)
at br.com.caelum.vraptor.core.ToInstantiateInterceptorHandler.execute(ToInstantiateInterceptorHandler.java:54)
at br.com.caelum.vraptor.core.DefaultInterceptorStack.next(DefaultInterceptorStack.java:54)
at br.com.caelum.vraptor.interceptor.ParametersInstantiatorInterceptor.intercept(ParametersInstantiatorInterceptor.java:87)
at br.com.caelum.vraptor.core.LazyInterceptorHandler.execute(LazyInterceptorHandler.java:59)
at br.com.caelum.vraptor.core.DefaultInterceptorStack.next(DefaultInterceptorStack.java:54)
at br.com.caelum.vraptor.interceptor.ExceptionHandlerInterceptor.intercept(ExceptionHandlerInterceptor.java:71)
at br.com.caelum.vraptor.core.ToInstantiateInterceptorHandler.execute(ToInstantiateInterceptorHandler.java:54)
at br.com.caelum.vraptor.core.DefaultInterceptorStack.next(DefaultInterceptorStack.java:54)
at br.com.caelum.vraptor.interceptor.ResourceLookupInterceptor.intercept(ResourceLookupInterceptor.java:69)
at br.com.caelum.vraptor.core.ToInstantiateInterceptorHandler.execute(ToInstantiateInterceptorHandler.java:54)
at br.com.caelum.vraptor.core.DefaultInterceptorStack.next(DefaultInterceptorStack.java:54)
at br.com.caelum.vraptor.core.ToInstantiateInterceptorHandler.execute(ToInstantiateInterceptorHandler.java:56)
at br.com.caelum.vraptor.core.DefaultInterceptorStack.next(DefaultInterceptorStack.java:54)
at br.com.caelum.vraptor.core.EnhancedRequestExecution.execute(EnhancedRequestExecution.java:44)
at br.com.caelum.vraptor.VRaptor$1.insideRequest(VRaptor.java:92)
at br.com.caelum.vraptor.ioc.spring.SpringProvider.provideForRequest(SpringProvider.java:58)
at br.com.caelum.vraptor.VRaptor.doFilter(VRaptor.java:89)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:405)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:964)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:515)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:304)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
meu interceptor esta assim:
package br.com.dental.interceptor;
import br.com.caelum.vraptor.InterceptionException;
import br.com.caelum.vraptor.Intercepts;
import br.com.caelum.vraptor.Result;
import br.com.caelum.vraptor.core.InterceptorStack;
import br.com.caelum.vraptor.interceptor.Interceptor;
import br.com.caelum.vraptor.resource.ResourceMethod;
import br.com.dental.controller.UsuariosController;
import br.com.dental.usuario.UsuarioWeb;
@Intercepts
public class LoginInterceptor implements Interceptor {
private UsuarioWeb usuarioWeb;
private Result result;
public LoginInterceptor(UsuarioWeb usuarioWeb, Result result){
this.usuarioWeb = usuarioWeb;
this.result = result;
}
public void intercept(InterceptorStack stack, ResourceMethod method,
Object instance) throws InterceptionException {
if(usuarioWeb.getLogado() != null){
stack.next(method, instance);
}else{
}
result.redirectTo(UsuariosController.class).loginForm();
}
public boolean accepts(ResourceMethod method) {
//ResourceClass resource = method.getResource();
return true;// !resource.getType().isAssignableFrom(UsuariosController.class);
}
}
vlw