Re: After upgrading from Struts 2.0.x to 2.2.x, static content no longer served...
I'm using a combination of empty extension and exclusions for static content which works well now. Got pretty confused too at beginnning when I changed to an empty extension though: http://struts.apache.org/2.2.1/docs/static-content.html in web.xml: filter filter-namestruts2/filter-name filter-class org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter /filter-class /filter filter-mapping filter-namestruts2/filter-name url-pattern/*/url-pattern !-- Filter exclusions defined in struts.xml -- /filter-mapping and in struts.xml: constant name=struts.action.extension value=/ constant name=struts.action.excludePattern value=/js/.*, /css/.*, /img/.*/ Eric Nielsen, 19-10-2010 05:21: Li Ying wrote: Are your setting: constant name=struts.action.extension value= / ? Yes, I was intentionally setting the extension to the empty string. This used to work under the SmartUrls plugin in 2.0.x days. I've dug though and found the comments in his source about how the author made that work. First switched to using action as the extension and all the filter mappings to *.action -- things worked again, but had urls of a form I don't prefer. Started to port the SmartURL changes into a custom subclass of FilterDispatcher -- and noticed that its deprecated and I should have used the StrutsExecuteFilter and StrutsPrepareFilter instead. Abandoned the port and switched to the correct filters and the empty extension. Static content worked again. Changed some jsps, restarted server -- static content stopped working, very confused. Switched to the , value you suggested in the followup email and that seems to have fixed the static content again, but something broke the taglibs. Started getting the According to TLD or attribute directive in tag file, attribute href does not accept any expressions error but I'm using the correct tag lib: %@ taglib uri=http://java.sun.com/jsp/jstl/core;prefix=c % %@ taglib uri=/struts-tags prefix=s % and this was working fine before. Dug deeper trying to see if I had missed other filter/servlet changes over the past couple of years, and yes I had. Tried following the directions on: http://struts.apache.org/2.x/docs/sitemesh-plugin.html but can't seem to figure out how to combine that with spring -- If I don't use the Struts Listener Freemarker won't start; if I don't use the Spring listener none of my beans get injected. Can't seem to use both. I'm currently Googling trying to find example/tutorials using Struts 2.2.x, Spring, Sitemesh, and Freemarker, but so far all are either pre 2.1.6 (the new style fitlers) or leave off either spring or sitemesh. If anyone can point out a good, modern tutorial/guide that deals with Struts 2.2, Spring, Sitemesh, Freemarker, (and Hibernate) that would be wonderful. I feel like I'm currently fixing one thing, while breaking another... Thanks. Try delete it, use the default setting instead. I take a quick look of the struts source code. In [org.apache.struts2.dispatcher.mapper.DefaultActionMapper], it use the extension of request url to detect if this request should be mapped to an Action. If you set this constant to , then DefaultActionMapper will map all the request to Action. You can read the source of method [getMapping]/[dropExtension]/[dropExtension] for more information. On Mon, Oct 18, 2010 at 4:25 PM, Eric Nielsenericdniel...@gmail.com wrote: I recently upgraded from Struts 2.0.x + SmartURLs to Struts 2.2.1 + Convention plugin. However after upgrading all my static content is no longer being served. I read all the release notes along the way that I could find and nothing suggests that my old approach should have stopped working. Can anyone point out what else I need to change/tweak to get static content behaving again? I'm guessing its related to my have a action extension? I'm using Maven as the build system. static content is at src/main/webapp/css /javascript /template /WEB-INF Here are my filters from web.xml filter filter-namestruts-cleanup/filter-name filter-classorg.apache.struts2.dispatcher.ActionContextCleanUp/filter-class /filter filter filter-namesitemesh/filter-name filter-classorg.apache.struts2.sitemesh.FreemarkerPageFilter/filter-class /filter filter filter-nameSpring OpenEntityManagerInViewFilter/filter-name filter-classorg.springframework.orm.jpa.support.OpenEntityManagerInViewFilter/filter-class /filter filter filter-namestruts/filter-name filter-classorg.apache.struts2.dispatcher.FilterDispatcher/filter-class /filter filter-mapping filter-namestruts-cleanup/filter-name url-pattern/*/url-pattern /filter-mapping filter-mapping filter-namesitemesh/filter-name url-pattern/*/url-pattern /filter-mapping filter-mapping
Re: After upgrading from Struts 2.0.x to 2.2.x, static content no longer served...
Are your setting: constant name=struts.action.extension value= / ? Try delete it, use the default setting instead. I take a quick look of the struts source code. In [org.apache.struts2.dispatcher.mapper.DefaultActionMapper], it use the extension of request url to detect if this request should be mapped to an Action. If you set this constant to , then DefaultActionMapper will map all the request to Action. You can read the source of method [getMapping]/[dropExtension]/[dropExtension] for more information. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: After upgrading from Struts 2.0.x to 2.2.x, static content no longer served...
By the way, if you DO want to set the extension of action to , try: constant name=struts.action.extension value=, / See if it works. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: After upgrading from Struts 2.0.x to 2.2.x, static content no longer served...
Li Ying wrote: Are your setting: constant name=struts.action.extension value= / ? Yes, I was intentionally setting the extension to the empty string. This used to work under the SmartUrls plugin in 2.0.x days. I've dug though and found the comments in his source about how the author made that work. First switched to using action as the extension and all the filter mappings to *.action -- things worked again, but had urls of a form I don't prefer. Started to port the SmartURL changes into a custom subclass of FilterDispatcher -- and noticed that its deprecated and I should have used the StrutsExecuteFilter and StrutsPrepareFilter instead. Abandoned the port and switched to the correct filters and the empty extension. Static content worked again. Changed some jsps, restarted server -- static content stopped working, very confused. Switched to the , value you suggested in the followup email and that seems to have fixed the static content again, but something broke the taglibs. Started getting the According to TLD or attribute directive in tag file, attribute href does not accept any expressions error but I'm using the correct tag lib: %@ taglib uri=http://java.sun.com/jsp/jstl/core;prefix=c % %@ taglib uri=/struts-tags prefix=s % and this was working fine before. Dug deeper trying to see if I had missed other filter/servlet changes over the past couple of years, and yes I had. Tried following the directions on: http://struts.apache.org/2.x/docs/sitemesh-plugin.html but can't seem to figure out how to combine that with spring -- If I don't use the Struts Listener Freemarker won't start; if I don't use the Spring listener none of my beans get injected. Can't seem to use both. I'm currently Googling trying to find example/tutorials using Struts 2.2.x, Spring, Sitemesh, and Freemarker, but so far all are either pre 2.1.6 (the new style fitlers) or leave off either spring or sitemesh. If anyone can point out a good, modern tutorial/guide that deals with Struts 2.2, Spring, Sitemesh, Freemarker, (and Hibernate) that would be wonderful. I feel like I'm currently fixing one thing, while breaking another... Thanks. Try delete it, use the default setting instead. I take a quick look of the struts source code. In [org.apache.struts2.dispatcher.mapper.DefaultActionMapper], it use the extension of request url to detect if this request should be mapped to an Action. If you set this constant to , then DefaultActionMapper will map all the request to Action. You can read the source of method [getMapping]/[dropExtension]/[dropExtension] for more information. On Mon, Oct 18, 2010 at 4:25 PM, Eric Nielsen ericdniel...@gmail.com wrote: I recently upgraded from Struts 2.0.x + SmartURLs to Struts 2.2.1 + Convention plugin. However after upgrading all my static content is no longer being served. I read all the release notes along the way that I could find and nothing suggests that my old approach should have stopped working. Can anyone point out what else I need to change/tweak to get static content behaving again? I'm guessing its related to my have a action extension? I'm using Maven as the build system. static content is at src/main/webapp/css /javascript /template /WEB-INF Here are my filters from web.xml filter filter-namestruts-cleanup/filter-name filter-classorg.apache.struts2.dispatcher.ActionContextCleanUp/filter-class /filter filter filter-namesitemesh/filter-name filter-classorg.apache.struts2.sitemesh.FreemarkerPageFilter/filter-class /filter filter filter-nameSpring OpenEntityManagerInViewFilter/filter-name filter-classorg.springframework.orm.jpa.support.OpenEntityManagerInViewFilter/filter-class /filter filter filter-namestruts/filter-name filter-classorg.apache.struts2.dispatcher.FilterDispatcher/filter-class /filter filter-mapping filter-namestruts-cleanup/filter-name url-pattern/*/url-pattern /filter-mapping filter-mapping filter-namesitemesh/filter-name url-pattern/*/url-pattern /filter-mapping filter-mapping filter-nameSpring OpenEntityManagerInViewFilter/filter-name url-pattern/*/url-pattern /filter-mapping filter-mapping filter-namestruts/filter-name url-pattern/*/url-pattern /filter-mapping Here's the root node and contents of the struts.xml: struts constant name=struts.objectFactory value=spring / constant name=struts.devMode value=true / constant name=struts.action.extension value= / constant name=struts.convention.default.parent.package value=cib-default / package name=cib-default extends=struts-default interceptors interceptor name=reattachment class=com.ballroomregistrar.compinabox.online.web.interceptors.WebSessionReattachmentInterceptor / interceptor
Re: After upgrading from Struts 2.0.x to 2.2.x, static content no longer served...
2010/10/18 Eric Nielsen ericdniel...@gmail.com: Here are my filters from web.xml filter filter-namestruts-cleanup/filter-name filter-classorg.apache.struts2.dispatcher.ActionContextCleanUp/filter-class /filter filter filter-namesitemesh/filter-name filter-classorg.apache.struts2.sitemesh.FreemarkerPageFilter/filter-class /filter filter filter-nameSpring OpenEntityManagerInViewFilter/filter-name filter-classorg.springframework.orm.jpa.support.OpenEntityManagerInViewFilter/filter-class /filter filter filter-namestruts/filter-name filter-classorg.apache.struts2.dispatcher.FilterDispatcher/filter-class /filter Try to use the new filter: http://struts.apache.org/2.2.1/struts2-core/apidocs/org/apache/struts2/dispatcher/ng/package-summary.html Regards -- Łukasz + 48 606 323 122 http://www.lenart.org.pl/ Kapituła Javarsovia 2010 http://javarsovia.pl - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org