03-01-2011 04:21 AM
Community v3.4.0 (c 3335) schema 4,113
1 Web Scripts
Back to Web Scripts Home
Up to package /org/alfresco
The World's Simplest Webscript
GET /alfresco/service/demo/simple
Description: Hands back a little bit of JSON
Authentication: none
Transaction: none
Format Style: argument
Default Format: Determined at run-time
Id: org/alfresco/demo/simple.get
Description: classpath:alfresco/templates/webscripts/org/alfresco/demo/simple.get.desc.xml
Web Script: org/alfresco/demo/simple.get
Generated from /alfresco/service/script/org/alfresco/demo/simple.get on Mar 1, 2011 10:14:40 AM
Script Properties
Id: org/alfresco/demo/simple.get
Short Name: The World's Simplest Webscript
Description: Hands back a little bit of JSON
Authentication: none
Transaction: none
Method: GET
URL Template: /demo/simple
Format Style: argument
Default Format: [undefined]
Negotiated Formats: [undefined]
Implementation: class org.springframework.extensions.webscripts.DeclarativeWebScript
Extensions: [undefined]
Store: workspace://SpacesStore/app:company_home/app:dictionary/cm:extensionwebscripts
[No implementation files]
Store: workspace://SpacesStore/app:company_home/app:dictionary/cm:webscripts
[No implementation files]
Store: classpath:alfresco/templates/webscripts
File: org/alfresco/demo/simple.get.desc.xml
<webscript>
<shortname>The World's Simplest Webscript</shortname>
<description>Hands back a little bit of JSON</description>
<url>/demo/simple</url>
<authentication>none</authentication>
<format default="">argument</format>
</webscript>
Store: classpath:webscripts
[No implementation files]
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: 02010002 Web Script format '' is not registered
Exception: org.springframework.extensions.webscripts.WebScriptException - 02010002 Web Script format '' is not registered
org.springframework.extensions.webscripts.DeclarativeWebScript.execute(DeclarativeWebScript.java:58)
org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecute(RepositoryContainer.java:336)
org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecuteAs(RepositoryContainer.java:466)
org.alfresco.repo.web.scripts.RepositoryContainer.executeScript(RepositoryContainer.java:263)
org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:333)
org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:189)
org.springframework.extensions.webscripts.servlet.WebScriptServlet.service(WebScriptServlet.java:118)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
org.alfresco.web.app.servlet.GlobalLocalizationFilter.doFilter(GlobalLocalizationFilter.java:58)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:859)
org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:579)
org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1555)
java.lang.Thread.run(Thread.java:619)
Server: Community v3.4.0 (c 3335) schema 4,113
Time: Mar 1, 2011 10:14:35 AM
Diagnostics: Inspect Web Script (org/alfresco/demo/simple.get)
Web Script Status 500 - Internal Error
The Web Script /share/page/script/org/alfresco/module/demoscripts/simple.get 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: 02010000 Web Script Id 'org/alfresco/module/demoscripts/simple.get' not found
Exception: org.springframework.extensions.webscripts.WebScriptException - 02010000 Web Script Id 'org/alfresco/module/demoscripts/simple.get' not found
org.springframework.extensions.webscripts.bean.ServiceDump.executeImpl(ServiceDump.java:61)
org.springframework.extensions.webscripts.DeclarativeWebScript.executeImpl(DeclarativeWebScript.java:235)
org.springframework.extensions.webscripts.DeclarativeWebScript.execute(DeclarativeWebScript.java:64)
org.springframework.extensions.webscripts.PresentationContainer.executeScript(PresentationContainer.java:69)
org.springframework.extensions.webscripts.LocalWebScriptRuntimeContainer.executeScript(LocalWebScriptRuntimeContainer.java:231)
org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:333)
org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:189)
org.springframework.extensions.webscripts.servlet.mvc.WebScriptView.renderMergedOutputModel(WebScriptView.java:99)
org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:250)
org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1060)
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:798)
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:716)
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:647)
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:552)
javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
org.alfresco.web.site.servlet.MTAuthenticationFilter.doFilter(MTAuthenticationFilter.java:74)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
org.alfresco.web.site.servlet.SSOAuthenticationFilter.doFilter(SSOAuthenticationFilter.java:301)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:859)
org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:579)
org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1555)
java.lang.Thread.run(Thread.java:619)
Server: Spring WebScripts - v1.0.0 (Release Candidate 2 739) schema 1,000
Time: Mar 1, 2011 10:12:37 AM
.jar file in <Alfresco>/tomcat/webapps/alfresco/WEB-INF/lib or class files in <Alfresco>/tomcat/webapps/alfresco/WEB-INF/classes
web-scripts-application-context.xml - <Alfresco>/tomcat/webapps/alfresco/WEB-INF/classes/alfresco
simple.get.desc.xml - <Alfresco>/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/demo
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.7.1
Created-By: 19.0-b09 (Sun Microsystems Inc.)
03-01-2011 11:46 AM
<html>
<body>
<p>${status.code}</p>
<p>${status.message}</p>
</body>
</html>
<format default="html">argument</format>
into simple.get.desc.xml.
<html>
<body>
<p>200</p>
<p></p>
</body>
</html>
03-01-2011 12:02 PM
03-02-2011 05:56 AM
I find your description unclear but I do note that I don't see your Java Backed Web Script being registered anywhere.
package com.packtpub.a3ws.samples.ch07;
import java.util.HashMap;
import java.util.Map;
import org.springframework.extensions.webscripts.Cache;
import org.springframework.extensions.webscripts.DeclarativeWebScript;
import org.springframework.extensions.webscripts.Status;
import org.springframework.extensions.webscripts.WebScriptRequest;
public class HelloWorldJavaWebScript extends DeclarativeWebScript {
@Override
protected Map<String, Object> executeImpl(WebScriptRequest req, Status status, Cache cache) {
Map<String, Object> model = new HashMap<String, Object>();
model.put("message", "Hello, world");
return model;
}
}
<bean id="webscript.com.packtpub.a3ws.samples.ch07.jhello.get"
class="com.packtpub.a3ws.samples.ch07.HelloWorldJavaWebScript"
parent="webscript" />
<webscript>
<shortname>jhello</shortname>
<description>Another try</description>
<url>/jhello</url>
<authentication>none</authentication>
<format default="html">argument</format>
</webscript>
<html>
<body>
<p>If it doesn't work, it will be a tragedy!</p>
<p>${message}</p>
</body>
</html>
com/packtpub/a3ws/samples/ch07/HelloWorldJavaWebScript.class
…\WEB-INF\classes\alfresco\templates\webscripts\com\packtpub\a3ws\samples\ch07
. jhello.get.desc.xml
. jhello.get.html.ftl
. jhello-context.xml
…\WEB-INF\classes\com\packtpub\a3ws\samples\ch07\HelloWorldJavaWebScript.class
jhello
GET /alfresco/service/jhello
Description: Another try
Authentication: none
Transaction: none
Format Style: argument
Default Format: html
Id: com/packtpub/a3ws/samples/ch07/jhello.get
Description: classpath:alfresco/templates/webscripts/com/packtpub/a3ws/samples/ch07/jhello.get.desc.xml
Web Script: com/packtpub/a3ws/samples/ch07/jhello.get
Generated from /alfresco/service/script/com/packtpub/a3ws/samples/ch07/jhello.get on Mar 2, 2011 11:53:23 AM
Script Properties
Id: com/packtpub/a3ws/samples/ch07/jhello.get
Short Name: jhello
Description: Another try
Authentication: none
Transaction: none
Method: GET
URL Template: /jhello
Format Style: argument
Default Format: html
Negotiated Formats: [undefined]
Implementation: class org.springframework.extensions.webscripts.DeclarativeWebScript
Extensions: [undefined]
Store: workspace://SpacesStore/app:company_home/app:dictionary/cm:extensionwebscripts
[No implementation files]
Store: workspace://SpacesStore/app:company_home/app:dictionary/cm:webscripts
[No implementation files]
Store: classpath:alfresco/extension/templates/webscripts
[No implementation files]
Store: classpath:alfresco/templates/webscripts
File: com/packtpub/a3ws/samples/ch07/jhello.get.desc.xml
<webscript>
<shortname>jhello</shortname>
<description>Another try</description>
<url>/jhello</url>
<authentication>none</authentication>
<format default="html">argument</format>
</webscript>
File: com/packtpub/a3ws/samples/ch07/jhello.get.html.ftl
<html>
<body>
<p>If it doesn't work, it will be a tragedy!</p>
<p>${message}</p>
</body>
</html>
Store: classpath:webscripts
[No implementation files]
The Web Script /alfresco/service/jhello 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: 02020005 Wrapped Exception (with status template): 02020003 Errore durante lelaborazione del modello '{0}'. Contattare lamministratore di sistema.
Exception: freemarker.core.NonStringException - Error on line 4, column 6 in com/packtpub/a3ws/samples/ch07/jhello.get.html.ftl Expecting a string, date or number here, Expression message is instead a org.springframework.extensions.webscripts.MessageMethod
freemarker.core.Expression.getStringValue(Expression.java:126)
freemarker.core.Expression.getStringValue(Expression.java:93)
freemarker.core.DollarVariable.accept(DollarVariable.java:76)
freemarker.core.Environment.visit(Environment.java:210)
freemarker.core.MixedContent.accept(MixedContent.java:92)
freemarker.core.Environment.visit(Environment.java:210)
freemarker.core.Environment.process(Environment.java:190)
……..
03-02-2011 11:33 AM
[…]
<!– Execute: ant -f build.xml –>
[…]
<target name="compile" depends="init">
<javac srcdir="${basedir}/src" destdir="${basedir}/build" classpathref="libs">
</javac>
</target>
<path id="libs">
<fileset dir="../alfresco-community-sdk-3.4.b/lib" includes="**/*.jar" />
</path>
<target name="archive" depends="compile">
<jar destfile="${basedir}/deploy/jar/jhello.jar" basedir="${basedir}/build" compress="true" update="true" />
</target>
</project>
03-03-2011 04:18 AM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.