struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From JOSE L MARTINEZ-AVIAL <jlm...@gmail.com>
Subject Re: json result type not parse OGNL expressions in params
Date Mon, 22 Oct 2012 12:33:01 GMT
I just created the issue:

https://issues.apache.org/jira/browse/WW-3906

I think I can implement part of this issue on my own. What do I need to do
in order to collaborate in this?

Thanks

JL


2012/10/22 Lukasz Lenart <lukaszlenart@apache.org>

> 2012/10/21 JOSE L MARTINEZ-AVIAL <jlmagc@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-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message