Guest User

Untitled

a guest
Dec 14th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. import javax.ws.rs.GET;
  2. import javax.ws.rs.Path;
  3. import javax.ws.rs.Produces;
  4. import javax.ws.rs.core.MediaType;
  5. import javax.ws.rs.core.Response;
  6. import org.springframework.beans.factory.annotation.Value;
  7. import org.springframework.stereotype.Component;
  8.  
  9. /**
  10. * @author Inanc Sevinc
  11. *
  12. */
  13. @Path("/")
  14. @Component
  15. public class TestResource{
  16.  
  17. @Value("#{buildprop['build.date']}")
  18. private String buildDate;
  19.  
  20. /**
  21. * @return build date of the package which is defined in build.properties
  22. */
  23. @GET
  24. @Path("/version")
  25. @Produces(MediaType.TEXT_PLAIN)
  26. public Response version() {
  27. try {
  28. return Response.ok(buildDate).build();
  29. } catch (Exception e) {
  30. return Response.status(Response.Status.INTERNAL_SERVER_ERROR)
  31. .entity("version info couldn't be retrieved").build();
  32. }
  33. }
  34. }
Add Comment
Please, Sign In to add comment