Place CSS and Javascript outside EAR
-
23-06-2021 - |
Question
I have a web application deployed in IBM websphere. Each time I change my css or javascript file I have to redeploy EAR file. Is it possible to place these css/javascript files outside EAR/WAR file so that I can avoid redeploying EAR file.
La solution
For that pattern, I recommend placing those static files in a different location on your web server (or proxy server if you have one), then referencing them from your pages with a path Alias. For instance in Apache/IHS:
Alias /css /usr/IBM/HTTPServer/htdocs/css
And then in your HTML/JSP:
<link rel="stylesheet" href="/css/styles.css" type="text/css" media="screen">
Autres conseils
You can make an Utility Application as Dynamic Web Project and place all the css,images and script files inside it. you can create a seperate WAR outside EAR. your files inside EAR can refer to this WAR file for the resources, but you have to take care of the context-path. Here you can avoid of complete building of EAR file but you need to build WAR file. Accessing the css/js/images outside WAR and EAR doesnt sound a correct way of implementation.
With JRebel you can map the resources that reside in an arbitrary location. So once you make any changes to the resources, these will be visible in the app instantly.
deploy your ear as an "Exploded Archive Directories"
see http://docs.oracle.com/cd/E15051_01/wls/docs103/deployment/deployunits.html
then you can just copy the static files and move on
websphere seems to support it to, at least for the war part http://publib.boulder.ibm.com/infocenter/discover/v8r4/index.jsp?topic=/com.ibm.websphere.ii.product.ce.doc/configuring/iiyviigdepwebexpl.htm