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.
public class SiteMgrWebScript extends AbstractWebScript { public void execute(WebScriptRequest req, WebScriptResponse res) throws IOException { try {
public class SiteMgrWebScript extends AbstractWebScript { protected SiteService siteService; public void setSiteService(SiteService siteService){ this.siteService =siteService; }
<bean id="yourwebscriptId" class="yourPackage.SiteMgrWebScript" parent="webscript"> <property name="siteService"> <ref bean="SiteService" /> </property> </bean>
<webscript> <shortname>Create some sites</shortname> <description>Hands back a little bit of JSON</description> <url>/demo/simple</url> <authentication>user</authentication> <transaction>required</transaction> <format default="">argument</format> </webscript>
HTTP Status 500 - type Exception report message description The server encountered an internal error () that prevented it from fulfilling this request. exception javax.servlet.ServletException: Could not resolve view with name 'site/testShort/dashboard' in servlet with name 'Spring Surf Dispatcher Servlet' org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1042) org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:798)
public class SiteMgrWebScript extends AbstractWebScript { protected SiteService siteService; public void setSiteService(SiteService ss) { siteService = ss; } public void execute(WebScriptRequest req, WebScriptResponse res) throws IOException { try { List<SiteInfo> sites = siteService.listSites( "admin" ); SiteInfo siTest = siteService.getSite( "testShort" ); if ( siTest != null ) { System.out.println( "SITE ALREADY EXISTS, deleting first." ); siteService.deleteSite( "testShort" ); } else { System.out.println( "SITE DOES NOT EXIST, no need deleting." ); } SiteInfo siNew = siteService.createSite( "site-dashboard", "testShort", "testTitle", "testDesc", SiteVisibility.PUBLIC ); System.out.println( "Now we need to do the Share stuff, make the dashboard, etc??? How to do in Java???" ); // build a json object and put some data in it JSONObject obj = new JSONObject(); obj.put("Success", "Site created without throwing exception."); String jsonString = obj.toString(); res.getWriter().write(jsonString); } catch ( JSONException e ) { System.err.println( e.toString() ); throw new WebScriptException("Unable to serialize JSON"); } }