LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
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


Reply
  Search this Thread
Old 11-23-2005, 05:58 AM   #1
javabuddy
LQ Newbie
 
Registered: Nov 2005
Posts: 4

Rep: Reputation: 0
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.
 
Old 11-23-2005, 07:43 AM   #2
AdaHacker
Member
 
Registered: Oct 2001
Location: Brockport, NY
Distribution: Kubuntu
Posts: 384

Rep: Reputation: 32
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.
 
Old 11-23-2005, 09:33 PM   #3
javabuddy
LQ Newbie
 
Registered: Nov 2005
Posts: 4

Original Poster
Rep: Reputation: 0
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.
 
Old 11-24-2005, 08:11 AM   #4
AdaHacker
Member
 
Registered: Oct 2001
Location: Brockport, NY
Distribution: Kubuntu
Posts: 384

Rep: Reputation: 32
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.
 
Old 11-28-2005, 04:27 AM   #5
javabuddy
LQ Newbie
 
Registered: Nov 2005
Posts: 4

Original Poster
Rep: Reputation: 0
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.
 
Old 06-02-2006, 11:20 AM   #6
mocha_java
LQ Newbie
 
Registered: Jun 2006
Posts: 2

Rep: Reputation: 0
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
 
Old 06-04-2006, 10:23 PM   #7
javabuddy
LQ Newbie
 
Registered: Nov 2005
Posts: 4

Original Poster
Rep: Reputation: 0
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.
 
Old 06-05-2006, 07:45 AM   #8
mocha_java
LQ Newbie
 
Registered: Jun 2006
Posts: 2

Rep: Reputation: 0
Thank you very much! I tried and it works!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Get the absolute path of file using file descriptor. appas Programming 7 01-19-2012 11:47 AM
Absolute path qspares Linux - Software 6 10-02-2007 03:11 AM
HTML + href absolute path does not work blizunt7 Programming 3 11-21-2005 04:59 PM
how to get absolute path of current executing C/C++ prog? Thinking Programming 2 10-10-2005 10:27 AM
absolute path to qmail in sme 5.6? dopper Linux - Software 0 10-28-2003 01:48 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 07:10 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration