0

I am literally going crazy about this issue.

We have set up a Liferay environment that is using @RessourceMapping Methods to provide Images to our website. Those images show up on every browser (Safari, Chrome, Firefox, Mobile)- except Internet Explorer.

Our Code in the backend is pretty straightforward:

public void getImage(ResourceRequest request, ResourceResponse response) throws IOException {

byte[] imageSrc = getImageFromDatabase()
response.setContentType("image/jpg");
OutputStream portletOutputStream = response.getPortletOutputStream();
portletOutputStream.write(imageSrc);
response.setContentLength(length);
portletOutputStream.flush();
portletOutputStream.close();

}

The JSP displaying the Image is also not complicated:

<div class="span12">
    <img src="${getImageUrl}" width="100%" />
</div>

What I can see (In Internet Explorer Dev Tools) is that for some of the pictures that don´t get loaded I do get a 304 and for others just "cancelled".

Here is an example of the URL I am calling :

http://my-server/web/my-portlet/display?p_p_id=mylongportletnamedisplayportlet_WAR_mylongportletname&p_p_lifecycle=2&p_p_state=normal&p_p_mode=view&p_p_resource_id=getImage&p_p_cacheability=cacheLevelPage&p_p_col_id=column2&p_p_col_count=2&_mylongportletnamedisplayportlet_WAR_mylongportletname_id=658468&_mylongportletnamedisplayportlet_WAR_mylongportletname_imageType=logo&_mylongportletnamedisplayportlet_WAR_mylongportletname_entityType=car

Any idea why those images are not displayed in Internet Explorer ?

Breiti
  • 579
  • 5
  • 21
  • Can you share the `getImageUrl` as well the image link being generated? – Parkash Kumar Mar 07 '16 at 10:16
  • Hi, thanks for your comment. The image is just a normal jpg / RGB image. Nothing Special here. The URL I will paste above – Breiti Mar 07 '16 at 10:21
  • There is nothing in the URL which identifies image content. Its just the AJAX call URL. Shouldn't you write image somewhere and set it's link to img tag? – Parkash Kumar Mar 07 '16 at 10:30
  • I'd like to see the HTTP level traffic on this. Can you "view image" and see what you get there? Or check with whatever Firebug-like debug-tool IE supports. – Olaf Kock Mar 07 '16 at 12:42
  • Hi Everyone. I have no idea why this happend but what I did was to replace the RessourceMapping with a Servlet and everything works now. – Breiti Mar 08 '16 at 19:54

1 Answers1

0

I have not found an answer to my question but I have found a workaround:

I am using a simple servlet now. It just returns the Image and that´s it: Done in 5 mins, works like a charm.

I will stick with servlets for now.

Breiti
  • 579
  • 5
  • 21