1 package org.collectionspace.hello.services;
6 * Service that returns a brief "ping"-type response.
7 * Allows clients to test basic connectivity.
9 * @author $Author: aron $
10 * @version $Revision: 547 $
11 * @version $Date: 2009-01-30 12:48:42 -0800 (Fri, 30 Jan 2009) $
15 import javax.ws.rs.GET;
16 import javax.ws.rs.Path;
17 import javax.ws.rs.Produces;
20 @Produces("text/plain")
21 public class PingResource {
23 // Paths relative to the root path, defined above.
24 final static String ECHO_RELATIVE_PATH = "echo";
25 final static String PING_RELATIVE_PATH = "ping";
27 // Ping or echo message to return.
28 final static String SERVICE_NAME = "CollectionSpace";
29 final static String SERVICE_PING_MESSAGE =
30 "The " + SERVICE_NAME + " system is alive and listening.\n";
32 /////////////////////////////////////////////////////////////////
34 * Class constructor (no argument).
36 public PingResource() {
40 /////////////////////////////////////////////////////////////////
42 * Returns a brief "ping"-type message.
44 * @return A brief "ping"-type message.
46 @Path(PING_RELATIVE_PATH)
48 public String getPing() {
49 return SERVICE_PING_MESSAGE;
52 /////////////////////////////////////////////////////////////////
54 * Returns a brief "ping"-type message. Allows this message to be retrieved
55 * from an "echo" URI, as well as a "ping" URI.
57 * @return A brief "ping"-type message.
59 @Path(ECHO_RELATIVE_PATH)
61 public String getEcho() {