06-06-2012 07:25 AM
public class JavaDir extends DeclarativeWebScript
{
protected Map<String, Object> executeImpl(WebScriptRequest req, Status status, Cache cache)
{
String user = null;
user = req.getParameter("username");
Map<String, Object> model = new HashMap<String, Object>();
model.put("username", user);
return model;
}
}
<webscript>
<shortname>Folder Listing Utility</shortname>
<description>Java-backed implementation of listing folder contents
</description>
<url>/javadir/username={username}</url>
<authentication>user</authentication>
</webscript>
<html>
<head>
<title>Folder java funciona</title>
</head>
${username} funciona
</body>
</html>
All I want now, is to display the username received. (the URI is ttp://localhost:8080/alfresco/service/javadir/{username}
500 Description: An error inside the HTTP server which prevented it from fulfilling the request.
Message: 05060023 Wrapped Exception (with status template): 05060003 Error during processing of the template 'Expression username is undefined on line 5, column 19 in org/example/javadir.get.html.ftl.'. Please contact your system administrator.
Exception: freemarker.core.InvalidReferenceException - Expression username is undefined on line 5, column 19 in org/example/javadir.get.html.ftl.
06-06-2012 08:26 AM
<webscript>
<shortname>Folder Listing Utility</shortname>
<description>Java-backed implementation of listing folder contents
</description>
<url>/javadir/username</url>
<authentication>user</authentication>
</webscript>
and try to call the webscript with06-07-2012 10:03 PM
Hi,
in your descriptor it's better to writeand try to call the webscript with<webscript>
<shortname>Folder Listing Utility</shortname>
<description>Java-backed implementation of listing folder contents
</description>
<url>/javadir/username</url>
<authentication>user</authentication>
</webscript>
http://localhost:8080/alfresco/service/javadir/username?username=Nuno
You also missed the <body> opening tag.
Regards
protected Map<String, Object> executeImpl(WebScriptRequest req,
Status status, Cache cache)
{
String content="testing";
try {
content = req.getContent().getContent();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Map<String, Object> model = new HashMap<String, Object>();
model.put("content", content);
return model;
}
———-
freemarker.core.InvalidReferenceException: Expression content is undefined on line 6, column 30 in javadir.post.html.ftl.
<html>
<head>
<title>Utilizador bomba </title>
</head>
<body>
o conteudo e o seguinte ${content}
</body>
</html>
<webscript>
<shortname>Folder Listing Utility</shortname>
<description>Java-backed implementation of listing folder contents
</description>
<url>/javadir</url>
<authentication>user</authentication>
</webscript>
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN 2.0//EN'
'http://www.springframework.org/dtd/spring-beans-2.0.dtd'>
<beans>
<bean id="webscript.org.example.javadir.post"
class="org.example.JavaDir" parent="webscript">
</bean>
</beans>
Am I not using the correct approach?06-08-2012 02:50 AM
06-08-2012 06:23 AM
Map<String, Object> model = new HashMap<String, Object>();
model.put("username", usss);
model.put("testing", test);
return model;
06-11-2012 03:04 AM
&alf_method=POST
and look at the results.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.