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);
}
}
java类javax.servlet.ServletConfig的实例源码
CMISServletDispatcher.java 文件源码
项目:alfresco-remote-api
阅读 29
收藏 0
点赞 0
评论 0
ShibbolethExtAuthnHandler.java 文件源码
项目:e-identification-tupas-idp-public
阅读 40
收藏 0
点赞 0
评论 0
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);
}
}
ViewApi.java 文件源码
项目:swaggy-jenkins
阅读 38
收藏 0
点赞 0
评论 0
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;
}
AgentApi.java 文件源码
项目:elastest-instrumentation-manager
阅读 44
收藏 0
点赞 0
评论 0
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;
}
AgentconfigurationApi.java 文件源码
项目:elastest-instrumentation-manager
阅读 40
收藏 0
点赞 0
评论 0
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;
}
TagHandlerPool.java 文件源码
项目:apache-tomcat-7.0.73-with-comment
阅读 47
收藏 0
点赞 0
评论 0
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);
}
ContainerUtil.java 文件源码
项目:parabuild-ci
阅读 36
收藏 0
点赞 0
评论 0
/**
* 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);
}
}
PrometheusServlet.java 文件源码
项目:dropwizard-prometheus
阅读 70
收藏 0
点赞 0
评论 0
@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);
}
IndexServlet.java 文件源码
项目:dremio-oss
阅读 41
收藏 0
点赞 0
评论 0
@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);
}
BlueApi.java 文件源码
项目:swaggy-jenkins
阅读 39
收藏 0
点赞 0
评论 0
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;
}
SchemaViewerServlet.java 文件源码
项目:joai-project
阅读 31
收藏 0
点赞 0
评论 0
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.");
}
TagHandlerPool.java 文件源码
项目:lams
阅读 45
收藏 0
点赞 0
评论 0
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);
}
StartupUtil.java 文件源码
项目:validator-web
阅读 41
收藏 0
点赞 0
评论 0
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);
}
}
}
Servlet.java 文件源码
项目:rockscript
阅读 40
收藏 0
点赞 0
评论 0
@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", "*");
}
SRWServletExt.java 文件源码
项目:Equella
阅读 34
收藏 0
点赞 0
评论 0
@Override
public void init() throws ServletException
{
Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
final ServletConfig config = super.getServletConfig();
super.init();
// We do so we don't have specify a 'database' on the URL path
// eg. http://localhost:8988/dev/first/srw/
srwInfo = new SRWServletInfo()
{
@Override
public String getDBName(HttpServletRequest request)
{
return DB_NAME;
}
};
srwInfo.init(config);
srwInfo.getProperties().put("defaultSchema", EquellaSRWDatabase.DEFAULT_SCHEMA.getTleId()); //$NON-NLS-1$
srwInfo.getProperties().put("db." + DB_NAME + ".class", EquellaSRWDatabase.class.getName()); //$NON-NLS-1$ //$NON-NLS-2$
}
DwrGuiceServlet.java 文件源码
项目:parabuild-ci
阅读 35
收藏 0
点赞 0
评论 0
/**
* Copies DWR configuration values from the Guice bindings into
* {@code servletConfig} to make these values accessible to the
* standard DWR servlet configuration machinery.
*/
@Override public void init(ServletConfig servletConfig) throws ServletException
{
// Save this for later use by destroy.
this.servletContext = servletConfig.getServletContext();
// Set the current context thread-locally so our internal classes can
// look up the Injector and use it in turn to look up further objects.
pushServletContext(this.servletContext);
try
{
// Since ServletConfig is immutable, we use a modifiable
// decoration of the real servlet configuration and pass
// that to the init method of the superclass.
ModifiableServletConfig config = new ModifiableServletConfig(servletConfig);
// Apply settings configured at bind-time.
setInitParameters(config);
// Use our internal manager classes to replace and delegate to
// any user-specified or default implementations, after adding
// additional creators and converters registered at bind-time.
configureDelegatedTypes(config);
// Normal DwrServlet initialization happens here using the
// modified ServletConfig instead of the one we were passed.
super.init(config);
// Objects with (non-global) application scope are initialized
// eagerly.
initApplicationScoped();
}
finally
{
// Clean up the ThreadLocal we just used.
popServletContext();
}
}
CountriesServlet.java 文件源码
项目:java-web-services-training
阅读 66
收藏 0
点赞 0
评论 0
@Override
public void init(ServletConfig config) throws ServletException {
super.init(config);
// Prepare list of Country objects
countries.add(new Country("IDN", "Indonesia"));
countries.add(new Country("MYS", "Malaysia"));
}
PentahoServlet.java 文件源码
项目:pentaho-8-reporting-for-java-developers
阅读 36
收藏 0
点赞 0
评论 0
@Override
public void init(
ServletConfig config)
throws ServletException
{
super.init(config);
ClassicEngineBoot.getInstance().start();
}
ContainerUtil.java 文件源码
项目:parabuild-ci
阅读 38
收藏 0
点赞 0
评论 0
/**
* Take a DefaultContainer and setup the default beans
* @param container The container to configure
* @param servletConfig The servlet configuration (null to ignore)
* @throws InstantiationException If we can't instantiate a bean
* @throws IllegalAccessException If we have access problems creating a bean
*/
public static void setupFromServletConfig(DefaultContainer container, ServletConfig servletConfig) throws InstantiationException, IllegalAccessException
{
Enumeration en = servletConfig.getInitParameterNames();
while (en.hasMoreElements())
{
String name = (String) en.nextElement();
String value = servletConfig.getInitParameter(name);
container.addParameter(name, value);
}
}
CGIServlet.java 文件源码
项目:lams
阅读 30
收藏 0
点赞 0
评论 0
/**
* Sets instance variables.
* <P>
* Modified from Craig R. McClanahan's InvokerServlet
* </P>
*
* @param config a <code>ServletConfig</code> object
* containing the servlet's
* configuration and initialization
* parameters
*
* @exception ServletException if an exception has occurred that
* interferes with the servlet's normal
* operation
*/
public void init(ServletConfig config) throws ServletException {
super.init(config);
// Verify that we were not accessed using the invoker servlet
String servletName = getServletConfig().getServletName();
if (servletName == null)
servletName = "";
if (servletName.startsWith("org.apache.catalina.INVOKER."))
throw new UnavailableException
("Cannot invoke CGIServlet through the invoker");
// Set our properties from the initialization parameters
if (getServletConfig().getInitParameter("debug") != null)
debug = Integer.parseInt(getServletConfig().getInitParameter("debug"));
cgiPathPrefix = getServletConfig().getInitParameter("cgiPathPrefix");
boolean passShellEnvironment =
Boolean.valueOf(getServletConfig().getInitParameter("passShellEnvironment")).booleanValue();
if (passShellEnvironment) {
shellEnv.putAll(System.getenv());
}
if (getServletConfig().getInitParameter("executable") != null) {
cgiExecutable = getServletConfig().getInitParameter("executable");
}
if (getServletConfig().getInitParameter("parameterEncoding") != null) {
parameterEncoding = getServletConfig().getInitParameter("parameterEncoding");
}
}
PentahoServlet.java 文件源码
项目:pentaho-8-reporting-for-java-developers
阅读 32
收藏 0
点赞 0
评论 0
@Override
public void init(
ServletConfig config)
throws ServletException
{
super.init(config);
ClassicEngineBoot.getInstance().start();
}
UfloServlet.java 文件源码
项目:uflo
阅读 35
收藏 0
点赞 0
评论 0
@Override
public void init(ServletConfig config) throws ServletException {
super.init(config);
WebApplicationContext applicationContext=getWebApplicationContext(config);
Collection<ServletHandler> handlers=applicationContext.getBeansOfType(ServletHandler.class).values();
for(ServletHandler handler:handlers){
String url=handler.url();
if(handlerMap.containsKey(url)){
throw new RuntimeException("Handler ["+url+"] already exist.");
}
handlerMap.put(url, handler);
}
}
TagHandlerPool.java 文件源码
项目:apache-tomcat-7.0.73-with-comment
阅读 39
收藏 0
点赞 0
评论 0
protected static String getOption(ServletConfig config, String name,
String defaultV) {
if (config == null)
return defaultV;
String value = config.getInitParameter(name);
if (value != null)
return value;
if (config.getServletContext() == null)
return defaultV;
value = config.getServletContext().getInitParameter(name);
if (value != null)
return value;
return defaultV;
}
StartupUtil.java 文件源码
项目:parabuild-ci
阅读 76
收藏 0
点赞 0
评论 0
/**
* We have some special logging classes to maintain an optional dependence
* on commons-logging. This sets the servlet for when this is not available.
* @param servletConfig The servlet configuration
* @param servlet The servlet that we are running under
*/
public static void setupLogging(ServletConfig servletConfig, HttpServlet servlet)
{
ServletLoggingOutput.setExecutionContext(servlet);
String logLevel = servletConfig.getInitParameter(ContainerUtil.INIT_LOGLEVEL);
if (logLevel != null)
{
ServletLoggingOutput.setLevel(logLevel);
}
}
PentahoServlet.java 文件源码
项目:pentaho-8-reporting-for-java-developers
阅读 39
收藏 0
点赞 0
评论 0
@Override
public void init(
ServletConfig config)
throws ServletException
{
super.init(config);
ClassicEngineBoot.getInstance().start();
}
DefaultWebContextBuilder.java 文件源码
项目:parabuild-ci
阅读 33
收藏 0
点赞 0
评论 0
public void set(HttpServletRequest request, HttpServletResponse response, ServletConfig config, ServletContext context, Container container)
{
try
{
WebContext ec = new DefaultWebContext(request, response, config, context, container);
user.set(ec);
}
catch (Exception ex)
{
log.fatal("Failed to create an ExecutionContext", ex);
}
}
WebContextThreadStack.java 文件源码
项目:validator-web
阅读 34
收藏 0
点赞 0
评论 0
/**
* Make the current thread know what the current request is.
* @param servletConfig The servlet configuration object used by a servlet container
* @param request The incoming http request
* @param response The outgoing http reply
* @see #disengageThread()
*/
public static void engageThread(ServletConfig servletConfig, HttpServletRequest request, HttpServletResponse response) {
try {
WebContext ec = new DefaultWebContext(request, response, servletConfig,
servletConfig.getServletContext());
engageThread(ec);
} catch (Exception ex) {
log.fatal("Failed to create an ExecutionContext", ex);
}
}
ProductServlet.java 文件源码
项目:sgroup
阅读 39
收藏 0
点赞 0
评论 0
/**
* 带参数的初始化,只执行一次
* @param config web.xml的配置
* @throws ServletException
*/
@Override
public void init(ServletConfig config) throws ServletException {
super.init(config);
// 读取编码格式
// charset = config.getInitParameter("charset");
}
TagHandlerPool.java 文件源码
项目:lazycat
阅读 36
收藏 0
点赞 0
评论 0
protected static String getOption(ServletConfig config, String name, String defaultV) {
if (config == null)
return defaultV;
String value = config.getInitParameter(name);
if (value != null)
return value;
if (config.getServletContext() == null)
return defaultV;
value = config.getServletContext().getInitParameter(name);
if (value != null)
return value;
return defaultV;
}
CommCoreServlet.java 文件源码
项目:joai-project
阅读 30
收藏 0
点赞 0
评论 0
/**
* Intialize the StandardsSuggestionService and place it in the ServletContext
* where it can be found by the Rest Service Clases.
*
* @param config Description of the Parameter
* @exception ServletException Description of the Exception
*/
public void init(ServletConfig config)
throws ServletException {
log.info (getDateStamp() + " CommCoreServlet starting");
String initErrorMsg = "";
try {
super.init(config);
} catch (Throwable exc) {
initErrorMsg = "CommCoreServlet Initialization Error:\n " + exc;
log.error (initErrorMsg);
}
// initialize the AdnStandardsManager
String commCoreStandardsPath = getAbsolutePath ((String)getServletContext().getInitParameter("commCoreStandardsPath"));
if (commCoreStandardsPath == null) {
throw new ServletException("init parameter \"commCoreStandardsPath\" not found in servlet context");
}
CommCoreServiceHelper commCoreServiceHelper = null;
try {
commCoreServiceHelper = new CommCoreServiceHelper(commCoreStandardsPath);
} catch (Exception e) {
log.error("Failed to initialize StdDocument.", e);
}
if (commCoreServiceHelper != null)
getServletContext().setAttribute("commCoreServiceHelper", commCoreServiceHelper);
else
throw new ServletException ("Failed to initialize StdDocument");
log.info (getDateStamp() + " CommCoreServlet completed.\n");
}