Hey Raphael,

Actually for Wt's builtin resources (wt-resources), the WtServlet itself
would already serve the correct file instead of directing the request to
the 'application logic'.

So I would have expected that what you initially did should have worked
(it's only for your own style files that you need the setup that I
suggested).

Can you file a bug report to see if we can reproduce this and see why JWt
is not serving the correct resource file?

Regards,
koen


2013/9/4 Raphael Bauduin <rbli...@gmail.com>

> Hi Koen,
>
> thanks for your answer, it brought me to the following solution. I post it
> below in the case it can be useful to anyone else.
>
> I had to make the static resources available under the same prefix (when
> the servler holder was set to /app, the url of a static resource started
> with /app/wt-resources/)
>
> Cheers
>
> raph
>
>
>     @server = Server.new(8080)
>     #
>     # get external path for resources in jar
>
> static_content=@server.getClass().getClassLoader().getResource("eu/webtoolkit/jwt/wt-resources").toExternalForm()
>     # create a web context, and define where the resources will be
> available
>     # the prefix has to be the same as for the servlet holder below
>     web_context=WebAppContext.new(static_content, '/wt-resources')
>
>     context = ServletContextHandler.new(ServletContextHandler::SESSIONS)
>     context.addEventListener(ServletInit.new);
>
>     servlet = HelloMain.new()
>     holder = ServletHolder.new(servlet)
>     context.addServlet(holder, '/')
>
>     handler_list= HandlerList.new
>     handler_list.setHandlers([web_context,context])
>     @server.setHandler(handler_list);
>
>
>
>
> On Mon, Sep 2, 2013 at 9:51 AM, Koen Deforche <k...@emweb.be> wrote:
>
>> Hey Raphael,
>>
>> 2013/8/29 Raphael Bauduin <rbli...@gmail.com>
>>
>>> Hi,
>>>
>>> I'm using JWt with Jruby and Jetty.
>>> I'm initialising my app with this code:
>>>
>>>     @server = Server.new(8080)
>>>     context = ServletContextHandler.new(ServletContextHandler::SESSIONS)
>>>     context.setContextPath("/");
>>>     context.addEventListener(ServletInit.new);
>>>     @server.setHandler(context);
>>>
>>>     servlet = HelloMain.new()
>>>     holder = ServletHolder.new(servlet)
>>>     context.addServlet(holder, '/')
>>>     @server.start
>>>
>>> A request is sent for
>>> http://localhost:8080/wt-resources/themes/default/wt.css , but the
>>> response received is html:
>>>
>>>
>> You are getting the response from the application servlet, rather than
>> for a static resource. That's because you configure jetty to let the
>> servlet handle all requests under "/".
>>
>> You need to either explain Jetty to give priority to static files (I'm
>> not sure if that can be done), or deploy the application at a more specific
>> path (e.g. addServlet(holder, "/app/*")).
>>
>> Regards,
>> koen
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
>> Discover the easy way to master current and previous Microsoft
>> technologies
>> and advance your career. Get an incredible 1,500+ hours of step-by-step
>> tutorial videos with LearnDevNow. Subscribe today and save!
>>
>> http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk
>> _______________________________________________
>> witty-interest mailing list
>> witty-interest@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/witty-interest
>>
>>
>
>
> --
> Web database: http://www.myowndb.com
> Free Software Developers Meeting: http://www.fosdem.org
>
>
> ------------------------------------------------------------------------------
> Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
> Discover the easy way to master current and previous Microsoft technologies
> and advance your career. Get an incredible 1,500+ hours of step-by-step
> tutorial videos with LearnDevNow. Subscribe today and save!
> http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk
> _______________________________________________
> witty-interest mailing list
> witty-interest@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/witty-interest
>
>
------------------------------------------------------------------------------
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk
_______________________________________________
witty-interest mailing list
witty-interest@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/witty-interest

Reply via email to