You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by Marco Tedone <mt...@jemos.co.uk> on 2004/10/10 14:15:19 UTC

Servlet mappings VS servelt mapping

Hi, I'm going through the 1.2.4 code. In the ActionServlet class, there is a 
FIXME for the 'servletMapping' instance variable, to allow multiple 
mappings. I did a bit of investigation, and this change would have a major 
impact on the framework. In particular:

1) The Global.SERVLET_KEY value should become a collection (or an array) of 
servlet mappings (i.e. *.do, *.struts, /action/* and so on).

2) The change to the Global.SERVLET_KEY would affect the 
org.apache.struts.config.ConfigHelper class and the 
org.apache.struts.taglib.TagUtils class. While the first one could be just a 
matter of adding a method that instead of returning a String for the 
Global.SERVLET_KEY would return the collection (or array) of servlet 
mapping, the major impact would be on the TagUtils class. This class infact, 
defines the getActionMappingURL method, which, in turn, is invoked by the 
following classes:

    share\org\apache\struts\config\ConfigHelper.java(407): public String 
getActionMappingURL(String action) {
share\org\apache\struts\config\ConfigHelper.java(567): return 
getEncodeURL(getActionMappingURL(path));
share\org\apache\struts\config\ConfigHelperInterface.java(192): public 
String getActionMappingURL(String action);
share\org\apache\struts\taglib\TagUtils.java(463): 
url.append(instance.getActionMappingURL(action, module, pageContext, 
false));
share\org\apache\struts\taglib\TagUtils.java(744): public String 
getActionMappingURL(String action, PageContext pageContext) {
share\org\apache\struts\taglib\TagUtils.java(745): return 
getActionMappingURL(action,null,pageContext,false);
share\org\apache\struts\taglib\TagUtils.java(752): public String 
getActionMappingURL(String action, String module, PageContext pageContext, 
boolean contextRelative) {
share\org\apache\struts\taglib\TagUtils.java(811): public String[] 
getActionMappingURLs(String action, String module, PageContext pageContext, 
boolean contextRelative) {
share\org\apache\struts\taglib\html\FormTag.java(519): 
TagUtils.getInstance().getActionMappingURL(
share\org\apache\struts\taglib\html\ImgTag.java(621): return 
TagUtils.getInstance().getActionMappingURL(action, module, pageContext, 
isContextRelativeSet());
share\org\apache\struts\util\RequestUtils.java(1355): * Use {@link 
org.apache.struts.taglib.TagUtils#getActionMappingURL(String,PageContext)} 
instead.
share\org\apache\struts\util\RequestUtils.java(1357): public static String 
getActionMappingURL(
share\org\apache\struts\util\RequestUtils.java(1362): return 
TagUtils.getInstance().getActionMappingURL(action, pageContext);


If you want the Global.SERVLET_KEY storing multiple mappings (I've thought 
of a collection because is Digester which fills it, and the number of 
elements is unknown at runtime, depending on the web.xml file), than a 
serious thought about how TagUtils, FormTag, ImgTag and RequestUtils work is 
needed.





---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


Re: Servlet mappings VS servelt mapping

Posted by Joe Germuska <Jo...@Germuska.com>.
>If you want the Global.SERVLET_KEY storing multiple mappings (I've 
>thought of a collection because is Digester which fills it, and the 
>number of elements is unknown at runtime, depending on the web.xml 
>file), than a serious thought about how TagUtils, FormTag, ImgTag 
>and RequestUtils work is needed.

In short, I think the answer is just "yes."

I haven't heard a lot of demand for multiple servlet mappings.  I'm 
not sure if people have just learned to deal with this limitation of 
Struts, or whether it's not something people really need.  I don't 
have much need for it myself.

If this is something that you'd really like to see a future version 
of Struts do, then perhaps you can start on some of that serious 
thought, and on getting other Struts users and developers also 
thinking about it.  Perhaps it can be done in a way which maintains 
backwards compatibility, or perhaps it will turn out to be one of the 
motivators towards a Struts 2.0 version which is less tightly bound 
to complete compatibility with the current code base.

Joe

-- 
Joe Germuska            
Joe@Germuska.com  
http://blog.germuska.com    
"In fact, when I die, if I don't hear 'A Love Supreme,' I'll turn 
back; I'll know I'm in the wrong place."
    - Carlos Santana

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org