@Test public void testHelloWorld() throws Exception { Response response = rest.helloWorld(); Assert.assertEquals(Response.Status.OK.getStatusCode(), response.getStatus()); Assert.assertEquals("Hello World", response.getEntity()); }
@GET @Path("helloworld") @Produces(MediaType.TEXT_PLAIN) @RestQuery(name = "helloworld", description = "example service call", responses = {@RestResponse(description = "Hello World", responseCode = HttpServletResponse.SC_OK), @RestResponse(description = "The underlying service could not output something.", responseCode = HttpServletResponse.SC_INTERNAL_SERVER_ERROR) }, returnDescription = "The text that the service returns.") public Response helloWorld() throws Exception { logger.info("REST call for Hello World"); return Response.ok().entity(helloWorldService.helloWorld()).build(); }
HelloWorldRestEndpoint { @GET @Path("helloworld") @Produces(MediaType.TEXT_PLAIN) @RestQuery(name = "helloworld", description = "example service call", responses = {@RestResponse(description = "Hello World", responseCode = HttpServletResponse.SC_OK), @RestResponse(description = "The underlying service could not output something.", responseCode = HttpServletResponse.SC_INTERNAL_SERVER_ERROR) }, returnDescription = "The text that the service returns.") public Response helloWorld() throws Exception { logger.info("REST call for Hello World"); return Response.ok().entity(helloWorldService.helloWorld()).build(); } }
HelloWorldRestEndpoint { @GET @Path("helloworld") @Produces(MediaType.TEXT_PLAIN) @RestQuery(name = "helloworld", description = "example service call", responses = {@RestResponse(description = "Hello World", responseCode = HttpServletResponse.SC_OK), @RestResponse(description = "The underlying service could not output something.", responseCode = HttpServletResponse.SC_INTERNAL_SERVER_ERROR) }, returnDescription = "The text that the service returns.") public Response helloWorld() throws Exception { logger.info("REST call for Hello World"); return Response.ok().entity(helloWorldService.helloWorld()).build(); }  }
HelloWorldRestEndpoint { @GET @Path("helloworld") @Produces(MediaType.TEXT_PLAIN) @RestQuery(name = "helloworld", description = "example service call", responses = {@RestResponse(description = "Hello World", responseCode = HttpServletResponse.SC_OK), @RestResponse(description = "The underlying service could not output something.", responseCode = HttpServletResponse.SC_INTERNAL_SERVER_ERROR) }, returnDescription = "The text that the service returns.") public Response helloWorld() throws Exception { logger.info("REST call for Hello World"); return Response.ok().entity(helloWorldService.helloWorld()).build(); }  @GET @Path("helloworld") @Produces(MediaType.TEXT_PLAIN) @RestQuery(name = "helloworld", description = "example service call", responses = {@RestResponse(description = "Hello World", responseCode = HttpServletResponse.SC_OK), @RestResponse(description = "The underlying service could not output something.", responseCode = HttpServletResponse.SC_INTERNAL_SERVER_ERROR) }, returnDescription = "The text that the service returns.") Response helloWorld(); @GET @Path("helloname") @Produces(MediaType.TEXT_PLAIN) @RestQuery(name = "helloname", description = "example service call with parameter", restParameters = { @RestParameter(description = "name to output", isRequired = false, name = "name", type = RestParameter.Type.TEXT) }, responses = {@RestResponse(description = "Hello or Hello Name", responseCode = HttpServletResponse.SC_OK), @RestResponse(description = "The underlying service could not output something.", responseCode = HttpServletResponse.SC_INTERNAL_SERVER_ERROR) }, returnDescription = "The text that the service returns.") Response helloName(@FormParam("name") String name); @GET @Produces(MediaType.TEXT_HTML) @Path("docs") String getDocs(); @Reference(name = "helloworld-service") void setHelloWorldService(HelloWorldService service); }
HelloWorldRestEndpoint { @GET @Path("helloworld") @Produces(MediaType.TEXT_PLAIN) @RestQuery(name = "helloworld", description = "example service call", responses = {@RestResponse(description = "Hello World", responseCode = HttpServletResponse.SC_OK), @RestResponse(description = "The underlying service could not output something.", responseCode = HttpServletResponse.SC_INTERNAL_SERVER_ERROR) }, returnDescription = "The text that the service returns.") public Response helloWorld() throws Exception { logger.info("REST call for Hello World"); return Response.ok().entity(helloWorldService.helloWorld()).build(); }  @GET @Path("helloworld") @Produces(MediaType.TEXT_PLAIN) @RestQuery(name = "helloworld", description = "example service call", responses = {@RestResponse(description = "Hello World", responseCode = HttpServletResponse.SC_OK), @RestResponse(description = "The underlying service could not output something.", responseCode = HttpServletResponse.SC_INTERNAL_SERVER_ERROR) }, returnDescription = "The text that the service returns.") Response helloWorld(); @GET @Path("helloname") @Produces(MediaType.TEXT_PLAIN) @RestQuery(name = "helloname", description = "example service call with parameter", restParameters = { @RestParameter(description = "name to output", isRequired = false, name = "name", type = RestParameter.Type.TEXT) }, responses = {@RestResponse(description = "Hello or Hello Name", responseCode = HttpServletResponse.SC_OK), @RestResponse(description = "The underlying service could not output something.", responseCode = HttpServletResponse.SC_INTERNAL_SERVER_ERROR) }, returnDescription = "The text that the service returns.") Response helloName(@FormParam("name") String name); @GET @Produces(MediaType.TEXT_HTML) @Path("docs") String getDocs(); @Reference(name = "helloworld-service") void setHelloWorldService(HelloWorldService service);  }