Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
11-23-2005, 05:58 AM
|
#1
|
LQ Newbie
Registered: Nov 2005
Posts: 4
Rep:
|
Image Path reference in Linux (Absolute path)
Hi
I am a JSP/Servlet developer.
I am new to Linux server environment.
I am experiencing a problem with Image Path reference in Linux server.
My application (myapp.war) is running in Linux in the following path:
/opt/jboss-3.2.6/server/default/deploy/myapp.war
The myapp.war is having the html,xml,jsp and servlet files.
I stored the images in a different location. The reason is, the images can be frequently changed.
/var/myapp_images/ABC/image1.gif
I want to refer the above image in the <IMG> tag of the html file.
If I give the <IMG> tag like below, the jboss servlet context is taking effect, i.e., the
/opt/jboss-3.2.6/server/default/deploy folder.
<IMG src = "/var/myapp_images/ABC/image1.gif">
The image is not loaded from the particular location. It shows an empty area with red color x mark.
But, the browser shows the address of the image as url/var/myapp_images/ABC/image1.gif.
(The url has the IP address and 8080 port number.)
Image Type : Not available.
Image Size : Not available.
How can I refer the image which is in a different location?
My Operating System is : Windows 2000.
JBOSS3.2.6 is running in : Linux server.
I am testing the myapp application in my Windows 2000.
I have given the absolute path reference for image. But it is not taking effect.
Anything needs to be configured / altered?
Please help me to fix this issue.
Thanks,
JavaBuddy.
|
|
|
11-23-2005, 07:43 AM
|
#2
|
Member
Registered: Oct 2001
Location: Brockport, NY
Distribution: Kubuntu
Posts: 384
Rep:
|
I have no clue on JSP, so forgive me if this is way off.
You said that you're referencing the image in an HTML file. Unless your app is doing some kind of processing on the HTML file to adjust the path before serving it, giving the real local path won't work. A client browser will always interpret a path like that as relative to the web root of the server.
In order for clients to find the image, you need to put it under your DocumentRoot (as set in your Apache configuration) and use a path relative to that. So if your document root is /var/mysite, you might put the image in /var/mysite/images/image1.gif and give the URL as /images/image1.gif.
|
|
|
11-23-2005, 09:33 PM
|
#3
|
LQ Newbie
Registered: Nov 2005
Posts: 4
Original Poster
Rep:
|
AdaHacker, thanks for your reply.
Its good to store the images inside the Document Root.
But the images are not permanent. They are temporary only. They can be changed daily. So, images should not be stored inside the Document root.
If it is inside the Document Root, then the JBOSS server needs to be stopped and started daily to finish the build process.
Is there any options to create a link file which maps to the /var/myapp_images directory from /opt/jboss-3.2.6/server/default/deploy/.?
Thanks,
JavaBuddy.
|
|
|
11-24-2005, 08:11 AM
|
#4
|
Member
Registered: Oct 2001
Location: Brockport, NY
Distribution: Kubuntu
Posts: 384
Rep:
|
Quote:
Originally posted by javabuddy
Is there any options to create a link file which maps to the /var/myapp_images directory from /opt/jboss-3.2.6/server/default/deploy/.?
|
Yeah, you could try making a symlink under your document root instead of putting the actual files there. That should work. Of course, you would need make sure following symlinks is enabled in your Apache configuration.
|
|
|
11-28-2005, 04:27 AM
|
#5
|
LQ Newbie
Registered: Nov 2005
Posts: 4
Original Poster
Rep:
|
Thanks AdaHacker.
I added the "/var/myapp_images" directory to the "jboss-service.xml" file in "opt/jboss-3.2.6/server/default/conf/" directory.
<attribute name="URLs">
deploy, file://var/myapp_images"
</attribute>
Thanks for your idea to look on to the configuration settings.
Now the problem is fixed.
JavaBuddy.
|
|
|
06-02-2006, 11:20 AM
|
#6
|
LQ Newbie
Registered: Jun 2006
Posts: 2
Rep:
|
I have the same problem but I could not make it work. Could anybody give me some idea? Here is my settings:
jboss-service.xml:
<attribute name="URLs">
deploy/,file://tmp/images
</attribue>
test.jsp:
<img src="/tmp/images/image1.gif" alt="" width="50" height="20">
I got
"The requested resource (/tmp/images/image1.gif) is not available."
from jboss.
Thanks
|
|
|
06-04-2006, 10:23 PM
|
#7
|
LQ Newbie
Registered: Nov 2005
Posts: 4
Original Poster
Rep:
|
Hi,
You should have a folder or directory named with .war extension under the /tmp/images/ (like, /tmp/images/abc.war), else the JBOSS server wont refer the image file. All your images should be copied inside the abc.war file. Adjust your image reference in JSP or HTML to get them from the /tmp/images/abc.war.
Refer "Hot Deployment in JBOSS" for more details.
http://www.jboss.com/index.html?modu...wtopic&t=73022
Thanks,
JavaBuddy.
|
|
|
06-05-2006, 07:45 AM
|
#8
|
LQ Newbie
Registered: Jun 2006
Posts: 2
Rep:
|
Thank you very much! I tried and it works!
|
|
|
All times are GMT -5. The time now is 04:25 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|