XMLWordPrintable

Details

    • Sub-task
    • Resolution: Done
    • Major
    • 2.16.1.Final
    • 2.13.0.Final
    • Java EE

    Description

      It would be good to have a command to create a REST endpoint. A command like this :

      rest-new-endpoint --named MyEndpoint
      

      Would generate

      @Path("/myEndpoint")
      public class CustomerEndpoint
      {
      }
      

      Changing the path would be :

      rest-new-endpoint --named MyEndPoint --path endpoint
      

      This would generate :

      @Path("/endpoint")
      public class CustomerEndpoint
      {
      }
      

      The command also allows to generate several default methods (get, post, put, delete) with default mime type and so on :

      rest-new-endpoint --named MyEndPoin --methods GET POST DELETE
      

      This would generate :

      @Path("/myEndpoint")
      public class CustomerEndpoint
      {
      @GET
         @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
         public Response doGet()
         {
            return Response.noContent().build();
         }
      
         @POST
         @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
         public Response doPost()
         {
            return Response.noContent().build();
         }
      }
      

      Also, a REST configuration class needs to be creates, such as :

      @ApplicationPath("/rest")
      public class RestApplication extends Application
      {
      }
      

      Attachments

        Activity

          People

            agoncal Antonio Goncalves (Inactive)
            agoncal Antonio Goncalves (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: