* @throw MalformedURLException Upon error forming the URL
*/
public static URL getAssetURL(String uri, Cell cell) throws MalformedURLException {
// First try to form an AssetURI class given the uri string. If none
// exists, then return the uri directly as a URL
AssetURI assetURI = AssetURI.uriFactory(uri);
if (assetURI == null) {
logger.warning("Unable to find AssetURI object for " + uri);
return new URL(uri);
}
// From the cell, find out what the associated wonderland session is
// and fetch the server host name and port from that
WonderlandSession session = cell.getCellCache().getSession();
ServerSessionManager manager = session.getSessionManager();
if (manager == null) {
logger.warning("Unable to find manager for session " + session);
return new URL(uri);
}
String serverHostAndPort = manager.getServerNameAndPort();
// Annotate the URI with the host name and port from the session and
// return as a URL
assetURI.setServerHostAndPort(serverHostAndPort);
return assetURI.toURL();
}