0

I saw this question and I was able to convert HTML with a separate stylesheet to one with inline CSS. However, when I tried to run it in Google AppEngine, it complained

java.lang.NoClassDefFoundError: java.io.FileOutputStream is a restricted class. Please see the Google App Engine developer's guide for more details.

I worked around that problem then it complained again

Caused by: java.lang.NoClassDefFoundError: java.awt.Color is a restricted class. Please see the Google App Engine developer's guide for more details.

So I don't think I can use that CSSBox library. Is there another way to convert HTML to inline CSS HTML in Google AppEngine?

Community
  • 1
  • 1
Chloe
  • 25,162
  • 40
  • 190
  • 357
  • Could you post a full stack trace for the second error? For this application (if you are using the code from the mentioned question) the java.awt.* should not be necessary at all. – radkovo Jan 09 '14 at 09:38
  • @radkovo Here is the full stack trace for java.awt.Color. http://pastebin.com/34zHhPBb – Chloe Jan 13 '14 at 16:59

2 Answers2

1

The JRE Class White List provides a list of classes that can be used from the JRE.

The above 2 classes that it is complaining about are not in that list and you cannot use them. You will either have to look for alternatives (other libraries), see if those classes can be dropped from the JAR (without ofcourse affecting your functionality) and so on.

Romin
  • 8,708
  • 2
  • 24
  • 28
1

Maybe you could use a historical version of CSSBox that is based on CSSParser instead of the newer jStyleParser. It is probably less efficient (all data is represented as strings) but it has less dependencies.

The way of use remains more or less the same, see the ComputeStyles demo for that version. It should depend only on clases from org.fit.cssbox.css -- these should be acceptable for GAE. However, I have no experience with using the CSSParser on GAE.

radkovo
  • 868
  • 6
  • 10
  • I saw jStyleParser was added in version 2. https://web.archive.org/web/20090309190904/http://cssbox.sourceforge.net/download.php. I found the latest release before that, 1.1. https://sourceforge.net/projects/cssbox/files/cssbox/1.1/. – Chloe Jan 13 '14 at 15:19