-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Hello world action exposed to the internet in code first archety…
…pes (#1920)
- Loading branch information
Showing
3 changed files
with
43 additions
and
1 deletion.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
...resources/archetype-resources/src/main/java/__packageInPathFormat__/hello/HelloWorld.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package ${package}.hello; | ||
|
||
import kalix.javasdk.action.Action; | ||
import kalix.javasdk.annotations.Acl; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
|
||
/** | ||
* This is a simple Action that returns "Hello World!". | ||
* Locally, you can access it by running `curl http://localhost:9000/hello`. | ||
*/ | ||
@RequestMapping | ||
// Exposing action to the Internet. | ||
@Acl(allow = @Acl.Matcher(principal = Acl.Principal.INTERNET)) | ||
public class HelloWorld extends Action { | ||
|
||
@GetMapping("/hello") | ||
public Action.Effect<String> hello() { | ||
return effects().reply("Hello World!"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
...resources/archetype-resources/src/main/kotlin/__packageInPathFormat__/hello/HelloWorld.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package ${package}.hello; | ||
|
||
import kalix.javasdk.action.Action | ||
import kalix.javasdk.annotations.Acl | ||
import org.springframework.web.bind.annotation.GetMapping | ||
import org.springframework.web.bind.annotation.RequestMapping | ||
|
||
/** | ||
* This is a simple Action that returns "Hello World!". | ||
* Locally, you can access it by running `curl http://localhost:9000/hello`. | ||
*/ | ||
@RequestMapping | ||
// Exposing action to the Internet. | ||
@Acl(allow = [Acl.Matcher(principal = Acl.Principal.INTERNET)]) | ||
class HelloWorld : Action() { | ||
|
||
@GetMapping("/hello") | ||
fun hello(): Effect<String> { | ||
return effects().reply("Hello World!") | ||
} | ||
} |