File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB and other Java EE Technologies and the fly likes Static Content in WAR Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Static Content in WAR" Watch "Static Content in WAR" New topic
Author

Static Content in WAR

Michael Morris
Ranch Hand

Joined: Jan 30, 2002
Posts: 3451
I ran across a situation at work the other day that really has me baffled. I needed to provide a short-term solution to a cross-scripting security issue. In a nutshell I have to use some JavaScript that was created by another team to request a that a work window that my application runs in be closed. I simply dropped their JS file in my root context and sourced it in a JSP (also in the root context). It worked fine on my development box, but when the EAR was deployed on WebSphere the JS file could not be resolved (got a 404). The explanation that was given to me was that we run static content from an Apache server and dynamic from WebSphere.

My question is, does the J2EE or Servlet Spec address this issue? Is it not reasonable to assume that if the WAR works on one J2EE Server (assuming all proprietary configuration is performed) that it should work on all J2EE Servers? The EAR does work on Sun's Reference Implementation that comes with the J2EE SDK.


Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336


assuming all proprietary configuration is performed

Your problem is a configuration issue not a spec. issue isn't it? A spec. compliant War by will run in any web container. OK there's always some confuguration to do but you anticipate that. The configuration you need here is to change Apache Http Server config stuff to direct the request for a static resource through to the Web Container, rather than trying to serve it itself, since its in the War rather than in a directory somewhere avaliable to the web server. Or alternatively remove the web server from the process.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
 
 
subject: Static Content in WAR