ZK - Open Source Ajax Java FrameworkZK - Open Source Ajax Java Framework

Weblogic: static content problem on production server

chryss
3 Sep 2010 06:52:01 GMT
3 Sep 2010 06:52:01 GMT

N/A

PeterKuo
26 Sep 2010 22:41:48 GMT
26 Sep 2010 22:41:48 GMT

@chryss
Please avoid modify your original post.
It may confuse others.

chryss
7 Oct 2010 04:31:11 GMT
7 Oct 2010 04:31:11 GMT

Sorry, my approach was all wrong and I did not had the time to update my post:
I was trying to deploy a small ZK application in an environment composed of Apache 2.2 + Weblogic 8.1. (with reverse proxy): my problem was the loss of static content once the application was deployed on the production server.
The cause of my problem was that while under development the URL of my application was http://localhost:portNumber/myApplication, but on the production server the address of my application became http://address:portNumber/somePrefix/myApplication.
While all the logic of the software worked correctly, the static contents were all lost because the requests to the Apache server did not contain "/somePrefix" in their path (my pages contained all the data I needed from the DB, but not a single image/css/js was included).
I solved it like this:

- in zk.xml I declared my own URLEncoder:
<system-config>
.............
<url-encoder-class> MyUrlEncoder</url-encoder-class>
</system-config>

- and implemented the URLEncoder class like this:

public class MyUrlEncoder implements URLEncoder{

public String encodeURL(ServletContext arg0, ServletRequest arg1,
ServletResponse arg2, String arg3) {
String urlPrefix = System.getProperty(envAttribute); //the envAttribute is defined on each weblogic server and contains the "/somePrefix" mentioned above
String encodedUrl = arg3;
if(urlPrefix!=null && !arg3.startsWith("http://")) {
encodedUrl = urlPrefix+arg3;
}
return encodedUrl;
}
That did the trick!