You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Lujie Liu (JIRA)" <ji...@apache.org> on 2009/02/26 05:41:46 UTC

[jira] Created: (WW-3012) rest plugin doesn't support handle json post request

rest plugin doesn't support handle json post request
----------------------------------------------------

                 Key: WW-3012
                 URL: https://issues.apache.org/struts/browse/WW-3012
             Project: Struts 2
          Issue Type: Bug
          Components: Plugin - REST
    Affects Versions: 2.1.6
            Reporter: Lujie Liu


I have used jquery ajax post josn request,but failed

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WW-3012) rest plugin doesn't support handle json post request

Posted by "Dave Newton (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-3012?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=45642#action_45642 ] 

Dave Newton commented on WW-3012:
---------------------------------

Have you examined the POST to see if it's being sent *as* JSON? AFAIK jQuery.post function makes a regular post, not a JSON request, but I could be remembering incorrectly.

> rest plugin doesn't support handle json post request
> ----------------------------------------------------
>
>                 Key: WW-3012
>                 URL: https://issues.apache.org/struts/browse/WW-3012
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Plugin - REST
>    Affects Versions: 2.1.6
>            Reporter: Lujie Liu
>
> I have used jquery ajax post josn request,but failed

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (WW-3012) rest plugin doesn't support handle json post request

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

Lujie Liu updated WW-3012:
--------------------------


this is my jquery javascript code
$.post(contextPath+"/pop-dialog!search.json", {
			searchColumn :$("#searchColumn").val(),
			searchOperation :$("#searchOperation").val(),
			searchKeyword :$("#searchKeyword").val(),
			tableAlias :type
		}, function(data) {
			appendToTable(data, prev);
		},"json");
if change it by using $.getJSON(....),everything is going well

This is log

[09-02-26 15:05:51 CommonsLogger.java:45] Could not find property [struts.actionMapping]
[09-02-26 15:05:51 CommonsLogger.java:45] Could not find property [struts.valueStack]
[09-02-26 15:05:51 Log4JLoggerFactory.java:96] 

Method public java.lang.String org.apache.commons.lang.exception.NestableRuntimeException.getMessage(int) threw an exception when invoked on net.sf.json.JSONException: A JSONObject text must begin with '{' at character 0 of 
The problematic instruction:
----------
==> ${msgs[0][0]} [on line 76, column 25 in org/apache/struts2/dispatcher/error.ftl]
----------

Java backtrace for programmers:
----------
freemarker.template.TemplateModelException: Method public java.lang.String org.apache.commons.lang.exception.NestableRuntimeException.getMessage(int) threw an exception when invoked on net.sf.json.JSONException: A JSONObject text must begin with '{' at character 0 of 
	at freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:130)
	at freemarker.ext.beans.SimpleMethodModel.get(SimpleMethodModel.java:138)
	at freemarker.core.DynamicKeyName.dealWithNumericalKey(DynamicKeyName.java:111)
	at freemarker.core.DynamicKeyName._getAsTemplateModel(DynamicKeyName.java:90)
	at freemarker.core.Expression.getAsTemplateModel(Expression.java:89)
	at freemarker.core.Expression.getStringValue(Expression.java:93)
	at freemarker.core.DollarVariable.accept(DollarVariable.java:76)
	at freemarker.core.Environment.visit(Environment.java:209)
	at freemarker.core.MixedContent.accept(MixedContent.java:92)
	at freemarker.core.Environment.visit(Environment.java:209)
	at freemarker.core.IfBlock.accept(IfBlock.java:82)
	at freemarker.core.Environment.visit(Environment.java:209)
	at freemarker.core.IfBlock.accept(IfBlock.java:82)
	at freemarker.core.Environment.visit(Environment.java:209)
	at freemarker.core.MixedContent.accept(MixedContent.java:92)
	at freemarker.core.Environment.visit(Environment.java:209)
	at freemarker.core.Environment.process(Environment.java:189)
	at freemarker.template.Template.process(Template.java:237)
	at org.apache.struts2.dispatcher.Dispatcher.sendError(Dispatcher.java:703)
	at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:485)
	at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
	at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:76)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
	at com.openeap.filters.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:86)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:875)
	at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
	at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
	at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
	at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
	at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.NullPointerException
	at freemarker.ext.beans.SimpleMemberModel.unwrapArguments(SimpleMemberModel.java:85)
	at freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:106)
	... 38 more
[09-02-26 15:05:51 StandardWrapperValve.java:260] Servlet.service() for servlet default threw exception
java.lang.IllegalStateException
	at org.apache.catalina.connector.ResponseFacade.sendError(ResponseFacade.java:405)
	at org.apache.struts2.dispatcher.Dispatcher.sendError(Dispatcher.java:707)
	at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:485)
	at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
	at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:76)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
	at com.openeap.filters.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:86)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:875)
	at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
	at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
	at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
	at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
	at java.lang.Thread.run(Thread.java:619)


> rest plugin doesn't support handle json post request
> ----------------------------------------------------
>
>                 Key: WW-3012
>                 URL: https://issues.apache.org/struts/browse/WW-3012
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Plugin - REST
>    Affects Versions: 2.1.6
>            Reporter: Lujie Liu
>
> I have used jquery ajax post josn request,but failed

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (WW-3012) rest plugin doesn't support handle json post request

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

Wes Wannemacher closed WW-3012.
-------------------------------

    Resolution: Incomplete

Dave, you are right... I use JQuery regularly, and the .postJSON acts just as you describe. I'm closing because we haven't seen a response in a few months.

> rest plugin doesn't support handle json post request
> ----------------------------------------------------
>
>                 Key: WW-3012
>                 URL: https://issues.apache.org/struts/browse/WW-3012
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Plugin - REST
>    Affects Versions: 2.1.6
>            Reporter: Lujie Liu
>
> I have used jquery ajax post josn request,but failed

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WW-3012) rest plugin doesn't support handle json post request

Posted by "Philip Luppens (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-3012?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=45640#action_45640 ] 

Philip Luppens commented on WW-3012:
------------------------------------

Please elaborate a bit more about what is going wrong (configuration, error logs, code), or I'm resolving this as 'Incomplete'.

> rest plugin doesn't support handle json post request
> ----------------------------------------------------
>
>                 Key: WW-3012
>                 URL: https://issues.apache.org/struts/browse/WW-3012
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Plugin - REST
>    Affects Versions: 2.1.6
>            Reporter: Lujie Liu
>
> I have used jquery ajax post josn request,but failed

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.