The only way I've been able to do it is to extend Configuration, override
initExceptionHandler, and use static bean lookup. Our configuration overrides
many other init methods to lookup spring beans.
With the coming stripes 1.6 object factory all this goes away and it's pure and
simple... can't wait for that =)
From: Andy [mailto:[email protected]]
Sent: Tuesday, July 14, 2009 10:10 AM
To: [email protected]
Subject: [Stripes-users] Exception Handler and Spring
Hi, I created an exception handler and would like to inject a spring bean
(errorService) so that I can log the error. I am currently using the
stripes-spring.jar. Is it possible to make the exception handler spring
managed? http://www.silvermindsoftware.com/stripes/??
Thanks
Andy
import net.sourceforge.stripes.exception.ExceptionHandler;
import net.sourceforge.stripes.config.Configuration;
import net.sourceforge.stripes.action.RedirectResolution;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.ServletException;
import java.io.IOException;
public class MyExceptionHandler implements ExceptionHandler {
public void init(Configuration configuration) throws Exception {
}
public void handle(Throwable throwable, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
new RedirectResolution("/content/jsp/error.jsp").execute(request,
response);
}
}
________________________________
Hotmail(r) has ever-growing storage! Don't worry about storage limits. Check it
out.<http://windowslive.com/Tutorial/Hotmail/Storage?ocid=TXT_TAGLM_WL_HM_Tutorial_Storage_062009>
------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users