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


Java Component.start方法代码示例

本文整理汇总了Java中org.restlet.Component.start方法的典型用法代码示例。如果您正苦于以下问题:Java Component.start方法的具体用法?Java Component.start怎么用?Java Component.start使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.restlet.Component的用法示例。


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

示例1: startServer

import org.restlet.Component; //导入方法依赖的package包/类
@BeforeClass
public static void startServer() throws Exception {
	// Creating restlet component
	component = new Component();

	// The status service is disabled by default.
	component.getStatusService().setEnabled(false);

	component.getClients().add(Protocol.HTTP);
	component.getClients().add(Protocol.FILE);
	component.getClients().add(Protocol.WAR);
	component.getClients().add(Protocol.RIAP);

	component.getServers().add(Protocol.HTTP, portNumber);

	component.start();
}
 
开发者ID:devacfr,项目名称:spring-restlet,代码行数:18,代码来源:AbstractResourceTest.java

示例2: main

import org.restlet.Component; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
    // Create a new Component.
    Component component = new Component();

    // Add a new HTTP server listening on port 8182.
    Server server = component.getServers().add(Protocol.HTTP, 8182);
    server.getContext().getParameters().add("useForwardedForHeader", "true");

    ShindigApplication application = new ShindigApplication(server.getContext());
    // Attach the sample application.
    component.getDefaultHost().attach("/shindig", application);

    server.getContext().getAttributes().put(Constants.CONTEXT_PATH_KEY, "/shindig");
    server.getContext().getAttributes().put(Constants.BASE_URL_KEY, "http://localhost:8182");

    // Start the component.
    component.start();

}
 
开发者ID:devacfr,项目名称:spring-restlet,代码行数:20,代码来源:ShindigServer.java

示例3: main

import org.restlet.Component; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
    // Create a new Component.
    Component component = new Component();

    // Add a new HTTP server listening on port 8182.
    org.restlet.Server server =  component.getServers().add(Protocol.HTTP, 8182);
    server.getContext().getParameters().add("useForwardedForHeader", "true");


    RestletSpringApplication application = new RestletSpringApplication();
    // Attach the sample application.
    component.getDefaultHost().attach( application);

    // Start the component.
    component.start();
}
 
开发者ID:devacfr,项目名称:spring-restlet,代码行数:17,代码来源:Server.java

示例4: testGetsStatus

import org.restlet.Component; //导入方法依赖的package包/类
@Test
public void testGetsStatus() throws Exception {
	Component component = new Component();
	component.getServers().add(Protocol.HTTP, port);
	component.getDefaultHost().attach(setupApp());
	component.start();

	try {
		Client client = new Client(Protocol.HTTP);
		
		for(File file: Arrays.asList(new File("test1.txt"), new File("test2.txt"), new File("test3.txt"))){
		
			FileTrackingStatus status = getStatusObject(client, file.getAbsolutePath());
			
			assertNotNull(status);
			assertEquals(file.getAbsolutePath(), status.getPath());
			
		}
		
	} finally {
		component.stop();
	}

}
 
开发者ID:gerritjvv,项目名称:bigstreams,代码行数:25,代码来源:TestFileTrackerStatusPathResource.java

示例5: testPingCheckOK

import org.restlet.Component; //导入方法依赖的package包/类
/**
 * Tests that the PingCheck does not through errors when the ping service is
 * running
 * 
 * @throws Exception
 */
@Test
public void testPingCheckOK() throws Exception {

	Component pingComp = (Component) bootstrap
			.getBean("restletPingComponent");

	pingComp.start();
	try {

		PingCheck pingCheck = bootstrap.getBean(PingCheck.class);

		pingCheck.runCheck();
		assertTrue(true);

	} catch (Throwable t) {
		t.printStackTrace();
		assertTrue(false);
	} finally {
		pingComp.stop();
	}

}
 
开发者ID:gerritjvv,项目名称:bigstreams,代码行数:29,代码来源:TestPingCheck.java

示例6: main

import org.restlet.Component; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
    logger.info("main() Start");

    if (args.length == 0) {
        loadProperties("");
    } else {
        loadProperties(args[0]);
    }

    Component component = new Component();
    component.getServers().add(Protocol.HTTP, SERVER_PORT);
    component.getDefaultHost().attach(SERVER_PATH, new RMrouterApplication());
    component.start();

    logger.info("main() End");
}
 
开发者ID:o3project,项目名称:ocnrm,代码行数:17,代码来源:OcnRMServ.java

示例7: onCreate

