Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-4350

Add more programmatic support for web app construction via servlet 3.0

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 1.5.4, 6.0.0-beta1
    • 1.5.5, 6.0.0-beta1
    • wicket
    • None

    Description

      Since servlet 3.0 web applications can be set up completely in code.

      To support this kind of setup wicket should

      • support the manual assignment of an web application instance to WicketFilter
      • support setting the runtime configuration type in WebApplication programmtically through a setter instead of reading web.xml

      sample code for demonstrating the use case:

      public class AppContextListener implements ServletContextListener
      {
      private GuiceContext guiceContext;

      @Override
      public void contextInitialized(ServletContextEvent sce)

      { // create configuration final AppConfig configuration = new WebAppConfig(); // setup guice guiceContext = new GuiceContext(configuration); // create injector final Injector injector = guiceContext.createInjector(); // create wicket application WebApplication application = injector.getInstance(WebApplication.class); application.setConfigurationType(RuntimeConfigurationType.DEVELOPMENT); // create wicket filter WicketFilter filter = new WicketFilter(application); filter.setFilterPath(""); // dynamically add wicket filter final FilterRegistration.Dynamic wicket = sce.getServletContext().addFilter("wicket", filter); // add filter mapping for path '/' wicket.addMappingForUrlPatterns(EnumSet.allOf(DispatcherType.class), true, "/*"); }

      // ...
      }

      Attachments

        1. Initializer.java
          1 kB
          Martin Tzvetanov Grigorov
        2. Start.java
          2 kB
          Martin Tzvetanov Grigorov
        3. javax.servlet.ServletContainerInitializer
          0.0 kB
          Martin Tzvetanov Grigorov

        Activity

          People

            pete Peter Ertl
            pete Peter Ertl
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: