Example usage for org.apache.wicket.protocol.http WicketFilter FILTER_MAPPING_PARAM

List of usage examples for org.apache.wicket.protocol.http WicketFilter FILTER_MAPPING_PARAM

Introduction

In this page you can find the example usage for org.apache.wicket.protocol.http WicketFilter FILTER_MAPPING_PARAM.

Prototype

String FILTER_MAPPING_PARAM

To view the source code for org.apache.wicket.protocol.http WicketFilter FILTER_MAPPING_PARAM.

Click Source Link

Document

The name of the root path parameter that specifies the root dir of the app.

Usage

From source file:de.alpharogroup.wicket.base.examples.StartBaseExamples.java

License:Apache License

public static void main(final String[] args) throws Exception {
    System.setProperty("wicket.configuration", "development");
    final String projectname = "jaulp.wicket.base.examples";
    final File projectDirectory = PathFinder.getProjectDirectory();
    final File webapp = PathFinder.getRelativePath(projectDirectory, projectname, "src", "main", "webapp");
    final String filterPath = "/*";

    final ServletContextHandler servletContextHandler = ServletContextHandlerFactory
            .getNewServletContextHandler(ServletContextHandlerConfiguration.builder()
                    .filterHolderConfiguration(FilterHolderConfiguration.builder()
                            .filterClass(WicketFilter.class).filterPath(filterPath)
                            .initParameter(WicketFilter.FILTER_MAPPING_PARAM, "/*")
                            .initParameter(ContextParamWebApplicationFactory.APP_CLASS_PARAM,
                                    WicketApplication.class.getName())
                            .build())//from   w  w w. ja  v  a2 s .  c  o m
                    .servletHolderConfiguration(ServletHolderConfiguration.builder()
                            .servletClass(DefaultServlet.class).pathSpec(filterPath).build())
                    .contextPath("/").webapp(webapp).maxInactiveInterval(300).filterPath("/*").build());

    final Jetty9RunConfiguration config = newJetty9RunConfiguration(servletContextHandler);

    final Server server = new Server();
    Jetty9Runner.runServletContextHandler(server, config);
}

From source file:de.alpharogroup.wicket.behaviors.examples.StartBehaviorsExamples.java

License:Apache License

public static void main(final String[] args) throws Exception {
    System.setProperty("wicket.configuration", "development");
    final String projectname = "jaulp.wicket.behaviors.examples";
    final File projectDirectory = PathFinder.getProjectDirectory();
    final File webapp = PathFinder.getRelativePath(projectDirectory, projectname, "src", "main", "webapp");
    final String filterPath = "/*";

    final ServletContextHandler servletContextHandler = ServletContextHandlerFactory
            .getNewServletContextHandler(ServletContextHandlerConfiguration.builder()
                    .filterHolderConfiguration(FilterHolderConfiguration.builder()
                            .filterClass(WicketFilter.class).filterPath(filterPath)
                            .initParameter(WicketFilter.FILTER_MAPPING_PARAM, "/*")
                            .initParameter(ContextParamWebApplicationFactory.APP_CLASS_PARAM,
                                    WicketApplication.class.getName())
                            .build())/*from  w  w  w .  j  a v  a 2  s. c  o m*/
                    .servletHolderConfiguration(ServletHolderConfiguration.builder()
                            .servletClass(DefaultServlet.class).pathSpec(filterPath).build())
                    .contextPath("/").webapp(webapp).maxInactiveInterval(300).filterPath("/*").build());

    final Jetty9RunConfiguration config = newJetty9RunConfiguration(servletContextHandler);

    final Server server = new Server();
    Jetty9Runner.runServletContextHandler(server, config);
}

From source file:de.alpharogroup.wicket.data.provider.examples.StartDataProviderExamples.java

License:Apache License

