This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Static Content in WAR

 
Michael Morris
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic