Example usage for javax.servlet DispatcherType FORWARD

List of usage examples for javax.servlet DispatcherType FORWARD

Introduction

In this page you can find the example usage for javax.servlet DispatcherType FORWARD.

Prototype

DispatcherType FORWARD

To view the source code for javax.servlet DispatcherType FORWARD.

Click Source Link

Usage

From source file:http2.DispatcherServletInitializer.java

@Override
public void onStartup(ServletContext servletContext) throws ServletException {
    servletContext.addFilter("pcf", "org.eclipse.jetty.servlets.PushCacheFilter").addMappingForUrlPatterns(
            EnumSet.of(DispatcherType.REQUEST, DispatcherType.FORWARD, DispatcherType.INCLUDE), true, "/*");
    super.onStartup(servletContext);
}

From source file:rashjz.info.com.az.config.MyWebInitializer.java

@Override
public void onStartup(ServletContext servletContext) throws ServletException {
    AnnotationConfigWebApplicationContext appContext = new AnnotationConfigWebApplicationContext();
    appContext.register(SpringWebConfig.class);

    DispatcherServlet dispatcherServlet = new DispatcherServlet(appContext);
    dispatcherServlet.setThrowExceptionIfNoHandlerFound(true);
    ServletRegistration.Dynamic dispatcher = servletContext.addServlet("SpringDispatcher", dispatcherServlet);
    dispatcher.setLoadOnStartup(1);/*from w w  w .  j  av  a2 s.co  m*/
    dispatcher.addMapping("/");

    CharacterEncodingFilter characterEncodingFilter = new CharacterEncodingFilter();
    characterEncodingFilter.setEncoding("UTF-8");
    characterEncodingFilter.setForceEncoding(true);

    EnumSet<DispatcherType> dispatcherTypes = EnumSet.of(DispatcherType.REQUEST, DispatcherType.FORWARD);
    FilterRegistration.Dynamic characterEncoding = servletContext.addFilter("characterEncoding",
            characterEncodingFilter);
    characterEncoding.addMappingForUrlPatterns(dispatcherTypes, true, "/*");
}

From source file:org.fon.documentmanagementsystem.config.WebAppInitializer.java

@Override
public void onStartup(ServletContext servletContext) throws ServletException {
    AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext();
    ctx.register(AppConfig.class);
    ctx.setServletContext(servletContext);
    ServletRegistration.Dynamic servlet = servletContext.addServlet("dispatcher", new DispatcherServlet(ctx));
    servlet.addMapping("/");
    servlet.setLoadOnStartup(1);/*from  www .j a  v a  2  s .c o  m*/
    servlet.setMultipartConfig(new MultipartConfigElement("", 1024 * 1024 * 25, 1024 * 1024 * 25, 0));

    CharacterEncodingFilter characterEncodingFilter = new CharacterEncodingFilter();
    characterEncodingFilter.setEncoding("UTF-8");
    characterEncodingFilter.setForceEncoding(true);
    FilterRegistration.Dynamic characterEncoding = servletContext.addFilter("characterEncoding",
            characterEncodingFilter);
    EnumSet<DispatcherType> dispatcherTypes = EnumSet.of(DispatcherType.REQUEST, DispatcherType.FORWARD);
    characterEncoding.addMappingForUrlPatterns(dispatcherTypes, true, "/*");
}

From source file:org.jblogcms.core.config.MainConfig.java

