Project

General

Profile

Bug #2175

serving wt-resources with WtServlet

Added by Anonymous over 8 years ago. Updated about 8 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
-
Target version:
Start date:
09/04/2013
Due date:
% Done:

0%

Estimated time:

Description

Following a discussion with Koen on the ml, here is an issue to check if the WtServlet serves wt-resources correctly.

I had to implement it this way in Jruby:

    @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);
#1

Updated by Koen Deforche about 8 years ago

  • Status changed from New to Resolved
  • Assignee set to Koen Deforche
  • Target version set to 3.3.1

Hey,

The proper way to deploy the servlet should be using:

context.addServlet(holder, '/*')

In this way you don't need to deal with the wt-resources yourself as they will be handled by WtServlet too (not as files but as dynamic contents).

Regards,

koen

#2

Updated by Koen Deforche about 8 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF