Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
404 views
in Technique[技术] by (71.8m points)

java ee 7 - Alternate docroot not working on glassfish 4

Im trying to set-up an alternate docroot in order to serve uploaded documents from. I have included the following in my glassfish web xml

<context-root>/dom</context-root>
  <property description="Uploaded Images" name="alternatedocroot_1" value="from=/uploads/* dir=C:/Test" /> 

I have then stored a test pdf in the Test folder called cars.pdf.

To access it i am typing the following into my browser

http://localhost:8080/uploads/cars.pdf

This however simply gives me a 404 error, ive tried googling and searching about here but nothing seems to work. Can some tell me what im doing wrong?

Thanks Steve

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You should use

<property description="Uploaded Images" name="alternatedocroot_1" value="from=/uploads/* dir=C:Test" />

and then drop your images into C:Testuploads

or, for example, use

<property description="Uploaded Images" name="alternatedocroot_1" value="from=/uploads/* dir=C:" />

and then drop your images into C:uploads


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

56.9k users

...