Tomcat + Applets, please help

S

Stu

Hi,

I have an applet that needs to access some jar files that are stored
in the WEB-INF directory of tomcat. Does anybody know if there is
anyway to do this without duplicating them and placing them in the
same directory as the applet?

Thanks in advance.

Stu.
 
W

Wendy S

Stu said:
I have an applet that needs to access some jar files that are stored
in the WEB-INF directory of tomcat. Does anybody know if there is
anyway to do this without duplicating them and placing them in the
same directory as the applet?

A Servlet Container is not allowed to serve up content under WEB-INF
directly. I don't know what an Applet's request for a .jar file looks like
(it it a normal-looking HTTP request?) but I suppose it would be possible to
write a Servlet to read the .jar file from WEB-INF/lib and stream it back to
the Applet.

However... consider your design. Can you move the processing that needs
these .jar files to the server, and just have the Applet retrieve the
results?
 
N

Nigel Wade

Stu said:
Hi,

I have an applet that needs to access some jar files that are stored
in the WEB-INF directory of tomcat. Does anybody know if there is
anyway to do this without duplicating them and placing them in the
same directory as the applet?

Thanks in advance.

Stu.

Create a root context that allows links (this works in Linux/UNIX, no idea
about Windows), in this case it's %CATALINA_HOME%/webapps/ROOT.

<Context path="" docBase="ROOT" debug="0" >
<Resources className="org.apache.naming.resources.FileDirContext"
allowLinking="true" />
</Context>

In %CATALINA_HOME%/webapps/ROOT create a directory (I call mine java) with
lib and classes as soft links to whatever directory you store the jar/class
files. The URL needed in the applet is then
codebase=http://server:port/java/lib archive=yourfile.jar.

Just be careful to make sure you don't allow access to something you don't
want to allow out.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,679
Members
48,796
Latest member
Greg L.

Latest Threads

Top