0

画像データを格納するためにシリアル化されたクラスを宣言したクラスがあります

@Persistent(serialized = "true")
private DownloadableFile imageLogoFile;

クラスの実装

public class DownloadableFile implements Serializable {

public DownloadableFile(byte[] コンテンツ、文字列ファイル名、文字列 mimeType) { super(); this.content = コンテンツ; this.filename = ファイル名; this.mimeType = mimeType; private static final long serialVersionUID = -8497358622042084708L; } プライベート バイト[] コンテンツ。プライベート文字列ファイル名; プライベート文字列 mimeType; public DownloadableFile() { } }

showlogo は、データストアからコンテンツをフェッチすることになっているサーブレットですが、その呼び出しはすべて null を返しますが、blob は appwrench で表示されます。

画像データに影響を与えると予想される場所

final Image logoImage = new Image();
logoImage.setUrl("/showlogo");
logoImage.setHeight("100px");
logoImage.setWidth("100px");

編集:画像データが保存され、取得されますが、画像は引き伸ばされます。高さ/幅などを与えてみましたが、

サーブレット コード:

com.sms.DownloadableFile df = w.getImageLogoFile();
if (df != null){
    String filen = df.getFilename();
    response.setHeader("Content-Disposition", "filename="+filen);
    String mime = df.getMimeType();
    response.setContentType(mime);
    byte[] b = df.getContent();
    //Base64.encode(b);
    response.setContentLength(b.length);
    ServletOutputStream out = response.getOutputStream();
    out.write(b);
    // Pipe data here
    out.flush();
    out.close();
}
4

1 に答える 1

1

そのフィールドをフェッチ グループに入れていないため、フェッチされません。

于 2010-01-07T11:34:47.227 に答える