class LocalizationBundleJaxrsService {

    @GET
    @Path("/{name}")
    @Produces(MediaType.APPLICATION_JSON)
    public Response getBundle(@PathParam("name") String bundleName, @Context HttpHeaders headers, @Context Request request) {
        Locale locale = headers.getAcceptableLanguages().get(0);

        Map<String, String> messages = messageSource.getAllMessagesForBaseName(bundleName, locale);

        EntityTag etag = generateETag(toJson(messages));
        Response.ResponseBuilder response = request.evaluatePreconditions(etag);

        if (response == null) {
            response = messages.isEmpty() ? Response.noContent() : Response.ok(messages);
        }

        return response.tag(etag).build();
    }

}