Skip to content
mirrors JAX-RS annotated services in JavaScript
Pull request Compare This branch is even with marcbaechinger:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


What is jax-rs-js?

jax-rs-js aims to help accessing JAX-RS annotated services from within a browser application. Complete coverage of JAX-RS features is not a goal of jax-rs-js. Instead some common and straightforward patterns are covered. See in the test source directory to see whats currently covered.

jax-rs-js currently relies on jquery on the browser side.

jax-rs-js is shipped with a Servlet to be included in a web application and to serve JavaScript files for JAX-RS services:

public Note addNote(Note note) {
    return note;

is called in JavaScript like this:
    title: "Sample note",
    note: "push changes on github"
  function(note) {
    // do something with service response in callback function

See for a working example (integration tests).

Build and install

Build with maven

mvn clean install

Include dependency in your pom.xml


or copy jax-rs-js-1.0-SNAPSHOT.jar to your environment.

Servlet configuration in web.xml

A servlet generates and serves a JavaScript file for classes defined with init params:

    <!-- required: path to the JSX-RS servlet -->

Include JavaScript in the HTML page

<script src="<%= request.getContextPath() %>/resources-js/"> </script>

$(function() { {
     // render notes...

Something went wrong with that request. Please try again.