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


Java StatusService类代码示例

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


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

示例1: Component

import org.restlet.service.StatusService; //导入依赖的package包/类
/**
 * Constructor.
 */
public Component() {
    super();
    this.hosts = new CopyOnWriteArrayList<VirtualHost>();
    this.clients = new ClientList(null);
    this.servers = new ServerList(null, this);
    this.realms = new CopyOnWriteArrayList<Realm>();
    this.services = new ServiceList(getContext());

    if (Engine.getInstance() != null) {
        // To be done before setting the helper...
        this.services.add(new org.restlet.service.TaskService());

        this.helper = new ComponentHelper(this);
        Context childContext = getContext().createChildContext();
        this.defaultHost = new VirtualHost(childContext);
        this.internalRouter = new InternalRouter(childContext);
        this.services.add(new LogService());
        getLogService().setContext(childContext);
        this.services.add(new StatusService());
        this.clients.setContext(childContext);
        this.servers.setContext(childContext);
    }
}
 
开发者ID:restlet,项目名称:restlet-framework,代码行数:27,代码来源:Component.java

示例2: run

import org.restlet.service.StatusService; //导入依赖的package包/类
/**
 * Run the Application on an open port.
 *
 */
public void run() {

    try {
        setStatusService(new StatusService() {
            @Override
            public Representation getRepresentation(Status status,
                                                    Request request,
                                                    Response response) {
                return new JacksonRepresentation<>(status);
            }
        });

        // Start listening for REST requests
        component = new Component();
        server = component.getServers().add(Protocol.HTTP, 0);
        component.getDefaultHost().attach(this);
        component.start();
    } catch (Exception e) {
        //  Web server did not start.
        throw new IllegalStateException(e);
    }
}
 
开发者ID:opennetworkinglab,项目名称:spring-open,代码行数:27,代码来源:TestRestApiServer.java

示例3: run

