Skip to content

Commit bcae0fd

Browse files
Add port into context
1 parent f8b35a9 commit bcae0fd

File tree

5 files changed

+14
-9
lines changed

5 files changed

+14
-9
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ repositories {
2222
```
2323
- Add the dependency
2424
```
25-
implementation 'com.github.DaikonWeb:daikon:0.6.2'
25+
implementation 'com.github.DaikonWeb:daikon:0.6.3'
2626
```
2727

2828
### Maven
@@ -40,7 +40,7 @@ implementation 'com.github.DaikonWeb:daikon:0.6.2'
4040
<dependency>
4141
<groupId>com.github.DaikonWeb</groupId>
4242
<artifactId>daikon</artifactId>
43-
<version>0.6.2</version>
43+
<version>0.6.3</version>
4444
</dependency>
4545
```
4646

build.gradle

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
plugins {
2-
id 'org.jetbrains.kotlin.jvm' version '1.3.50'
2+
id 'org.jetbrains.kotlin.jvm' version '1.3.61'
33
id("maven")
44
}
55

66
group = 'com.github.DaikonWeb'
7-
version '0.6.2'
7+
version '0.6.3'
88

99
repositories {
1010
mavenCentral()
1111
maven { url 'https://jitpack.io' }
1212
}
1313

1414
dependencies {
15-
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
16-
compile "org.eclipse.jetty:jetty-server:9.4.24.v20191120"
17-
compile "org.eclipse.jetty:jetty-servlet:9.4.24.v20191120"
15+
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
16+
compile("org.eclipse.jetty:jetty-server:9.4.25.v20191220")
17+
compile("org.eclipse.jetty:jetty-servlet:9.4.25.v20191220")
1818
testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.2")
1919
testImplementation("com.nhaarman.mockitokotlin2:mockito-kotlin:2.1.0")
2020
testImplementation("org.junit.jupiter:junit-jupiter-api:5.5.1")

src/main/kotlin/daikon/Context.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ package daikon
33
interface Context {
44
fun addAttribute(key: String, value: Any)
55
fun <T> getAttribute(key: String) : T
6+
fun port(): Int
67
}

src/main/kotlin/daikon/HttpServer.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class HttpServer(private val port: Int = 4545, initializeActions: HttpServer.()
1818
private val afterStartActions = mutableListOf<(Context) -> Unit>()
1919
private val beforeStopActions = mutableListOf<(Context) -> Unit>()
2020
private val basePath = mutableListOf("")
21-
private val context = ServerContext()
21+
private val context= ServerContext(port)
2222

2323
init {
2424
initializeActions()

src/main/kotlin/daikon/ServerContext.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package daikon
22

3-
class ServerContext : Context {
3+
class ServerContext(private val port: Int) : Context {
44

55
private val attributes = mutableMapOf<String, Any>()
66

@@ -12,4 +12,8 @@ class ServerContext : Context {
1212
@Suppress("UNCHECKED_CAST")
1313
return attributes[key] as T
1414
}
15+
16+
override fun port(): Int {
17+
return port
18+
}
1519
}

0 commit comments

Comments
 (0)