You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Nikos Andreou (JIRA)" <ji...@apache.org> on 2009/03/17 12:16:03 UTC
[jira] Created: (WW-3040) Context supplied through convertValue to
custom converter is missing many key-value pairs (including ServletContext)
Context supplied through convertValue to custom converter is missing many key-value pairs (including ServletContext)
--------------------------------------------------------------------------------------------------------------------
Key: WW-3040
URL: https://issues.apache.org/struts/browse/WW-3040
Project: Struts 2
Issue Type: Bug
Affects Versions: 2.1.6
Environment: Windows Vista x64, Tomcat 6.0.18, Eclipse 3.4.1
Reporter: Nikos Andreou
I recently upgraded from Struts 2.0.11 to 2.1.6. I had a custom date converter class. In the convertValue method, I had the code:
ServletContext servletContext = (ServletContext) context.get(StrutsStatics.SERVLET_CONTEXT);
I was getting the servletContext and I was reading a param where I had my date pattern.
With 2.0.11, the above code returns the servletContext. With 2.1.6, I get null. Basically, the difference in the context provided through
public Object convertValue(Map context, Object value, Class toType) {}
is this:
2.0.11
---------
Key= com.opensymphony.xwork2.dispatcher.HttpServletRequest Value= org.apache.struts2.dispatcher.StrutsRequestWrapper@196232
Key= com.opensymphony.xwork2.ActionContext.locale Value= en_US
Key= com.opensymphony.xwork2.util.ValueStack.ReportErrorsOnNoProp Value= true
Key= com.opensymphony.xwork2.dispatcher.HttpServletResponse Value= org.apache.catalina.connector.ResponseFacade@7dde6a
Key= com.opensymphony.xwork2.ActionContext.name Value= Transaction2
Key= com.opensymphony.xwork2.ActionContext.application Value= {org.apache.catalina.WELCOME_FILES=[Ljava.lang.String;@2a38be, blah-blah, datePattern=yyyy-MM-dd}
Key= last.property.accessed Value= null
Key= com.opensymphony.xwork2.dispatcher.ServletContext Value= org.apache.catalina.core.ApplicationContextFacade@11656b
Key= request Value= {struts.valueStack=com.opensymphony.xwork2.util.OgnlValueStack@13fb657}
Key= last.bean.accessed Value= null
Key= parameters Value= {amount=[Ljava.lang.String;@1dc0b6b, transactionType=[Ljava.lang.String;@171c4b5, accountId=[Ljava.lang.String;@2975fa, transactionDate=[Ljava.lang.String;@754c}
Key= __link Value= [Ljava.lang.Object;@14e518
Key= application Value= {org.apache.catalina.WELCOME_FILES=[Ljava.lang.String;@2a38be, blah-blah, datePattern=yyyy-MM-dd}
Key= xwork.NullHandler.createNullObjects Value= true
Key= current.property.path Value= null
Key= conversion.property.fullName Value= transactionDate
Key= attr Value= org.apache.struts2.util.AttributeMap@1cca665
Key= com.opensymphony.xwork2.ActionContext.session Value= {}
Key= com.opensymphony.xwork2.ActionContext.actionInvocation Value= com.opensymphony.xwork2.DefaultActionInvocation@c03c11
Key= com.opensymphony.xwork2.util.ValueStack.ValueStack Value= com.opensymphony.xwork2.util.OgnlValueStack@13fb657
Key= session Value= {}
Key= xwork.MethodAccessor.denyMethodExecution Value= true
Key= report.conversion.errors Value= true
Key= struts.actionMapping Value= org.apache.struts2.dispatcher.mapper.ActionMapping@a79811
Key= com.opensymphony.xwork2.ActionContext.parameters Value= {amount=[Ljava.lang.String;@1dc0b6b, transactionType=[Ljava.lang.String;@171c4b5, accountId=[Ljava.lang.String;@2975fa, transactionDate=[Ljava.lang.String;@754c}
2.1.6
-------
Key= com.opensymphony.xwork2.util.ValueStack.ReportErrorsOnNoProp Value= true
Key= xwork.NullHandler.createNullObjects Value= true
Key= current.property.path Value= null
Key= conversion.property.fullName Value= transactionDate
Key= last.property.accessed Value= null
Key= report.conversion.errors Value= true
Key= xwork.MethodAccessor.denyMethodExecution Value= true
Key= last.bean.accessed Value= null
Most key-value pairs are missing and at the moment my code fails to work and I get an exception. I am wondering if this is a known issue and whether there is a workaround.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (WW-3040) Context supplied through convertValue
to custom converter is missing many key-value pairs (including
ServletContext)
Posted by "Nikos Andreou (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/struts/browse/WW-3040?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=46318#action_46318 ]
Nikos Andreou commented on WW-3040:
-----------------------------------
>From the above topic, I see people waiting for a solution. I can personally insert the date pattern directly in my java class, but this will make my program less configurable. Changing a xml is always more convenient that changing and recompiling your code. The question that remains in my head is why this changed in Struts 2.1.6. Was there an issue is 2.0.11 that had to change in 2.1.6? I personally loved the way I could get the servletContext in conversions since I can keep the formats I want in XML and use the framework to read the strings directly.
> Context supplied through convertValue to custom converter is missing many key-value pairs (including ServletContext)
> --------------------------------------------------------------------------------------------------------------------
>
> Key: WW-3040
> URL: https://issues.apache.org/struts/browse/WW-3040
> Project: Struts 2
> Issue Type: Bug
> Affects Versions: 2.1.6
> Environment: Windows Vista x64, Tomcat 6.0.18, Eclipse 3.4.1
> Reporter: Nikos Andreou
>
> I recently upgraded from Struts 2.0.11 to 2.1.6. I had a custom date converter class. In the convertValue method, I had the code:
> ServletContext servletContext = (ServletContext) context.get(StrutsStatics.SERVLET_CONTEXT);
> I was getting the servletContext and I was reading a param where I had my date pattern.
> With 2.0.11, the above code returns the servletContext. With 2.1.6, I get null. Basically, the difference in the context provided through
> public Object convertValue(Map context, Object value, Class toType) {}
> is this:
> 2.0.11
> ---------
> Key= com.opensymphony.xwork2.dispatcher.HttpServletRequest Value= org.apache.struts2.dispatcher.StrutsRequestWrapper@196232
> Key= com.opensymphony.xwork2.ActionContext.locale Value= en_US
> Key= com.opensymphony.xwork2.util.ValueStack.ReportErrorsOnNoProp Value= true
> Key= com.opensymphony.xwork2.dispatcher.HttpServletResponse Value= org.apache.catalina.connector.ResponseFacade@7dde6a
> Key= com.opensymphony.xwork2.ActionContext.name Value= Transaction2
> Key= com.opensymphony.xwork2.ActionContext.application Value= {org.apache.catalina.WELCOME_FILES=[Ljava.lang.String;@2a38be, blah-blah, datePattern=yyyy-MM-dd}
> Key= last.property.accessed Value= null
> Key= com.opensymphony.xwork2.dispatcher.ServletContext Value= org.apache.catalina.core.ApplicationContextFacade@11656b
> Key= request Value= {struts.valueStack=com.opensymphony.xwork2.util.OgnlValueStack@13fb657}
> Key= last.bean.accessed Value= null
> Key= parameters Value= {amount=[Ljava.lang.String;@1dc0b6b, transactionType=[Ljava.lang.String;@171c4b5, accountId=[Ljava.lang.String;@2975fa, transactionDate=[Ljava.lang.String;@754c}
> Key= __link Value= [Ljava.lang.Object;@14e518
> Key= application Value= {org.apache.catalina.WELCOME_FILES=[Ljava.lang.String;@2a38be, blah-blah, datePattern=yyyy-MM-dd}
> Key= xwork.NullHandler.createNullObjects Value= true
> Key= current.property.path Value= null
> Key= conversion.property.fullName Value= transactionDate
> Key= attr Value= org.apache.struts2.util.AttributeMap@1cca665
> Key= com.opensymphony.xwork2.ActionContext.session Value= {}
> Key= com.opensymphony.xwork2.ActionContext.actionInvocation Value= com.opensymphony.xwork2.DefaultActionInvocation@c03c11
> Key= com.opensymphony.xwork2.util.ValueStack.ValueStack Value= com.opensymphony.xwork2.util.OgnlValueStack@13fb657
> Key= session Value= {}
> Key= xwork.MethodAccessor.denyMethodExecution Value= true
> Key= report.conversion.errors Value= true
> Key= struts.actionMapping Value= org.apache.struts2.dispatcher.mapper.ActionMapping@a79811
> Key= com.opensymphony.xwork2.ActionContext.parameters Value= {amount=[Ljava.lang.String;@1dc0b6b, transactionType=[Ljava.lang.String;@171c4b5, accountId=[Ljava.lang.String;@2975fa, transactionDate=[Ljava.lang.String;@754c}
> 2.1.6
> -------
> Key= com.opensymphony.xwork2.util.ValueStack.ReportErrorsOnNoProp Value= true
> Key= xwork.NullHandler.createNullObjects Value= true
> Key= current.property.path Value= null
> Key= conversion.property.fullName Value= transactionDate
> Key= last.property.accessed Value= null
> Key= report.conversion.errors Value= true
> Key= xwork.MethodAccessor.denyMethodExecution Value= true
> Key= last.bean.accessed Value= null
> Most key-value pairs are missing and at the moment my code fails to work and I get an exception. I am wondering if this is a known issue and whether there is a workaround.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (WW-3040) Context supplied through convertValue
to custom converter is missing many key-value pairs (including
ServletContext)
Posted by "Wes Wannemacher (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/struts/browse/WW-3040?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=46319#action_46319 ]
Wes Wannemacher commented on WW-3040:
-------------------------------------
If you're just looking for the ServletContext, can you do - ServletActionContext.getServletContext() ?
I can't remember the exact issue, but it could have been anything from cleanup to security... I think anything you need is available, you just have to look around the javadocs to find the exact method calls.
> Context supplied through convertValue to custom converter is missing many key-value pairs (including ServletContext)
> --------------------------------------------------------------------------------------------------------------------
>
> Key: WW-3040
> URL: https://issues.apache.org/struts/browse/WW-3040
> Project: Struts 2
> Issue Type: Bug
> Affects Versions: 2.1.6
> Environment: Windows Vista x64, Tomcat 6.0.18, Eclipse 3.4.1
> Reporter: Nikos Andreou
> Fix For: 2.1.7
>
>
> I recently upgraded from Struts 2.0.11 to 2.1.6. I had a custom date converter class. In the convertValue method, I had the code:
> ServletContext servletContext = (ServletContext) context.get(StrutsStatics.SERVLET_CONTEXT);
> I was getting the servletContext and I was reading a param where I had my date pattern.
> With 2.0.11, the above code returns the servletContext. With 2.1.6, I get null. Basically, the difference in the context provided through
> public Object convertValue(Map context, Object value, Class toType) {}
> is this:
> 2.0.11
> ---------
> Key= com.opensymphony.xwork2.dispatcher.HttpServletRequest Value= org.apache.struts2.dispatcher.StrutsRequestWrapper@196232
> Key= com.opensymphony.xwork2.ActionContext.locale Value= en_US
> Key= com.opensymphony.xwork2.util.ValueStack.ReportErrorsOnNoProp Value= true
> Key= com.opensymphony.xwork2.dispatcher.HttpServletResponse Value= org.apache.catalina.connector.ResponseFacade@7dde6a
> Key= com.opensymphony.xwork2.ActionContext.name Value= Transaction2
> Key= com.opensymphony.xwork2.ActionContext.application Value= {org.apache.catalina.WELCOME_FILES=[Ljava.lang.String;@2a38be, blah-blah, datePattern=yyyy-MM-dd}
> Key= last.property.accessed Value= null
> Key= com.opensymphony.xwork2.dispatcher.ServletContext Value= org.apache.catalina.core.ApplicationContextFacade@11656b
> Key= request Value= {struts.valueStack=com.opensymphony.xwork2.util.OgnlValueStack@13fb657}
> Key= last.bean.accessed Value= null
> Key= parameters Value= {amount=[Ljava.lang.String;@1dc0b6b, transactionType=[Ljava.lang.String;@171c4b5, accountId=[Ljava.lang.String;@2975fa, transactionDate=[Ljava.lang.String;@754c}
> Key= __link Value= [Ljava.lang.Object;@14e518
> Key= application Value= {org.apache.catalina.WELCOME_FILES=[Ljava.lang.String;@2a38be, blah-blah, datePattern=yyyy-MM-dd}
> Key= xwork.NullHandler.createNullObjects Value= true
> Key= current.property.path Value= null
> Key= conversion.property.fullName Value= transactionDate
> Key= attr Value= org.apache.struts2.util.AttributeMap@1cca665
> Key= com.opensymphony.xwork2.ActionContext.session Value= {}
> Key= com.opensymphony.xwork2.ActionContext.actionInvocation Value= com.opensymphony.xwork2.DefaultActionInvocation@c03c11
> Key= com.opensymphony.xwork2.util.ValueStack.ValueStack Value= com.opensymphony.xwork2.util.OgnlValueStack@13fb657
> Key= session Value= {}
> Key= xwork.MethodAccessor.denyMethodExecution Value= true
> Key= report.conversion.errors Value= true
> Key= struts.actionMapping Value= org.apache.struts2.dispatcher.mapper.ActionMapping@a79811
> Key= com.opensymphony.xwork2.ActionContext.parameters Value= {amount=[Ljava.lang.String;@1dc0b6b, transactionType=[Ljava.lang.String;@171c4b5, accountId=[Ljava.lang.String;@2975fa, transactionDate=[Ljava.lang.String;@754c}
> 2.1.6
> -------
> Key= com.opensymphony.xwork2.util.ValueStack.ReportErrorsOnNoProp Value= true
> Key= xwork.NullHandler.createNullObjects Value= true
> Key= current.property.path Value= null
> Key= conversion.property.fullName Value= transactionDate
> Key= last.property.accessed Value= null
> Key= report.conversion.errors Value= true
> Key= xwork.MethodAccessor.denyMethodExecution Value= true
> Key= last.bean.accessed Value= null
> Most key-value pairs are missing and at the moment my code fails to work and I get an exception. I am wondering if this is a known issue and whether there is a workaround.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (WW-3040) Context supplied through convertValue to
custom converter is missing many key-value pairs (including ServletContext)
Posted by "Wes Wannemacher (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/struts/browse/WW-3040?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Wes Wannemacher updated WW-3040:
--------------------------------
Fix Version/s: 2.1.7
Let me know if ServletActionContext.getServletContext() doesn't work. I'll try to fix it if it doesn't. If it does work, I'll close this issue.
> Context supplied through convertValue to custom converter is missing many key-value pairs (including ServletContext)
> --------------------------------------------------------------------------------------------------------------------
>
> Key: WW-3040
> URL: https://issues.apache.org/struts/browse/WW-3040
> Project: Struts 2
> Issue Type: Bug
> Affects Versions: 2.1.6
> Environment: Windows Vista x64, Tomcat 6.0.18, Eclipse 3.4.1
> Reporter: Nikos Andreou
> Fix For: 2.1.7
>
>
> I recently upgraded from Struts 2.0.11 to 2.1.6. I had a custom date converter class. In the convertValue method, I had the code:
> ServletContext servletContext = (ServletContext) context.get(StrutsStatics.SERVLET_CONTEXT);
> I was getting the servletContext and I was reading a param where I had my date pattern.
> With 2.0.11, the above code returns the servletContext. With 2.1.6, I get null. Basically, the difference in the context provided through
> public Object convertValue(Map context, Object value, Class toType) {}
> is this:
> 2.0.11
> ---------
> Key= com.opensymphony.xwork2.dispatcher.HttpServletRequest Value= org.apache.struts2.dispatcher.StrutsRequestWrapper@196232
> Key= com.opensymphony.xwork2.ActionContext.locale Value= en_US
> Key= com.opensymphony.xwork2.util.ValueStack.ReportErrorsOnNoProp Value= true
> Key= com.opensymphony.xwork2.dispatcher.HttpServletResponse Value= org.apache.catalina.connector.ResponseFacade@7dde6a
> Key= com.opensymphony.xwork2.ActionContext.name Value= Transaction2
> Key= com.opensymphony.xwork2.ActionContext.application Value= {org.apache.catalina.WELCOME_FILES=[Ljava.lang.String;@2a38be, blah-blah, datePattern=yyyy-MM-dd}
> Key= last.property.accessed Value= null
> Key= com.opensymphony.xwork2.dispatcher.ServletContext Value= org.apache.catalina.core.ApplicationContextFacade@11656b
> Key= request Value= {struts.valueStack=com.opensymphony.xwork2.util.OgnlValueStack@13fb657}
> Key= last.bean.accessed Value= null
> Key= parameters Value= {amount=[Ljava.lang.String;@1dc0b6b, transactionType=[Ljava.lang.String;@171c4b5, accountId=[Ljava.lang.String;@2975fa, transactionDate=[Ljava.lang.String;@754c}
> Key= __link Value= [Ljava.lang.Object;@14e518
> Key= application Value= {org.apache.catalina.WELCOME_FILES=[Ljava.lang.String;@2a38be, blah-blah, datePattern=yyyy-MM-dd}
> Key= xwork.NullHandler.createNullObjects Value= true
> Key= current.property.path Value= null
> Key= conversion.property.fullName Value= transactionDate
> Key= attr Value= org.apache.struts2.util.AttributeMap@1cca665
> Key= com.opensymphony.xwork2.ActionContext.session Value= {}
> Key= com.opensymphony.xwork2.ActionContext.actionInvocation Value= com.opensymphony.xwork2.DefaultActionInvocation@c03c11
> Key= com.opensymphony.xwork2.util.ValueStack.ValueStack Value= com.opensymphony.xwork2.util.OgnlValueStack@13fb657
> Key= session Value= {}
> Key= xwork.MethodAccessor.denyMethodExecution Value= true
> Key= report.conversion.errors Value= true
> Key= struts.actionMapping Value= org.apache.struts2.dispatcher.mapper.ActionMapping@a79811
> Key= com.opensymphony.xwork2.ActionContext.parameters Value= {amount=[Ljava.lang.String;@1dc0b6b, transactionType=[Ljava.lang.String;@171c4b5, accountId=[Ljava.lang.String;@2975fa, transactionDate=[Ljava.lang.String;@754c}
> 2.1.6
> -------
> Key= com.opensymphony.xwork2.util.ValueStack.ReportErrorsOnNoProp Value= true
> Key= xwork.NullHandler.createNullObjects Value= true
> Key= current.property.path Value= null
> Key= conversion.property.fullName Value= transactionDate
> Key= last.property.accessed Value= null
> Key= report.conversion.errors Value= true
> Key= xwork.MethodAccessor.denyMethodExecution Value= true
> Key= last.bean.accessed Value= null
> Most key-value pairs are missing and at the moment my code fails to work and I get an exception. I am wondering if this is a known issue and whether there is a workaround.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Closed: (WW-3040) Context supplied through convertValue to
custom converter is missing many key-value pairs (including ServletContext)
Posted by "Wes Wannemacher (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/struts/browse/WW-3040?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Wes Wannemacher closed WW-3040.
-------------------------------
Resolution: Not A Problem
Assignee: Wes Wannemacher
glad to be of service!
> Context supplied through convertValue to custom converter is missing many key-value pairs (including ServletContext)
> --------------------------------------------------------------------------------------------------------------------
>
> Key: WW-3040
> URL: https://issues.apache.org/struts/browse/WW-3040
> Project: Struts 2
> Issue Type: Bug
> Affects Versions: 2.1.6
> Environment: Windows Vista x64, Tomcat 6.0.18, Eclipse 3.4.1
> Reporter: Nikos Andreou
> Assignee: Wes Wannemacher
> Fix For: 2.1.7
>
>
> I recently upgraded from Struts 2.0.11 to 2.1.6. I had a custom date converter class. In the convertValue method, I had the code:
> ServletContext servletContext = (ServletContext) context.get(StrutsStatics.SERVLET_CONTEXT);
> I was getting the servletContext and I was reading a param where I had my date pattern.
> With 2.0.11, the above code returns the servletContext. With 2.1.6, I get null. Basically, the difference in the context provided through
> public Object convertValue(Map context, Object value, Class toType) {}
> is this:
> 2.0.11
> ---------
> Key= com.opensymphony.xwork2.dispatcher.HttpServletRequest Value= org.apache.struts2.dispatcher.StrutsRequestWrapper@196232
> Key= com.opensymphony.xwork2.ActionContext.locale Value= en_US
> Key= com.opensymphony.xwork2.util.ValueStack.ReportErrorsOnNoProp Value= true
> Key= com.opensymphony.xwork2.dispatcher.HttpServletResponse Value= org.apache.catalina.connector.ResponseFacade@7dde6a
> Key= com.opensymphony.xwork2.ActionContext.name Value= Transaction2
> Key= com.opensymphony.xwork2.ActionContext.application Value= {org.apache.catalina.WELCOME_FILES=[Ljava.lang.String;@2a38be, blah-blah, datePattern=yyyy-MM-dd}
> Key= last.property.accessed Value= null
> Key= com.opensymphony.xwork2.dispatcher.ServletContext Value= org.apache.catalina.core.ApplicationContextFacade@11656b
> Key= request Value= {struts.valueStack=com.opensymphony.xwork2.util.OgnlValueStack@13fb657}
> Key= last.bean.accessed Value= null
> Key= parameters Value= {amount=[Ljava.lang.String;@1dc0b6b, transactionType=[Ljava.lang.String;@171c4b5, accountId=[Ljava.lang.String;@2975fa, transactionDate=[Ljava.lang.String;@754c}
> Key= __link Value= [Ljava.lang.Object;@14e518
> Key= application Value= {org.apache.catalina.WELCOME_FILES=[Ljava.lang.String;@2a38be, blah-blah, datePattern=yyyy-MM-dd}
> Key= xwork.NullHandler.createNullObjects Value= true
> Key= current.property.path Value= null
> Key= conversion.property.fullName Value= transactionDate
> Key= attr Value= org.apache.struts2.util.AttributeMap@1cca665
> Key= com.opensymphony.xwork2.ActionContext.session Value= {}
> Key= com.opensymphony.xwork2.ActionContext.actionInvocation Value= com.opensymphony.xwork2.DefaultActionInvocation@c03c11
> Key= com.opensymphony.xwork2.util.ValueStack.ValueStack Value= com.opensymphony.xwork2.util.OgnlValueStack@13fb657
> Key= session Value= {}
> Key= xwork.MethodAccessor.denyMethodExecution Value= true
> Key= report.conversion.errors Value= true
> Key= struts.actionMapping Value= org.apache.struts2.dispatcher.mapper.ActionMapping@a79811
> Key= com.opensymphony.xwork2.ActionContext.parameters Value= {amount=[Ljava.lang.String;@1dc0b6b, transactionType=[Ljava.lang.String;@171c4b5, accountId=[Ljava.lang.String;@2975fa, transactionDate=[Ljava.lang.String;@754c}
> 2.1.6
> -------
> Key= com.opensymphony.xwork2.util.ValueStack.ReportErrorsOnNoProp Value= true
> Key= xwork.NullHandler.createNullObjects Value= true
> Key= current.property.path Value= null
> Key= conversion.property.fullName Value= transactionDate
> Key= last.property.accessed Value= null
> Key= report.conversion.errors Value= true
> Key= xwork.MethodAccessor.denyMethodExecution Value= true
> Key= last.bean.accessed Value= null
> Most key-value pairs are missing and at the moment my code fails to work and I get an exception. I am wondering if this is a known issue and whether there is a workaround.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (WW-3040) Context supplied through convertValue
to custom converter is missing many key-value pairs (including
ServletContext)
Posted by "David Mansfield (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/struts/browse/WW-3040?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=46297#action_46297 ]
David Mansfield commented on WW-3040:
-------------------------------------
the valuestack present during type conversions that take place during the parametersinterceptor is a "fake" stack created to prevent some security problems. the fake stack doesn't contain almost any of the things the real stack has, including what you need.
i'm not sure there's a way to get what you're looking for, but for reference, here's a previous report similar to yours:
http://jira.opensymphony.com/browse/XW-670
> Context supplied through convertValue to custom converter is missing many key-value pairs (including ServletContext)
> --------------------------------------------------------------------------------------------------------------------
>
> Key: WW-3040
> URL: https://issues.apache.org/struts/browse/WW-3040
> Project: Struts 2
> Issue Type: Bug
> Affects Versions: 2.1.6
> Environment: Windows Vista x64, Tomcat 6.0.18, Eclipse 3.4.1
> Reporter: Nikos Andreou
>
> I recently upgraded from Struts 2.0.11 to 2.1.6. I had a custom date converter class. In the convertValue method, I had the code:
> ServletContext servletContext = (ServletContext) context.get(StrutsStatics.SERVLET_CONTEXT);
> I was getting the servletContext and I was reading a param where I had my date pattern.
> With 2.0.11, the above code returns the servletContext. With 2.1.6, I get null. Basically, the difference in the context provided through
> public Object convertValue(Map context, Object value, Class toType) {}
> is this:
> 2.0.11
> ---------
> Key= com.opensymphony.xwork2.dispatcher.HttpServletRequest Value= org.apache.struts2.dispatcher.StrutsRequestWrapper@196232
> Key= com.opensymphony.xwork2.ActionContext.locale Value= en_US
> Key= com.opensymphony.xwork2.util.ValueStack.ReportErrorsOnNoProp Value= true
> Key= com.opensymphony.xwork2.dispatcher.HttpServletResponse Value= org.apache.catalina.connector.ResponseFacade@7dde6a
> Key= com.opensymphony.xwork2.ActionContext.name Value= Transaction2
> Key= com.opensymphony.xwork2.ActionContext.application Value= {org.apache.catalina.WELCOME_FILES=[Ljava.lang.String;@2a38be, blah-blah, datePattern=yyyy-MM-dd}
> Key= last.property.accessed Value= null
> Key= com.opensymphony.xwork2.dispatcher.ServletContext Value= org.apache.catalina.core.ApplicationContextFacade@11656b
> Key= request Value= {struts.valueStack=com.opensymphony.xwork2.util.OgnlValueStack@13fb657}
> Key= last.bean.accessed Value= null
> Key= parameters Value= {amount=[Ljava.lang.String;@1dc0b6b, transactionType=[Ljava.lang.String;@171c4b5, accountId=[Ljava.lang.String;@2975fa, transactionDate=[Ljava.lang.String;@754c}
> Key= __link Value= [Ljava.lang.Object;@14e518
> Key= application Value= {org.apache.catalina.WELCOME_FILES=[Ljava.lang.String;@2a38be, blah-blah, datePattern=yyyy-MM-dd}
> Key= xwork.NullHandler.createNullObjects Value= true
> Key= current.property.path Value= null
> Key= conversion.property.fullName Value= transactionDate
> Key= attr Value= org.apache.struts2.util.AttributeMap@1cca665
> Key= com.opensymphony.xwork2.ActionContext.session Value= {}
> Key= com.opensymphony.xwork2.ActionContext.actionInvocation Value= com.opensymphony.xwork2.DefaultActionInvocation@c03c11
> Key= com.opensymphony.xwork2.util.ValueStack.ValueStack Value= com.opensymphony.xwork2.util.OgnlValueStack@13fb657
> Key= session Value= {}
> Key= xwork.MethodAccessor.denyMethodExecution Value= true
> Key= report.conversion.errors Value= true
> Key= struts.actionMapping Value= org.apache.struts2.dispatcher.mapper.ActionMapping@a79811
> Key= com.opensymphony.xwork2.ActionContext.parameters Value= {amount=[Ljava.lang.String;@1dc0b6b, transactionType=[Ljava.lang.String;@171c4b5, accountId=[Ljava.lang.String;@2975fa, transactionDate=[Ljava.lang.String;@754c}
> 2.1.6
> -------
> Key= com.opensymphony.xwork2.util.ValueStack.ReportErrorsOnNoProp Value= true
> Key= xwork.NullHandler.createNullObjects Value= true
> Key= current.property.path Value= null
> Key= conversion.property.fullName Value= transactionDate
> Key= last.property.accessed Value= null
> Key= report.conversion.errors Value= true
> Key= xwork.MethodAccessor.denyMethodExecution Value= true
> Key= last.bean.accessed Value= null
> Most key-value pairs are missing and at the moment my code fails to work and I get an exception. I am wondering if this is a known issue and whether there is a workaround.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (WW-3040) Context supplied through convertValue
to custom converter is missing many key-value pairs (including
ServletContext)
Posted by "Nikos Andreou (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/struts/browse/WW-3040?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=46326#action_46326 ]
Nikos Andreou commented on WW-3040:
-----------------------------------
Wes, you typed the magic piece of code. It works absolutely fine for me. I get what I want from the ServletContext (the date pattern). You can close the issue. Thanks for all your help.
> Context supplied through convertValue to custom converter is missing many key-value pairs (including ServletContext)
> --------------------------------------------------------------------------------------------------------------------
>
> Key: WW-3040
> URL: https://issues.apache.org/struts/browse/WW-3040
> Project: Struts 2
> Issue Type: Bug
> Affects Versions: 2.1.6
> Environment: Windows Vista x64, Tomcat 6.0.18, Eclipse 3.4.1
> Reporter: Nikos Andreou
> Fix For: 2.1.7
>
>
> I recently upgraded from Struts 2.0.11 to 2.1.6. I had a custom date converter class. In the convertValue method, I had the code:
> ServletContext servletContext = (ServletContext) context.get(StrutsStatics.SERVLET_CONTEXT);
> I was getting the servletContext and I was reading a param where I had my date pattern.
> With 2.0.11, the above code returns the servletContext. With 2.1.6, I get null. Basically, the difference in the context provided through
> public Object convertValue(Map context, Object value, Class toType) {}
> is this:
> 2.0.11
> ---------
> Key= com.opensymphony.xwork2.dispatcher.HttpServletRequest Value= org.apache.struts2.dispatcher.StrutsRequestWrapper@196232
> Key= com.opensymphony.xwork2.ActionContext.locale Value= en_US
> Key= com.opensymphony.xwork2.util.ValueStack.ReportErrorsOnNoProp Value= true
> Key= com.opensymphony.xwork2.dispatcher.HttpServletResponse Value= org.apache.catalina.connector.ResponseFacade@7dde6a
> Key= com.opensymphony.xwork2.ActionContext.name Value= Transaction2
> Key= com.opensymphony.xwork2.ActionContext.application Value= {org.apache.catalina.WELCOME_FILES=[Ljava.lang.String;@2a38be, blah-blah, datePattern=yyyy-MM-dd}
> Key= last.property.accessed Value= null
> Key= com.opensymphony.xwork2.dispatcher.ServletContext Value= org.apache.catalina.core.ApplicationContextFacade@11656b
> Key= request Value= {struts.valueStack=com.opensymphony.xwork2.util.OgnlValueStack@13fb657}
> Key= last.bean.accessed Value= null
> Key= parameters Value= {amount=[Ljava.lang.String;@1dc0b6b, transactionType=[Ljava.lang.String;@171c4b5, accountId=[Ljava.lang.String;@2975fa, transactionDate=[Ljava.lang.String;@754c}
> Key= __link Value= [Ljava.lang.Object;@14e518
> Key= application Value= {org.apache.catalina.WELCOME_FILES=[Ljava.lang.String;@2a38be, blah-blah, datePattern=yyyy-MM-dd}
> Key= xwork.NullHandler.createNullObjects Value= true
> Key= current.property.path Value= null
> Key= conversion.property.fullName Value= transactionDate
> Key= attr Value= org.apache.struts2.util.AttributeMap@1cca665
> Key= com.opensymphony.xwork2.ActionContext.session Value= {}
> Key= com.opensymphony.xwork2.ActionContext.actionInvocation Value= com.opensymphony.xwork2.DefaultActionInvocation@c03c11
> Key= com.opensymphony.xwork2.util.ValueStack.ValueStack Value= com.opensymphony.xwork2.util.OgnlValueStack@13fb657
> Key= session Value= {}
> Key= xwork.MethodAccessor.denyMethodExecution Value= true
> Key= report.conversion.errors Value= true
> Key= struts.actionMapping Value= org.apache.struts2.dispatcher.mapper.ActionMapping@a79811
> Key= com.opensymphony.xwork2.ActionContext.parameters Value= {amount=[Ljava.lang.String;@1dc0b6b, transactionType=[Ljava.lang.String;@171c4b5, accountId=[Ljava.lang.String;@2975fa, transactionDate=[Ljava.lang.String;@754c}
> 2.1.6
> -------
> Key= com.opensymphony.xwork2.util.ValueStack.ReportErrorsOnNoProp Value= true
> Key= xwork.NullHandler.createNullObjects Value= true
> Key= current.property.path Value= null
> Key= conversion.property.fullName Value= transactionDate
> Key= last.property.accessed Value= null
> Key= report.conversion.errors Value= true
> Key= xwork.MethodAccessor.denyMethodExecution Value= true
> Key= last.bean.accessed Value= null
> Most key-value pairs are missing and at the moment my code fails to work and I get an exception. I am wondering if this is a known issue and whether there is a workaround.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Issue Comment Edited: (WW-3040) Context supplied through
convertValue to custom converter is missing many key-value pairs (including
ServletContext)
Posted by "Nikos Andreou (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/struts/browse/WW-3040?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=46318#action_46318 ]
Nikos Andreou edited comment on WW-3040 at 6/2/09 7:54 AM:
-----------------------------------------------------------
Thanks for your answer. From the above topic, I see people looking for a solution. I can personally insert the date pattern directly in my java class, but this will make my program less configurable. Changing a xml is always more convenient that changing and recompiling your code. The question that remains in my head is why this changed in Struts 2.1.6. Was there an issue is 2.0.11 that had to change in 2.1.6? I personally loved the way I could get the servletContext in conversions since I can keep the formats I want in XML and use the framework to read the strings directly.
was (Author: nikos_a):
From the above topic, I see people waiting for a solution. I can personally insert the date pattern directly in my java class, but this will make my program less configurable. Changing a xml is always more convenient that changing and recompiling your code. The question that remains in my head is why this changed in Struts 2.1.6. Was there an issue is 2.0.11 that had to change in 2.1.6? I personally loved the way I could get the servletContext in conversions since I can keep the formats I want in XML and use the framework to read the strings directly.
> Context supplied through convertValue to custom converter is missing many key-value pairs (including ServletContext)
> --------------------------------------------------------------------------------------------------------------------
>
> Key: WW-3040
> URL: https://issues.apache.org/struts/browse/WW-3040
> Project: Struts 2
> Issue Type: Bug
> Affects Versions: 2.1.6
> Environment: Windows Vista x64, Tomcat 6.0.18, Eclipse 3.4.1
> Reporter: Nikos Andreou
>
> I recently upgraded from Struts 2.0.11 to 2.1.6. I had a custom date converter class. In the convertValue method, I had the code:
> ServletContext servletContext = (ServletContext) context.get(StrutsStatics.SERVLET_CONTEXT);
> I was getting the servletContext and I was reading a param where I had my date pattern.
> With 2.0.11, the above code returns the servletContext. With 2.1.6, I get null. Basically, the difference in the context provided through
> public Object convertValue(Map context, Object value, Class toType) {}
> is this:
> 2.0.11
> ---------
> Key= com.opensymphony.xwork2.dispatcher.HttpServletRequest Value= org.apache.struts2.dispatcher.StrutsRequestWrapper@196232
> Key= com.opensymphony.xwork2.ActionContext.locale Value= en_US
> Key= com.opensymphony.xwork2.util.ValueStack.ReportErrorsOnNoProp Value= true
> Key= com.opensymphony.xwork2.dispatcher.HttpServletResponse Value= org.apache.catalina.connector.ResponseFacade@7dde6a
> Key= com.opensymphony.xwork2.ActionContext.name Value= Transaction2
> Key= com.opensymphony.xwork2.ActionContext.application Value= {org.apache.catalina.WELCOME_FILES=[Ljava.lang.String;@2a38be, blah-blah, datePattern=yyyy-MM-dd}
> Key= last.property.accessed Value= null
> Key= com.opensymphony.xwork2.dispatcher.ServletContext Value= org.apache.catalina.core.ApplicationContextFacade@11656b
> Key= request Value= {struts.valueStack=com.opensymphony.xwork2.util.OgnlValueStack@13fb657}
> Key= last.bean.accessed Value= null
> Key= parameters Value= {amount=[Ljava.lang.String;@1dc0b6b, transactionType=[Ljava.lang.String;@171c4b5, accountId=[Ljava.lang.String;@2975fa, transactionDate=[Ljava.lang.String;@754c}
> Key= __link Value= [Ljava.lang.Object;@14e518
> Key= application Value= {org.apache.catalina.WELCOME_FILES=[Ljava.lang.String;@2a38be, blah-blah, datePattern=yyyy-MM-dd}
> Key= xwork.NullHandler.createNullObjects Value= true
> Key= current.property.path Value= null
> Key= conversion.property.fullName Value= transactionDate
> Key= attr Value= org.apache.struts2.util.AttributeMap@1cca665
> Key= com.opensymphony.xwork2.ActionContext.session Value= {}
> Key= com.opensymphony.xwork2.ActionContext.actionInvocation Value= com.opensymphony.xwork2.DefaultActionInvocation@c03c11
> Key= com.opensymphony.xwork2.util.ValueStack.ValueStack Value= com.opensymphony.xwork2.util.OgnlValueStack@13fb657
> Key= session Value= {}
> Key= xwork.MethodAccessor.denyMethodExecution Value= true
> Key= report.conversion.errors Value= true
> Key= struts.actionMapping Value= org.apache.struts2.dispatcher.mapper.ActionMapping@a79811
> Key= com.opensymphony.xwork2.ActionContext.parameters Value= {amount=[Ljava.lang.String;@1dc0b6b, transactionType=[Ljava.lang.String;@171c4b5, accountId=[Ljava.lang.String;@2975fa, transactionDate=[Ljava.lang.String;@754c}
> 2.1.6
> -------
> Key= com.opensymphony.xwork2.util.ValueStack.ReportErrorsOnNoProp Value= true
> Key= xwork.NullHandler.createNullObjects Value= true
> Key= current.property.path Value= null
> Key= conversion.property.fullName Value= transactionDate
> Key= last.property.accessed Value= null
> Key= report.conversion.errors Value= true
> Key= xwork.MethodAccessor.denyMethodExecution Value= true
> Key= last.bean.accessed Value= null
> Most key-value pairs are missing and at the moment my code fails to work and I get an exception. I am wondering if this is a known issue and whether there is a workaround.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.