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


Java NamespaceException类代码示例

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


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

示例1: start

import org.osgi.service.http.NamespaceException; //导入依赖的package包/类
public void start () throws ServletException, NamespaceException
{
    final BundleContext bundleContext = FrameworkUtil.getBundle ( DispatcherServletInitializer.class ).getBundleContext ();
    this.context = Dispatcher.createContext ( bundleContext );

    this.errorHandler = new ErrorHandlerTracker ();

    Dictionary<String, String> initparams = new Hashtable<> ();

    final MultipartConfigElement multipart = Servlets.createMultiPartConfiguration ( PROP_PREFIX_MP );
    final DispatcherServlet servlet = new DispatcherServlet ();
    servlet.setErrorHandler ( this.errorHandler );
    this.webContainer.registerServlet ( servlet, "dispatcher", new String[] { "/" }, initparams, 1, false, multipart, this.context );

    this.proxyFilter = new FilterTracker ( bundleContext );
    this.webContainer.registerFilter ( this.proxyFilter, new String[] { "/*" }, null, null, this.context );

    initparams = new Hashtable<> ();
    initparams.put ( "filter-mapping-dispatcher", "request" );
    this.webContainer.registerFilter ( new BundleFilter (), new String[] { "/bundle/*" }, null, initparams, this.context );

    this.jspTracker = new BundleTracker<> ( bundleContext, Bundle.INSTALLED | Bundle.ACTIVE, new JspBundleCustomizer ( this.webContainer, this.context ) );
    this.jspTracker.open ();
}
 
开发者ID:eclipse,项目名称:packagedrone,代码行数:25,代码来源:DispatcherServletInitializer.java

示例2: addingBundle

import org.osgi.service.http.NamespaceException; //导入依赖的package包/类
@Override
public JspBundle addingBundle ( final Bundle bundle, final BundleEvent event )
{
    final Enumeration<String> result = bundle.getEntryPaths ( "/WEB-INF" );
    if ( result != null && result.hasMoreElements () )
    {
        try
        {
            return new JspBundle ( bundle, this.service, this.context );
        }
        catch ( ServletException | NamespaceException e )
        {
            logger.warn ( "Failed to register JSP bundle: " + bundle.getSymbolicName (), e );
            return null;
        }
    }

    return null;
}
 
开发者ID:eclipse,项目名称:packagedrone,代码行数:20,代码来源:JspBundleCustomizer.java

示例3: activate

import org.osgi.service.http.NamespaceException; //导入依赖的package包/类
protected void activate(BundleContext context) {
	HttpContext httpContext = new DefaultHttpContext(m_httpService.createDefaultHttpContext());
	
	try {
		m_httpService.registerResources("/weblog", "www/index.html", httpContext);
		m_httpService.registerResources("/weblogjs", "www/weblogjs", httpContext);
		m_httpService.registerResources("/weblogcss", "www/weblogcss", httpContext);
		
		m_httpService.registerServlet("/weblogapi", new LogLevelApi(), null, httpContext);
		m_httpService.registerServlet("/weblogviewapi", new LogViewApi(), null, httpContext);
	} catch (NamespaceException|ServletException e) {
		s_logger.error("Error registering weblog", e);
		throw new ComponentException(e);
	}
	s_logger.info("WebLog activated");
}
 
开发者ID:darugnaa,项目名称:kura-web-log,代码行数:17,代码来源:LogConsole.java

示例4: addingBundle

import org.osgi.service.http.NamespaceException; //导入依赖的package包/类
@Override
public Object addingBundle(Bundle bundle, BundleEvent event) {
  ArrayList<String> aliases = new ArrayList<String>();
  
  String[] resources = findResources(bundle);
  
  if ( resources != null ) {
    HttpContext ctx = new ProxyHttpContext(bundle);
    
    for ( String p : resources ) {
      String[] split = p.split("\\s*=\\s*");
      String alias = split[0];
      String file = split.length == 1 ? split[0] : split[1];
      try {
        System.out.println( "Registering " + alias + "->" + file );
        http.registerResources(alias, file, ctx);
        aliases.add( alias );
      } catch (NamespaceException e) {
        e.printStackTrace();
      }            
    }
  }
  
  return aliases.isEmpty() ? null : aliases.toArray(new String[aliases.size()]);
}
 
