private void addCombinedScriptLink(Element container, List<String> scripts)
{
try
{
ClientDataSink dataSink = clientDataEncoder.createSink();
ObjectOutputStream stream = dataSink.getObjectOutputStream();
stream.writeInt(scripts.size());
for (String scriptURL : scripts)
{
// Each scriptURL will be prefixed with the context path, which isn't needed to build the combined virtual
// asset (in fact, it gets in the way).
stream.writeUTF(scriptURL.substring(contextPathLength));
}
String virtualURL = fullAssetPrefix + RequestConstants.VIRTUAL_FOLDER + dataSink.getEncodedClientData() + ".js";
container.element("script",
"type", "text/javascript",
"src", virtualURL);
}