Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Jersey itself provides an entire set of <a href="http://download.java.net/maven/2/com/sun/jersey/samples/jersey-samples/1.0.3/jersey-samples-1.0.3-project.zip" rel="nofollow noreferrer">examples</a>, and specifically the simplest helloworld example shows how to start a server on a port to either just run it or test against in JUnits. If you look at that, you'll get example for how to setup and start a server.</p> <p>Now, on configuring MessageBodyReaders and MessageBodyWriters as part of a jersey application, you'll find that this is covered by the JAX-RS spec itself (which jersey implements). First off, your reader and writer need the @Provider annotation. Additionally, the reader should get the @Consumes annotation, and the writer should get the @Produces annotation, so you can specify what mime-type(s) they consume and produce, respectively.</p> <p>Next is activating them. The helloworld example above won't show that, because it doesn't use custom readers or writers (another example might, I didn't look). So instead of supplying the package to find resources (as they do; you'll know what I speak of when you see the helloworld example), you'll code a subclass of Application, where you specify your resource class and the reader/writer classes. With the reader and writer you have the option of specifying either a class (that you return from getClasses), or providing an already created instance yourself (that you return from getSingletons).</p> <p>Finally, specify the name of your Application sub-class as the value of init-parameter <code>"javax.ws.rs.Application"</code>. The init-params can be passed to GrizzlyWebContainerFactory.create (again, you'll see this used in the example) when you start the server.</p> <p>Hope this helps.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload