2012/10/21 JOSE L MARTINEZ-AVIAL <jlm...@gmail.com>: > I just reviewed the code, and it seems that the HttpHeaderResult only > parses the parameters headers and errorMessage, but not the parameters > status or error. I think it could be a nice thing to have. my workaround is > to extend JSONResult incorporating the following: > > public void setStatusCode(String statusCode) { > ValueStack stack = ActionContext.getContext().getValueStack(); > > setStatusCode(Integer.parseInt(TextParseUtil.translateVariables(statusCode, > stack))); > } > > public void setErrorCode(String errorCode) { > ValueStack stack = ActionContext.getContext().getValueStack(); > setErrorCode(Integer.parseInt(TextParseUtil.translateVariables(errorCode, > stack))); > } > > It works fine but I think that this feature should be incorporated to all > parameters. I would like to know opinions from other people before opening > a jira issue for this.
It makes sense, please register an issue. But jus one thing, you should delay expression evaluation to very end and not to evaluate params when you setting them up, rather when you using them in a code, like: public void setErrorCode(String errorCode) { this.errorCode = errorCode; } and in protected void writeToResponse(HttpServletResponse response, String json, boolean gzip) throws IOException { int errorCode = evaluate(errorCode); JSONUtil.writeJSONToResponse(new SerializationParams(response, getEncoding(), isWrapWithComments(), json, false, gzip, noCache, statusCode, errorCode, prefix, contentType, wrapPrefix, wrapSuffix)); } Regards -- Ćukasz mobile +48 606 323 122 http://www.lenart.org.pl/ Warszawa JUG conference - Confitura http://confitura.pl/ --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org