Creating a RESTful WebService without using Jersey or any other libs

后端 未结 2 981
生来不讨喜
生来不讨喜 2021-02-07 23:48

okay you might say its a duplicate of this.

It might be but the answer is still yet to be found.

Isn\'t there any way we can make a RESTful web service without u

2条回答
  •  名媛妹妹
    2021-02-08 00:42

    You should be able to accomplish this with servlets. Create a servlet for each service or url that you expose to your service consumers.

    Eg. For a user CRUD service, create a UserServlet and specify the mapping as /user/*. Consumers of your service, will hit urls such as

    • http://yourdomain.com/user
    • http://yourdomain.com/user/23

    for various RESTful operations.

    Inside of the servlet, you should be able to extract the request parameters, form data, request headers and context information.

    For a detailed discussion on how to design your restful api and best practices, search "Restful API Design". Here are a couple of links to get you started

    • https://blog.apigee.com/detail/api_design_third_edition_video_slides
    • https://blog.apigee.com/detail/slides_for_restful_api_design_second_edition_webinar/

提交回复
热议问题