I have a legacy app that I am replacing with Wicket. It has to be done over time, so I can't do a wholesale rewrite of the app. I have Wicket as the "main" framework and my legacy, homemade framework will be the secondary. The few Wicket/Databinder pages that I have work pretty well. My legacy pages are data-oriented as well and I was planning on a partial rewrite of the legacy data tier to use Hibernate instead of pure JDBC.
My problem comes in when I try and access the Hibernate Session from my legacy data-tier. I call DataStaticService.getHibernateSession();, but I get this exception: [code] org.hibernate.HibernateException: No session currently bound to execution context at org.hibernate.context.ManagedSessionContext.currentSession(ManagedSessionContext.java:50) at org.hibernate.impl.SessionFactoryImpl.getCurrentSession(SessionFactoryImpl.java:542) at net.databinder.DataStaticService.getHibernateSession(DataStaticService.java:45) [/code] I know on the surface this looks like a Datbinder question, but I think it may be deeper than that. I believe I am getting this because the WicketFilter (and therefore the RequestCycle processing) isn't happening for my legacy pages. So I thought that I could write my own filter that would attempt to do the RequestCycle stuff, but I'm afraid it is currently a little overwhelming. Before I really dig in, does that seem to be a good approach? I am thinking that if I can use Wicket to somehow process the requests of my legacy app I can get the benefits of Wicket without having to rewrite everything upfront. When I made my first attempt at my own filter, it literally was a capture of the WicketFilter doGet method (with some minor mods. public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain chain) throws IOException, ServletException { HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest; HttpServletResponse httpServletResponse = (HttpServletResponse) servletResponse; String url = httpServletRequest.getRequestURI(); if (url.contains(".jsp")) { log.info("AIMSFilter.doFilter(): " + url); final WebApplication webApplication = (WebApplication) Application.get("aimsWicket"); // Create a new webrequest final WebRequest request = webApplication.newWebRequest(httpServletRequest); // First, set the webapplication for this thread Application.set(webApplication); // Get session for request final WebSession session = webApplication.getSession(request); RequestCycle cycle = RequestCycle.get(); if (cycle == null) { // Create a response object and set the output encoding according to // wicket's application setttings. final WebResponse response = webApplication.newWebResponse(httpServletResponse); response.setAjax(request.isAjax()); response.setCharacterEncoding(webApplication.getRequestCycleSettings().getResponseRequestEncoding()); try { cycle = session.newRequestCycle(request, response); try { // Process request cycle.request(); } catch (AbortException e) { // noop } } finally { // Close response response.close(); // Clean up thread local session Session.unset(); // Clean up thread local application Application.unset(); } } } chain.doFilter(servletRequest, servletResponse); } What ended up happening was the MainPage/getHomePage() class was included in the response. I'm not comepletely sure that that description is accurate because I don't have a lot of scenarios to test for proof, but that is what I see on the screen and that was the pageClass that I saw in DefaultResponseStrategy.respond on the requestCycle.getRequestTarget(). Ultimately, I want to be able to do similar processing that takes place for Wicket Pages when I request one of my legacy pages. Where should I even start? Thanks! Chuck -- View this message in context: http://www.nabble.com/Legacy-apps-tf2871064.html#a8024672 Sent from the Wicket - User mailing list archive at Nabble.com. ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user