Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import javax.ws.rs.GET;
- import javax.ws.rs.Path;
- import javax.ws.rs.Produces;
- import javax.ws.rs.core.MediaType;
- import javax.ws.rs.core.Response;
- import org.springframework.beans.factory.annotation.Value;
- import org.springframework.stereotype.Component;
- /**
- * @author Inanc Sevinc
- *
- */
- @Path("/")
- @Component
- public class TestResource{
- @Value("#{buildprop['build.date']}")
- private String buildDate;
- /**
- * @return build date of the package which is defined in build.properties
- */
- @GET
- @Path("/version")
- @Produces(MediaType.TEXT_PLAIN)
- public Response version() {
- try {
- return Response.ok(buildDate).build();
- } catch (Exception e) {
- return Response.status(Response.Status.INTERNAL_SERVER_ERROR)
- .entity("version info couldn't be retrieved").build();
- }
- }
- }
Add Comment
Please, Sign In to add comment