public static void main(final String[] args) throws Exception {
    System.setProperty("wicket.configuration", "development");
    final String projectname = "jaulp.wicket.data.provider.examples";
    final File projectDirectory = PathFinder.getProjectDirectory();
    final File webapp = PathFinder.getRelativePath(projectDirectory, projectname, "src", "main", "webapp");
    final String filterPath = "/*";

    final ServletContextHandler servletContextHandler = ServletContextHandlerFactory
            .getNewServletContextHandler(ServletContextHandlerConfiguration.builder()
                    .filterHolderConfiguration(FilterHolderConfiguration.builder()
                            .filterClass(WicketFilter.class).filterPath(filterPath)
                            .initParameter(WicketFilter.FILTER_MAPPING_PARAM, "/*")
                            .initParameter(ContextParamWebApplicationFactory.APP_CLASS_PARAM,
                                    WicketApplication.class.getName())
                            .build())// w  w w .  ja va 2s.c o  m
                    .servletHolderConfiguration(ServletHolderConfiguration.builder()
                            .servletClass(DefaultServlet.class).pathSpec(filterPath).build())
                    .contextPath("/").webapp(webapp).maxInactiveInterval(300).filterPath("/*").build());

    final Jetty9RunConfiguration config = newJetty9RunConfiguration(servletContextHandler);

    final Server server = new Server();
    Jetty9Runner.runServletContextHandler(server, config);
}

From source file:de.alpharogroup.wicket.dialogs.examples.StartDialogsExamples.java

License:Apache License

/**
 * The main method.//w w w . j a v  a 2s  .c  om
 *
 * @param args
 *            the arguments
 * @throws Exception
 *             the exception
 */
public static void main(final String[] args) throws Exception {
    System.setProperty("wicket.configuration", "development");
    final String projectname = "jaulp.wicket.dialogs.examples";
    final File projectDirectory = PathFinder.getProjectDirectory();
    final File webapp = PathFinder.getRelativePath(projectDirectory, projectname, "src", "main", "webapp");
    final String filterPath = "/*";

    final ServletContextHandler servletContextHandler = ServletContextHandlerFactory
            .getNewServletContextHandler(ServletContextHandlerConfiguration.builder()
                    .filterHolderConfiguration(FilterHolderConfiguration.builder()
                            .filterClass(WicketFilter.class).filterPath(filterPath)
                            .initParameter(WicketFilter.FILTER_MAPPING_PARAM, "/*")
                            .initParameter(ContextParamWebApplicationFactory.APP_CLASS_PARAM,
                                    WicketApplication.class.getName())
                            .build())
                    .servletHolderConfiguration(ServletHolderConfiguration.builder()
                            .servletClass(DefaultServlet.class).pathSpec(filterPath).build())
                    .contextPath("/").webapp(webapp).maxInactiveInterval(300).filterPath("/*").build());

    final Jetty9RunConfiguration config = newJetty9RunConfiguration(servletContextHandler);

    final Server server = new Server();
    Jetty9Runner.runServletContextHandler(server, config);
}

From source file:de.alpharogroup.wicket.dropdownchoices.examples.StartDropDownChoicesExamples.java

License:Apache License

public static void main(final String[] args) throws Exception {
    System.setProperty("wicket.configuration", "development");
    final String projectname = "jaulp.wicket.dropdownchoices.examples";
    final File projectDirectory = PathFinder.getProjectDirectory();
    final File webapp = PathFinder.getRelativePath(projectDirectory, projectname, "src", "main", "webapp");
    final String filterPath = "/*";

    final ServletContextHandler servletContextHandler = ServletContextHandlerFactory
            .getNewServletContextHandler(ServletContextHandlerConfiguration.builder()
                    .filterHolderConfiguration(FilterHolderConfiguration.builder()
                            .filterClass(WicketFilter.class).filterPath(filterPath)
                            .initParameter(WicketFilter.FILTER_MAPPING_PARAM, "/*")
                            .initParameter(ContextParamWebApplicationFactory.APP_CLASS_PARAM,
                                    WicketApplication.class.getName())
                            .build())//from   ww w .  j a v a2 s  .c om
                    .servletHolderConfiguration(ServletHolderConfiguration.builder()
                            .servletClass(DefaultServlet.class).pathSpec(filterPath).build())
                    .contextPath("/").webapp(webapp).maxInactiveInterval(300).filterPath("/*").build());

    final Jetty9RunConfiguration config = newJetty9RunConfiguration(servletContextHandler);

    final Server server = new Server();
    Jetty9Runner.runServletContextHandler(server, config);
}

