我正在尝试传递我的ftl模板的位置。
在MyApplication中扩展应用程序
我试过......
getConnectorService().getClientProtocols().add(Protocol.FILE);
我甚至试图摆脱这种感觉......
ConnectorService cs =new ConnectorService();
cs.setClientProtocols(UtilMisc.toList(Protocol.FILE, Protocol.HTTP));
setConnectorService(cs);
@Override
public Restlet createInboundRoot() {
//I even added this in to get it to print out which had been set and they were in there!
for(Protocol p :getConnectorService().getClientProtocols()){
Debug.log(p.getName());
}
// initialize the Freemarker's configuration
configuration = new Configuration();
configuration
.setTemplateLoader(new ContextTemplateLoader(
getContext(),
"file:/D:/development/myexample/deploy/myexample-integrations/webapp/myexample-base/service"));
然后我在我的HtmlRepresentationHandler中有这个......
String templateName = "serviceInfo.ftl";
MediaType mediaType = MediaType.APPLICATION_XHTML;
TemplateRepresentationrep = new TemplateRepresentation(templateName, getApp().getConfiguration(), cleanServiceResultMapInstance(results), mediaType);
我总是得到同样的错误,我甚至尝试过其他协议都无济于事。
Jan 8, 2012 4:45:58 AM org.restlet.engine.component.ClientRouter getNext
[java] WARNING: The protocol used by this request is not declared in the list of client connectors. (FILE)
[java] WARNING: Unable to get the template serviceInfo.ftl. Error message: Template serviceInfo.ftl not found.