[jira] [Commented] (WW-4558) contentType override ignored for JSONInterceptor

2015-10-29 Thread Lukasz Lenart (JIRA)

[ 
https://issues.apache.org/jira/browse/WW-4558?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14981992#comment-14981992
 ] 

Lukasz Lenart commented on WW-4558:
---

The problem is that the {{contentType}} is used in both directions - to read 
incoming request and to populate response - and basically just two types are 
supported

{noformat}
"Content type must be 'application/json' or 'application/json-rpc'. Ignoring 
request with content type ", contentType
{noformat}

I think this field can be dropped

> contentType override ignored for JSONInterceptor
> 
>
> Key: WW-4558
> URL: https://issues.apache.org/jira/browse/WW-4558
> Project: Struts 2
>  Issue Type: Bug
>  Components: Plugin - JSON
>Affects Versions: 2.3.24
>Reporter: Jasper Rosenberg
>Priority: Minor
> Fix For: 2.3.x
>
>
> JSONInterceptor takes a contentType parameter, but as far as I can tell does 
> nothing with it.  I would think a reasonable way to use it would be to have 
> it used if available, rather than the content type from the request so that 
> the interceptor can be used when receiving a JSON post from a third party 
> that does not set the correct content type.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Updated] (WW-4558) contentType override ignored for JSONInterceptor

2015-10-29 Thread Lukasz Lenart (JIRA)

 [ 
https://issues.apache.org/jira/browse/WW-4558?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Lukasz Lenart updated WW-4558:
--
Fix Version/s: 2.3.x

> contentType override ignored for JSONInterceptor
> 
>
> Key: WW-4558
> URL: https://issues.apache.org/jira/browse/WW-4558
> Project: Struts 2
>  Issue Type: Bug
>  Components: Plugin - JSON
>Affects Versions: 2.3.24
>Reporter: Jasper Rosenberg
>Priority: Minor
> Fix For: 2.3.x
>
>
> JSONInterceptor takes a contentType parameter, but as far as I can tell does 
> nothing with it.  I would think a reasonable way to use it would be to have 
> it used if available, rather than the content type from the request so that 
> the interceptor can be used when receiving a JSON post from a third party 
> that does not set the correct content type.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (WW-4034) Allow to use custom JSONwriter

2015-10-29 Thread Lukasz Lenart (JIRA)

[ 
https://issues.apache.org/jira/browse/WW-4034?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14981122#comment-14981122
 ] 

Lukasz Lenart commented on WW-4034:
---

"own JSONWriter" means your own implementation of JSONWriter, it can base on 
anything ;-)

> Allow to use custom JSONwriter
> --
>
> Key: WW-4034
> URL: https://issues.apache.org/jira/browse/WW-4034
> Project: Struts 2
>  Issue Type: Improvement
>  Components: Plugin - JSON
>Reporter: Emir Buğra KÖKSALAN
>Priority: Minor
> Fix For: 2.5
>
>
> Throws when accessing to a private inner class in that method:
> private void map(Map map, Method method) throws JSONException
> May be pass when trying to access a private class. example source code should 
> be:
> {code:java}
> private void map(Map map, Method method) throws JSONException {
> this.add("{");
> ...
> while (it.hasNext()) {
> Map.Entry entry = (Map.Entry) it.next();
> Object key = entry.getKey();
> String expr = null;
> if (this.buildExpr) {
> try {
> if (key == null) {
> LOG.error("Cannot build expression for null key in " + 
> this.exprStack);
> continue;
> } else {
> expr = this.expandExpr(key.toString());
> if (this.shouldExcludeProperty(expr)) {
> continue;
> }
> expr = this.setExprStack(expr);
> }
> }
> catch (Exception ex) {
> LOG.error("Error: " + ex.getLocalizedMessage());
> continue;
> }
> }
> if (hasData) {
> this.add(',');
> }
> ...
> this.add("}");
> }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Comment Edited] (WW-4034) Allow to use custom JSONwriter

2015-10-29 Thread Othon Crelier (JIRA)

[ 
https://issues.apache.org/jira/browse/WW-4034?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14980868#comment-14980868
 ] 

Othon Crelier edited comment on WW-4034 at 10/29/15 5:29 PM:
-

Further explaining, my model has plenty of Jackson annotations such as 
@JsonIgnore in Lazy JPA properties. And JSONWriter simply won't respect them.


was (Author: othon2000):
Further explaining, my model has plenty of Jackson annotations such as 
@JsonIgnore in Lazy properties. And JSONWriter simply won't respect them.

