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-3493] Do not remove a JMS resource with deployed dependencies

Ensure that there is a dependency between the JMS resource service
(JMSQueueService and JMSTopicService) and the BinderService for their
JNDI bindings so that if the resource is removed, the missing dependency
is detected.

Add recovering of the JMSQueue and JMSTopic services in the :remove
operations by replaying the runtime part of their corresponding :add
operations.

JIRA: https://issues.jboss.org/browse/WFLY-3493
WFLY-3440 Split up Java EE dependency processor into the appropriate subsystems
[WFLY-3508][BZ1104730], add parameter StateValues for new ErrorState.
Refactor the way we register transformers.
Add buildTransformation(...) methods for new resources, even though these methods are not yet triggered.
WFLY-3478 fixing mask verification
WFLY-3530 Upgrade Weld to 2.2.2.Final
WFLY-3539: removing jms-connection-factory from non full configurations
[WFLY-547] track uncleanly unregistered slave hosts
Optimize cache key size by using component name instead of bean class name.
WFLY-3138, check Model Type to fix IllegalArgumentException when calling invalid asPropertyList method.
WFLY-794: adds missing package in sun.jdk module, adds simple test to ensure rmi context is in jndi, and enhances the existent jmx connector test to run remotely
Merge pull request #6372 from pferraro/transformers

Refactor the way we register transformers for jgroups and infinispan subsystems
Merge pull request #6392 from soul2zimate/WFLY-3508

[WFLY-3508][BZ1104730], add parameter StateValues for new ErrorState.
Merge pull request #6421 from mkouba/WFLY-3530-90

WFLY-3530 Upgrade Weld to 2.2.2.Final
Merge pull request #6422 from emmartins/WFLY-3539

WFLY-3539: removing jms-connection-factory from non full configurations
Merge pull request #6427 from soul2zimate/WFLY-3138

WFLY-3138, check Model Type to fix IllegalArgumentException when calling invalid asPropertyList
Make tracking and reporting of active ops more robust in OperationCancellationTestCase
WFLY-3380 Change isCallerInRole implementation to use the EJBAuthorizationHelper