From source file:de.alpharogroup.wicket.xslt.examples.StartXsltExamples.java

License:Apache License

public static void main(final String[] args) throws Exception {
    System.setProperty("wicket.configuration", "development");
    final String projectname = "wicket.xslt.examples";
    final File projectDirectory = PathFinder.getProjectDirectory();
    final File webapp = PathFinder.getRelativePath(projectDirectory, projectname, "src", "main", "webapp");
    final String filterPath = "/*";

    final ServletContextHandler servletContextHandler = ServletContextHandlerFactory
            .getNewServletContextHandler(ServletContextHandlerConfiguration.builder()
                    .filterHolderConfiguration(FilterHolderConfiguration.builder()
                            .filterClass(WicketFilter.class).filterPath(filterPath)
                            .initParameter(WicketFilter.FILTER_MAPPING_PARAM, "/*")
                            .initParameter(ContextParamWebApplicationFactory.APP_CLASS_PARAM,
                                    WicketApplication.class.getName())
                            .build())//www  .  j  a  va  2s. c  o m
                    .servletHolderConfiguration(ServletHolderConfiguration.builder()
                            .servletClass(DefaultServlet.class).pathSpec(filterPath).build())
                    .contextPath("/").webapp(webapp).maxInactiveInterval(300).filterPath("/*").build());

    final Jetty9RunConfiguration config = newJetty9RunConfiguration(servletContextHandler);

    final Server server = new Server();
    Jetty9Runner.runServletContextHandler(server, config);
}

From source file:edu.uci.ics.hyracks.control.cc.web.WebServer.java

License:Apache License

private Handler createAdminConsoleHandler() {
    FilterHolder filter = new FilterHolder(WicketFilter.class);
    filter.setInitParameter(ContextParamWebApplicationFactory.APP_CLASS_PARAM,
            HyracksAdminConsoleApplication.class.getName());
    filter.setInitParameter(WicketFilter.FILTER_MAPPING_PARAM, "/*");
    filter.setInitParameter(Application.CONFIGURATION, RuntimeConfigurationType.DEPLOYMENT.toString());

    ServletContextHandler handler = new ServletContextHandler(ServletContextHandler.SESSIONS);
    handler.setContextPath("/adminconsole");
    handler.setAttribute(ClusterControllerService.class.getName(), ccs);
    handler.addFilter(filter, "/*", EnumSet.of(DispatcherType.REQUEST, DispatcherType.ERROR));
    handler.addServlet(DefaultServlet.class, "/");
    return handler;
}

From source file:guru.mmp.application.web.WebApplicationInitializer.java

License:Apache License

/**
 * Configure the given {@link ServletContext} with any servlets, filters, listeners,
 * context-params and attributes necessary for initialization.
 *
 * @param servletContext the {@code ServletContext} to initialize
 *///from w w w.j av  a 2 s  . co  m
@Override
public void onStartup(ServletContext servletContext) throws ServletException {
    try {
        Class<? extends Servlet> dispatcherServletClass = Thread.currentThread().getContextClassLoader()
                .loadClass("org.springframework.web.servlet.DispatcherServlet").asSubclass(Servlet.class);

        ServletRegistration dispatcherServlet = servletContext.addServlet("DispatcherServlet",
                (dispatcherServletClass));
        dispatcherServlet.addMapping("/*");

        dispatcherServlet.setInitParameter("contextClass",
                "org.springframework.web.context.support.AnnotationConfigWebApplicationContext");

        logger.info("Initialising the Spring Dispatcher servlet");
    } catch (ClassNotFoundException ignored) {
    }

    if (Debug.inDebugMode()) {
        servletContext.setInitParameter("configuration", "development");
    } else {
        servletContext.setInitParameter("configuration", "deployment");
    }

    // Is Multiple Organisation Support Enabled
    servletContext.setInitParameter("multipleOrganisationSupportEnabled", "true");

    FilterRegistration wicketFilter = servletContext.addFilter(WICKET_FILTER_NAME,
            org.apache.wicket.protocol.http.WicketFilter.class);

    wicketFilter.setInitParameter(WicketFilter.APP_FACT_PARAM, SpringWebApplicationFactory.class.getName());

    wicketFilter.setInitParameter(WICKET_APPLICATION_BEAN_PARAMETER, "webApplication");
    wicketFilter.setInitParameter(WicketFilter.FILTER_MAPPING_PARAM, "/*");
    wicketFilter.addMappingForUrlPatterns(null, false, "/*");

    try {
        Class<? extends Servlet> viewReportServletClass = Thread.currentThread().getContextClassLoader()
                .loadClass("guru.mmp.application.web.servlets.ViewReportServlet").asSubclass(Servlet.class);

        ServletRegistration viewReportServlet = servletContext.addServlet("ViewReportServlet",
                (viewReportServletClass));
        viewReportServlet.addMapping("/viewReport");
    } catch (ClassNotFoundException ignored) {
    }

    try {
        Class<? extends Servlet> cxfServletClass = Thread.currentThread().getContextClassLoader()
                .loadClass("org.apache.cxf.transport.servlet.CXFServlet").asSubclass(Servlet.class);

        ServletRegistration cxfServlet = servletContext.addServlet("CXFServlet", (cxfServletClass));
        cxfServlet.addMapping("/service/*");

        logger.info("Initialising the Apache CXF framework");
    } catch (ClassNotFoundException ignored) {
    }
}

