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