You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by "rathinasamy.r.s@snovabits.net" <ra...@snovabits.net> on 2013/05/16 13:55:42 UTC
How to use Spring MVC resources static images in tapestry
Hi All,
I am developing an application using Tapestry 5.3.1
I have tried to use MVC resources mapping to cache images, But it seems
doesn't works
Here my coding:
_Context xml configuration:_
mvc:resources mapping="/images/**"
location="file:${catalina.home}/props/" cache-period="1234" />
<mvc:annotation-driven />
_Index.tml:_
<img src="/images/home.jpg" width="130" />
I have this home.jpg file in tomcat catalina home path props folder.
Application runs successfully, but the images are not loaded
Can anyone help me?
Regards,
Rathinasamy.
Re: How to use Spring MVC resources static images in tapestry
Posted by "rathinasamy.r.s@snovabits.net" <ra...@snovabits.net>.
_ApplicationContext.xml:_
<mvc:resources mapping="/images/**"
location="file:${catalina.home}/props/" cache-period="1234" />
<mvc:annotation-driven />
_VideosModule.java:_
public static void contributeIgnoredPathsFilter(Configuration<String>
configuration) {
configuration.add("/images/.*");
}
_Index.tml:_
<img src="${contextPath}/images/home.jpg" width="130" />
_Index.java:_
@Inject
private HttpServletRequest servletRequest;
public String getContextPath() {
return servletRequest.getContextPath();
}
When I run the application it runs successfully, however images not loaded
*_Using inspect element get the tag:_*
<imgwidth="130"src="/Videos/images/home.jpg"> ---> It shows *Failed to
load the given URL*
Any idea?
On 5/17/2013 12:04 PM, Lance Java wrote:
> Does your webapp have a context path? You may need to use
>
> <img src="/contextPath/images/..."
>
> You can use request.getContextPath() to make it dynamic
>
Re: How to use Spring MVC resources static images in tapestry
Posted by Lance Java <la...@googlemail.com>.
Of course you need to map spring's servlet / filter (whatever it is) to a
url pattern in web.xml. Unfortunately the current generation of servlet
containers are not mind readers :)
This question is now off topic, please continue on an appropriate spring
mailing list.
Re: How to use Spring MVC resources static images in tapestry
Posted by "rathinasamy.r.s@snovabits.net" <ra...@snovabits.net>.
Do I need to add any spring specifications in web.xml for this?
On 5/17/2013 12:04 PM, Lance Java wrote:
> Does your webapp have a context path? You may need to use
>
> <img src="/contextPath/images/..."
>
> You can use request.getContextPath() to make it dynamic
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: How to use Spring MVC resources static images in tapestry
Posted by Lance Java <la...@googlemail.com>.
Does your webapp have a context path? You may need to use
<img src="/contextPath/images/..."
You can use request.getContextPath() to make it dynamic
Re: How to use Spring MVC resources static images in tapestry
Posted by "rathinasamy.r.s@snovabits.net" <ra...@snovabits.net>.
I have added the "/images" path to this contributeIgnoredPathsFilter,
however it does not works.
On 5/16/2013 8:24 PM, Lance Java wrote:
> You will need to tell tapestry to ignore the "/images" path so that another
> servlet (spring) can handle it.
>
> http://tapestry.apache.org/configuration.html#Configuration-ConfiguringIgnoredPaths
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: How to use Spring MVC resources static images in tapestry
Posted by Lance Java <la...@googlemail.com>.
You will need to tell tapestry to ignore the "/images" path so that another
servlet (spring) can handle it.
http://tapestry.apache.org/configuration.html#Configuration-ConfiguringIgnoredPaths