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 6346267
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T20:59:06+00:00 2026-05-24T20:59:06+00:00

Sorry, this questions sounds silly, but after developing some of my RESTful services using

  • 0

Sorry, this questions sounds silly, but after developing some of my RESTful services using Jersey, I asked myself the question — If REST is just an architecture, and not a protocol like SOAP, why do we need a specification like JAX-RS?

I actually googled for questions like “What is the difference between servlets and RESTful services over HTTP” and to sum up the community answers, I got:

  1. RESTful service development (on Jersey) is an architecture, which inherently uses servlets.
  2. JAX-RS compliant tools like Jersey provide easy marshalling-unmarshalling of XML/JSON data, helping the developers.
  3. REST helps us use GET/POST/PUT/DELETE in a fashion that is far efficient than normal servlets.

According to these answers, I guess if I write a servlet which uses JAXB (for dealing with automatic serialization), and I efficiently use GET/POST/PUT/DELETE in my servlet code, I don’t use a tool like Jersey, and hence JAX-RS.

I know I am terribly wrong passing this statement, please correct me.

PS: This doubt actually came in when I had to develop some RESTful services in PHP. After going on through some of the RESTful PHP codes, I realized they are just the same old PHP scripts, with some helper methods for handling XML/JSON.

  • 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-24T20:59:06+00:00Added an answer on May 24, 2026 at 8:59 pm

    Why use JAX-RS / Jersey?

    Short Answer

    Because it makes the development of RESTful services easier.

    Long Answer

    JAX-RS is a standard that makes it easy to create a RESTful service that can be deployed to any Java application server: GlassFish, WebLogic, WebSphere, JBoss, etc.

    JAX-RS is part of Java EE, and when JAX-RS is used with other Java EE technologies it becomes even easier to create your RESTful service:

    • EJB – A session bean is used as the service implementation and also handles the transaction semantics.
    • JAX-RS – Used to expose the session bean as a RESTful service
    • JPA – Used to persist the POJOs to the database. Note how the EntityManager is injected onto the session bean.
    • JAXB – Used to convert the POJO to/from XML (in GlassFish it can also be used to convert the POJO to/from JSON). JAX-RS by default handles the interaction with the JAXB implementation.

    Sample JAX-RS Service

    package org.example;
    
    import java.util.List;
    
    import javax.ejb.*;
    import javax.persistence.*;
    import javax.ws.rs.*;
    import javax.ws.rs.core.MediaType;
    
    @Stateless
    @LocalBean
    @Path("/customers")
    public class CustomerService {
    
        @PersistenceContext(unitName="CustomerService",
                            type=PersistenceContextType.TRANSACTION)
        EntityManager entityManager;
    
        @POST
        @Consumes(MediaType.APPLICATION_XML)
        public void create(Customer customer) {
            entityManager.persist(customer);
        }
    
        @GET
        @Produces(MediaType.APPLICATION_XML)
        @Path("{id}")
        public Customer read(@PathParam("id") long id) {
            return entityManager.find(Customer.class, id);
        }
    
        @PUT
        @Consumes(MediaType.APPLICATION_XML)
        public void update(Customer customer) {
            entityManager.merge(customer);
        }
    
        @DELETE
        @Path("{id}")
        public void delete(@PathParam("id") long id) {
            Customer customer = read(id);
            if(null != customer) {
                entityManager.remove(customer);
            }
        }
    
        @GET
        @Produces(MediaType.APPLICATION_XML)
        @Path("findCustomersByCity/{city}")
        public List<Customer> findCustomersByCity(@PathParam("city") String city) {
            Query query = entityManager.createNamedQuery("findCustomersByCity");
            query.setParameter("city", city);
            return query.getResultList();
        }
    
    }
    

    For More Information:

    • http://blog.bdoughan.com/2010/08/creating-restful-web-service-part-45.html
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Sorry if this question sounds a little silly, but I am not sure what
Sorry if this sounds like a really silly question. But I Googled the web
Sorry if my questions sounds silly, but I never worked with Oracle databases. If
Sorry, this question might sound silly, but I need some help! My project is
First of I'm very sorry but this questions is not so so specific. All
Sorry if this is a dupe. There are many similar questions but it seems
Sorry if this sounds like a newbie question, but the other day a Java
I am sorry, if this question sounds stupid, but I have searched a lot
Sorry if this sounds like a really stupid question, but I need to make
Sorry if this question sounds stupid, but I only know HTML/CSS and so I'm

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.