开发者ID:mcculls,项目名称:osgi-in-action,代码行数:26,代码来源:HttpResourceTracker.java

示例5: start

import org.osgi.service.http.NamespaceException; //导入依赖的package包/类
public void start () throws ServletException, NamespaceException
{
    final BundleContext bundleContext = FrameworkUtil.getBundle ( DispatcherServletInitializer.class ).getBundleContext ();
    this.context = Dispatcher.createContext ( bundleContext );

    Dictionary<String, String> initparams = new Hashtable<> ();

    final MultipartConfigElement multipart = JspServletInitializer.createMultiPartConfiguration ( PROP_PREFIX_MP );
    this.webContainer.registerServlet ( new DispatcherServlet (), "dispatcher", new String[] { "/" }, initparams, 1, false, multipart, this.context );

    this.proxyFilter = new FilterTracker ( bundleContext );
    this.webContainer.registerFilter ( this.proxyFilter, new String[] { "/*" }, null, null, this.context );

    initparams = new Hashtable<> ();
    initparams.put ( "filter-mapping-dispatcher", "request" );
    this.webContainer.registerFilter ( new BundleFilter (), new String[] { "/bundle/*" }, null, initparams, this.context );

    this.jspTracker = new BundleTracker<> ( bundleContext, Bundle.INSTALLED | Bundle.ACTIVE, new JspBundleCustomizer ( this.webContainer, this.context ) );
    this.jspTracker.open ();
}
 
开发者ID:ctron,项目名称:package-drone,代码行数:21,代码来源:DispatcherServletInitializer.java

示例6: registerResources

import org.osgi.service.http.NamespaceException; //导入依赖的package包/类
/**
 * Register spa resources under a resource servlet.
 * 
 */
protected void registerResources() {
	
	clientPath = (String) configProps.get(CLIENTPATH);
	Object zip = configProps.get(GZIPRESOURCES);
	doGzip = zip instanceof Boolean ? (Boolean) zip: Boolean.parseBoolean(zip != null ? zip.toString(): "false");
	
	if( clientPath != null && clientPath.length() > 0) {
		try {
			registeredAlias = clientPath;
			
			httpService.registerServlet(registeredAlias, new ResourceServlet("/resources", doGzip.booleanValue(), this ), null, null);
			
			//httpService.registerResources(registeredAlias, "/resources", null);
		
			Activator.log(LogService.LOG_INFO, "Mapped /obix under alias " + registeredAlias);
			
			// Remember initialisation was done.
			isInitialized = true;
		} catch (NamespaceException | ServletException e) {
			Activator.log(LogService.LOG_ERROR, "Error while registering resources:  " + e.toString());
		}
	}
}
 
开发者ID:lathil,项目名称:Ptoceti,代码行数:28,代码来源:ClientApplicationHandler.java

示例7: addServlet

