当前位置: 首页>>代码示例>>Java>>正文


Java ServletConfig类代码示例

本文整理汇总了Java中javax.servlet.ServletConfig的典型用法代码示例。如果您正苦于以下问题:Java ServletConfig类的具体用法?Java ServletConfig怎么用?Java ServletConfig使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ServletConfig类属于javax.servlet包,在下文中一共展示了ServletConfig类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: init

import javax.servlet.ServletConfig; //导入依赖的package包/类
public void init()
{
	Endpoint endpoint = new Endpoint(getBinding(), version);
	registry.registerDispatcher(endpoint, this);

	try
	{
		// fake the CMIS servlet
		ServletConfig config = getServletConfig();
    	this.servlet = getServlet();
    	servlet.init(config);
	}
	catch(ServletException e)
	{
		throw new AlfrescoRuntimeException("Failed to initialise CMIS servlet dispatcher", e);
	}
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:18,代码来源:CMISServletDispatcher.java

示例2: init

import javax.servlet.ServletConfig; //导入依赖的package包/类
@Override
public void init(ServletConfig config) throws ServletException {
  Info info = new Info()
    .title("Swagger Server")
    .description("orchestrates backend jobs")
    .termsOfService("")
    .contact(new Contact()
      .email("[email protected]"))
    .license(new License()
      .name("LGPL 3.0")
      .url("http://www.gnu.org/licenses/lgpl-3.0.txt"));

  ServletContext context = config.getServletContext();
  Swagger swagger = new Swagger().info(info);

  new SwaggerContextService().withServletConfig(config).updateSwagger(swagger);
}
 
开发者ID:deelam,项目名称:agilion,代码行数:18,代码来源:Bootstrap.java

示例3: init

import javax.servlet.ServletConfig; //导入依赖的package包/类
public void init(ServletConfig config) throws ServletException {
    try {
        WebApplicationContext springContext = WebApplicationContextUtils.getRequiredWebApplicationContext(config.getServletContext());
        final AutowireCapableBeanFactory beanFactory = springContext.getAutowireCapableBeanFactory();
        beanFactory.autowireBean(this);
    }
    catch (Exception e) {
        logger.error("Error initializing ShibbolethExtAuthnHandler", e);
    }
}
 
开发者ID:vrk-kpa,项目名称:e-identification-tupas-idp-public,代码行数:11,代码来源:ShibbolethExtAuthnHandler.java

示例4: ViewApi

import javax.servlet.ServletConfig; //导入依赖的package包/类
public ViewApi(@Context ServletConfig servletContext) {
   ViewApiService delegate = null;

   if (servletContext != null) {
      String implClass = servletContext.getInitParameter("ViewApi.implementation");
      if (implClass != null && !"".equals(implClass.trim())) {
         try {
            delegate = (ViewApiService) Class.forName(implClass).newInstance();
         } catch (Exception e) {
            throw new RuntimeException(e);
         }
      } 
   }

   if (delegate == null) {
      delegate = ViewApiServiceFactory.getViewApi();
   }

   this.delegate = delegate;
}
 
开发者ID:cliffano,项目名称:swaggy-jenkins,代码行数:21,代码来源:ViewApi.java

示例5: AgentApi

import javax.servlet.ServletConfig; //导入依赖的package包/类
public AgentApi(@Context ServletConfig servletContext) {
   AgentApiService delegate = null;

   if (servletContext != null) {
      String implClass = servletContext.getInitParameter("AgentApi.implementation");
      if (implClass != null && !"".equals(implClass.trim())) {
         try {
            delegate = (AgentApiService) Class.forName(implClass).newInstance();
         } catch (Exception e) {
            throw new RuntimeException(e);
         }
      } 
   }

   if (delegate == null) {
      delegate = AgentApiServiceFactory.getAgentApi();
   }

   this.delegate = delegate;
}
 
开发者ID:elastest,项目名称:elastest-instrumentation-manager,代码行数:21,代码来源:AgentApi.java

示例6: AgentconfigurationApi

import javax.servlet.ServletConfig; //导入依赖的package包/类
public AgentconfigurationApi(@Context ServletConfig servletContext) {
   AgentconfigurationApiService delegate = null;

   if (servletContext != null) {
      String implClass = servletContext.getInitParameter("AgentconfigurationApi.implementation");
      if (implClass != null && !"".equals(implClass.trim())) {
         try {
            delegate = (AgentconfigurationApiService) Class.forName(implClass).newInstance();
         } catch (Exception e) {
            throw new RuntimeException(e);
         }
      } 
   }

   if (delegate == null) {
      delegate = AgentconfigurationApiServiceFactory.getAgentconfigurationApi();
   }

   this.delegate = delegate;
}
 
开发者ID:elastest,项目名称:elastest-instrumentation-manager,代码行数:21,代码来源:AgentconfigurationApi.java

示例7: init

import javax.servlet.ServletConfig; //导入依赖的package包/类
protected void init(ServletConfig config) {
    int maxSize = -1;
    String maxSizeS = getOption(config, OPTION_MAXSIZE, null);
    if (maxSizeS != null) {
        try {
            maxSize = Integer.parseInt(maxSizeS);
        } catch (Exception ex) {
            maxSize = -1;
        }
    }
    if (maxSize < 0) {
        maxSize = Constants.MAX_POOL_SIZE;
    }
    this.handlers = new Tag[maxSize];
    this.current = -1;
    instanceManager = InstanceManagerFactory.getInstanceManager(config);
}
 
开发者ID:sunmingshuai,项目名称:apache-tomcat-7.0.73-with-comment,代码行数:18,代码来源:TagHandlerPool.java

示例8: createDefaultContainer

import javax.servlet.ServletConfig; //导入依赖的package包/类
/**
 * Create a {@link DefaultContainer}, allowing users to upgrade to a child
 * of DefaultContainer using an {@link ServletConfig} init parameter of
 * <code>org.directwebremoting.Container</code>. Note that while the
 * parameter name is the classname of {@link Container}, currently the only
 * this can only be used to create children that inherit from
 * {@link DefaultContainer}. This restriction may be relaxed in the future.
 * Unlike {@link #setupDefaultContainer(DefaultContainer, ServletConfig)},
 * this method does not call any setup methods.
 * @param servletConfig The source of init parameters
 * @return An unsetup implementaion of DefaultContainer
 * @throws ServletException If the specified class could not be found
 * @see ServletConfig#getInitParameter(String)
 */
public static DefaultContainer createDefaultContainer(ServletConfig servletConfig) throws ServletException
{
    try
    {
        String typeName = servletConfig.getInitParameter(Container.class.getName());
        if (typeName == null)
        {
            return new DefaultContainer();
        }

        log.debug("Using alternate Container implementation: " + typeName);
        Class type = LocalUtil.classForName(typeName);
        return (DefaultContainer) type.newInstance();
    }
    catch (Exception ex)
    {
        throw new ServletException(ex);
    }
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:34,代码来源:ContainerUtil.java

示例9: init

import javax.servlet.ServletConfig; //导入依赖的package包/类
@Override
public void init(ServletConfig config) throws ServletException {
    super.init(config);

    final ServletContext context = config.getServletContext();
    if (null == registry) {
        final Object registryAttr = context.getAttribute(METRICS_REGISTRY);
        if (registryAttr instanceof MetricRegistry) {
            this.registry = (MetricRegistry) registryAttr;
        } else {
            throw new ServletException("Couldn't find a MetricRegistry instance.");
        }
    }

    filter = (MetricFilter) context.getAttribute(METRIC_FILTER);
    if (filter == null) {
        filter = MetricFilter.ALL;
    }

    this.allowedOrigin = context.getInitParameter(ALLOWED_ORIGIN);
}
 
开发者ID:dhatim,项目名称:dropwizard-prometheus,代码行数:22,代码来源:PrometheusServlet.java

示例10: init

import javax.servlet.ServletConfig; //导入依赖的package包/类
@Override
public void init(ServletConfig servletConfig) throws ServletException {
  this.servletConfig = servletConfig;

  //templateCfg.setClassForTemplateLoading(getClass(), "/");
  Resource baseResource;
  try {
    baseResource = Resource.newResource(servletConfig.getInitParameter("resourceBase"));
  } catch (MalformedURLException e) {
    throw new ServletException(e);
  }
  templateCfg.setTemplateLoader(new ResourceTemplateLoader(baseResource));
  templateCfg.setDefaultEncoding("UTF-8");

  // Sets how errors will appear.
  // During web page *development* TemplateExceptionHandler.HTML_DEBUG_HANDLER
  // is better.
  // cfg.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER);
  templateCfg.setTemplateExceptionHandler(TemplateExceptionHandler.HTML_DEBUG_HANDLER);
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:21,代码来源:IndexServlet.java

示例11: BlueApi

import javax.servlet.ServletConfig; //导入依赖的package包/类
public BlueApi(@Context ServletConfig servletContext) {
   BlueApiService delegate = null;

   if (servletContext != null) {
      String implClass = servletContext.getInitParameter("BlueApi.implementation");
      if (implClass != null && !"".equals(implClass.trim())) {
         try {
            delegate = (BlueApiService) Class.forName(implClass).newInstance();
         } catch (Exception e) {
            throw new RuntimeException(e);
         }
      } 
   }

   if (delegate == null) {
      delegate = BlueApiServiceFactory.getBlueApi();
   }

   this.delegate = delegate;
}
 
开发者ID:cliffano,项目名称:swaggy-jenkins,代码行数:21,代码来源:BlueApi.java

示例12: init

import javax.servlet.ServletConfig; //导入依赖的package包/类
public void init(ServletConfig conf) 
  		 throws ServletException {
System.out.println(getDateStamp() + " SchemaViewerServlet starting");
String initErrorMsg = "";
try {
	super.init(conf);
} catch (Throwable exc) {
	initErrorMsg = "SchemaViewerServlet Initialization Error:\n  " + exc;
	prtlnErr (initErrorMsg);
}

ServletContext servletContext = getServletContext();

MetadataVocab vocab = (MetadataVocab)servletContext.getAttribute( "MetadataVocab" );
if (vocab == null) {
	throw new ServletException ("MetadataVocab not found in servlet context");
}

// set up remote searcher
/* RemoteSearcher rs = (RemoteSearcher) servletContext.getAttribute ("RemoteSearcher");
if (rs == null) {
	throw new ServletException ("RemoteSearcher not found in servlet context");
} */

System.out.println(getDateStamp() + " SchemaViewerServlet initialized.");
  }
 
开发者ID:NCAR,项目名称:joai-project,代码行数:27,代码来源:SchemaViewerServlet.java

示例13: init

import javax.servlet.ServletConfig; //导入依赖的package包/类
protected void init( ServletConfig config ) {
    int maxSize=-1;
    String maxSizeS=getOption(config, OPTION_MAXSIZE, null);
    if( maxSizeS != null ) {
        try {
            maxSize=Integer.parseInt(maxSizeS);
        } catch( Exception ex) {
            maxSize=-1;
        }
    }
    if( maxSize <0  ) {
        maxSize=Constants.MAX_POOL_SIZE;
    }
    this.handlers = new Tag[maxSize];
    this.current = -1;
    instanceManager = InstanceManagerFactory.getInstanceManager(config);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:18,代码来源:TagHandlerPool.java

示例14: scanValidationComponents

import javax.servlet.ServletConfig; //导入依赖的package包/类
private static void scanValidationComponents(DefaultContainer container, ServletConfig servletConfig) {
    String scanPackage = servletConfig.getInitParameter(SCAN_PACKAGE_INIT_PARAMETER);
    if (scanPackage == null) {
        return;
    }
    
    ClassPathScanner scanner = new ClassPathScanner();
    scanner.addIncludeFilter(new ValidationScriptMappingTypeFilter());
    Set<Class<?>> classes = scanner.scan(scanPackage);
    
    for (Class<?> beanClass : classes) {
        try {
            Object bean = ClassUtils.newInstance(beanClass);
            String beanName = generateBeanName(beanClass, container);
            container.addBean(beanName, bean);
        } catch (Exception e) {
            log.error("Unable to instantiate class [" + beanClass.getName() + "].", e);
        }
    }
}
 
开发者ID:devefx,项目名称:validator-web,代码行数:21,代码来源:StartupUtil.java

示例15: init

import javax.servlet.ServletConfig; //导入依赖的package包/类
@Override
public void init(ServletConfig servletConfig) throws ServletException {
  super.init(servletConfig);

  if (engine==null) {
    Map<String,String> configurationProperties = readConfigurationProperties(servletConfig);
    engine = createEngine(configurationProperties);
  }

  engine.start();

  log.debug(" ____            _     ____            _       _    ");
  log.debug("|  _ \\ ___   ___| | __/ ___|  ___ _ __(_)_ __ | |_  ");
  log.debug("| |_) / _ \\ / __| |/ /\\___ \\ / __| '__| | '_ \\| __| ");
  log.debug("|  _ < (_) | (__|   <  ___) | (__| |  | | |_) | |_  ");
  log.debug("|_| \\_\\___/ \\___|_|\\_\\|____/ \\___|_|  |_| .__/ \\__| ");
  log.debug("                                        |_|         ");

  setGson(engine.getGson());

  engine
    .getRequestHandlers()
    .forEach(requestHandler->requestHandler(requestHandler));

  defaultResponseHeader("Access-Control-Allow-Origin", "*");
}
 
开发者ID:rockscript,项目名称:rockscript,代码行数:27,代码来源:Servlet.java


注:本文中的javax.servlet.ServletConfig类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。