You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by "Justin Patterson (JIRA)" <ve...@apache.org> on 2006/03/03 16:56:07 UTC

[jira] Created: (VELTOOLS-57) ServletToolboxManager fails for .war files

ServletToolboxManager fails for .war files
------------------------------------------

         Key: VELTOOLS-57
         URL: http://issues.apache.org/jira/browse/VELTOOLS-57
     Project: VelocityTools
        Type: Bug
  Components: VelocityView  
    Versions: 1.1    
 Environment: irrelevant
    Reporter: Justin Patterson


When webapps are deployed as .war files and the ServletToolboxManager is loaded from a shared location (mine is in shared/lib on Tomcat), the getInstance(ServletContext,String) method always returns the same manager.  This is because the call to ServletContext.getRealPath(String) method, whose return value is used as the key into the managersMap, returns null when the webapp is deployed as a jar, per the servlet API.  So, all ServletContext's end up getting/putting their managers using the null key into the managersMap .

This is easy to fix.  You just need another way to scope the toolbox filename based on the input ServletContext that's guaranteed to return something unique.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


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


[jira] Updated: (VELTOOLS-57) ServletToolboxManager fails for .war files

Posted by "Justin Patterson (JIRA)" <ve...@apache.org>.
     [ http://issues.apache.org/jira/browse/VELTOOLS-57?page=all ]

Justin Patterson updated VELTOOLS-57:
-------------------------------------

    Version: 1.2
                 (was: 1.1)

Sorry.  It is actually 1.2 that I found it against.

> ServletToolboxManager fails for .war files
> ------------------------------------------
>
>          Key: VELTOOLS-57
>          URL: http://issues.apache.org/jira/browse/VELTOOLS-57
>      Project: VelocityTools
>         Type: Bug
>   Components: VelocityView
>     Versions: 1.2
>  Environment: irrelevant
>     Reporter: Justin Patterson
>      Fix For: 1.3, 2.0

>
> When webapps are deployed as .war files and the ServletToolboxManager is loaded from a shared location (mine is in shared/lib on Tomcat), the getInstance(ServletContext,String) method always returns the same manager.  This is because the call to ServletContext.getRealPath(String) method, whose return value is used as the key into the managersMap, returns null when the webapp is deployed as a jar, per the servlet API.  So, all ServletContext's end up getting/putting their managers using the null key into the managersMap .
> This is easy to fix.  You just need another way to scope the toolbox filename based on the input ServletContext that's guaranteed to return something unique.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


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


[jira] Updated: (VELTOOLS-57) ServletToolboxManager fails for .war files

Posted by "Justin Patterson (JIRA)" <ve...@apache.org>.
     [ http://issues.apache.org/jira/browse/VELTOOLS-57?page=all ]

Justin Patterson updated VELTOOLS-57:
-------------------------------------

    Attachment: patch

This is the patch that I've made to my local tree and which has worked for me.

Basically, I'm creating the map key based on the hashCode of the ServletContext.  I couldn't find a better method on ServletContext that was guaranteed to give me a unique value.  I don't think that this should be an issue since the cache is not persistent.

> ServletToolboxManager fails for .war files
> ------------------------------------------
>
>          Key: VELTOOLS-57
>          URL: http://issues.apache.org/jira/browse/VELTOOLS-57
>      Project: VelocityTools
>         Type: Bug
>   Components: VelocityView
>     Versions: 1.2
>  Environment: irrelevant
>     Reporter: Justin Patterson
>      Fix For: 1.3, 2.0
>  Attachments: patch
>
> When webapps are deployed as .war files and the ServletToolboxManager is loaded from a shared location (mine is in shared/lib on Tomcat), the getInstance(ServletContext,String) method always returns the same manager.  This is because the call to ServletContext.getRealPath(String) method, whose return value is used as the key into the managersMap, returns null when the webapp is deployed as a jar, per the servlet API.  So, all ServletContext's end up getting/putting their managers using the null key into the managersMap .
> This is easy to fix.  You just need another way to scope the toolbox filename based on the input ServletContext that's guaranteed to return something unique.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


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


[jira] Resolved: (VELTOOLS-57) ServletToolboxManager fails for .war files

Posted by "Nathan Bubna (JIRA)" <ve...@apache.org>.
     [ http://issues.apache.org/jira/browse/VELTOOLS-57?page=all ]
     
Nathan Bubna resolved VELTOOLS-57:
----------------------------------

    Fix Version:     (was: 2.0)
     Resolution: Fixed
      Assign To: Nathan Bubna

ok, the change is in.  thanks!

> ServletToolboxManager fails for .war files
> ------------------------------------------
>
>          Key: VELTOOLS-57
>          URL: http://issues.apache.org/jira/browse/VELTOOLS-57
>      Project: VelocityTools
>         Type: Bug
>   Components: VelocityView
>     Versions: 1.2
>  Environment: irrelevant
>     Reporter: Justin Patterson
>     Assignee: Nathan Bubna
>      Fix For: 1.3
>  Attachments: patch
>
> When webapps are deployed as .war files and the ServletToolboxManager is loaded from a shared location (mine is in shared/lib on Tomcat), the getInstance(ServletContext,String) method always returns the same manager.  This is because the call to ServletContext.getRealPath(String) method, whose return value is used as the key into the managersMap, returns null when the webapp is deployed as a jar, per the servlet API.  So, all ServletContext's end up getting/putting their managers using the null key into the managersMap .
> This is easy to fix.  You just need another way to scope the toolbox filename based on the input ServletContext that's guaranteed to return something unique.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


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


[jira] Updated: (VELTOOLS-57) ServletToolboxManager fails for .war files

Posted by "Nathan Bubna (JIRA)" <ve...@apache.org>.
     [ http://issues.apache.org/jira/browse/VELTOOLS-57?page=all ]

Nathan Bubna updated VELTOOLS-57:
---------------------------------

    Fix Version: 1.3
                 2.0

acked.  thx.

and can i assume this is an issue in version 1.2 as well?

patches are always welcome. :) 
but if no one else steps up, i'll try to get this into the next version.



> ServletToolboxManager fails for .war files
> ------------------------------------------
>
>          Key: VELTOOLS-57
>          URL: http://issues.apache.org/jira/browse/VELTOOLS-57
>      Project: VelocityTools
>         Type: Bug
>   Components: VelocityView
>     Versions: 1.1
>  Environment: irrelevant
>     Reporter: Justin Patterson
>      Fix For: 1.3, 2.0

>
> When webapps are deployed as .war files and the ServletToolboxManager is loaded from a shared location (mine is in shared/lib on Tomcat), the getInstance(ServletContext,String) method always returns the same manager.  This is because the call to ServletContext.getRealPath(String) method, whose return value is used as the key into the managersMap, returns null when the webapp is deployed as a jar, per the servlet API.  So, all ServletContext's end up getting/putting their managers using the null key into the managersMap .
> This is easy to fix.  You just need another way to scope the toolbox filename based on the input ServletContext that's guaranteed to return something unique.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


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


[jira] Commented: (VELTOOLS-57) ServletToolboxManager fails for .war files

Posted by "Nathan Bubna (JIRA)" <ve...@apache.org>.
    [ http://issues.apache.org/jira/browse/VELTOOLS-57?page=comments#action_12368893 ] 

Nathan Bubna commented on VELTOOLS-57:
--------------------------------------

yeah, looks like that'll do the trick.

Of course, if we can make ServletToolboxManager serializable, we could just put it into the servlet context attributes with the relative path to the toolbox file as the key...

but for now i'll stick with this.  thanks!

> ServletToolboxManager fails for .war files
> ------------------------------------------
>
>          Key: VELTOOLS-57
>          URL: http://issues.apache.org/jira/browse/VELTOOLS-57
>      Project: VelocityTools
>         Type: Bug
>   Components: VelocityView
>     Versions: 1.2
>  Environment: irrelevant
>     Reporter: Justin Patterson
>      Fix For: 1.3, 2.0
>  Attachments: patch
>
> When webapps are deployed as .war files and the ServletToolboxManager is loaded from a shared location (mine is in shared/lib on Tomcat), the getInstance(ServletContext,String) method always returns the same manager.  This is because the call to ServletContext.getRealPath(String) method, whose return value is used as the key into the managersMap, returns null when the webapp is deployed as a jar, per the servlet API.  So, all ServletContext's end up getting/putting their managers using the null key into the managersMap .
> This is easy to fix.  You just need another way to scope the toolbox filename based on the input ServletContext that's guaranteed to return something unique.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


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