It appears the mock app does quite some nasty things... this works: /** * */ public AbstractWebService() { Application.set(getApplication());
final ServletContext servletContext = getApplication().getServletContext(); final MockHttpSession mockHttpSession = new MockHttpSession(servletContext); final MockHttpServletRequest mockHttpServletRequest = new MockHttpServletRequest(Application.get(), mockHttpSession, servletContext); final MockHttpServletResponse servletResponse = new MockHttpServletResponse(mockHttpServletRequest); final WebRequest wicketRequest = getApplication().newWebRequest(mockHttpServletRequest); final WebResponse wicketResponse = getApplication().newWebResponse(servletResponse); getApplication().newRequestCycle(wicketRequest, wicketResponse); } 2012/11/8 Martin Makundi <martin.maku...@koodaripalvelut.com>: > BTW: Is useful to pass the context path... ;) > > 2012/11/7 Martin Makundi <martin.maku...@koodaripalvelut.com>: >> Solved, extend this class from your webservice or other: >> >> public abstract class AbstractWicketCompatibleWebService { >> private static Application application; // Set in Application() >> constructor for example >> private final MockWebApplication mockWebApplication; >> >> /** >> * >> */ >> public AbstractWicketCompatibleWebService() { >> Application.set(getApplication()); >> mockWebApplication = new MockWebApplication(getApplication(), null); >> mockWebApplication.createRequestCycle(); >> } >> >> /** >> * @return the application >> */ >> public static Application getApplication() { >> return application; >> } >> >> /** Call from Application() constructor for example >> * @param application >> */ >> public static void setApplication(Application application) { >> AbstractWicketCompatibleWebService.application = application; >> } >> } >> >> >> >> ** >> Martin >> >> 2012/9/19 Oscar Besga Arcauz <obe...@isdefe.es>: >>> Maybe if you do a foward from webservice to wicket page... >>> >>> From other side, you can see Wicket Session classes and data into the >>> normal HttpSession (thougth it needs a little navigation) >>> or you can hook data in normal HttpSession into wicket classes. >>> >>> My2cents: I would refactor helpers outside wicket >>> >>> >>> >>> > > > Oscar Besga Arcauz < < < >>> >>> -----Martin Grigorov <mgrigo...@apache.org> escribió: ----- >>> Para: users@wicket.apache.org >>> De: Martin Grigorov <mgrigo...@apache.org> >>> Fecha: 18/09/2012 21:42 >>> Asunto: Re: Wicket Application instance from outside Wicket Application >>> >>> See org.apache.wicket.protocol.http.servlet.WicketSessionFilter >>> >>> On Tue, Sep 18, 2012 at 9:31 PM, Ernesto Reinaldo Barreiro >>> <reier...@gmail.com> wrote: >>>> Can't the wicket filter be put in from of axis (servlet/filter) so that you >>>> have a session and application attached to the thread? >>>> >>>> On Tue, Sep 18, 2012 at 6:05 PM, Martin Makundi < >>>> martin.maku...@koodaripalvelut.com> wrote: >>>> >>>>> Hi! >>>>> >>>>> We have Axis web services running in the same Jetty as Wicket. >>>>> >>>>> Our Axis web services happen to call some wicket helper methods, which >>>>> assume there is a session and application on thread. For localization, >>>>> etc. >>>>> >>>>> How can our Wreb Service best get hold of the wicket application at >>>>> runtime? >>>>> >>>>> >>>>> ** >>>>> Martin >>>>> >>>>> --------------------------------------------------------------------- >>>>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org >>>>> For additional commands, e-mail: users-h...@wicket.apache.org >>>>> >>>>> >>>> >>>> >>>> -- >>>> Regards - Ernesto Reinaldo Barreiro >>>> Antilia Soft >>>> http://antiliasoft.com >>> >>> >>> >>> -- >>> Martin Grigorov >>> jWeekend >>> Training, Consulting, Development >>> http://jWeekend.com >>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org >>> For additional commands, e-mail: users-h...@wicket.apache.org >>> >>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org >>> For additional commands, e-mail: users-h...@wicket.apache.org >>> --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org