Refresh image in Oxygen Author Component

Having trouble installing Oxygen? Got a bug to report? Post it all here.
aleh.haidash
Posts: 32
Joined: Tue May 26, 2015 10:28 am

Refresh image in Oxygen Author Component

Post by aleh.haidash »

We are using Oxygen web Component in our application as a main topic editor.

I've bumped into the problem when in topic was included a link to image.

We used our StylesFilter implementation - DITAStylesFilter. In DITAStylesFilter I used this code to download images:

Code: Select all

 StringBuilder request = new StringBuilder();
request.append("repository_root?sourceDocPath=");
request.append(sourceDocPath);
request.append("&destDocPath=");
request.append(decodeLink(attrValue.getValue()));

String url = baseUrl + "/";

styles.setProperty(Styles.KEY_MIXED_CONTENT, new StaticContent[] { new URIContent(url, request.toString()) });
When I removed image from cmis, the oxygen shows: Unsupported image type for http:/../image.jpg. When I've recovered an image and done a reloadContent, the oxygen continued to show this warning. I tried to use clearImageCache and WSAuthorEditorPage.refresh() before reloadConten, but it still doesn't work.

A request in DITAStylesFilter was formed correctly before reloadContent, but it does not come to our servlet.

How can I fix this problem?

Best regards,
Aleh.
Best Regards,
Aleh
Radu
Posts: 9449
Joined: Fri Jul 09, 2004 5:18 pm

Re: Refresh image in Oxygen Author Component

Post by Radu »

Hi Aleh,

So you are using our Author Component product for editing content on the CMS.
What version of the Author Component are you using?

Just to see that I clearly understand the problem, so you first remove the image on the CMS and this is shown up as a broken link in the component, then you re-add the image on the CMS but even if you refresh the Author page, the link is shown as missing and no callback is received on your CMS servlet.

The problem is that the default Java HTTP Connection implementation uses caching when retrieving resources. So even if the Oxygen code creates a new HTTP Connection to the image and retrieves the input stream from it, the connection will return some cached content.

In the latest Author Component code corresponding to Oxygen 17 we called in our code httpConnection.setUseCaches(false); before retrieving content from each image. So it is possible that the problem no longer occurs with the latest Author Component code.

One other possibility for you would be at some point after the applet was loaded and before you open any XML document to use Java reflection to set the flag java.net.URLConnection.defaultUseCaches to false, something like:

Code: Select all

      try {
Field defaultUsesCache = URLConnection.class.getDeclaredField("defaultUseCaches");
defaultUsesCache.setAccessible(true);
defaultUsesCache.set(null, Boolean.FALSE);
} catch (Exception e) {
e.printStackTrace();
}
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
aleh.haidash
Posts: 32
Joined: Tue May 26, 2015 10:28 am

Re: Refresh image in Oxygen Author Component

Post by aleh.haidash »

Hi Radu

Thanks a lot. This helps.
Best Regards,
Aleh
Post Reply