You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Jose L Martinez-Avial (JIRA)" <ji...@apache.org> on 2012/10/22 14:32:12 UTC

[jira] [Created] (WW-3906) All resultype parameters should be parsed for OGNL expressions

Jose L Martinez-Avial created WW-3906:
-----------------------------------------

             Summary: All resultype parameters should be parsed for OGNL expressions
                 Key: WW-3906
                 URL: https://issues.apache.org/jira/browse/WW-3906
             Project: Struts 2
          Issue Type: Improvement
          Components: Core Actions, Plugin - JSON
    Affects Versions: 2.3.4
            Reporter: Jose L Martinez-Avial


Currently only some parameters for ResultType are parsed for OGNL expression. For example, HttpHeaderResult implements that option only for errorMessage and Headers, but not for errorCode or status. So it is not possible to set dinamically the error code, it needs to be hardcoded in the XML configuration file. The same issue happens with the JSONResult. That should be changed in order to support OGNL expression for parameter values where it is possible.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (WW-3906) All resultype parameters should be parsed for OGNL expressions

Posted by "Jose L Martinez-Avial (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WW-3906?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jose L Martinez-Avial updated WW-3906:
--------------------------------------

    Attachment: patch-3906.patch
    
> All resultype parameters should be parsed for OGNL expressions
> --------------------------------------------------------------
>
>                 Key: WW-3906
>                 URL: https://issues.apache.org/jira/browse/WW-3906
>             Project: Struts 2
>          Issue Type: Improvement
>          Components: Core Actions, Plugin - JSON
>    Affects Versions: 2.3.4
>            Reporter: Jose L Martinez-Avial
>              Labels: Ognl, Result
>             Fix For: 2.3.7
>
>         Attachments: patch-3906.patch
>
>
> Currently only some parameters for ResultType are parsed for OGNL expression. For example, HttpHeaderResult implements that option only for errorMessage and Headers, but not for errorCode or status. So it is not possible to set dinamically the error code, it needs to be hardcoded in the XML configuration file. The same issue happens with the JSONResult. That should be changed in order to support OGNL expression for parameter values where it is possible.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (WW-3906) All resultype parameters should be parsed for OGNL expressions

Posted by "Jose L Martinez-Avial (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WW-3906?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13482070#comment-13482070 ] 

Jose L Martinez-Avial commented on WW-3906:
-------------------------------------------

I'm taking a look at the code of HttpHeaderResult, and I see that the execute method calls sendError(If an error has been set) before calling addHeader (if there is any header). But, according to the specification, the method sendError should be the last method to call:
"[...]If the response has already been committed, this method throws an IllegalStateException. After using this method, the response should be considered to be committed and should not be written to."

http://docs.oracle.com/javaee/6/api/javax/servlet/http/HttpServletResponse.html#sendError%28int,%20java.lang.String%29

So I suppose that should be changed in order to send the error at the end (Although I've never seen it to fail).

Also, I have some doubts about how to treat an error in the parsing of the OGNL expression. Let's say that I set the errorCode as a String, and take it throuh the TextParseUtil, but the result is not an integer. What should be the normal behaviour in that case?

                
> All resultype parameters should be parsed for OGNL expressions
> --------------------------------------------------------------
>
>                 Key: WW-3906
>                 URL: https://issues.apache.org/jira/browse/WW-3906
>             Project: Struts 2
>          Issue Type: Improvement
>          Components: Core Actions, Plugin - JSON
>    Affects Versions: 2.3.4
>            Reporter: Jose L Martinez-Avial
>              Labels: Ognl, Result
>             Fix For: 2.3.7
>
>
> Currently only some parameters for ResultType are parsed for OGNL expression. For example, HttpHeaderResult implements that option only for errorMessage and Headers, but not for errorCode or status. So it is not possible to set dinamically the error code, it needs to be hardcoded in the XML configuration file. The same issue happens with the JSONResult. That should be changed in order to support OGNL expression for parameter values where it is possible.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (WW-3906) All resultype parameters should be parsed for OGNL expressions

Posted by "Lukasz Lenart (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WW-3906?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Lukasz Lenart updated WW-3906:
------------------------------

    Fix Version/s: 2.3.7
    
> All resultype parameters should be parsed for OGNL expressions
> --------------------------------------------------------------
>
>                 Key: WW-3906
>                 URL: https://issues.apache.org/jira/browse/WW-3906
>             Project: Struts 2
>          Issue Type: Improvement
>          Components: Core Actions, Plugin - JSON
>    Affects Versions: 2.3.4
>            Reporter: Jose L Martinez-Avial
>              Labels: Ognl, Result
>             Fix For: 2.3.7
>
>
> Currently only some parameters for ResultType are parsed for OGNL expression. For example, HttpHeaderResult implements that option only for errorMessage and Headers, but not for errorCode or status. So it is not possible to set dinamically the error code, it needs to be hardcoded in the XML configuration file. The same issue happens with the JSONResult. That should be changed in order to support OGNL expression for parameter values where it is possible.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (WW-3906) All resultype parameters should be parsed for OGNL expressions

Posted by "Jose L Martinez-Avial (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WW-3906?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jose L Martinez-Avial updated WW-3906:
--------------------------------------

    Attachment:     (was: patch-3906.patch)
    
> All resultype parameters should be parsed for OGNL expressions
> --------------------------------------------------------------
>
>                 Key: WW-3906
>                 URL: https://issues.apache.org/jira/browse/WW-3906
>             Project: Struts 2
>          Issue Type: Improvement
>          Components: Core Actions, Plugin - JSON
>    Affects Versions: 2.3.4
>            Reporter: Jose L Martinez-Avial
>              Labels: Ognl, Result
>             Fix For: 2.3.7
>
>         Attachments: patch-3906.patch
>
>
> Currently only some parameters for ResultType are parsed for OGNL expression. For example, HttpHeaderResult implements that option only for errorMessage and Headers, but not for errorCode or status. So it is not possible to set dinamically the error code, it needs to be hardcoded in the XML configuration file. The same issue happens with the JSONResult. That should be changed in order to support OGNL expression for parameter values where it is possible.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (WW-3906) All resultype parameters should be parsed for OGNL expressions

Posted by "Jose L Martinez-Avial (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WW-3906?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jose L Martinez-Avial updated WW-3906:
--------------------------------------

    Attachment: patch-3906.patch

Ok, I just prepared a patch in order to be able to set the error as a String, and then parse it and convert it to an int. I added a try/catch for the conversion. I also had to modify the test in order to match the new method signature, and the result of tests.
                
> All resultype parameters should be parsed for OGNL expressions
> --------------------------------------------------------------
>
>                 Key: WW-3906
>                 URL: https://issues.apache.org/jira/browse/WW-3906
>             Project: Struts 2
>          Issue Type: Improvement
>          Components: Core Actions, Plugin - JSON
>    Affects Versions: 2.3.4
>            Reporter: Jose L Martinez-Avial
>              Labels: Ognl, Result
>             Fix For: 2.3.7
>
>         Attachments: patch-3906.patch
>
>
> Currently only some parameters for ResultType are parsed for OGNL expression. For example, HttpHeaderResult implements that option only for errorMessage and Headers, but not for errorCode or status. So it is not possible to set dinamically the error code, it needs to be hardcoded in the XML configuration file. The same issue happens with the JSONResult. That should be changed in order to support OGNL expression for parameter values where it is possible.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira