]> git.aero2k.de Git - tmp/jakarta-migration.git/blob
2d389127d9fa971de15820dd3189cfcb14dd7d50
[tmp/jakarta-migration.git] /
1 package org.collectionspace.hello.services;
2
3 /**
4  *  PingResource
5  *      
6  *  Service that returns a brief "ping"-type response.
7  *  Allows clients to test basic connectivity.
8  *
9  *      @author $Author: aron $
10  *      @version $Revision: 547 $
11  *  @version $Date: 2009-01-30 12:48:42 -0800 (Fri, 30 Jan 2009) $
12  *
13  */
14
15 import javax.ws.rs.GET;
16 import javax.ws.rs.Path;
17 import javax.ws.rs.Produces;
18
19 @Path("")
20 @Produces("text/plain")
21 public class PingResource {
22
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";
26   
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";
31
32   /////////////////////////////////////////////////////////////////
33   /**
34    * Class constructor (no argument).
35    */
36   public PingResource() {
37     // do nothing
38   }
39     
40   /////////////////////////////////////////////////////////////////
41         /**
42          * Returns a brief "ping"-type message.
43          *
44          * @return  A brief "ping"-type message.
45          */
46   @Path(PING_RELATIVE_PATH)
47   @GET
48   public String getPing() {
49     return SERVICE_PING_MESSAGE;
50   }
51
52   /////////////////////////////////////////////////////////////////
53         /**
54          * Returns a brief "ping"-type message.  Allows this message to be retrieved
55          * from an "echo" URI, as well as a "ping" URI.
56          *
57          * @return  A brief "ping"-type message.
58          */
59   @Path(ECHO_RELATIVE_PATH)
60   @GET
61   public String getEcho() {
62     return getPing();
63   }
64 }