Skip to content

Commit 5deaeca

Browse files
committed
Add Kotlin example; remove Eclipse files.
1 parent c9ba4b9 commit 5deaeca

File tree

13 files changed

+168
-225
lines changed

13 files changed

+168
-225
lines changed

.idea/workspace.xml

Lines changed: 120 additions & 36 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

httprpc-test/.classpath

Lines changed: 0 additions & 53 deletions
This file was deleted.

httprpc-test/.project

Lines changed: 0 additions & 28 deletions
This file was deleted.

httprpc-test/.settings/org.eclipse.jdt.core.prefs

Lines changed: 0 additions & 13 deletions
This file was deleted.

httprpc-test/.settings/org.eclipse.wst.common.component

Lines changed: 0 additions & 12 deletions
This file was deleted.

httprpc-test/.settings/org.eclipse.wst.common.project.facet.core.xml

Lines changed: 0 additions & 7 deletions
This file was deleted.

httprpc-test/build.gradle

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
*/
1414

1515
plugins {
16+
id "org.jetbrains.kotlin.jvm" version "1.3.21"
1617
id 'war'
17-
id 'eclipse'
1818
}
1919

2020
group = 'org.httprpc'
@@ -30,10 +30,21 @@ dependencies {
3030
providedCompile 'javax.servlet.jsp:javax.servlet.jsp-api:2.3.1'
3131
implementation 'org.mongodb:mongo-java-driver:3.6.3'
3232
implementation 'mysql:mysql-connector-java:8.0.15'
33+
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
3334
}
3435

3536
compileJava {
3637
options.compilerArgs = [
3738
'-parameters'
3839
]
3940
}
41+
compileKotlin {
42+
kotlinOptions {
43+
jvmTarget = "1.8"
44+
}
45+
}
46+
compileTestKotlin {
47+
kotlinOptions {
48+
jvmTarget = "1.8"
49+
}
50+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
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+
import javax.servlet.annotation.WebServlet
20+
21+
/**
22+
* Kotlin example service.
23+
*/
24+
@WebServlet(urlPatterns = ["/kotlin/*"], loadOnStartup = 1)
25+
class KotlinService : WebService() {
26+
@RequestMethod("GET")
27+
fun sayHello(): String {
28+
return "Hello from Kotlin"
29+
}
30+
}

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,12 @@
104104

105105
<hr/>
106106

107+
<a href="${pageContext.request.contextPath}/kotlin?api">Kotlin (API)</a><br/>
108+
<br/>
109+
<a href="${pageContext.request.contextPath}/kotlin">Kotlin</a><br/>
110+
111+
<hr/>
112+
107113
<form action="${pageContext.request.contextPath}/test" method="post" enctype="application/x-www-form-urlencoded">
108114
<table>
109115
<tr>

httprpc/.classpath

Lines changed: 0 additions & 44 deletions
This file was deleted.

0 commit comments

Comments
 (0)