當前位置: 首頁>>代碼示例>>Java>>正文


Java SimpleUriRouter類代碼示例

本文整理匯總了Java中netflix.karyon.transport.http.SimpleUriRouter的典型用法代碼示例。如果您正苦於以下問題:Java SimpleUriRouter類的具體用法?Java SimpleUriRouter怎麽用?Java SimpleUriRouter使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


SimpleUriRouter類屬於netflix.karyon.transport.http包,在下文中一共展示了SimpleUriRouter類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: TriathlonRouter

import netflix.karyon.transport.http.SimpleUriRouter; //導入依賴的package包/類
public TriathlonRouter(HealthCheckEndpoint healthCheckEndpoint, TriathlonEndpointImpl triathlonEndpoint) {

        delegate = new SimpleUriRouter<>();
        delegate.addUri("/healthcheck", healthCheckEndpoint)
                .addUri("/v2/apps",
                        (request, response) -> {
                            Observable<Void> result = Observable.defer(response::close);
                            if (request.getHttpMethod() == HttpMethod.POST) {
                                result = triathlonEndpoint.postApps(request, response);
                            }
                            return result;
                        });
    }
 
開發者ID:schibsted,項目名稱:triathlon,代碼行數:14,代碼來源:TriathlonRouter.java

示例2: IndexResource

import netflix.karyon.transport.http.SimpleUriRouter; //導入依賴的package包/類
public IndexResource() {
    endpoint = new HelloEndpoint();
    delegate = new SimpleUriRouter<>();

    delegate
    .addUri("/", new RequestHandler<ByteBuf, ByteBuf>() {
        @Override
        public Observable<Void> handle(HttpServerRequest<ByteBuf> request,
                final HttpServerResponse<ByteBuf> response) {

            return endpoint.getHello()
            .flatMap(new Func1<String, Observable<Void>>() {
                @Override
                public Observable<Void> call(String body) {
                    String instanceId = "";
                    String userdata = "";

                    try{
                        instanceId = execCmd("curl http://metadata/computeMetadata/v1/instance/id -H Metadata-Flavor:Google") + execCmd("wget -q -O - http://instance-data/latest/meta-data/instance-id");
                        userdata = System.getenv("USERDATA");

                    } catch (Exception e){
                        e.printStackTrace();
                    }
                    response.writeString("<html><head><style>body{text-align:center;font-family:'Lucida Grande'}</style></head><body><img src='http://kenzan.com/wp-content/themes/kenzan/images/logo-reg.png' /><h2>Example Spinnaker Application</h2><h3>Instance Id " + instanceId + "</h3><h3>$USERDATA ENV VAR: " + userdata + "</h3></body></html>");
                    return response.close();
                }
            });
        }
    });
}
 
開發者ID:kenzanlabs,項目名稱:hello-karyon-rxnetty,代碼行數:32,代碼來源:IndexResource.java

示例3: ExampleRouter

import netflix.karyon.transport.http.SimpleUriRouter; //導入依賴的package包/類
public ExampleRouter() {
    delegate = new SimpleUriRouter<>();
    HealthCheck healthCheckHandler = new HealthCheck();

    delegate
    .addUri("", new IndexResource())
    .addUri("/hello/*", new HelloResource())
    .addUri("/healthcheck", new HealthCheckEndpoint(healthCheckHandler));
}
 
開發者ID:kenzanlabs,項目名稱:hello-karyon-rxnetty,代碼行數:10,代碼來源:ExampleRouter.java


注:本文中的netflix.karyon.transport.http.SimpleUriRouter類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。