From source file:lt.eif.viko.wicket.ui.WebModule.java

License:Apache License

@Override
protected void configureServlets() {
    bind(WicketApplication.class).toProvider(WickGuiceAppProvider.class);
    // avoids "Error initializing WicketFilter - you have no <filter-mapping> element..." 
    // IllegalArgumentException
    Map<String, String> params = new HashMap<String, String>();
    params.put(WicketFilter.FILTER_MAPPING_PARAM, "/*");

    filter("/*").through(WicketGuiceFilter.class, params);

}

From source file:name.martingeisse.admin.WebServerLauncher.java

License:Open Source License

/**
 * Launches the web server.//from  w w w  .  j av a  2s. c o m
 * @throws Exception on errors
 */
public static void launch() throws Exception {
    logger.debug("WebServerLauncher.launch(): begin");

    final EnumSet<DispatcherType> allDispatcherTypes = EnumSet.allOf(DispatcherType.class);

    // create and configure a servlet context
    final ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
    context.setContextPath("/");
    context.getSessionHandler().getSessionManager().setMaxInactiveInterval(30 * 60);
    context.getSessionHandler().getSessionManager().setSessionIdPathParameterName("none");

    // add the global servlet listener
    context.addEventListener(new GlobalServletContext());
    context.addFilter(SideEffectsOriginRestrictionFilter.class, "/*", allDispatcherTypes);
    context.addFilter(AntiJsessionidUrlFilter.class, "/*", allDispatcherTypes);

    // the GZIP filter seems to cause problems on Jetty. The HTTP response either has
    // an incorrect or duplicate Content-Length header (my tools won't tell me...)
    //context.addFilter(GzipFilter.class, "/*", allDispatcherTypes);

    // JDBC connection-closing filter
    context.addFilter(EntityConnectionServletFilter.class, "/*", allDispatcherTypes);

    // add the Wicket filter
    final Filter wicketFilter = new WicketFilter();
    final FilterHolder wicketFilterHolder = new FilterHolder(wicketFilter);
    wicketFilterHolder.setInitParameter(WicketFilter.FILTER_MAPPING_PARAM, "/*");
    wicketFilterHolder.setInitParameter("applicationClassName",
            AdminWicketApplication.class.getCanonicalName());
    context.addFilter(wicketFilterHolder, "/*", allDispatcherTypes);

    // a default servlet is needed, otherwise the filters cannot catch the request
    context.addServlet(DefaultServlet.class, "/*");

    // configure SSL / HTTPS
    //      SslContextFactory sslContextFactory = new SslContextFactory("/Users/martin/.keystore");
    //      sslContextFactory.setKeyStorePassword("changeit");
    //      SslSocketConnector sslSocketConnector = new SslSocketConnector(sslContextFactory);
    //      sslSocketConnector.setPort(8443);

    final Server server = new Server(8888);
    //      server.addConnector(sslSocketConnector);
    server.setHandler(context);
    server.start();
    server.join();

    logger.debug("WebServerLauncher.launch(): end");
}