Beispiel #1
0
 @Bean(name = "captchaServlet")
 public ServletRegistrationBean captchaServlet() {
   ServletRegistrationBean bean = new ServletRegistrationBean();
   bean.setServlet(new CaptchaServlet());
   bean.addUrlMappings("/captcha");
   return bean;
 }
Beispiel #2
0
 // Replaces web.xml
 @Bean
 public ServletRegistrationBean servletRegistrationBean(ApplicationContext context) {
   ServletRegistrationBean servletRegistrationBean =
       new ServletRegistrationBean(new CXFServlet(), "/services/*");
   servletRegistrationBean.setLoadOnStartup(1);
   return servletRegistrationBean;
 }
Beispiel #3
0
 @Bean
 public ServletRegistrationBean jaxrsServlet() {
   final JerseySwaggerServlet servlet = new JerseySwaggerServlet();
   final ServletRegistrationBean registrationBean = new ServletRegistrationBean(servlet, "/api/*");
   registrationBean.addInitParameter(JAXRS_APPLICATION_CLASS, JerseyApplication.class.getName());
   return registrationBean;
 }
 @Bean
 public ServletRegistrationBean servletRegistrationBean() {
   CXFServlet cxfServlet = new CXFServlet();
   ServletRegistrationBean servletRegistrationBean =
       new ServletRegistrationBean(cxfServlet, "/soap/*");
   servletRegistrationBean.setLoadOnStartup(1);
   return servletRegistrationBean;
 }
  /**
   * Register dispatcherServlet programmatically
   *
   * @return ServletRegistrationBean
   */
  @Bean
  public ServletRegistrationBean dispatcherServletRegistration() {

    ServletRegistrationBean registration = new ServletRegistrationBean(dispatcherServlet(), "/*");
    registration.setOrder(3);

    registration.setName(
        DispatcherServletAutoConfiguration.DEFAULT_DISPATCHER_SERVLET_REGISTRATION_BEAN_NAME);

    return registration;
  }
  /**
   * 配置Druid Servlet支持监控页面
   *
   * @param ds
   * @return
   */
  @Bean
  public ServletRegistrationBean druidStatView(DruidSettings ds) {

    ServletRegistrationBean registrationBean =
        new ServletRegistrationBean(new StatViewServlet(), "/druid/*");
    Map<String, String> initParameters = new HashMap<>();
    initParameters.put("resetEnable", ds.isResetEnable() + "");
    initParameters.put("loginUsername", ds.getLoginUsername());
    initParameters.put("loginPassword", ds.getLoginPassword());
    registrationBean.setInitParameters(initParameters);
    return registrationBean;
  }
  @Bean
  public ServletRegistrationBean servletRegistrationBean() {
    ServletRegistrationBean result =
        new ServletRegistrationBean(new CGIServlet(), this.cgiPathMapping);

    result.addInitParameter("executable", "");
    result.addInitParameter("cgiPathPrefix", this.cgiPathPrefix);
    result.addInitParameter("parameterEncoding", StandardCharsets.UTF_8.displayName());
    result.addInitParameter("passShellEnvironment", "true");

    return result;
  }
 @Bean
 @ConditionalOnMissingBean(name = "jerseyServletRegistration")
 @ConditionalOnProperty(
     prefix = "spring.jersey",
     name = "type",
     havingValue = "servlet",
     matchIfMissing = true)
 public ServletRegistrationBean jerseyServletRegistration() {
   ServletRegistrationBean registration =
       new ServletRegistrationBean(new ServletContainer(this.config), this.path);
   addInitParameters(registration);
   registration.setName("jerseyServlet");
   return registration;
 }
 @Bean
 ServletRegistrationBean h2servletRegistration() {
   ServletRegistrationBean registrationBean = new ServletRegistrationBean(new WebServlet());
   registrationBean.addUrlMappings("/db/*");
   return registrationBean;
 }