Search in sources :

Example 1 with HttpConfigRequest

use of com.yahoo.vespa.config.server.http.HttpConfigRequest in project vespa by vespa-engine.

the class HttpGetConfigHandler method handleGET.

@Override
public HttpResponse handleGET(HttpRequest req) {
    HttpConfigRequest request = HttpConfigRequest.createFromRequestV2(req);
    RequestHandler requestHandler = HttpConfigRequests.getRequestHandler(tenants, request);
    HttpConfigRequest.validateRequestKey(request.getConfigKey(), requestHandler, request.getApplicationId());
    return HttpConfigResponse.createFromConfig(resolveConfig(request, requestHandler));
}
Also used : RequestHandler(com.yahoo.vespa.config.server.RequestHandler) HttpConfigRequest(com.yahoo.vespa.config.server.http.HttpConfigRequest)

Example 2 with HttpConfigRequest

use of com.yahoo.vespa.config.server.http.HttpConfigRequest in project vespa by vespa-engine.

the class HttpGetConfigHandlerTest method require_that_request_gets_correct_fields_with_full_appid.

@Test
public void require_that_request_gets_correct_fields_with_full_appid() {
    String uriLongAppId = "http://yahoo.com:8080/config/v2/tenant/bill/application/sookie/environment/dev/region/bellefleur/instance/sam/foo.bar/myid";
    HttpRequest r = HttpRequest.createTestRequest(uriLongAppId, GET);
    HttpConfigRequest req = HttpConfigRequest.createFromRequestV2(r);
    assertThat(req.getApplicationId().tenant().value(), is("bill"));
    assertThat(req.getApplicationId().application().value(), is("sookie"));
    assertThat(req.getApplicationId().instance().value(), is("sam"));
}
Also used : HttpRequest(com.yahoo.container.jdisc.HttpRequest) HttpConfigRequest(com.yahoo.vespa.config.server.http.HttpConfigRequest) HandlerTest(com.yahoo.vespa.config.server.http.HandlerTest) Test(org.junit.Test) SessionHandlerTest(com.yahoo.vespa.config.server.http.SessionHandlerTest)

Example 3 with HttpConfigRequest

use of com.yahoo.vespa.config.server.http.HttpConfigRequest in project vespa by vespa-engine.

the class HttpGetConfigHandlerTest method require_that_request_gets_correct_fields_with_short_appid.

@Test
public void require_that_request_gets_correct_fields_with_short_appid() {
    String uriShortAppId = "http://yahoo.com:8080/config/v2/tenant/jason/application/alcide/foo.bar/myid";
    HttpRequest r = HttpRequest.createTestRequest(uriShortAppId, GET);
    HttpConfigRequest req = HttpConfigRequest.createFromRequestV2(r);
    assertThat(req.getApplicationId().tenant().value(), is("jason"));
    assertThat(req.getApplicationId().application().value(), is("alcide"));
    assertThat(req.getApplicationId().instance().value(), is("default"));
}
Also used : HttpRequest(com.yahoo.container.jdisc.HttpRequest) HttpConfigRequest(com.yahoo.vespa.config.server.http.HttpConfigRequest) HandlerTest(com.yahoo.vespa.config.server.http.HandlerTest) Test(org.junit.Test) SessionHandlerTest(com.yahoo.vespa.config.server.http.SessionHandlerTest)

Aggregations

HttpConfigRequest (com.yahoo.vespa.config.server.http.HttpConfigRequest)3 HttpRequest (com.yahoo.container.jdisc.HttpRequest)2 HandlerTest (com.yahoo.vespa.config.server.http.HandlerTest)2 SessionHandlerTest (com.yahoo.vespa.config.server.http.SessionHandlerTest)2 Test (org.junit.Test)2 RequestHandler (com.yahoo.vespa.config.server.RequestHandler)1