Skip to content

Commit fb7c4b1

Browse files
committed
Add greeting service.
1 parent c9e0ab6 commit fb7c4b1

File tree

3 files changed

+42
-0
lines changed

3 files changed

+42
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
* Licensed under the Apache License, Version 2.0 (the "License");
3+
* you may not use this file except in compliance with the License.
4+
* You may obtain a copy of the License at
5+
*
6+
* http://www.apache.org/licenses/LICENSE-2.0
7+
*
8+
* Unless required by applicable law or agreed to in writing, software
9+
* distributed under the License is distributed on an "AS IS" BASIS,
10+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
* See the License for the specific language governing permissions and
12+
* limitations under the License.
13+
*/
14+
15+
package org.httprpc.test;
16+
17+
import org.httprpc.RequestMethod;
18+
import org.httprpc.WebService;
19+
20+
import javax.servlet.annotation.WebServlet;
21+
22+
/**
23+
* Test service.
24+
*/
25+
@WebServlet(urlPatterns={"/greeting/*"}, loadOnStartup=1)
26+
public class GreetingService extends WebService {
27+
private static final long serialVersionUID = 0;
28+
29+
@RequestMethod("GET")
30+
public String getGreeting() {
31+
return "Hello, World!";
32+
}
33+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
GreetingService = Greeting example service.
2+
3+
getGreeting = Returns a friendly greeting.

httprpc-test/src/main/webapp/index.jsp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@
88
<body>
99

1010
<h2>Test</h2>
11+
<a href="${pageContext.request.contextPath}/greeting?api">Greeting (API)</a><br/>
12+
<br/>
13+
<a href="${pageContext.request.contextPath}/greeting">Greeting</a><br/>
14+
15+
<hr/>
16+
1117
<a href="${pageContext.request.contextPath}/math?api">Math (API)</a><br/>
1218
<br/>
1319
<a href="${pageContext.request.contextPath}/math/sum?a=2&b=4">Sum</a><br/>

0 commit comments

Comments
 (0)