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.
WFLY-3568 Make it possible to wrap InjectionTarget for WS endpoint and
EJB interceptor
Improve DIST_ASYNC compatibility by using FORCE_SYNCHRONOUS flag where cache write result is required.
Proactively validate that session attributes are Serializable.
Fix intermittent error in transformers tests on blank maven repo
Remove OSGI dependencies as they ware only used by Arquillian containers.
Ultimately fix WFLY-3401 EJB StatefulTimeoutTestCase transient failures.
If expiration task fires promptly, then now - lastAccessedTime == timeout
So make sure expiration check is inclusive.
[WFLY-3577] Better default for SSL cipher suite in JBoss Web config
adjust transformers framework settings
Re compress zip files to bring zip distro down bit more
Merge pull request #6475 from kabir/cipher-suite

[WFLY-3577] Better default for SSL cipher suite in JBoss Web config
Switch from infinispan internal linkage to custom LRU
Merge pull request #6479 from n1hility/master

[WFLY-3585] Switch from infinispan internal linkage to custom LRU
Merge pull request #6472 from ctomc/build

Fix intermittent error in transformers tests on blank maven repo
Merge pull request #6474 from pferraro/master

Ultimately fix WFLY-3401 EJB StatefulTimeoutTestCase transient failures.
Merge pull request #6468 from pferraro/force_sync

Proactively validate that distributable session attributes are Serializable
Merge pull request #6464 from mkouba/WFLY-3568

WFLY-3568 Make it possible to wrap InjectionTarget for WS endpoint and
Change to new checkstyle artifact
Upgrade to WF core Alpha2
Add javax.activation to web build (was in core)