NetBeans Visual JSF editor tutorial on web applications running over HTTPS displaying warning in IE “This page contains both secure and nonsecure items”.

NetBeans Visual JSF editor tutorial on web applications running over HTTPS displaying warning in IE “This page contains both secure and nonsecure items”.

If you “view source” on the page that Woodstock generates, you will see the following line:

</span><code><script type="text/javascript" src="/app/theme/com/sun/webui/jsf/suntheme4_2-080320/javascript/bootstrap.js"></code><span style="font-family: Georgia,'Times New Roman','Bitstream Charter',Times,serif; font-size: 13px; line-height: 19px;">

Now if you change that line to:

</span><code><script type="text/javascript" src="https://www.yourserver.com:8443/ app/theme/com/sun/webui/jsf/suntheme4_2-080320/javascript/bootstrap.js"></code><span style="font-family: Georgia,'Times New Roman','Bitstream Charter',Times,serif; font-size: 13px; line-height: 19px;">

The site will now work under HTTPS without any security warnings. Obviously, this cannot be done straightforward because this piece of HTML code is generated by the Woodstock library. The solution we have implemented to resolve this problem is to change the code in the Woodstock library that generates the HTML header of the pages. The following solution is not the most elegant solution; it’s more of a simple workaround to solve this problem in production environment:

  1. Open the Woodstock project web site, https://woodstock.dev.java.net/index.html, and go to “Build it Yourself.”
  2. Follow the instructions on the “Build it Yourself” page to register and get a CVS access to download the framework source code. The CVS URL will be something like: :pserver:username@cvs.dev.java.net:/cvs. You don’t need NetBeans 5.5, as it is written in the compile instructions.
  3. Open the CVS repository with NetBeans and check out the module “woodstock/webui” and branch “Release42″ as a new project.
  4. Open the project and edit the “JavaScriptUtilities.java” file in package com.sun.webui.jsf.util in “src/runtime” folder.
  5. In method “renderJavaScriptInclude”   change line 578 from:
    </span><code>String jsFile = getTheme().getPathToJSFile(file);</code><span style="font-family: Georgia,'Times New Roman','Bitstream Charter',Times,serif; font-size: 13px; line-height: 19px;">

    To:

    </span><code>String jsFile = "https://www.yourserver.com:8443" + getTheme().getPathToJSFile(file);</code><span style="font-family: Georgia,'Times New Roman','Bitstream Charter',Times,serif; font-size: 13px; line-height: 19px;">

  6. Save the file and rebuild the project. During compile, you might notice a lot of warnings, etc – just ignore them.
  7. Copy and overwrite the newly compiled webui-jsf.jar and webui-jsf-dt.jar from the Woodstock source code folder “woodstockwebuidist” to the NetBeans subfolder. “visualweb2modulesext”. Keep a copy of the original jar files (see below).
  8. Rebuild your WAR file and deploy it on the HTTPS server.

There you go. You should now have your website working under IE with no security warnings. Note that the newly compiled .jar files will work only on the server URL you define in Step 5. They won’t work in localhost development environment, so you might want to change with original .jar files during development phase. Cheers.

Comments

Visual Web JSF (Woodstock) IE7 HTTPS warning « Java blog 16-04-2009, 11:56

[...] are some solutions to change de webui-jsf.jar library to hardcode the URL, since this is not the best [...]

Reply
Scott Cheadle 21-04-2009, 05:48

Hi,

Using your example as a base, I have made it somewhat more portable by not needing to hardcode the server/port etc. The following lines will do this. :-

String uri=((HttpServletRequest)FacesContext.getCurrentInstance().getExternalContext().getRequest()).getRequestURI();
String url=((HttpServletRequest)FacesContext.getCurrentInstance().getExternalContext().getRequest()).getRequestURL().toString();
String bitineed = url.replace(uri, “”);
String jsFile = bitineed + getTheme().getPathToJSFile(file);

Reply
Ana Garcia 11-08-2009, 11:32

I am using the code provided by Scott. I saved the project and did a clean and build. I am getting a BUILD FAILED message. Is this part of the messages to ignore?

Reply
Dimitar Dobrev 12-08-2009, 07:55

@Ana Garcia

Ana,
I have not tried the code that Scott proposed. Have you tried the solution as I published it originally?

Reply
Ana Garcia 12-08-2009, 11:59

I tried it and it still fails on the build. I even deleted it and started all over without no luck. it says that is unable to access ..libwebui-tools.jar ; maybe I am not doing the steps correctly: when it comes back from tcheckout, it ask if I want it to open the project and I clickon Open Project, then I go and make the changes. save the file; run build. Did I miss something?

this is the last part of the output:
l10n-uptodate:
native2ascii:
Running native2asci for componentBundle_de.properties,componentBundle_es.properties,componentBundle_fr.properties,componentBundle_it.properties,componentBundle_ja.properties,componentBundle_ko.properties,componentBundle_pt_BR.properties,componentBundle_sv.properties,componentBundle_zh_CN.properties,componentBundle_zh_HK.properties,componentBundle_zh_TW.properties,modelBundle_de.properties,modelBundle_es.properties,modelBundle_fr.properties,modelBundle_it.properties,modelBundle_ja.properties,modelBundle_ko.properties,modelBundle_pt_BR.properties,modelBundle_sv.properties,modelBundle_zh_CN.properties,modelBundle_zh_HK.properties,modelBundle_zh_TW.properties,renderkithtmlBundle_de.properties,renderkithtmlBundle_es.properties,renderkithtmlBundle_fr.properties,renderkithtmlBundle_it.properties,renderkithtmlBundle_ja.properties,renderkithtmlBundle_ko.properties,renderkithtmlBundle_pt_BR.properties,renderkithtmlBundle_sv.properties,renderkithtmlBundle_zh_CN.properties,renderkithtmlBundle_zh_HK.properties,renderkithtmlBundle_zh_TW.properties,resourcesLogMessages_de.properties,resourcesLogMessages_es.properties,resourcesLogMessages_fr.properties,resourcesLogMessages_it.properties,resourcesLogMessages_ja.properties,resourcesLogMessages_ko.properties,resourcesLogMessages_pt_BR.properties,resourcesLogMessages_sv.properties,resourcesLogMessages_zh_CN.properties,resourcesLogMessages_zh_HK.properties,resourcesLogMessages_zh_TW.properties, it takes several minutes…
Unable to access jarfile C:Sourcewoodstock42woodstocktoolswoodstocklibwebui-tools.jar
C:Sourcewoodstock42woodstockwebuibuild.xml:455: The following error occurred while executing this line:
C:Sourcewoodstock42woodstockwebuibuild-l10n.xml:63: The following error occurred while executing this line:
C:Sourcewoodstock42woodstockwebuibuild-l10n.xml:264: Java returned: 1
BUILD FAILED (total time: 41 seconds)

Reply
Visual Web JSF (Woodstock) IE7 HTTPS warning » JavaWithMarcus 18-02-2010, 07:44

[...] are some solutions to change de webui-jsf.jar library to hardcode the URL, since this is not the best [...]

Reply

Leave a Reply