Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » ServerTools (WTP) » How to place web files outside the application context?
How to place web files outside the application context? [message #213248] Mon, 05 May 2008 08:15 Go to next message
Eclipse UserFriend
Originally posted by: bill.davidson.gmail.com

I'm using eclipse-jee-ganymede-M6 and I can't seem to figure out
how to put files outside of the application context. In particular,
I would like to put some of my more generic CSS and Javascript files
in top level /css/ and /js/ directories (relative to the server root)
rather than in /MyAppName/css/ or /MyAppName/js/ so that I could use
them with other apps without having multiple copies on my server.

I'm fine with putting them in another project if I need to but I need
them to still be served up by the same local instance of Tomcat 6 that's
serving up MyAppName. This instance is apparently configured by
Eclipse and puts the files in some funky location deep in the bowels
of the workspace .metadata/.plugins directory. I need the css/js files
in this instance because I want to use them in my JSP's. I've tried
creating other web projects, both static and dynamic but I can't seem to
get it right. It always wants to put the files under the project name/
application context relative to the server root. I suppose I could
create a project called "css" and another called "js" but that just
feels wrong.
Re: How to place web files outside the application context? [message #213280 is a reply to message #213248] Mon, 05 May 2008 19:26 Go to previous messageGo to next message
Larry Isaacs is currently offline Larry IsaacsFriend
Messages: 1354
Registered: July 2009
Senior Member
Bill Davidson wrote:
> I'm using eclipse-jee-ganymede-M6 and I can't seem to figure out
> how to put files outside of the application context. In particular,
> I would like to put some of my more generic CSS and Javascript files
> in top level /css/ and /js/ directories (relative to the server root)
> rather than in /MyAppName/css/ or /MyAppName/js/ so that I could use
> them with other apps without having multiple copies on my server.
>
> I'm fine with putting them in another project if I need to but I need
> them to still be served up by the same local instance of Tomcat 6 that's
> serving up MyAppName. This instance is apparently configured by
> Eclipse and puts the files in some funky location deep in the bowels
> of the workspace .metadata/.plugins directory. I need the css/js files
> in this instance because I want to use them in my JSP's. I've tried
> creating other web projects, both static and dynamic but I can't seem to
> get it right. It always wants to put the files under the project name/
> application context relative to the server root. I suppose I could
> create a project called "css" and another called "js" but that just
> feels wrong.

For info about why ".metadata/.plugins/...", see
http://wiki.eclipse.org/WTP_Tomcat_FAQ.

As for sharing files "outside of the application context", I believe
servlet containers and app servers are designed not to do this for
security reasons. Thus, all the resources for a Dynamic Web Project
that get published to the server will go somewhere under the base
directory for that webapp.

However, I can say that the Tomcat server support in WTP does support a
Dynamic Web Project being published as the default context, i.e. the one
with a blank context name. This means the "css" and "js" folders of
such a project would have URLs like "http://localhost:8080/css/..." or
"http://localhost:8080/js/...". To achieve this, specify a blank
Context Root when you create the Dynamic Web Project. If the project
already exists, open its Properties dialog and set the Context Root to
blank on the "Web Project Settings" page. When you add this project to
a Tomcat server, it will override the ROOT context that WTP provides
internally as the default context.

Cheers,
Larry
Re: How to place web files outside the application context? [message #213417 is a reply to message #213248] Wed, 07 May 2008 22:43 Go to previous message
Eclipse UserFriend
Originally posted by: davisons.qwest.com

Bill,
I actually did exactly the last thing you mentioned. Another option is to
run a separate HTTP server to serve up the static content. The environment
I'm developing for has a web server that serves up the static content,
employs a module to handle ColdFusion templates, and redirects to a BEA WLS
to handle other dynamic web apps. I simulate that environment on my
localhost by deploying to my local WLS separate dynamic web apps containing
the static content. (Iin my case the browser needs to load static content
from /shared, /images, and /styles). Now I'm also running CF-8 as a web app
under WLS. It works great and I can easily migrate applications from my
localhost to QA and production servers without changing any of the code.

Regards,
Stephen Davison

"Bill Davidson" <bill.davidson@gmail.com> wrote in message
news:fvmfmo$f6v$1@build.eclipse.org...
> I'm using eclipse-jee-ganymede-M6 and I can't seem to figure out
> how to put files outside of the application context. In particular,
> I would like to put some of my more generic CSS and Javascript files
> in top level /css/ and /js/ directories (relative to the server root)
> rather than in /MyAppName/css/ or /MyAppName/js/ so that I could use
> them with other apps without having multiple copies on my server.
>
> I'm fine with putting them in another project if I need to but I need
> them to still be served up by the same local instance of Tomcat 6 that's
> serving up MyAppName. This instance is apparently configured by
> Eclipse and puts the files in some funky location deep in the bowels
> of the workspace .metadata/.plugins directory. I need the css/js files
> in this instance because I want to use them in my JSP's. I've tried
> creating other web projects, both static and dynamic but I can't seem to
> get it right. It always wants to put the files under the project name/
> application context relative to the server root. I suppose I could
> create a project called "css" and another called "js" but that just
> feels wrong.
Previous Topic:log4j, Tomcat and WTP Server configuration?
Next Topic:Significance? org.eclipse.wtp
Goto Forum:
  


Current Time: Fri Mar 29 10:51:11 GMT 2024

Powered by FUDForum. Page generated in 0.02763 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top