Refactor to JAX-RS