Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6752257
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T13:01:24+00:00 2026-05-26T13:01:24+00:00

Today I read about Restful services. Basically what I understand that is Restful webservices

  • 0

Today I read about Restful services. Basically what I understand that is Restful webservices will work on HTTP request methods rather than normal webservice will work on SOAP request.

What is the need for Restful services as normal servlet can also work on the HTTP methods?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T13:01:25+00:00Added an answer on May 26, 2026 at 1:01 pm

    RESTful is more an architecture style than a different technology. In server perspective, it is designed to be entirely stateless and self-contained on a per-request basis (i.e. there are no sessions). In client perspective, it’s more a way of getting information in different formats via URLs with (self-documenting) path parameters instead of request parameters.

    Surely you can do this with a plain vanilla servlet, but it would introduce some boilerplate code to gather the path parameters and to generate the desired response. JAX-RS is just a convenient and self-containing API which removes the need for writing all the boilerplate code yourself, resulting in minimal and more self-documenting code.

    Assuming that you’ve a JAXB entity as model as below:

    @XmlRootElement
    public class Data {
    
        @XmlElement
        private Long id;
    
        @XmlElement
        private String value;
    
        // ...
    
        @Override
        public String toString() {
            return String.format("Data[id=%d,value=%s]", id, value);
        }
    
    }
    

    And a JAX-RS resource as below:

    @Path("data")
    public class DataResource {
    
        @EJB
        private DataService service;
    
        @GET 
        @Path("text/{id}")
        @Produces(MediaType.TEXT_PLAIN)
        public String getAsText(@PathParam("id") Long id) {
            return String.valueOf(service.find(id));
        }
    
        @GET 
        @Path("xml/{id}")
        @Produces(MediaType.APPLICATION_XML)
        public Data getAsXml(@PathParam("id") Long id) {
            return service.find(id);
        }
    
        @GET 
        @Path("json/{id}")
        @Produces(MediaType.APPLICATION_JSON)
        public Data getAsJson(@PathParam("id") Long id) {
            return service.find(id);
        }
    
    }
    

    Then you’d already get the desired content in proper format by:

    • http://example.com/rest/data/text/123
    • http://example.com/rest/data/xml/123
    • http://example.com/rest/data/json/123

    That’s it. Try to do the same with a single plain vanilla Servlet 🙂 Please note that SOAP essentially also goes over HTTP. It’s basically an extra XML layer over HTTP, not a different network protocol.

    See also:

    • REST tutorial
    • JAXB tutorial
    • Jersey tutorial
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Today I've had a read about wordpress plugins, so far I understand that they
I always read about the horrible thing that goto is. But today, reading about
I read some articles about HTTP headers compression. Today I installed YSlow and it
What I read today about UNIX's pipes: If multiple processes are writing to a
I read about the Conditional attribute today. According to MSDN: Applying ConditionalAttribute to a
Today I read this blog entry by Roger Alsing about how to paint a
Today I read that there is a software called WinCalibra (scroll a bit down)
I was dumbfounded today, when I read that Apple has allowed PhoneGap apps for
I read today about sharded counters in Google App Engine . The article says
I read about unions the other day( today ) and tried the sample functions

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.