Refactor using Jax-Rs