Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>there are several alternatives:</p> <ul> <li>servlets</li> <li><a href="http://www.restlet.org/" rel="nofollow noreferrer">restlet</a>: lightweight REST framework </li> <li>jax-rs: using <a href="http://jersey.java.net/" rel="nofollow noreferrer">jersey</a> or the restlet module implementing the jax-rs specs</li> <li><a href="https://grizzly.dev.java.net/" rel="nofollow noreferrer">grizzly</a>: NIO based server (with HTTP support + handlers)</li> <li><a href="http://mina.apache.org/" rel="nofollow noreferrer">apache mina</a>: event-driven, async server (with HTTP support)</li> </ul> <p>all these frameworks come with a built-in server. </p> <p>EDIT</p> <p>jax-rs has a similar approach using url templates:</p> <pre><code>@Path("/users/{username}") public class UserResource { @GET @Produces("text/xml") public String getUser(@PathParam("username") String userName) { } } </code></pre> <p>then put your handlers in an Application object:</p> <pre><code>public class MyApplicaton extends Application { public Set&lt;Class&gt; getClasses() { Set&lt;Class&gt; s = new HashSet&lt;Class&gt;(); s.add(UserResource.class); return s; } } </code></pre> <p>another example with JAX-RS:</p> <pre><code>@GET @Produces("application/json") @Path("/network/{id: [0-9]+}/{nid}") public User getUserByNID(@PathParam("id") int id, @PathParam("nid") String nid) { } </code></pre> <p>EDIT 2</p> <p>Restlet supports a centralized configurations like Django, in your Application object:</p> <pre><code>// Attach the handlers to the root router router.attach("/users/{user}", account); router.attach("/users/{user}/orders", orders); router.attach("/users/{user}/orders/{order}", order); </code></pre>
 

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