There are several possibilites.
a) You could place the downloadable file in the ROOT.war directory (if you told me which version of JBoss AS I could give you the exact location, but a find within the service configuration directory should locate it)
b) You could deploly your EAR, and it's embedded WAR, as exploded directories. Then you could place the file in your WAR directory.
c) You can setup up an external directory
If I deploy the file there I still get;
The requested resource (/MyFile.xxx) is not available.
What URL are you using?
If you placed a file named downloadthis.pdf into the ROOT.war directory, then from a browser you would be able to access it using the URL you gave in your original post.
Looks like a letter casing mismatch (test.pdf vs Test.pdf). What is the real name of the file (test.pdf or Test.pdf), and what is the actual URL you used? And are you running on Linux - if you are then casing matters.
Also, just to double-check, your host's name is "www.mydomain.com" and you configured JBoss AS to listen to port 80. right?
Or are you running Apache HTTP at port 80 and having it filter and forward the requests?
Here is the full path of my PDF file: /opt/jbia/jboss-4.2.3.GA/server/admin/deploy/jboss-web.deployer/ROOT.war/test.pdf
I can access it just fine using: http://localhost:8080/test.pdf
On Linux, using http://localhost:8080/Test.pdf yields a "resourse not available" error.
www.mydomain.com has the beta version of my website and is in use on port 80. I have also put the PDF file on the localhost
The PDF file is lowercase test.pdf. I am using the correct URL for both tests;
And in both cases I get;
The requested resource (/test.pdf) is not available.
I didn't mention that my web app is deployed under JBoss Seam;
Serving Static External Files in recent 4.x versions of jboss
This works for Jboss 4.2.x and probably other versions as well.
Step 1 (optional): Copy a default web.xml from <JBOSS_HOME>/server/<config-name>/deploy/http-invoker.sar/invoker.war/WEB-INF and place it in your external directory, for example: /home/pgib/images/WEB-INF
Step 2: Edit <JBOSS_HOME>/server/<config-name>/deploy/jboss-web.deployer/server.xml and add a Context element under Host.(Step similar to standalone TC)
<Host name="localhost" ...> <!-- ADD static images DIRECTORY --> <Context path="/images" docBase="/home/pgib/images" reloadable="true"> </Context> <!-- The rest of your Host entity --> </Host>
This didn't work either!
Is Seam the cause?
Thanks for all you help.
Seam is not the fault because Seam is not used by the ROOT app.
How are you starting the app server? Are you using the -b option and is so what value are you specifying? See if this helps:
On the server the only way I could get the the application to run when the URL www.mydomain.com was entered was by starting JBoss with the command;
run.bat -b 0.0.0.0
On development machine (localhost) I start JBoss with the standard;
(NO -b parameters)
As it doesn't work with either I not sure what to do!
Well, there is something about your environment or configuration that is causing this, but at this point I have run out of ideas of what it could be. I have asked every question I can think of.
You say you cannot even access the file on your local development machine. I gave you the full path for my PDF file, and also the URL I used to successfully access it. Could you supply the same information for your development machine?
The test.pdf is located in;
Thanks for all your help.
I need this facilty for users to download a BlackBerry application from the website. It's a bit of a show stopper.
Based on the PDF file's location, and the way you start the app server, entering http://localhost:8080/test.pdf into the browser's address bar and hitting enter should cause the PDF to be downloaded (or opened, depending on the browser you are using and the browser's configuration). Heck, I even just now checked with Explorer and Chrome, my earlier attempt was with Firefox. All three worked.
For now, let's try to get this working on just your development machine; once that is working we will go back to www.mydomain.com.
Have you made any changes to any of the files that came with 4.2.3?
Could you try using a clean installation of 4.2.3 in another location (say at c:\temp\jboss-4.2.3.GA)? Deploy only the test.pdf file - do not deploy your app.
Also, what happens when you enter just http://localhost:8080?
The home (seam) page of my app loads and displays. Maybe this is the cause?
A number of changes to deploy my EJBs, SEAM configuration ejb-jar.xml, jboss.xml, web.xml.
***** UPDATE *****
Deployed the PDF to a clean installation of JBoss 5.1 and I can open the PDF with;
I now suspect it is the configuration to open the home page when I type http://localhost:8080