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-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
[WFLY-2964] Add some missing i18n
[WFLY-490] / [WFLY-2149] Bypass complex perms checking for SuperUser
[WFLY-3556] Timer persistence and restore
WFLY-3531 for applications with JPA persistence units, every deployment/subdeployment ends up with the NEXT_PHASE_DEP set up
[WFLY-3562] Remove requirement for maintaining subsystem-test KnownVersions
Merge pull request #6428 from emmartins/WFLY-794-master

WFLY-794: adds missing package in sun.jdk module, adds simple test to en...
Merge pull request #6437 from bstansberry/WFLY-2964

[WFLY-2964] Add some missing i18n
Merge pull request #6438 from bstansberry/WFLY-2149

[WFLY-490] / [WFLY-2149] Bypass complex perms checking for SuperUser
Merge pull request #6458 from bstansberry/KnownVersions

[WFLY-3562] Remove requirement for maintaining subsystem-test KnownVersi...
Move add-user module to the correct location
WFLY-3568 Make it possible to wrap InjectionTarget for WS endpoint and
EJB interceptor
Merge pull request #6460 from stuartwdouglas/master

Move add-user module to the correct location
Core split: Remove all non-core modules, add dependencies on org.wildfly.core artifacts
Merge pull request #6467 from stuartwdouglas/master

Core split: Remove all non-core modules, add dependencies on org.wildfly...
Merge pull request #6457 from langfr/WFLY-3556

[WFLY-3556] Timer persistence and restore
Improve DIST_ASYNC compatibility by using FORCE_SYNCHRONOUS flag where cache write result is required.
Proactively validate that session attributes are Serializable.
Merge pull request #6459 from scottmarlow/WFLY-3531_pu_next_phase_deps

WFLY-3531 for applications with JPA persistence units, every deployment/subdeployment ends up with the NEXT_PHASE_DEP set up