本文整理汇总了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);
}
}
示例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);
}
示例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);
}
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}
}
示例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);
}
示例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);
}
示例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;
}
示例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.");
}
示例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);
}
示例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);
}
}
}
示例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", "*");
}