简体   繁体   中英

How do I create a compressed XAP file in Java that Silverlight will read?

I have a Java-based web service that takes a Visual Studio build Silverlight XAP file and slipstreams content into it based on the incoming URL. This works just fine if I set the compression method to STORED :

ZipOutputStream zipStream = new ZipOutputStream(os) zipStream.setMethod(ZipOutputStream.STORED)

However, this produces an uncompressed file. I'd like to deliver a compressed file similar to what Visual Studio produces. The normal route to do this is to change the compression method to DEFLATED :

zipStream.setMethod(ZipOutputStream.DEFLATED)

This works fine in the code, and the produced XAP file checks out as a valid zip file using the standard tools (Windows Explorer, 7zip). However, the Silverlight plugin refuses to load it. There are no error messages in the console or exceptions in the browser, just a blank screen.

What do I need to do to tell the Java Deflater to create a compressed XAP file that Silverlight will accept?

Silverlight does not support some of the compression methods / levels. Not sure this works, but try set the compression level to 3 (see setLevel )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM