Chrome-only Issue: Serving images using a servlet. One image loads, one image doesn't -
edit:
i have page contains following html code:
<img src="/static/ads/1111.png"> <!-- 1 --> <img src="/static/2222.png"> <!-- 2 -->
when load page, image no. 1 cannot displayed. image no. 2 displayed.
checking image request in chrome devtools's network tab, request "pending".
what's weirder, when directly access image no. 1 in http://localhost:8080/static/ads/1111.png
, image loads.
this issue seems affect google chrome. tested in firefox , works there.
for chrome console error:
port error: not establish connection. receiving end not exist.
when compare request headers of image no. 1
cache-control:no-cache pragma:no-cache referer:http://localhost:8181/index.html user-agent:mozilla/5.0 (macintosh; intel mac os x 10_8_3) applewebkit/537.31 (khtml, gecko) chrome/26.0.1410.43 safari/537.31
vs image no. 2
accept:*/* accept-charset:iso-8859-1,utf-8;q=0.7,*;q=0.3 accept-encoding:gzip,deflate,sdch accept-language:en-us,en;q=0.8 cache-control:no-cache connection:keep-alive host:localhost:8181 pragma:no-cache referer:http://localhost:8181/index.html user-agent:mozilla/5.0 (macintosh; intel mac os x 10_8_3) applewebkit/537.31 (khtml, gecko) chrome/26.0.1410.43 safari/537.31
there big difference. know what's going on?
more information
i'm using balusc's fileservlet serve files found outside web-app directory.
my web app uses struts2 framework.
my web.xml:
<filter> <filter-name>struts2</filter-name> <filter-class>org.apache.struts2.dispatcher.ng.filter.strutsprepareandexecutefilter</filter-class> </filter> <filter-mapping> <filter-name>struts2</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <servlet> <servlet-name>fileservlet</servlet-name> <servlet-class>com.fileservlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>fileservlet</servlet-name> <url-pattern>/static/*</url-pattern> </servlet-mapping>
i have excluded path in struts.xml so:
<constant name="struts.action.excludepattern" value="/static/.*"/>
from jb nizet:
are sure you're not using ad-blocking plugin filter out images fom ** /ads/ **?
Comments
Post a Comment