Glassfish 3 - Loading images from a static server

后端 未结 1 690
独厮守ぢ
独厮守ぢ 2021-01-07 02:29

I\'m trying to load images (and other static content) from a server outside of my web application which is deployed to Glassfish v3. I have the following co

相关标签:
1条回答
  • 2021-01-07 02:44

    I have solved it based on an old thread relating to Glassfish version 2 that I found on Google after two days of search.

    In case anyone is interested in the solution, here it is:

    1) Create a file called sun-web.xml directly under Webcontent\WEB-INF directory and add the following configuration to this file:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE sun-web-app PUBLIC "-//Sun Microsystems, Inc.//DTD GlassFish Application Server 3.0 Servlet 3.0//EN" "http://www.sun.com/software/appserver/dtds/sun-web-app_3_0-0.dtd">
    <sun-web-app>
       <property name="alternatedocroot_1" value="from=/images/* dir=d:/internet/website" />
       <property name="alternatedocroot_2" value="from=/files/* dir=d:/internet/website" />
    </sun-web-app>
    

    2) Remove the servlet and servlet-mapping configurations from web.xml file (like I did above). Note: The above would work if you were to use Tomcat.

    3) Delete the website-files.xml from glassfish\domains\domain1\config directory as this file is not needed by Glassfish: Note: This file is needed by Tomcat.

    0 讨论(0)
提交回复
热议问题