Example usage for javax.servlet ServletRegistration.Dynamic setInitParameter

List of usage examples for javax.servlet ServletRegistration.Dynamic setInitParameter

Introduction

In this page you can find the example usage for javax.servlet ServletRegistration.Dynamic setInitParameter.

Prototype

public boolean setInitParameter(String name, String value);

Source Link

Document

Sets the initialization parameter with the given name and value on the Servlet or Filter that is represented by this Registration.

Usage

From source file:com.smin.config.web.DispatcherServletInitializer.java

protected void customizeRegistration(ServletRegistration.Dynamic registration) {
    registration.setInitParameter("dispatchOptionsRequest", "true");
}

From source file:com.ameer.testweb.app.conf.WebAppInitializer.java

@Override
protected void customizeRegistration(ServletRegistration.Dynamic registration) {
    registration.setInitParameter("defaultHtmlEscape", "true");
    registration.setInitParameter("spring.profiles.active", "default");
}

From source file:org.appverse.web.framework.backend.frontfacade.websocket.config.DispatcherServletInitializer.java

@Override
protected void customizeRegistration(ServletRegistration.Dynamic registration) {
    registration.setInitParameter("dispatchOptionsRequest", "true");
}

From source file:nl.pinniq.web.config.DispatcherServletInitializer.java

@Override
protected void customizeRegistration(ServletRegistration.Dynamic registration) {
    registration.setInitParameter("throwExceptionIfNoHandlerFound", "true");
    registration.setInitParameter("dispatchOptionsRequest", "true");
    registration.setAsyncSupported(true);
}

From source file:se.kth.csc.config.WebAppInitializer.java

@Override
protected void customizeRegistration(ServletRegistration.Dynamic registration) {
    registration.setInitParameter("defaultHtmlEscape", "true");
    registration.setInitParameter("spring.profiles.default", "default");
}

From source file:configuration.WebInitializer.java

@Override
protected void customizeRegistration(ServletRegistration.Dynamic registration) {
    registration.setInitParameter("defaultHtmlEscape", "true");
    registration.setInitParameter("dispatchOptionsRequest", "true");
    registration.setInitParameter("spring.profiles.active", "default");
    registration.setAsyncSupported(true);
}

From source file:org.teavm.flavour.example.server.ApplicationInitializer.java

private void initJersey(ServletContext servletContext) {
    JerseyInitializer.servletContext = servletContext;
    ServletRegistration.Dynamic reg = servletContext.addServlet("jersey", ServletContainer.class);
    reg.addMapping("/api/*");
    reg.setInitParameter("javax.ws.rs.Application", JerseyInitializer.class.getName());
}

From source file:net.ljcomputing.sr.config.StatusReporterWebConfiguration.java

/**
 * @see org.springframework.boot.context.web.SpringBootServletInitializer#onStartup(javax.servlet.ServletContext)
 *///w  ww .  jav a2  s . c  o m
public void onStartup(ServletContext container) throws ServletException {
    logger.info("onStartup ...");
    AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext();
    ctx.register(StatusReporterWebConfiguration.class);
    ctx.setServletContext(container);

    DispatcherServlet ds = new DispatcherServlet(ctx);
    ServletRegistration.Dynamic servlet = container.addServlet("dispatcherServlet", ds);

    servlet.setInitParameter("throwExceptionIfNoHandlerFound", "true");
    servlet.setLoadOnStartup(1);
    servlet.addMapping("/");

    logger.warn("servlet name: {}", servlet.getName());
    logger.warn("servlet throwExceptionIfNoHandlerFound: {}",
            servlet.getInitParameter("throwExceptionIfNoHandlerFound"));
}

From source file:org.efoe.poc.springws.provider.xmlbeans.initializer.WebXml.java

@Override
public void onStartup(ServletContext servletContext) throws ServletException {
    WebApplicationContext context = getContext();
    servletContext.addListener(new ContextLoaderListener(context));
    ServletRegistration.Dynamic dispatcher = servletContext.addServlet("DispatcherServlet",
            new DispatcherServlet(context));
    dispatcher.setLoadOnStartup(1);/*from  w ww .j a v  a2  s .com*/
    dispatcher.addMapping(MAPPING_URL);

    ServletRegistration.Dynamic ws = servletContext.addServlet("MessageDispatcherServlet",
            new MessageDispatcherServlet(context));
    ws.setInitParameter("transformWsdlLocations", "true");
    ws.addMapping("/services/*");
}

From source file:org.alfresco.bm.web.WebApp.java

@Override
public void onStartup(ServletContext container) {
    // Grab the server capabilities, otherwise just use the java version
    String javaVersion = System.getProperty("java.version");
    String systemCapabilities = System.getProperty(PROP_SYSTEM_CAPABILITIES, javaVersion);

    String appDir = new File(".").getAbsolutePath();
    String appContext = container.getContextPath();
    String appName = container.getContextPath().replace(SEPARATOR, "");

    // Create an application context (don't start, yet)
    XmlWebApplicationContext ctx = new XmlWebApplicationContext();
    ctx.setConfigLocations(new String[] { "classpath:config/spring/app-context.xml" });

    // Pass our properties to the new context
    Properties ctxProperties = new Properties();
    {/*ww w. j  a  va2s.  c o m*/
        ctxProperties.put(PROP_SYSTEM_CAPABILITIES, systemCapabilities);
        ctxProperties.put(PROP_APP_CONTEXT_PATH, appContext);
        ctxProperties.put(PROP_APP_DIR, appDir);
    }
    ConfigurableEnvironment ctxEnv = ctx.getEnvironment();
    ctxEnv.getPropertySources().addFirst(new PropertiesPropertySource(appName, ctxProperties));
    // Override all properties with system properties
    ctxEnv.getPropertySources().addFirst(new PropertiesPropertySource("system", System.getProperties()));
    // Bind to shutdown
    ctx.registerShutdownHook();

    ContextLoaderListener ctxLoaderListener = new ContextLoaderListener(ctx);
    container.addListener(ctxLoaderListener);

    ServletRegistration.Dynamic jerseyServlet = container.addServlet("jersey-serlvet", SpringServlet.class);
    jerseyServlet.setInitParameter("com.sun.jersey.config.property.packages", "org.alfresco.bm.rest");
    jerseyServlet.setInitParameter("com.sun.jersey.api.json.POJOMappingFeature", "true");
    jerseyServlet.addMapping("/api/*");
}