I just found that for this use case, I can use spring directly from
the servlet:
ServletContext servletContext =this.getServletContext();
WebApplicationContext ctx =
WebApplicationContextUtils
.getRequiredWebApplicationContext(servletContext);
UserDAO dao = (UserDAO)ctx.getBean( "userDao" );
thanks
ryan
On Dec 6, 2008, at 11:24 AM, Ryan McKinley wrote:
Hello-
Any advice on how to get the Application from a non-wicket servlet?
I have the session filter working well, so I can get the user
session. However, I only store the name in the sesion, and in the
session class call:
public User getUser()
{
if( userName != null ) {
UserDAO dao = ((BaseApplication) getApplication()).getUserDao();
return dao.fetch( userName );
}
return null;
}
That gives me an error:
org.apache.wicket.WicketRuntimeException: There is no application
attached to current thread btpool0-1
at org.apache.wicket.Application.get(Application.java:177)
...
Any pointers on how to get around this? Is it possible to have the
WicketSessionFilter also bind the Application?
Thanks in advance! You guys are great.
ryan