Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Embedded Jetty and Wicket

Looks good.  Does it work?


On 8 September 2010 08:26, David Ehrmann <ehrmann@xxxxxxxxx> wrote:
> I finally figured it out:
>                   ServletHolder servletHolder = new ServletHolder(new
> WicketServlet());
>           servletHolder.setInitParameter("applicationClassName",
> MyWebApplication.class.getName());
>
>           ServletContextHandler servletContextHandler = new
> ServletContextHandler(ServletContextHandler.SESSIONS);
>           servletContextHandler.setContextPath("/");
>           servletContextHandler.addServlet(servletHolder, "/*");
>
>           server.setHandler(servletContextHandler);
>                     server.start();
>                     server.join();
>
> Let me know if I missed something.
>
> Philip Healy wrote:
>>
>> Hi David,
>>
>>  I can't help you there I'm afraid, maybe one of the Jetty devs can
>> suggest something?
>>
>> Regards,
>> Philip
>>
>>
>> On 7 September 2010 17:16, David Ehrmann <ehrmann@xxxxxxxxx> wrote:
>>
>>>
>>> Any idea on how to do this in Jetty 7?  None of the Context classes
>>> have a three-argument constructor.
>>>
>>>
>>> http://download.eclipse.org/jetty/stable-7/apidocs/org/eclipse/jetty/server/handler/ContextHandler.Context.html
>>>
>>> On Mon, Sep 6, 2010 at 9:04 AM, Philip Healy <philip.healy@xxxxxxxxx>
>>> wrote:
>>>
>>>>
>>>> Hi David,
>>>>
>>>>  I used the code below for Wicket 1.3.0 and Jetty 6.1.3.  I haven't
>>>> used Wicket for a while so this may not apply to newer versions.
>>>> Replace "WebApplication.class.getCanonicalName()" with the class name
>>>> of your Wicket app.
>>>>
>>>> Regards,
>>>> Philip
>>>>
>>>> Server httpServer = new Server(8080);
>>>> Context context = new Context(httpServer, "/", Context.SESSIONS);
>>>> ServletHolder servletHolder = new ServletHolder(new WicketServlet());
>>>> servletHolder.setInitParameter("applicationClassName",
>>>> WebApplication.class.getCanonicalName());
>>>> context.addServlet(servletHolder, "/*");
>>>> httpServer.start();
>>>> httpServer.join();
>>>>
>>>>
>>>>
>>>> On 5 September 2010 07:04, David Ehrmann <ehrmann@xxxxxxxxx> wrote:
>>>>
>>>>>
>>>>> How can I get Wicket to run under embedded Jetty?  Wicket works by
>>>>> setting
>>>>> up web.xml to send all requests to the WicketFilter.  I tried this, but
>>>>> in
>>>>> WicketFilter, getServletContext() returns null:
>>>>>
>>>>> Server server = new Server(8080);
>>>>> ...
>>>>>          ServletHandler foo = new ServletHandler();
>>>>>          FilterHolder filterHolder = new FilterHolder();
>>>>>          filterHolder.setFilter(new WicketFilter());
>>>>>          filterHolder.setInitParameter("applicationClassName",
>>>>> MyApplication.class.getName());
>>>>>          filterHolder.setName("wicketFilter");
>>>>>          filterHolder.setServletHandler(foo);
>>>>>                    FilterMapping filterMapping = new FilterMapping();
>>>>>          filterMapping.setPathSpec("/*");
>>>>>          filterMapping.setFilterName("wicketFilter");
>>>>>                    foo.addFilter(filterHolder, filterMapping);
>>>>>          server.setHandler(foo);
>>>>>                    server.start();
>>>>>                    foo.initialize();
>>>>>                    server.join();
>>>>>
>>>>> Looking around, I found out that I'm not setting up a Context object,
>>>>> but
>>>>> this was with Jetty 6, and I'm not sure how I'd associate the context
>>>>> with
>>>>> that specific FilterHandler.
>>>>> _______________________________________________
>>>>> jetty-users mailing list
>>>>> jetty-users@xxxxxxxxxxx
>>>>> https://dev.eclipse.org/mailman/listinfo/jetty-users
>>>>>
>>>>>
>>>>
>>>> _______________________________________________
>>>> jetty-users mailing list
>>>> jetty-users@xxxxxxxxxxx
>>>> https://dev.eclipse.org/mailman/listinfo/jetty-users
>>>>
>>>>
>>>
>>> _______________________________________________
>>> jetty-users mailing list
>>> jetty-users@xxxxxxxxxxx
>>> https://dev.eclipse.org/mailman/listinfo/jetty-users
>>>
>>>
>>
>> _______________________________________________
>> jetty-users mailing list
>> jetty-users@xxxxxxxxxxx
>> https://dev.eclipse.org/mailman/listinfo/jetty-users
>>
>
> _______________________________________________
> jetty-users mailing list
> jetty-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/jetty-users
>


Back to the top