Files
spring-boot/spring-boot-samples/spring-boot-sample-undertow/src/main/java/sample/undertow/web/SampleController.java
Andy Wilkinson ff2d423fcb Correct the root context path used with Undertow
Undertow, like Tomcat, uses "" for the context path of the root
context. Previously, the Undertow deployment was being configured with
"/" for the root context. This was leading to a silent failure in
AsyncContextImpl.dispatch when it failed to look up the deployment
manager for the current request.

This commit updates UndertowEmbeddedServletContainerFactory to use the
correct context path (an empty String) for the root context.

Fixes gh-2365
2015-01-16 13:38:13 +00:00

53 lines
1.4 KiB
Java

/*
* Copyright 2012-2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package sample.undertow.web;
import java.util.concurrent.Callable;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import sample.undertow.service.HelloWorldService;
@RestController
public class SampleController {
@Autowired
private HelloWorldService helloWorldService;
@RequestMapping("/")
public String helloWorld() {
return this.helloWorldService.getHelloMessage();
}
@RequestMapping("/async")
public Callable<String> helloWorldAsync() {
return new Callable<String>() {
@Override
public String call() throws Exception {
return "async: "
+ SampleController.this.helloWorldService.getHelloMessage();
}
};
}
}