AnsweredAssumed Answered

Error in alf_callback

Question asked by kapil.k@globallogic.com on Jul 18, 2008
Has anyone tested and verfied that alf_callback really works?

I created a test webscript as follows:
<webscript>
<shortname>JSON test</shortname>
<description>Sample demonstrating JSON callback</description>
<url>/pac/test</url>
<url>/pac/test.json</url>
<url>/pac/test.json?alf_callback={methodName}</url>
<format default="json">extension</format>
<authentication>admin</authentication>
<transaction>required</transaction>
</webscript>

jsontest.get.json.ftl
***************************
<#ftl ns_prefixes={"D", "http://www.alfresco.org/alfresco/pr"}>

{
   "Image": {
      "Width":800,
      "Height":600,
      "Title":"View from 15th Floor"
   }
}

Invoked with URL:
http://localhost:8080/alfresco/service/pac/test.json (worked fine)
Response
***********
{
   "Image": {
      "Width":800,
      "Height":600,
      "Title":"View from 15th Floor"
   }
}

Invoked with URL (callback param added in uRL)

http://localhost:8080/alfresco/service/pac/test.json?alf_callback=myFunction
Response
***********
tion

java.lang.IllegalStateException: getOutputStream() has already been called for this response
   org.apache.catalina.connector.Response.getWriter(Response.java:601)
   org.apache.catalina.connector.ResponseFacade.getWriter(ResponseFacade.java:196)
   org.alfresco.web.scripts.servlet.WebScriptServletResponse.getWriter(WebScriptServletResponse.java:172)
   org.alfresco.web.scripts.AbstractRuntime.executeScript(AbstractRuntime.java:200)
   org.alfresco.web.scripts.servlet.WebScriptServlet.service(WebScriptServlet.java:108)
   javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

note The full stack trace of the root cause is available in the Apache Tomcat/5.5.23 logs.

Any help will be appreciated.
Thanks,
Kapil

Outcomes