@Bean public HttpServiceRegistrationBean okService() { return new HttpServiceRegistrationBean() .setServiceName("okService") .setService(new OkService()) .setPathMapping(PathMapping.ofExact("/ok")) .setDecorators(ImmutableList.of(LoggingService.newDecorator())); }
@Bean public HttpServiceRegistrationBean okService() { return new HttpServiceRegistrationBean() .setServiceName("okService") .setService(new AbstractHttpService() { @Override protected HttpResponse doGet(ServiceRequestContext ctx, HttpRequest req) { return HttpResponse.of(HttpStatus.OK, MediaType.PLAIN_TEXT_UTF_8, "ok"); } }) .setPathMapping(PathMapping.ofExact("/ok")) .setDecorators(LoggingService.newDecorator()); } }
@Bean public HttpServiceRegistrationBean okService() { return new HttpServiceRegistrationBean() .setServiceName("okService") .setService(new AbstractHttpService() { @Override protected HttpResponse doGet(ServiceRequestContext ctx, HttpRequest req) throws Exception { return HttpResponse.of(HttpStatus.OK, MediaType.PLAIN_TEXT_UTF_8, "ok"); } }) .setPathMapping(PathMapping.ofExact("/ok")) .setDecorators(LoggingService.newDecorator()); } }