[ 
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

Reply via email to