> Allow to use custom JSONwriter
> --
>
> Key: WW-4034
> URL: https://issues.apache.org/jira/browse/WW-4034
> Project: Struts 2
>  Issue Type: Improvement
>  Components: Plugin - JSON
>Reporter: Emir Buğra KÖKSALAN
>Priority: Minor
> Fix For: 2.5
>
>
> Throws when accessing to a private inner class in that method:
> private void map(Map map, Method method) throws JSONException
> May be pass when trying to access a private class. example source code should 
> be:
> {code:java}
> private void map(Map map, Method method) throws JSONException {
> this.add("{");
> ...
> while (it.hasNext()) {
> Map.Entry entry = (Map.Entry) it.next();
> Object key = entry.getKey();
> String expr = null;
> if (this.buildExpr) {
> try {
> if (key == null) {
> LOG.error("Cannot build expression for null key in " + 
> this.exprStack);
> continue;
> } else {
> expr = this.expandExpr(key.toString());
> if (this.shouldExcludeProperty(expr)) {
> continue;
> }
> expr = this.setExprStack(expr);
> }
> }
> catch (Exception ex) {
> LOG.error("Error: " + ex.getLocalizedMessage());
> continue;
> }
> }
> if (hasData) {
> this.add(',');
> }
> ...
> this.add("}");
> }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (WW-4034) Allow to use custom JSONwriter

2015-10-29 Thread Othon Crelier (JIRA)

[ 
https://issues.apache.org/jira/browse/WW-4034?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14980868#comment-14980868
 ] 

Othon Crelier commented on WW-4034:
---

Further explaining, my model has plenty of Jackson annotations such as 
@JsonIgnore in Lazy properties. And JSONWriter simply won't respect them.

> Allow to use custom JSONwriter
> --
>
> Key: WW-4034
> URL: https://issues.apache.org/jira/browse/WW-4034
> Project: Struts 2
>  Issue Type: Improvement
>  Components: Plugin - JSON
>Reporter: Emir Buğra KÖKSALAN
>Priority: Minor
> Fix For: 2.5
>
>
> Throws when accessing to a private inner class in that method:
> private void map(Map map, Method method) throws JSONException
> May be pass when trying to access a private class. example source code should 
> be:
> {code:java}
> private void map(Map map, Method method) throws JSONException {
> this.add("{");
> ...
> while (it.hasNext()) {
> Map.Entry entry = (Map.Entry) it.next();
> Object key = entry.getKey();
> String expr = null;
> if (this.buildExpr) {
> try {
> if (key == null) {
> LOG.error("Cannot build expression for null key in " + 
> this.exprStack);
> continue;
> } else {
> expr = this.expandExpr(key.toString());
> if (this.shouldExcludeProperty(expr)) {
> continue;
> }
> expr = this.setExprStack(expr);
> }
> }
> catch (Exception ex) {
> LOG.error("Error: " + ex.getLocalizedMessage());
> continue;
> }
> }
> if (hasData) {
> this.add(',');
> }
> ...
> this.add("}");
> }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (WW-4034) Allow to use custom JSONwriter

2015-10-29 Thread Othon Crelier (JIRA)

[ 
https://issues.apache.org/jira/browse/WW-4034?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14980811#comment-14980811
 ] 

Othon Crelier commented on WW-4034:
---

"I'm planning to extend current JSON support to inject your own JSONWriter and 
maybe more"
Wonder if this is being done for 2.5, it is really a nice to have.

And why do you write your own JSONWriter instead of using Jackson anyways?

> Allow to use custom JSONwriter
> --
>
> Key: WW-4034
> URL: https://issues.apache.org/jira/browse/WW-4034
> Project: Struts 2
>  Issue Type: Improvement
>  Components: Plugin - JSON
>Reporter: Emir Buğra KÖKSALAN
>Priority: Minor
> Fix For: 2.5
>
>
> Throws when accessing to a private inner class in that method:
> private void map(Map map, Method method) throws JSONException
> May be pass when trying to access a private class. example source code should 
> be:
> {code:java}
> private void map(Map map, Method method) throws JSONException {
> this.add("{");
> ...
> while (it.hasNext()) {
> Map.Entry entry = (Map.Entry) it.next();
> Object key = entry.getKey();
> String expr = null;
> if (this.buildExpr) {
> try {
> if (key == null) {
> LOG.error("Cannot build expression for null key in " + 
> this.exprStack);
> continue;
> } else {
> expr = this.expandExpr(key.toString());
> if (this.shouldExcludeProperty(expr)) {
> continue;
> }
> expr = this.setExprStack(expr);
> }
> }
> catch (Exception ex) {
> LOG.error("Error: " + ex.getLocalizedMessage());
> continue;
> }
> }
> if (hasData) {
> this.add(',');
> }
> ...
> this.add("}");
> }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Created] (WW-4558) contentType override ignored for JSONInterceptor

2015-10-29 Thread Jasper Rosenberg (JIRA)
Jasper Rosenberg created WW-4558:


 Summary: contentType override ignored for JSONInterceptor
 Key: WW-4558
 URL: https://issues.apache.org/jira/browse/WW-4558
 Project: Struts 2
  Issue Type: Bug
  Components: Plugin - JSON
Affects Versions: 2.3.24
Reporter: Jasper Rosenberg
Priority: Minor


JSONInterceptor takes a contentType parameter, but as far as I can tell does 
nothing with it.  I would think a reasonable way to use it would be to have it 
used if available, rather than the content type from the request so that the 
interceptor can be used when receiving a JSON post from a third party that does 
not set the correct content type.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)