import org.restlet.service.StatusService; //导入依赖的package包/类
public void run(FloodlightModuleContext fmlContext, String restHost, int restPort) {
    setStatusService(new StatusService() {
        @Override
        public Representation getRepresentation(Status status,
                                                Request request,
                                                Response response) {
            return new JacksonRepresentation<Status>(status);
        }                
    });
    
    // Add everything in the module context to the rest
    for (Class<? extends IFloodlightService> s : fmlContext.getAllServices()) {
        if (logger.isTraceEnabled()) {
            logger.trace("Adding {} for service {} into context",
                         s.getCanonicalName(), fmlContext.getServiceImpl(s));
        }
        context.getAttributes().put(s.getCanonicalName(), 
                                    fmlContext.getServiceImpl(s));
    }
    
    // Start listening for REST requests
    try {
        final Component component = new Component();
        if (restHost == null) {
        	component.getServers().add(Protocol.HTTP, restPort);
        } else {
        	component.getServers().add(Protocol.HTTP, restHost, restPort);
        }
        component.getClients().add(Protocol.CLAP);
        component.getDefaultHost().attach(this);
        component.start();
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
 
开发者ID:JianqingJiang,项目名称:QoS-floodlight,代码行数:36,代码来源:RestApiServer.java

示例4: Application

import org.restlet.service.StatusService; //导入依赖的package包/类
/**
 * Constructor.
 * 
 * @param context
 *            The context to use based on parent component context. This
 *            context should be created using the
 *            {@link Context#createChildContext()} method to ensure a proper
 *            isolation with the other applications.
 */
public Application(Context context) {
    super(context);

    if (Engine.getInstance() != null) {
        this.helper = new ApplicationHelper(this);
        this.helper.setContext(context);
    }

    ConnegService connegService = new ConnegService();
    ConverterService converterService = new ConverterService();
    MetadataService metadataService = new MetadataService();

    this.debugging = false;
    this.outboundRoot = null;
    this.inboundRoot = null;
    this.roles = new CopyOnWriteArrayList<Role>();
    this.services = new ServiceList(context);
    this.services.add(new TunnelService(true, true));
    this.services.add(new StatusService(true, converterService,
            metadataService, connegService));
    this.services.add(new DecoderService());
    this.services.add(new EncoderService(false));
    this.services.add(new RangeService());
    this.services.add(new ConnectorService());
    this.services.add(connegService);
    this.services.add(converterService);
    this.services.add(metadataService);
    this.services.add(new org.restlet.service.TaskService(false));
}
 
开发者ID:restlet,项目名称:restlet-framework,代码行数:39,代码来源:Application.java

示例5: run

import org.restlet.service.StatusService; //导入依赖的package包/类
public void run(FloodlightModuleContext fmlContext, int restPort) {
    setStatusService(new StatusService() {
        @Override
        public Representation getRepresentation(Status status,
                                                Request request,
                                                Response response) {
            return new JacksonRepresentation<Status>(status);
        }                
    });
    
    // Add everything in the module context to the rest
    for (Class<? extends IFloodlightService> s : fmlContext.getAllServices()) {
        if (logger.isTraceEnabled()) {
            logger.trace("Adding {} for service {} into context",
                         s.getCanonicalName(), fmlContext.getServiceImpl(s));
        }
        context.getAttributes().put(s.getCanonicalName(), 
                                    fmlContext.getServiceImpl(s));
    }
    
    // Start listening for REST requests
    try {
        final Component component = new Component();
        component.getServers().add(Protocol.HTTP, restPort);
        component.getClients().add(Protocol.CLAP);
        component.getDefaultHost().attach(this);
        component.start();
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
 
开发者ID:vishalshubham,项目名称:Multipath-Hedera-system-in-Floodlight-controller,代码行数:32,代码来源:RestApiServer.java

示例6: run

import org.restlet.service.StatusService; //导入依赖的package包/类
public void run(FloodlightModuleContext fmlContext, String restHost, int restPort) {
    setStatusService(new StatusService() {
        @Override
        public Representation getRepresentation(Status status,
                                                Request request,
                                                Response response) {
            return new JacksonRepresentation<Status>(status);
        }                
    });
    
    // Add everything in the module context to the rest
    for (Class<? extends IFloodlightService> s : fmlContext.getAllServices()) {
        if (logger.isTraceEnabled()) {
            logger.trace("Adding {} for service {} into context",
                         s.getCanonicalName(), fmlContext.getServiceImpl(s));
        }
        context.getAttributes().put(s.getCanonicalName(), 
                                    fmlContext.getServiceImpl(s));
    }
    
    /*
     * Specifically add the FML for use by the REST API's /wm/core/modules/...
     */
    context.getAttributes().put(fmlContext.getModuleLoader().getClass().getCanonicalName(), fmlContext.getModuleLoader());
    
    // Start listening for REST requests
    try {
        final Component component = new Component();
        if (restHost == null) {
        	component.getServers().add(Protocol.HTTP, restPort);
        } else {
        	component.getServers().add(Protocol.HTTP, restHost, restPort);
        }
        component.getClients().add(Protocol.CLAP);
        component.getDefaultHost().attach(this);
        component.start();
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
 
开发者ID:pixuan,项目名称:floodlight,代码行数:41,代码来源:RestApiServer.java

示例7: run

import org.restlet.service.StatusService; //导入依赖的package包/类
public void run(ModuleContext fmlContext, int restPort) {
    setStatusService(new StatusService() {
        @Override
        public Representation getRepresentation(Status status,
                                                Request request,
                                                Response response) {
            return new JacksonRepresentation<Status>(status);
        }                
    });
    
    // Add everything in the module context to the rest
    for (Class<? extends IPlatformService> s : fmlContext.getAllServices()) {
        if (logger.isTraceEnabled()) {
            logger.trace("Adding {} for service {} into context",
                         s.getCanonicalName(), fmlContext.getServiceImpl(s));
        }
        context.getAttributes().put(s.getCanonicalName(), 
                                    fmlContext.getServiceImpl(s));
    }
    
    // Start listening for REST requests
    try {
        final Component component = new Component();
        component.getServers().add(Protocol.HTTP, restPort);
        component.getDefaultHost().attach(this);
        component.start();
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
 
开发者ID:opendaylight,项目名称:archived-net-virt-platform,代码行数:31,代码来源:RestApiServer.java

示例8: run

import org.restlet.service.StatusService; //导入依赖的package包/类
public void run(FloodlightModuleContext fmlContext, int restPort) {
    setStatusService(new StatusService() {
        @Override
        public Representation getRepresentation(Status status,
                                                Request request,
                                                Response response) {
            return new JacksonRepresentation<Status>(status);
        }
    });

    // Add everything in the module context to the rest
    for (Class<? extends IFloodlightService> s : fmlContext.getAllServices()) {
        if (logger.isTraceEnabled()) {
            logger.trace("Adding {} for service {} into context",
                    s.getCanonicalName(), fmlContext.getServiceImpl(s));
        }
        context.getAttributes().put(s.getCanonicalName(),
                fmlContext.getServiceImpl(s));
    }

    // Start listening for REST requests
    try {
        final Component component = new Component();
        Server server = component.getServers().add(Protocol.HTTP, restPort);
        if (numThreads != null) {
            logger.debug("Setting number of REST API threads to {}", numThreads);
            server.getContext().getParameters().add("defaultThreads", numThreads);
        }
        component.getDefaultHost().attach(this);
        component.start();
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
 
开发者ID:opennetworkinglab,项目名称:spring-open,代码行数:35,代码来源:RestApiServer.java

示例9: run

import org.restlet.service.StatusService; //导入依赖的package包/类
public void run(FloodlightModuleContext fmlContext, String restHost) {
	setStatusService(new StatusService() {
		@Override
		public Representation getRepresentation(Status status,
				Request request,
				Response response) {
			return new JacksonRepresentation<Status>(status);
		}                
	});

	// Add everything in the module context to the rest
	for (Class<? extends IFloodlightService> s : fmlContext.getAllServices()) {
		if (logger.isTraceEnabled()) {
			logger.trace("Adding {} for service {} into context",
					s.getCanonicalName(), fmlContext.getServiceImpl(s));
		}
		context.getAttributes().put(s.getCanonicalName(), 
				fmlContext.getServiceImpl(s));
	}

	/*
	 * Specifically add the FML for use by the REST API's /wm/core/modules/...
	 */
	context.getAttributes().put(fmlContext.getModuleLoader().getClass().getCanonicalName(), fmlContext.getModuleLoader());

	/* Start listening for REST requests */
	try {
		final Component component = new Component();

		if (RestApiServer.useHttps) {
			Server server;

			if (restHost == null) {
				server = component.getServers().add(Protocol.HTTPS, Integer.valueOf(RestApiServer.httpsPort));
			} else {
				server = component.getServers().add(Protocol.HTTPS, restHost, Integer.valueOf(RestApiServer.httpsPort));
			}

			Series<Parameter> parameters = server.getContext().getParameters();
			//parameters.add("sslContextFactory", "org.restlet.ext.jsslutils.PkixSslContextFactory");
			parameters.add("sslContextFactory", "org.restlet.engine.ssl.DefaultSslContextFactory");

			parameters.add("keystorePath", RestApiServer.keyStore);
			parameters.add("keystorePassword", RestApiServer.keyStorePassword);
			parameters.add("keyPassword", RestApiServer.keyStorePassword);
			parameters.add("keystoreType", "JKS");

			parameters.add("truststorePath", RestApiServer.keyStore);
			parameters.add("truststorePassword", RestApiServer.keyStorePassword);
			parameters.add("trustPassword", RestApiServer.keyStorePassword);
			parameters.add("truststoreType", "JKS");

			parameters.add("needClientAuthentication", RestApiServer.httpsNeedClientAuth);
		}

		if (RestApiServer.useHttp) {
			if (restHost == null) {
				component.getServers().add(Protocol.HTTP, Integer.valueOf(RestApiServer.httpPort));
			} else {
				component.getServers().add(Protocol.HTTP, restHost, Integer.valueOf(RestApiServer.httpPort));
			}
		}

		component.getClients().add(Protocol.CLAP);
		component.getDefaultHost().attach(this);
		component.start();
	} catch (Exception e) {
		throw new RuntimeException(e);
	}
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:71,代码来源:RestApiServer.java

示例10: run

import org.restlet.service.StatusService; //导入依赖的package包/类
public void run(FloodlightModuleContext fmlContext, String restHost) {
	setStatusService(new StatusService() {
		@Override
		public Representation getRepresentation(Status status,
				Request request,
				Response response) {
			return new JacksonRepresentation<Status>(status);
		}
	});

	// Add everything in the module context to the rest
	for (Class<? extends IFloodlightService> s : fmlContext.getAllServices()) {
		if (logger.isTraceEnabled()) {
			logger.trace("Adding {} for service {} into context",
					s.getCanonicalName(), fmlContext.getServiceImpl(s));
		}
		context.getAttributes().put(s.getCanonicalName(),
				fmlContext.getServiceImpl(s));
	}

	/*
	 * Specifically add the FML for use by the REST API's /wm/core/modules/...
	 */
	context.getAttributes().put(fmlContext.getModuleLoader().getClass().getCanonicalName(), fmlContext.getModuleLoader());

	/* Start listening for REST requests */
	try {
		final Component component = new Component();

		if (RestApiServer.useHttps) {
			Server server;

			if (restHost == null) {
				server = component.getServers().add(Protocol.HTTPS, Integer.valueOf(RestApiServer.httpsPort));
			} else {
				server = component.getServers().add(Protocol.HTTPS, restHost, Integer.valueOf(RestApiServer.httpsPort));
			}

			Series<Parameter> parameters = server.getContext().getParameters();
			//parameters.add("sslContextFactory", "org.restlet.ext.jsslutils.PkixSslContextFactory");
			parameters.add("sslContextFactory", "org.restlet.engine.ssl.DefaultSslContextFactory");

			parameters.add("keystorePath", RestApiServer.keyStore);
			parameters.add("keystorePassword", RestApiServer.keyStorePassword);
			parameters.add("keyPassword", RestApiServer.keyStorePassword);
			parameters.add("keystoreType", "JKS");

			parameters.add("truststorePath", RestApiServer.keyStore);
			parameters.add("truststorePassword", RestApiServer.keyStorePassword);
			parameters.add("trustPassword", RestApiServer.keyStorePassword);
			parameters.add("truststoreType", "JKS");

			parameters.add("needClientAuthentication", RestApiServer.httpsNeedClientAuth);
		}

		if (RestApiServer.useHttp) {
			if (restHost == null) {
				component.getServers().add(Protocol.HTTP, Integer.valueOf(RestApiServer.httpPort));
			} else {
				component.getServers().add(Protocol.HTTP, restHost, Integer.valueOf(RestApiServer.httpPort));
			}
		}

		component.getClients().add(Protocol.CLAP);
		component.getDefaultHost().attach(this);
		component.start();
	} catch (Exception e) {
		throw new RuntimeException(e);
	}
}
 
开发者ID:zhenshengcai,项目名称:floodlight-hardware,代码行数:71,代码来源:RestApiServer.java

示例11: StatusFilter

import org.restlet.service.StatusService; //导入依赖的package包/类
/**
 * Constructor from a status service.
 * 
 * @param context
 *            The context.
 * @param statusService
 *            The helped status service.
 */
public StatusFilter(Context context, StatusService statusService) {
    this(context, statusService.isOverwriting(), statusService
            .getContactEmail(), statusService.getHomeRef());
    this.statusService = statusService;
}
 
开发者ID:restlet,项目名称:restlet-framework,代码行数:14,代码来源:StatusFilter.java

示例12: getStatusService

import org.restlet.service.StatusService; //导入依赖的package包/类
/**
 * Returns the helped status service.
 * 
 * @return The helped status service.
 */
public StatusService getStatusService() {
    return statusService;
}
 
开发者ID:restlet,项目名称:restlet-framework,代码行数:9,代码来源:StatusFilter.java

示例13: setStatusService

import org.restlet.service.StatusService; //导入依赖的package包/类
/**
 * Sets the helped status service.
 * 
 * @param statusService
 *            The helped status service.
 */
public void setStatusService(StatusService statusService) {
    this.statusService = statusService;
}
 
开发者ID:restlet,项目名称:restlet-framework,代码行数:10,代码来源:StatusFilter.java

示例14: getStatusService

import org.restlet.service.StatusService; //导入依赖的package包/类
/**
 * Returns the status service. The service is enabled by default.
 * 
 * @return The status service.
 */
public StatusService getStatusService() {
    return getServices().get(StatusService.class);
}
 
开发者ID:restlet,项目名称:restlet-framework,代码行数:9,代码来源:Application.java

示例15: setStatusService

import org.restlet.service.StatusService; //导入依赖的package包/类
/**
 * Sets the status service.
 * 
 * @param statusService
 *            The status service.
 */
public void setStatusService(StatusService statusService) {
    getServices().set(statusService);
}
 
开发者ID:restlet,项目名称:restlet-framework,代码行数:10,代码来源:Application.java


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