permaculture playing cards*
The moose likes Websphere and the fly likes how do I define an images directory in the server root (not the context root) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Websphere
Bookmark "how do I define an images directory in the server root (not the context root)" Watch "how do I define an images directory in the server root (not the context root)" New topic
Author

how do I define an images directory in the server root (not the context root)

Robert Glover
Greenhorn

Joined: Feb 07, 2004
Posts: 26
I am using RAD 7 and Websphere 6.1. Let's say for the sake of example I get to my Websphere app by this URL: //http://localhost:9043/myApp/index.jsp

What I need to know is how to define an images directory so that it can be found (under the auspices of Websphere) at this location:
URL: //http://localhost:9043/images/someimage

What I also need to know is how to define (and run under the auspices of Websphere) a .css file so that it can be found at this location:
URL: //http://localhost:9043/myCssFile.css


People have been asking questions similar to this in this JavaSaloon forum for a couple of years, and NO ONE has to day posted an answer, not even an answer that doesn't work.

I think Websphere 6.1 uses an Appache web server under the covers that is rebranded to be called an IBM web server. But I don't know where it is or what needs to be done to make it recognize the needs I detailed above.

I need a solution for this that works on my local desktop where I have RAD 7 and a local embedded Websphere 6.1, and I also need a solution for this that will work in DEV Webspere, QA Websphere, and PROD Websphere environments.

Please, let's finally answer this question once and for all. Everybody needs to know how to do this, don't you think?


So far I am: IBM 141 XML and Related Technologies Certified, Sun Cert Java Programmer, Sun Cert Java Developer, Sun Cert Java 2 Architect, Sun Cert J2EE Architect (part 1 only), Sun Cert J2EE Web Component Developer, Sun Cert Business Component Developer, and Microsoft Certified System Engineer for Win NT 4.
Daniel Moussa
Greenhorn

Joined: Jul 07, 2008
Posts: 20

I am actually in the same situation as you are. However, I found the following help entry in RAD 7 help, but it made no sense to me.
It basically talks about "modifying the project's PageCodeBase class" what ever that means!

See if it you can understand it and please post back a solution.

=========================================================================

Migrating Web applications with SDOs targeted to a WebSphere Application Server V5.1 runtime
If you have an existing Web project containing Service Data Objects (SDOs) that were initially created and targeted to a WebSphere Application Server V5.1 runtime (which used SDO access beans), then if you migrate to a non-WebSphere Application Server runtime (such as Apache Tomcat, for example) you might need to modify the project's PageCodeBase class.
If you migrate a Web project from a previous version containing SDOs that were initially created and targeted to a WebSphere Application Server V5.1 runtime, then you might get a "file IO exception" against the SDO XML files when you run the JavaServer Faces JSP on a non-WebSphere Application Server runtime.
This happens because different implementations of JavaServer Faces return the resource path, and the way it is returned varies by server; some servers will only return a relative path (such as "/MyProject/WebContent/sdo.xml"). In this case, a full system path (for example, "D:/workspace/MyProject/WebContent/sdo.xml") is required.

If you have these errors, you must modify the getRealPath(String relPath) method so that when it resolves it returns a full system path.
==========================================================================

[ December 04, 2008: Message edited by: Daniel Moussa ]
Paul Wallace
Ranch Hand

Joined: Oct 09, 2006
Posts: 40
Totally agreed with the author of this post, why is this info not easily obtainable? Did the author ever get a resolution?

Solution I currently "live with" in my local RAD environment is to add a project to my workspace that includes the static content and then add this project to the ear.

For deployments you can get at the config of the HTTP server and set up the references to the static content there. Something like this:

<VirtualHost xx.xxx.xxx.xxx>
DocumentRoot /webapp/myproducts
ServerName myproducts.mycompany.com
Alias /myproducts/images /webapp/myproducts/images
Alias /myproducts/resources /webapp/myproducts/resources
Alias /myproducts /webapp/myproducts
ErrorDocument 401 /401.html
ErrorDocument 403 /403.html
ErrorDocument 404 /404.html
ErrorDocument 500 /500.html
</VirtualHost>
Robert Glover
Greenhorn

Joined: Feb 07, 2004
Posts: 26
(how time flies). I discovered recently that when deploying to Websphere 6.1 that WAS6.1 is actually front-ended by an IBM-fied version of Apache HTTP server which IBM refers to as "IHS", i.e., IBM HTTP Server. IHS is configured the same way Apache HTTP server is configured. So all you have to do is locate file http.conf within the directory where IHS is located, and the changes can be made there using the Apache http documentation ( http://httpd.apache.org/ ). I am typing this at home from memory, but it seems to me the config file for IHS is located on Solaris in a place similar to : /opts/Websphere/runtimes/IBMHttpServer/conf/http.conf or something like that.
The bigger frustration now is local development using RAD or RSA, because so far I have not been able to find any installation of IHS within the RAD or RSA directories.
Another consideration is that so far the discussion has been about static files, particularly "/images". But another consideration is "Server Side Includes" which can easily be activated in Apache http. I have not tried but presumably that should be an easy matter to turn on in IHS. But again, the problem is that in the local RAD or RSA (where you run a local instance of Websphere) there does not appear to be an installation of IHS where the support for Server Side includes could be added.
If anybody knows where the equivalent of IHS is installed in RAD or RSA, please enlighten us.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how do I define an images directory in the server root (not the context root)