As we transition to the new Hyland Community, some post links may be temporarily disrupted as we finalize redirects. We apologize for the inconvenience and are working to resolve this as quickly as possible. Details.
<webscript> <shortname>XForms for Alfresco 3.0</shortname> <description>BlueXML XForms data service for Alfresco 3.0</description> <url>/wscript</url> <format default="xml"/>any</format> <authentication>none</authentication> <transaction>none</transaction> <family>bluexml</family> <family>xforms</family> </webscript>
<?xml version="1.0" encoding="UTF-8"?> <result> ${response} </result>
<?xml version='1.0' encoding='UTF-8'?> <!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'> <beans> <!– BlueXML XForms Data Controller –> <bean id="webscript.extension.com.bluexml.xforms.wscript.get" class="com.bluexml.xforms.controller.alfresco3x0.XFormsWebScript" parent="webscript"> <property name="dictionaryService"> <ref bean="dictionaryService" /> </property> </bean> </beans>
<!– SimpleWebScript –> <bean id="webscript.org.alfresco.demo.simple.get" class="org.alfresco.module.demoscripts.SimpleWebScript" parent="webscript"><property name="dictionaryService" ref="DictionaryService"/> </bean>
The Web Script /alfresco/service/demo/simple has responded with a status of 500 - Internal Error. 500 Description: An error inside the HTTP server which prevented it from fulfilling the request. Message: Web Script format '' is not registered …blah blah blah
org.alfresco.web.scripts.DeclarativeWebScript
org.alfresco.web.scripts.AbstractWebScript
<bean id="webscript.org.alfresco.java.simple.get" class="test.webscript.SimpleWebScript" parent="webscript" />
package test.webscript; import java.io.IOException; import org.alfresco.web.scripts.AbstractWebScript; import org.alfresco.web.scripts.WebScriptException; import org.alfresco.web.scripts.WebScriptRequest; import org.alfresco.web.scripts.WebScriptResponse; import org.json.JSONException; import org.json.JSONObject; public class SimpleWebScript extends AbstractWebScript { public void execute(WebScriptRequest req, WebScriptResponse res) throws IOException { try { // build a json object JSONObject obj = new JSONObject(); // put some data on it obj.put("field1", "data1"); // build a JSON string and send it back String jsonString = obj.toString(); res.getWriter().write(jsonString); } catch(JSONException e) { throw new WebScriptException("Unable to serialize JSON"); } } }
<webscript> <shortname>The World's Simplest Webscript</shortname> <description>Hands back a little bit of JSON</description> <url>/java/simple</url> <authentication>none</authentication> <format default="">argument</format> </webscript>
07210001 Web Script org/alfresco/java/simple.get already associated with the 'Presentation' container (classpath:alfresco/webscripts/org/alfresco/java/simple.get.desc.xml)
<bean id="webscript.test.simple.get" class="com.test.webscript.SimpleWebscript" parent="webscript" />
{ "status" : "${status}", "x" : "${x}", "y" : "${y}" }
<webscript> <shortname>Simple Webscript</shortname> <description>Returns JSON results</description> <url>/test/simple</url> <format default="json">extension</format> <authentication>none</authentication> </webscript>
import java.util.HashMap; import java.util.Map; import org.alfresco.web.scripts.DeclarativeWebScript; import org.alfresco.web.scripts.Status; import org.alfresco.web.scripts.WebScriptRequest; public class SimpleWebscript extends DeclarativeWebScript { @Override protected Map<String, Object> executeImpl(WebScriptRequest request, Status status) { String responseStatus = "200"; String x = "xxx"; String y = "yyy"; Map<String, Object> model = new HashMap<String, Object>(); model.put("status", responseStatus); model.put("x", x); model.put("y", y); return model; } }
{ "status" : { "code" : 500, "name" : "Internal Error", "description" : "An error inside the HTTP server which prevented it from fulfilling the request." }, "message" : "Wrapped Exception (with status template): Error during processing of the template 'Expression x is undefined on line 3, column 20 in test\/simple.get.json.ftl.'. Please contact your system administrator.", "exception" : "org.alfresco.web.scripts.WebScriptException - Wrapped Exception (with status template): Error during processing of the template 'Expression username is undefined on line 3, column 20 in test\/simple.get.json.ftl.'. Please contact your system administrator.", ….