hi,
I created my application with :
http://www.springsurf.org/sites/1.0....beginning.html
It builds fine. but i want to use java backed web scripts.
so i started following this example :
http://wiki.alfresco.com/wiki/Java-b...cripts_Samples
so i created:
org.springframework.extensions.webscripts.custom-webscripts-context.xml
Code:<?xml version='1.0' encoding='UTF-8'?> <!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'> <beans> <bean id="webscript.webscripts.quick-links.side.get" class="entertainment.quicklink.QuickLink" parent="webscript"> </bean> </beans>
created : entertainment.quicklink.QuickLink
and the script desc :Code:package entertainment.quicklink; import java.io.IOException; import org.json.JSONException; import org.json.JSONObject; import org.springframework.extensions.webscripts.AbstractWebScript; import org.springframework.extensions.webscripts.WebScriptException; import org.springframework.extensions.webscripts.WebScriptRequest; import org.springframework.extensions.webscripts.WebScriptResponse; public class QuickLink 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"); } } }
side.get.desc.xml
if i go to the page http://localhost:8180/home/sideCode:<webscript> <shortname>Quick Links</shortname> <description>Quick Links</description> <url>/home/side</url> <authentication>none</authentication> <format default="json">argument</format> </webscript>
i get : {"field1":"data1"}
so all seems well, but if i go to my home.xml under pages/home/
and add the component :
I dont see the same result inside the component..., actually i dont see anything.Code:<?xml version='1.0' encoding='UTF-8'?> <page> <id>home</id> <title>Home Page</title> <template-instance>home</template-instance> <authentication>none</authentication> <order-id>0</order-id> <components> <component> <region-id>main</region-id> <url>/home/main</url> </component> <component> <region-id>side</region-id> <url>/home/side</url> </component> </components> <associations> <page-association> <dest-id>blog</dest-id> <assoc-type>child</assoc-type> </page-association> <page-association> <dest-id>downloads</dest-id> <assoc-type>child</assoc-type> </page-association> </associations> </page>
Do i need to render it a FTL, JSP ??
I tried using a file side.get.html.ftl, side.get.json.ftl, but it seems to ignore it .
Am i missing something? I cant seem to find any help on forums/documentation.
Thank you


Reply With Quote