REST using Java to calculate prime numbers