當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。