當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。