0

Is there a way to configure Undertow to handle the root context? For example: I've set called setContextPath("/") and I would like to access my app using, for example, http://localhost:8080/

If I access http://localhost:8080//, it works :(.

Am I missing something?

Alberto Souza
  • 105
  • 1
  • 8
  • Use a context root like test,http://localhost:8080/test, add setContextPath("test"). – Shreyos Adikari Apr 03 '14 at 19:10
  • Can you post the code you are using to setup the deployment? – Stuart Douglas Apr 04 '14 at 01:50
  • Hi, I'm working at the same project. The code is in [this class](https://github.com/asouza/vraptor-undertow/blob/master/src/main/java/br/com/caelum/vraptor/undertown/builder/VRaptorServer.java#L52-L61), when the context is "/" the behaviour described by @Alberto happens. – Chico Sokol Apr 04 '14 at 18:05

1 Answers1

1

You should call setContextPath("")

as if you do setContextPath("/") you are mapping your application under "/" which is already under "/" that is why it responds to "//" url

Tomaz Cerar
  • 5,761
  • 25
  • 32
  • Hi, I tried the code you suggested and I got this exception: `Exception in thread "main" java.lang.IllegalArgumentException: UT000009: Path must be specified` I also took a look in class PathMatcher and I found this: https://github.com/undertow-io/undertow/blob/master/core/src/main/java/io/undertow/util/PathMatcher.java#L110 – Alberto Souza Jul 24 '14 at 20:08
  • Hi, the problem was not in the setContextPath. As ctomc said, we can pass an empty string. But you use "/" in the addPrefixPath("/") method. – Alberto Souza Aug 19 '14 at 15:49