@Override
public void onStartup(ServletContext servletContext) throws ServletException {
    AnnotationConfigWebApplicationContext rootContext = new AnnotationConfigWebApplicationContext();
    rootContext.register(MainContext.class);

    ServletRegistration.Dynamic dispatcher = servletContext.addServlet(DISPATCHER_SERVLET_NAME,
            new DispatcherServlet(rootContext));
    dispatcher.setLoadOnStartup(1);//ww w .  java2s .co  m
    dispatcher.addMapping(DISPATCHER_SERVLET_MAPPING);
    EnumSet<DispatcherType> dispatcherTypes = EnumSet.of(DispatcherType.REQUEST, DispatcherType.FORWARD);

    CharacterEncodingFilter characterEncodingFilter = new CharacterEncodingFilter();
    characterEncodingFilter.setEncoding("UTF-8");
    characterEncodingFilter.setForceEncoding(true);

    FilterRegistration.Dynamic characterEncoding = servletContext.addFilter("characterEncoding",
            characterEncodingFilter);
    characterEncoding.addMappingForUrlPatterns(dispatcherTypes, true, "/*");

    FilterRegistration.Dynamic security = servletContext.addFilter("springSecurityFilterChain",
            new DelegatingFilterProxy());
    security.addMappingForUrlPatterns(dispatcherTypes, true, "/*");

    servletContext.addListener(new ContextLoaderListener(rootContext));

}

From source file:io.github.microcks.config.WebConfiguration.java

@Override
public void onStartup(ServletContext servletContext) throws ServletException {
    log.info("Starting web application configuration, using profiles: {}",
            Arrays.toString(env.getActiveProfiles()));
    EnumSet<DispatcherType> disps = EnumSet.of(DispatcherType.REQUEST, DispatcherType.FORWARD,
            DispatcherType.ASYNC);/* w w w.  j av a  2 s.  c o m*/
    initCORSFilter(servletContext, disps);
    if (env.acceptsProfiles(ConfigurationConstants.PROFILE_PRODUCTION)) {
        //initStaticResourcesFilter(servletContext, disps);
    }
    log.info("Web application fully configured");
}

From source file:com.jiwhiz.web.config.WebConfigurer.java

@Override
public void onStartup(ServletContext servletContext) throws ServletException {
    log.info("Web application configuration, using profiles: {}", Arrays.toString(env.getActiveProfiles()));
    EnumSet<DispatcherType> disps = EnumSet.of(DispatcherType.REQUEST, DispatcherType.FORWARD,
            DispatcherType.ASYNC);//from  w w w .j  a v  a 2 s.c o m
    if (env.acceptsProfiles("prod")) {
        initCachingHttpHeadersFilter(servletContext, disps);
        initStaticResourcesProductionFilter(servletContext, disps);
    }
    log.info("Web application fully configured");
}

From source file:org.bitcoinrt.web.config.BitcointWebAppInitializer.java

public void onStartup(ServletContext servletContext) throws ServletException {

    AnnotationConfigWebApplicationContext webAppContext = new AnnotationConfigWebApplicationContext();
    webAppContext.register(WebConfig.class);

    final DispatcherServlet dispatcherServlet = new DispatcherServlet(webAppContext);

    ServletRegistration.Dynamic dispatcher = servletContext.addServlet("dispatcherServlet", dispatcherServlet);
    dispatcher.setLoadOnStartup(1);/*from   ww w. j a v  a  2 s . c om*/
    dispatcher.addMapping("/site/*");

    UrlRewriteFilter urlRewriteFilter = new UrlRewriteFilter();

    servletContext.addFilter("UrlRewriteFilter", urlRewriteFilter)
            .addMappingForUrlPatterns(EnumSet.of(DispatcherType.REQUEST, DispatcherType.FORWARD), false, "/*");

}

From source file:com.test.config.BackendConsoleWebConfig.java

@Override
public void onStartup(ServletContext servletContext) throws ServletException {
    AnnotationConfigWebApplicationContext webCtx = new AnnotationConfigWebApplicationContext();
    webCtx.register(BackendConsoleMVCConfig.class);
    webCtx.register(BackendConsoleConfig.class);

    servletContext.addListener(new ContextLoaderListener(webCtx));

    /* Spring Delegating Dispatcher Servlet */
    Servlet dispatcherServlet = new DispatcherServlet(webCtx);
    ServletRegistration.Dynamic dispatcherServletReg = servletContext.addServlet("dispatcherServlet",
            dispatcherServlet);/*from w  w  w .  j  av a 2 s  . co  m*/
    dispatcherServletReg.setLoadOnStartup(1);
    dispatcherServletReg.setInitParameter("contextConfigLocation", "");
    dispatcherServletReg.addMapping("/");

    /* Spring Security Delegating Filter */
    FilterRegistration springSecurityFilterChainReg = servletContext.addFilter("springSecurityFilterChain",
            DelegatingFilterProxy.class);
    springSecurityFilterChainReg.addMappingForServletNames(EnumSet.of(DispatcherType.REQUEST,
            DispatcherType.FORWARD, DispatcherType.ERROR, DispatcherType.ASYNC), false,
            dispatcherServletReg.getName());
}

