users@glassfish.java.net

Re: Referring external resource

From: <forums_at_java.net>
Date: Fri, 18 Mar 2011 07:02:59 -0500 (CDT)

Finally, i got after a long try.

Here is how i did.

1> created sun-web.xml and place in the same WEB-INF folder where web.xml
also present.


sun-web.xml conent below

 

 

 <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sun-web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Application
Server 9.0 Servlet 2.5//EN"
"http://www.sun.com/software/appserver/dtds/sun-web-app_2_5-0.dtd [1]">
  <sun-web-app>
   
    <!--  property name="alternatedocroot_1" value="from=/faces/*
dir=D:/images/thumbs" / -->
    <property name="alternatedocroot_1" value="from=/facebook/*
dir=/opt/PBMG/stage/SONYBMGBUZZ/" />
  </sun-web-app>
2> access the url :     http://localhost:8080/facebook/thumbs/image.jpg
[2]                                                                                                                                                                     
      it will actually  display you the image from the below unix
filesystem.    
 /opt/PBMG/stage/SONYBMGBUZZ/facebook/thumbs/image.jpg  

3>  Note :   My web application web context root is   /     , i
access my webapplication as   http://localhost:8080/ [3]

      when in the url : 
 http://localhost:8080/facebook/thumbs/image.jpg [4]  ,  when  
facebook  in url is found,  facebook will be appended to 
/opt/PBMG/stage/SONYBMGBUZZ/ .   so final will look like  
/opt/PBMG/stage/SONYBMGBUZZ/facebook/thumbs/image.jpg.  THis will refer the
image resource.


[1] http://www.sun.com/software/appserver/dtds/sun-web-app_2_5-0.dtd
[2] http://localhost:8080/facebook/thumbs/image.jpg
[3] http://localhost:8080/
[4] http://localhost:8080/facebook/thumbs/image.jpg

--
[Message sent by forum member 'krupakar_blr']
View Post: http://forums.java.net/node/782017