jax-rs vs HttpServlet in jee : <p>I'm so confused.
I worked servlet.</p>

<p>which one is newest?</p>

<p>which one is better for implementing <strong>restful</strong> architecture?</p>

<p>jax-rs example :</p>

<pre><code>// This method is called if XML is request
  @GET
  @Produces(MediaType.TEXT_XML)
  public String sayXMLHello() {
    return "&lt;?xml version=\"1.0\"?&gt;" + "&lt;hello&gt; Hello Jersey" + "&lt;/hello&gt;";
  }  
</code></pre>

<p>servlet example :</p>

<pre><code>/** Servlet implementation class FetchTest */
@WebServlet( urlPatterns = {"/users", "/Users/"})
public class Users extends HttpServlet
{
    /** @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */
    protected void doGet( HttpServletRequest request , HttpServletResponse response ) throws ServletException , IOException
    {
        m_showUsers( response);
    }

    /** @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */
    protected void doPost( HttpServletRequest request , HttpServletResponse response ) throws ServletException , IOException
    {
        m_updateUser(request , response);
    }
    @Override
    protected void doDelete( HttpServletRequest req , HttpServletResponse resp ) throws ServletException , IOException
    {
        m_deleteUser(req , resp);
    }
    @Override
    protected void doPut( HttpServletRequest req , HttpServletResponse resp ) throws ServletException , IOException
    {
        m_insertUser(req , resp);
    }
</code></pre>