import org.osgi.service.http.NamespaceException; //导入依赖的package包/类
public synchronized void addServlet(ServletHandler handler)
    throws ServletException, NamespaceException
{
    if (this.servletMap.containsKey(handler.getServlet())) {
        throw new ServletException("Servlet instance already registered");
    }

    if (this.aliasMap.containsKey(handler.getAlias())) {
        throw new NamespaceException("Servlet with alias already registered");
    }

    handler.init();
    this.servletMap.put(handler.getServlet(), handler);
    this.aliasMap.put(handler.getAlias(), handler.getServlet());
    updateServletArray();
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:17,代码来源:HandlerRegistry.java

示例8: registerServlet

import org.osgi.service.http.NamespaceException; //导入依赖的package包/类
public void registerServlet(String context, Servlet servlet, Dictionary dictionary, HttpContext httpContext) throws ServletException, NamespaceException {

        ContextHandlerCollection contexts = new ContextHandlerCollection();
        server.setHandler(contexts);
        ServletContextHandler root = new ServletContextHandler(contexts, "/",
                ServletContextHandler.SESSIONS);
        ServletHolder servletHolder = new ServletHolder(servlet);
        root.addServlet(servletHolder, context);

        if (!server.getServer().getState().equals(server.STARTED)) {
            try {
                server.start();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }

    }
 
开发者ID:ow2-chameleon,项目名称:fuchsia,代码行数:19,代码来源:HttpServiceImpl.java

示例9: activate

import org.osgi.service.http.NamespaceException; //导入依赖的package包/类
@Activate
protected void activate() {
    try {
        httpService.registerResources(HABOT_ALIAS, "web/dist", null);
        logger.info("Started HABot at " + HABOT_ALIAS);
    } catch (NamespaceException e) {
        logger.error("Error during HABot startup: {}", e.getMessage());
    }
}
 
开发者ID:ghys,项目名称:habot,代码行数:10,代码来源:HABotDashboardTile.java

示例10: bindWebFragment

import org.osgi.service.http.NamespaceException; //导入依赖的package包/类
protected void bindWebFragment(WebFragment webFragment) throws IOException,
                                                       ServletException,
                                                       NamespaceException {
    // TODO: support some ordering for jax-rs resource and template overrides?
    webFragments.add(webFragment);
    initJersey();
}
 
开发者ID:teamdigitale,项目名称:ontonethub,代码行数:8,代码来源:JerseyEndpoint.java

示例11: unbindWebFragment

import org.osgi.service.http.NamespaceException; //导入依赖的package包/类
protected void unbindWebFragment(WebFragment webFragment) throws IOException,
                                                         ServletException,
                                                         NamespaceException {
    navigationLinks.removeAll(webFragment.getNavigationLinks());
    webFragments.remove(webFragment);
    initJersey();
}
 
开发者ID:teamdigitale,项目名称:ontonethub,代码行数:8,代码来源:JerseyEndpoint.java

示例12: provideActivateData

import org.osgi.service.http.NamespaceException; //导入依赖的package包/类
@DataProvider(name = "provideActivateData")
public Object[][] provideActivateData() {

    return new Object[][] {
            { new NamespaceException(null), "Error when registering the IWA servlet" },
            { new ServletException(), "Error when registering the IWA servlet" },
            { new Exception(), "IWAFederatedAuthenticator bundle activation failed" },
            { null, "IWAFederatedAuthenticator bundle is activated"}
    };
}
 
开发者ID:wso2-extensions,项目名称:identity-local-auth-iwa-kerberos,代码行数:11,代码来源:IWAAuthenticatorServiceComponentTest.java

示例13: configure

import org.osgi.service.http.NamespaceException; //导入依赖的package包/类
@Activate
public void configure(Map<String, Object> config)
        throws ServletException, NamespaceException
{
    try {
        http.unregister("/buckets");
    } catch (IllegalArgumentException x) {}
    http.registerServlet("/buckets", this, null, http.createDefaultHttpContext());
}
 
开发者ID:ancoron,项目名称:hazelcast-rest,代码行数:10,代码来源:OSGiHazelcastMapServlet.java

示例14: start

import org.osgi.service.http.NamespaceException; //导入依赖的package包/类
@Activate
public void start() {
  try {
    httpService.registerServlet(SERVLET_PATH, this, null, null);
  } catch (ServletException | NamespaceException e) {
    LOGGER.error("Failed to register servlet at " + SERVLET_PATH, e);
  }
}
 
开发者ID:Cognifide,项目名称:aet,代码行数:9,代码来源:SuiteStatusServlet.java

示例15: activate

import org.osgi.service.http.NamespaceException; //导入依赖的package包/类
protected void activate(ComponentContext componentContext) {
    try {
        httpService.registerResources(DASHBOARD_ALIAS, "web", null);
        logger.info("Started dashboard at " + DASHBOARD_ALIAS);
    } catch (NamespaceException e) {
        logger.error("Error during servlet startup", e);
    }
}
 
开发者ID:Neulinet,项目名称:Zoo,代码行数:9,代码来源:DashboardService.java


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