import org.restlet.Component; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    // create datastore
    File path = getApplicationContext().getDir("datastores", MODE_PRIVATE);
    DatastoreManager manager = new DatastoreManager(path.getAbsolutePath());

    Datastore ds = manager.openDatastore("mydb");
    ds.close();

    Component component = new Component();
    component.getServers().add(Protocol.HTTP, 8182);
    component.getDefaultHost().attachDefault(HttpListener.class);

    try {
        component.start();
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
 
开发者ID:snowch,项目名称:z_sync-android-p2p-example.deprecated,代码行数:23,代码来源:MainActivity.java

示例8: setUp

import org.restlet.Component; //导入方法依赖的package包/类
@Before
public void setUp() {
    ServerManager.getInstance().setServer(new StubMCServer());
    component = new Component();
    client =  new Client(Protocol.HTTP);
    // Add a new HTTP server listening on port 8182.
    component.getServers().add(Protocol.HTTP, port);
    // Attach the sample application.
    component.getDefaultHost().attach("/mcrest", new RestApplication());
    try {
        component.start();
    } catch (Exception e) {
        e.printStackTrace();
    }
    serverUrl = "http://127.0.0.1:"+port+"/mcrest";
}
 
开发者ID:eternnoir,项目名称:MCRest,代码行数:17,代码来源:ServerStatusTest.java

示例9: authDisableTest

import org.restlet.Component; //导入方法依赖的package包/类
@Test
public void authDisableTest(){
    AuthPara auth = new AuthPara(USER,PASSWORD,false);
    Component component = new Component();
    component.getServers().add(Protocol.HTTP, port);
    component.getDefaultHost().attach("/mcrest", new RestApplication(auth));
    try {
        component.start();
    } catch (Exception e) {
        e.printStackTrace();
        Assert.fail();
    }
    String responseString = getRequestResult("/").getEntityAsText();
    Assert.assertTrue(responseString.contains("MCStub"));
    String worldResult = getRequestResult("/world").getEntityAsText();
    Assert.assertTrue(worldResult.contains("testWorld"));
}
 
开发者ID:eternnoir,项目名称:MCRest,代码行数:18,代码来源:AuthResourceTest.java

示例10: authEnableAllResource

import org.restlet.Component; //导入方法依赖的package包/类
@Test
public void authEnableAllResource(){
    AuthPara auth = new AuthPara(USER,PASSWORD,genAllResoureceList(),true);
    component = new Component();
    component.getServers().add(Protocol.HTTP, port);
    component.getDefaultHost().attach("/mcrest", new RestApplication(auth));
    try {
        component.start();
    } catch (Exception e) {
        e.printStackTrace();
        Assert.fail();
    }
    int statusCode = getRequestResult("/").getStatus().getCode();
    Assert.assertEquals(statusCode, 401);
    statusCode = getRequestResult("/player").getStatus().getCode();
    Assert.assertEquals(statusCode, 401);
    statusCode = getRequestResult("/world").getStatus().getCode();
    Assert.assertEquals(statusCode, 401);
}
 
开发者ID:eternnoir,项目名称:MCRest,代码行数:20,代码来源:AuthResourceTest.java

示例11: main

import org.restlet.Component; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {

        logger.debug("main() Start");

        // プロパティファイル呼び出し
        if (args.length == 0) {
            loadProperties(null);
        } else {
            loadProperties(args[0]);
        }

        Component component = new Component();
        component.getServers().add(Protocol.HTTP, loader.getServicePort());
        component.getDefaultHost().attach(loader.getCommonPath(), new PseudoMfRouter());
        component.getDefaultHost().attach("/ui/", new PseudoMfGuiRouter());
        component.getContext().getParameters().add("maxThreads", "10");
        component.start();

        logger.debug("CurrentDir:{}", System.getProperty("user.dir"));

        logger.info("## dummyMC GUI URI: http://<HOST>:{}/ui/index.html", loader.getServicePort());
        logger.debug("main() End");
    }
 
开发者ID:o3project,项目名称:pseudoMF,代码行数:24,代码来源:PseudoMfMain.java

示例12: main

import org.restlet.Component; //导入方法依赖的package包/类
public static void main(String[] args) {
  try {
    // Create a new Component.
    Component component = new Component();

    // Add a new HTTP server listening on port 8182.
    component.getServers().add(Protocol.HTTP, 8182);

    // Attach the sample application.
    component.getDefaultHost().attach(new LeanBeanApplication());

    // Start the component.
    component.start();
  } catch (Exception e) {
    // Something is wrong.
    e.printStackTrace();
  }
}
 
开发者ID:wisobi,项目名称:leanbean,代码行数:19,代码来源:LeanBeanApplication.java

示例13: run

import org.restlet.Component; //导入方法依赖的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

示例14: main

import org.restlet.Component; //导入方法依赖的package包/类
public static void main(String[] args) {
	try {
		// Create a new Component.
		Component component = new Component();

		// Add a new HTTP server listening on port 8082.
		component.getServers().add(Protocol.HTTP, 8080);

		// Attach the sample application.
		component.getDefaultHost().attach(new RestletApplication());

		// Start the component.
		component.start();
	} catch (Exception e) {
		// Something is wrong.
		e.printStackTrace();
	}
}
 
开发者ID:dice-group,项目名称:AGDISTIS,代码行数:19,代码来源:RunApp.java

示例15: main

import org.restlet.Component; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
       
        Component component = new Component();
        component.getClients().add(Protocol.FILE);
        //TODO: To test with the restlet 2.1 Maybe the maxTotalConnections could be avoided
        // see: http://restlet-discuss.1400322.n2.nabble.com/rejectedExecution-td4513620.html 
        //component.getServers().add(Protocol.HTTP, SERVER_PORT);
        Server server = new Server(Protocol.HTTP, 8111);                     
        component.getServers().add(server);
        server.getContext().getParameters().add("maxTotalConnections", "50");
        //end TODO
        Engine.getInstance().getRegisteredServers().clear();
        Engine.getInstance().getRegisteredServers().add(new HttpServerHelper(server)); 
        component.getClients().add(Protocol.FILE);                
        component.getDefaultHost().attach(new FreedomRestServer());
        component.start();
}
 
开发者ID:freedomotic,项目名称:freedomotic,代码行数:18,代码来源:FreedomRestServer.java


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