Refactor using Jax-RS