ServletContext.getVirtualServerName always returns "localhost"

I experimented with the new getVirtualServerName method introduced for interface ServletContext in servlet spec 3.1. The JavaDoc states: Returns the primary name of the virtual host on which this context is deployed. The name may or may not be a valid host name.

However Wildfly always seems to return "localhost" instead of the virtual host name specified in XML configuration files. My host config in standalone.xml looks like this: <host name="default-host" alias="www.sample.com">. I expected that getVirtualServerName returns "default-host" in this case. 

getVirtualServerName is implemented like this: "return deployment.getDeploymentInfo().getHostName();". However DeploymentInfo.setHostName is never called during startup. 

If I did not misunderstand what getVirtualServerName is supposed to deliver, something similar to my proposed patch should fix the problem. Sorry, I only looked at Wildfly source code for the first time today in a debugger and was unable to verify if my proposed patch compiles :( Hope a more experienced developer can have a quick look.
Add Read & Write timeouts configuration options

- undertow 2.0 schema & model
WFLY-3581: move EE Concurrency's JTA related code from EE to Transactions subsystem
Merge pull request #6482 from langfr/org.jboss.arquillian.junit

org.jboss.arquillian.junit twice in testsuite/pom.xml
Merge pull request #6480 from emmartins/WFLY-3581

WFLY-3581: move EE Concurrency's JTA related code from EE to Transaction...
Merge pull request #6415 from ctomc/undertow

Add Read & Write timeouts configuration options
Merge pull request #6396 from quijote/patch-1

ServletContext.getVirtualServerName always returns "localhost"