,因爲我可以在一個zip文件把密碼的Grails放密碼的壓縮文件中的Grails錯誤
package zip
import java.util.zip.ZipEntry
import java.util.zip.ZipOutputStream
class SampleZipController {
def index() { }
def downloadSampleZip() {
response.setContentType('APPLICATION/OCTET-STREAM')
response.setHeader('Content-Disposition', 'Attachment;Filename="example.zip"')
ZipOutputStream zip = new ZipOutputStream(response.outputStream);
def file1Entry = new ZipEntry('first_file.txt');
zip.putNextEntry(file1Entry);
zip.write("This is the content of the first file".bytes);
def file2Entry = new ZipEntry('second_file.txt');
zip.putNextEntry(file2Entry);
zip.write("This is the content of the second file".bytes);
zip.setPassword("password");
zip.close();
}
}
的問題是,我把setPassword財產,不會產生任何的壓縮文件案「 m保留錯誤的單詞。
「setPassword()」方法記錄在哪裏?我沒有在Java文檔中看到它。 –
謝謝你的迴應真的找不到文檔setPassword是正確的關鍵字。 –