Alguem jà tem desenvolvido alguma aplicação com vraptor3 ?
estou com um problema que não consigo resolver … cuando o metodo save é executado a classe não consigue ser redireciona pelo controller alguen tem uma ideia de como solucionar o problema…
package br.eg.collabcomponent.coord.userMgr;
import static br.com.caelum.vraptor.view.Results.logic;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import br.com.caelum.vraptor.Delete;
import br.com.caelum.vraptor.Get;
import br.com.caelum.vraptor.Path;
import br.com.caelum.vraptor.Post;
import br.com.caelum.vraptor.Resource;
import br.com.caelum.vraptor.Result;
import br.com.caelum.vraptor.ioc.RequestScoped;
import br.eg.componentFramework.controller.ComponentFrameworks;
@RequestScoped
@Resource
public class UserMgrController{
private UserMgrInstance userMgr;
private Result result;
//private HttpServletRequest request;
public UserMgrController(Result result, HttpServletRequest request) throws Exception {
this.result = result;
//String idToolInstance = request.getParameter("idToolInstance");
System.out.println(request.getParameter("idToolInstance"));
//this.userMgr = componentFrameworks.getCollabCF();
}
/*
* This is a basic operation set: list (to show items), edit (to view for edit) save (to create and to update), and remove (to delete)
*/
@Get
@Path(value="/groupware-api/{idToolInstance}/userMgr")
public List<User> list(String idToolInstance) throws Exception {
this.userMgr = (UserMgrInstance) ComponentFrameworks.getToolCF().getComponentInstance(idToolInstance).getCollabComponentInstance(UserMgrInstance.class);
result.include("toolInstance", ComponentFrameworks.getToolCF().getComponentInstance(idToolInstance));
return (List<User>) this.userMgr.findAll();
}
@Get
@Path(value="/groupware-api/{idToolInstance}/userMgr/{user.id}")
public User show(User user,String idToolInstance) throws Exception{
this.userMgr = (UserMgrInstance) ComponentFrameworks.getToolCF().getComponentInstance(idToolInstance).getCollabComponentInstance(UserMgrInstance.class);
result.include("toolInstance", ComponentFrameworks.getToolCF().getComponentInstance(idToolInstance));
if ((user!=null)&&(user.getId()!=0)) {
return this.userMgr.find(user.getId()+"");
} else {
return new User();
}
}
@Post
@Path(value="/groupware-api/{idToolInstance}/userMgr")
public void save(User user,String idToolInstance) throws Exception{
this.userMgr = (UserMgrInstance) ComponentFrameworks.getToolCF().getComponentInstance(idToolInstance).getCollabComponentInstance(UserMgrInstance.class);
this.userMgr.save(user);
//result.include("contextPath", request.getContextPath());
result.use(logic()).redirectTo(UserMgrController.class).list(idToolInstance);
}
@Delete
@Path(value="/groupware-api/{idToolInstance}/userMgr/{user.id}")
public void remove(User user,String idToolInstance) throws Exception{
this.userMgr = (UserMgrInstance) ComponentFrameworks.getToolCF().getComponentInstance(idToolInstance).getCollabComponentInstance(UserMgrInstance.class);
this.userMgr.delete(user.getId());
//result.include("contextPath", request.getContextPath());
result.use(logic()).redirectTo(UserMgrController.class).list(idToolInstance);
}
}
Aug 17, 2009 10:22:34 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet default threw exception
br.com.caelum.vraptor.InterceptionException: br.com.caelum.vraptor.proxy.ProxyCreationException: Tried to instantiate type: class br.eg.collabcomponent.coord.userMgr.UserMgrController 1 times, but none of the attempts worked. The exceptions are: [net.sf.cglib.core.CodeGenerationException: java.lang.NullPointerException–>null]
at br.com.caelum.vraptor.interceptor.ExecuteMethodInterceptor.intercept(ExecuteMethodInterceptor.java:76)
at br.com.caelum.vraptor.core.ToInstantiateInterceptorHandler.execute(ToInstantiateInterceptorHandler.java:57)
at br.com.caelum.vraptor.core.DefaultInterceptorStack.next(DefaultInterceptorStack.java:71)
at br.com.caelum.vraptor.interceptor.ParametersInstantiatorInterceptor.intercept(ParametersInstantiatorInterceptor.java:96)
at br.com.caelum.vraptor.core.ToInstantiateInterceptorHandler.execute(ToInstantiateInterceptorHandler.java:57)
at br.com.caelum.vraptor.core.DefaultInterceptorStack.next(DefaultInterceptorStack.java:71)
at br.com.caelum.vraptor.interceptor.InstantiateInterceptor.intercept(InstantiateInterceptor.java:55)
at br.com.caelum.vraptor.core.InstantiatedInterceptorHandler.execute(InstantiatedInterceptorHandler.java:51)
at br.com.caelum.vraptor.core.DefaultInterceptorStack.next(DefaultInterceptorStack.java:71)
at br.com.caelum.vraptor.interceptor.multipart.MultipartInterceptor.intercept(MultipartInterceptor.java:61)
at br.com.caelum.vraptor.core.ToInstantiateInterceptorHandler.execute(ToInstantiateInterceptorHandler.java:57)
at br.com.caelum.vraptor.core.DefaultInterceptorStack.next(DefaultInterceptorStack.java:71)
at br.com.caelum.vraptor.interceptor.InterceptorListPriorToExecutionExtractor.intercept(InterceptorListPriorToExecutionExtractor.java:59)
at br.com.caelum.vraptor.core.ToInstantiateInterceptorHandler.execute(ToInstantiateInterceptorHandler.java:57)
at br.com.caelum.vraptor.core.DefaultInterceptorStack.next(DefaultInterceptorStack.java:71)
at br.com.caelum.vraptor.core.URLParameterExtractorInterceptor.intercept(URLParameterExtractorInterceptor.java:45)
at br.com.caelum.vraptor.core.ToInstantiateInterceptorHandler.execute(ToInstantiateInterceptorHandler.java:57)
at br.com.caelum.vraptor.core.DefaultInterceptorStack.next(DefaultInterceptorStack.java:71)
at br.com.caelum.vraptor.interceptor.ResourceLookupInterceptor.intercept(ResourceLookupInterceptor.java:71)
at br.com.caelum.vraptor.core.ToInstantiateInterceptorHandler.execute(ToInstantiateInterceptorHandler.java:57)
at br.com.caelum.vraptor.core.DefaultInterceptorStack.next(DefaultInterceptorStack.java:71)
at br.com.caelum.vraptor.core.DefaultRequestExecution.execute(DefaultRequestExecution.java:71)
at br.com.caelum.vraptor.VRaptor$1.insideRequest(VRaptor.java:99)
at br.com.caelum.vraptor.ioc.pico.PicoProvider.provideForRequest(PicoProvider.java:140)
at br.com.caelum.vraptor.VRaptor.doFilter(VRaptor.java:97)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:636)
Caused by: br.com.caelum.vraptor.proxy.ProxyCreationException: Tried to instantiate type: class br.eg.collabcomponent.coord.userMgr.UserMgrController 1 times, but none of the attempts worked. The exceptions are: [net.sf.cglib.core.CodeGenerationException: java.lang.NullPointerException–>null]
at br.com.caelum.vraptor.proxy.DefaultProxifier.tryAllConstructors(DefaultProxifier.java:112)
at br.com.caelum.vraptor.proxy.DefaultProxifier.useCGLib(DefaultProxifier.java:60)
at br.com.caelum.vraptor.proxy.DefaultProxifier.proxify(DefaultProxifier.java:41)
at br.com.caelum.vraptor.view.DefaultLogicResult.redirectTo(DefaultLogicResult.java:108)
at br.eg.collabcomponent.coord.userMgr.UserMgrController.save(UserMgrController.java:71)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at br.com.caelum.vraptor.interceptor.ExecuteMethodInterceptor.intercept(ExecuteMethodInterceptor.java:60)
… 36 more