From source file:net.rgielen.actionframeworks.springmvc.ApplicationInitializer.java

@Override
public void onStartup(ServletContext servletContext) throws ServletException {
    AnnotationConfigWebApplicationContext context = new AnnotationConfigWebApplicationContext();
    context.register(ApplicationConfig.class);
    servletContext.addListener(new ContextLoaderListener(context));

    CharacterEncodingFilter characterEncodingFilter = new CharacterEncodingFilter();
    characterEncodingFilter.setEncoding("UTF-8");
    characterEncodingFilter.setForceEncoding(true);

    EnumSet<DispatcherType> dispatcherTypes = EnumSet.of(DispatcherType.REQUEST, DispatcherType.FORWARD);

    FilterRegistration.Dynamic characterEncoding = servletContext.addFilter("characterEncoding",
            characterEncodingFilter);/*  w w w. j a  v  a  2 s . co m*/
    characterEncoding.addMappingForUrlPatterns(dispatcherTypes, false, "/*");

    ServletRegistration.Dynamic registration = servletContext.addServlet("dispatcher",
            new DispatcherServlet(context));
    registration.setLoadOnStartup(1);
    registration.addMapping("/");

}

From source file:fr.treeptik.cloudunit.initializer.ApplicationConfig.java

@Override
public void onStartup(ServletContext servletContext) throws ServletException {
    AnnotationConfigWebApplicationContext rootContext = new AnnotationConfigWebApplicationContext();
    rootContext.register(CloudUnitApplicationContext.class);

    ServletRegistration.Dynamic dispatcher = servletContext.addServlet(DISPATCHER_SERVLET_NAME,
            new DispatcherServlet(rootContext));
    dispatcher.setLoadOnStartup(1);//from   w w w.  j a v  a  2 s . c  o  m
    dispatcher.addMapping(DISPATCHER_SERVLET_MAPPING);
    dispatcher.setAsyncSupported(true);

    FilterRegistration.Dynamic security = servletContext.addFilter("springSecurityFilterChain",
            new DelegatingFilterProxy());
    EnumSet<DispatcherType> securityDispatcherTypes = EnumSet.of(DispatcherType.REQUEST, DispatcherType.FORWARD,
            DispatcherType.ASYNC);

    security.addMappingForUrlPatterns(securityDispatcherTypes, false, "/user/*");
    security.addMappingForUrlPatterns(securityDispatcherTypes, false, "/file/*");
    security.addMappingForUrlPatterns(securityDispatcherTypes, false, "/logs/*");
    security.addMappingForUrlPatterns(securityDispatcherTypes, false, "/messages/*");
    security.addMappingForUrlPatterns(securityDispatcherTypes, false, "/application/*");
    security.addMappingForUrlPatterns(securityDispatcherTypes, false, "/server/*");
    security.addMappingForUrlPatterns(securityDispatcherTypes, false, "/snapshot/*");
    security.addMappingForUrlPatterns(securityDispatcherTypes, false, "/module/*");
    security.addMappingForUrlPatterns(securityDispatcherTypes, false, "/admin/*");
    security.addMappingForUrlPatterns(securityDispatcherTypes, false, "/image/*");
    security.addMappingForUrlPatterns(securityDispatcherTypes, false, "/nopublic/*");

    security.setAsyncSupported(true);

    servletContext.addListener(new ContextLoaderListener(rootContext));
}