【问题标题】:Issue displaying JPG in Safari for Yosemite OSX在 Yosemite OSX 的 Safari 中显示 JPG 的问题
【发布时间】:2015-07-03 05:44:15
【问题描述】:

我目前在 Safari(Yosemite OS X 版本)中显示来自 java 字节流的 jpgs 时遇到问题。该图像在所有其他浏览器(包括早期版本的 Safari)中都能正常显示。有人知道最新版本的 Safari 显示 jpg 的任何错误吗?有没有其他人遇到过这个问题并有解决方法。

        byte[] checkImage = checkImageString.getBytes(CommonConstants.ENCODING);

        checkImage = Base64.decodeBase64(checkImage);

        if ( null != checkImage ) {
            int imageLength = checkImage.length;
            response.setContentType(CommonConstants.JPEG_MIME_TYPE);
            response.setContentLength(imageLength);
            // to prevent caching
            response.setHeader( CommonConstants.ACCEPT_RANGES_HEADER, CommonConstants.BYTES);
            response.setHeader( CommonConstants.EXPIRES_HEADER, CommonConstants.EXPIRE );
            response.setHeader( CommonConstants.CACHE_CONTROL_HEADER, CommonConstants.NO_CACHE );
            response.setHeader( CommonConstants.PRAGMA_HEADER, CommonConstants.NO_CACHE );
            response.setStatus(HttpServletResponse.SC_OK);

            ServletOutputStream sos = response.getOutputStream();
            sos.write(checkImage, 0, imageLength);
            sos.flush();
            sos.close();
        }

【问题讨论】:

    标签: java utf-8 safari jpeg osx-yosemite


    【解决方案1】:

    看起来这不是编码问题,而是返回图像字节字符串的服务的问题。 -

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-11-07
      • 1970-01-01
      • 1970-01-01
      • 2013-03-07
      • 1970-01-01
      相关资源
      最近更新 更多