install and use jersey on Eclipse

18,975

Make sure you have jsr-311 jar on your classpath. For example you can download it from here.

Jersey supports JAXB out-of-the-box. It doesn't mean you have to use JAXB. If you need to serialize data to/from xml, using JAXB with Jersey is the most convenient.

Share:
18,975
Spring
Author by

Spring

Updated on June 19, 2022

Comments

  • Spring
    Spring almost 2 years

    In my Web service I use eclipse, java 1.5, spring. now I want to use jersey for REST and downloaded the jersey as a bundle jar from this address:

    http://jersey.java.net/nonav/documentation/latest/chapter_deps.html

    How can I add this jar to my project and start using the JAX-rs annotations, I added to buildpath but seems like does not work.

    Also is it necessary or a good idea to create JAXB annotated classes of my resource classes and using them with JERSEY?

  • Spring
    Spring almost 13 years
    thanks! I want to use Json, then what do you suggest? I have no clue where to start, can you give me the basic steps I have to do, at the moment I have a SOAP web service and want o convert it to REst Json
  • Tarlog
    Tarlog almost 13 years
    @jan If you need JSON, I suggest using Jackson with the JAXB annotations. Jackson has built-in JAX-RS provider, so you just need to make sure it's registered. see jackson.codehaus.org
  • Spring
    Spring almost 13 years
    Can you explain a bit more how will I do this: Jackson with the JAXB annotations. Do I need to create my resource files with from scratch with xjc?
  • Tarlog
    Tarlog almost 13 years
    You probably mean entity classes - the classes that resource methods receive as parameters or return. You can generate them using xjc if you have schema. If not, you can just create them using the standard JAXB annotations. Then you need to make sure you have Jackson at your classpath include the jax-rs support and register the Jackson JAXB provider. Declare @Produces and @Consumes annotations with the JSON media type and that's all.