how Can we change the output format to CSV instead of HTML ?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-20-2010 05:54 AM
how can we change the output of webscript to CSV file instead of html?
following are corresponding ftl and webscript files
——————————————————————————————————————————-
<#macro recurse_macro node depth>
<#if node.isContainer>
<tr>
<td>
${node.properties.name}
</td>
<td></td>
</tr>
<#list node.children as child>
<#if child.isContainer>
<@recurse_macro node=child depth=depth+1/>
<#list child.children as child2>
<#if child2.isDocument>
<tr><td></td><td>${child2.properties.name}</td></tr>
</#if>
</#list>
</#if>
</#list>
</#if>
</#macro>
<b>Recursive Listing of Spaces & Documents:</b>
<table border="1" celpadding="1" cellspacing="1">
<tr><th> Space </th><th> Document </th></tr>
<@recurse_macro node=companyhome depth=0/>
</table>
—————————————————————————————————
<webscript>
<shortname>recurcive</shortname>
<description>Recursive</description>
<url>/sample/recursive/{recursive}</url>
<format default="html">extension</format>
<authentication>guest</authentication>
</webscript>
————————————————————————————————–
i m getting output as belowRecursive Listing of Spaces & Documents:
Space Document
Company Home
Data Dictionary
Space Templates
Software Engineering Project
Documentation
Drafts
Pending Approval
Published
Samples
system-overview.html
Discussions
UI Design
Presentations
Quality Assurance
Presentation Templates
doc_info.ftl
localizable.ftl
my_docs.ftl
my_spaces.ftl
my_summary.ftl
translatable.ftl
recent_docs.ftl
general_example.ftl
my_docs_inline.ftl
show_audit.ftl
readme.ftl
Email Templates
notify_user_email.ftl
invite_user_email.ftl
RSS Templates
RSS_2.0_recent_docs.ftl
Saved Searches
Scripts
backup.js
example test script.js
backup and log.js
append copyright.js
alfresco docs.js
test return value.js
Web Scripts
org
alfresco
sample
blogsearch.get.js
blogsearch.get.atom.ftl
blogsearch.get.desc.xml
blogsearch.get.html.ftl
blogsearch.get.html.400.ftl
blogsearch.get.atom.400.ftl
categorysearch.get.js
categorysearch.get.atom.ftl
categorysearch.get.desc.xml
categorysearch.get.html.ftl
categorysearch.get.html.404.ftl
categorysearch.get.atom.404.ftl
folder.get.js
folder.get.atom.ftl
folder.get.desc.xml
folder.get.html.ftl
avmstores.get.desc.xml
avmstores.get.html.ftl
avmbrowse.get.js
avmbrowse.get.desc.xml
avmbrowse.get.html.ftl
hello1.get.desc.xml
hello1.get.html.ftl
new.get.desc.xml
new.get.html.ftl
recursive.get.desc.xml
recursive.get.html.ftl
readme.html
Web Scripts Extensions
readme.html
Guest Home
Alfresco-Tutorial.pdf
User Homes
testacp
test.acp
please anybody knows send me post quickly?
following are corresponding ftl and webscript files
——————————————————————————————————————————-
<#macro recurse_macro node depth>
<#if node.isContainer>
<tr>
<td>
${node.properties.name}
</td>
<td></td>
</tr>
<#list node.children as child>
<#if child.isContainer>
<@recurse_macro node=child depth=depth+1/>
<#list child.children as child2>
<#if child2.isDocument>
<tr><td></td><td>${child2.properties.name}</td></tr>
</#if>
</#list>
</#if>
</#list>
</#if>
</#macro>
<b>Recursive Listing of Spaces & Documents:</b>
<table border="1" celpadding="1" cellspacing="1">
<tr><th> Space </th><th> Document </th></tr>
<@recurse_macro node=companyhome depth=0/>
</table>
—————————————————————————————————
<webscript>
<shortname>recurcive</shortname>
<description>Recursive</description>
<url>/sample/recursive/{recursive}</url>
<format default="html">extension</format>
<authentication>guest</authentication>
</webscript>
————————————————————————————————–
i m getting output as belowRecursive Listing of Spaces & Documents:
Space Document
Company Home
Data Dictionary
Space Templates
Software Engineering Project
Documentation
Drafts
Pending Approval
Published
Samples
system-overview.html
Discussions
UI Design
Presentations
Quality Assurance
Presentation Templates
doc_info.ftl
localizable.ftl
my_docs.ftl
my_spaces.ftl
my_summary.ftl
translatable.ftl
recent_docs.ftl
general_example.ftl
my_docs_inline.ftl
show_audit.ftl
readme.ftl
Email Templates
notify_user_email.ftl
invite_user_email.ftl
RSS Templates
RSS_2.0_recent_docs.ftl
Saved Searches
Scripts
backup.js
example test script.js
backup and log.js
append copyright.js
alfresco docs.js
test return value.js
Web Scripts
org
alfresco
sample
blogsearch.get.js
blogsearch.get.atom.ftl
blogsearch.get.desc.xml
blogsearch.get.html.ftl
blogsearch.get.html.400.ftl
blogsearch.get.atom.400.ftl
categorysearch.get.js
categorysearch.get.atom.ftl
categorysearch.get.desc.xml
categorysearch.get.html.ftl
categorysearch.get.html.404.ftl
categorysearch.get.atom.404.ftl
folder.get.js
folder.get.atom.ftl
folder.get.desc.xml
folder.get.html.ftl
avmstores.get.desc.xml
avmstores.get.html.ftl
avmbrowse.get.js
avmbrowse.get.desc.xml
avmbrowse.get.html.ftl
hello1.get.desc.xml
hello1.get.html.ftl
new.get.desc.xml
new.get.html.ftl
recursive.get.desc.xml
recursive.get.html.ftl
readme.html
Web Scripts Extensions
readme.html
Guest Home
Alfresco-Tutorial.pdf
User Homes
testacp
test.acp
please anybody knows send me post quickly?
Labels:
- Labels:
-
Archive
6 REPLIES 6
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-20-2010 10:19 AM
You need to indicate the response format in the web script description.
The FTL file should have the name: recursive.get.csv.ftl and the description file should have the name: recursive.get.desc.xml. The 'recursive' part can be set to anything you want. The '.get' indicates the protocol, the '.csv' part indicates the returned format, and the '.ftl' part indicates the format of the file itself.
The FTL file should have the name: recursive.get.csv.ftl and the description file should have the name: recursive.get.desc.xml. The 'recursive' part can be set to anything you want. The '.get' indicates the protocol, the '.csv' part indicates the returned format, and the '.ftl' part indicates the format of the file itself.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-20-2010 10:50 AM
I changed the FTL file name as recrsive.get.csv.ftl whenever executing the file it's showing following exception please suggest me.
The Web Script /alfresco/service/sample/recurse/{recurse} 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: IO Error during processing of the template 'org/alfresco/sample/recurse.get.html.ftl'. Please contact your system administrator.
Exception: java.io.FileNotFoundException - Template org/alfresco/sample/recurse.get.html.ftl not found.
freemarker.template.Configuration.getTemplate(Configuration.java:489)
freemarker.template.Configuration.getTemplate(Configuration.java:452)
org.alfresco.repo.template.FreeMarkerProcessor.process(FreeMarkerProcessor.java:193)
org.alfresco.web.scripts.AbstractWebScript.renderTemplate(AbstractWebScript.java:329)
org.alfresco.web.scripts.DeclarativeWebScript.renderFormatTemplate(DeclarativeWebScript.java:232)
org.alfresco.web.scripts.DeclarativeWebScript.execute(DeclarativeWebScript.java:158)
org.alfresco.web.scripts.WebScriptRuntime.wrappedExecute(WebScriptRuntime.java:342)
org.alfresco.web.scripts.WebScriptRuntime.authenticatedExecute(WebScriptRuntime.java:308)
org.alfresco.web.scripts.WebScriptRuntime$1.execute(WebScriptRuntime.java:163)
org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:225)
org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:155)
org.alfresco.web.scripts.WebScriptRuntime.executeScript(WebScriptRuntime.java:174)
org.alfresco.web.scripts.WebScriptServlet.service(WebScriptServlet.java:109)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210)
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:870)
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:685)
java.lang.Thread.run(Thread.java:595)
Exception: org.alfresco.service.cmr.repository.TemplateException - IO Error during processing of the template 'org/alfresco/sample/recurse.get.html.ftl'. Please contact your system administrator.
org.alfresco.repo.template.FreeMarkerProcessor.process(FreeMarkerProcessor.java:220)
The Web Script /alfresco/service/sample/recurse/{recurse} 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: IO Error during processing of the template 'org/alfresco/sample/recurse.get.html.ftl'. Please contact your system administrator.
Exception: java.io.FileNotFoundException - Template org/alfresco/sample/recurse.get.html.ftl not found.
freemarker.template.Configuration.getTemplate(Configuration.java:489)
freemarker.template.Configuration.getTemplate(Configuration.java:452)
org.alfresco.repo.template.FreeMarkerProcessor.process(FreeMarkerProcessor.java:193)
org.alfresco.web.scripts.AbstractWebScript.renderTemplate(AbstractWebScript.java:329)
org.alfresco.web.scripts.DeclarativeWebScript.renderFormatTemplate(DeclarativeWebScript.java:232)
org.alfresco.web.scripts.DeclarativeWebScript.execute(DeclarativeWebScript.java:158)
org.alfresco.web.scripts.WebScriptRuntime.wrappedExecute(WebScriptRuntime.java:342)
org.alfresco.web.scripts.WebScriptRuntime.authenticatedExecute(WebScriptRuntime.java:308)
org.alfresco.web.scripts.WebScriptRuntime$1.execute(WebScriptRuntime.java:163)
org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:225)
org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:155)
org.alfresco.web.scripts.WebScriptRuntime.executeScript(WebScriptRuntime.java:174)
org.alfresco.web.scripts.WebScriptServlet.service(WebScriptServlet.java:109)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210)
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:870)
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:685)
java.lang.Thread.run(Thread.java:595)
Exception: org.alfresco.service.cmr.repository.TemplateException - IO Error during processing of the template 'org/alfresco/sample/recurse.get.html.ftl'. Please contact your system administrator.
org.alfresco.repo.template.FreeMarkerProcessor.process(FreeMarkerProcessor.java:220)
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-25-2010 09:33 AM
please anybody give me reply.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-27-2010 03:04 PM
In web scripts it is important that the files that go together have the same root name. In your example, you have a web script called "recurse" which cannot find the formatting file called recurse.get.csv.ftl – this is because you named the file recrsive.get.csv.ftl. It needs to be named recurse.get.csv.ftl
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2010 04:46 AM
I resolve my Problem,There is no mime type for generate CSV file and we can't generate CSV file by using webscripts also
after generated the HTML file format using webscript then you can copy the output and paste in notepad after that copy the content in notepad and open MS Excel sheet and paste whatevere copied in notepad and save as the file with the extension as comma delimited(CSV) thats all.
after generated the HTML file format using webscript then you can copy the output and paste in notepad after that copy the content in notepad and open MS Excel sheet and paste whatevere copied in notepad and save as the file with the extension as comma delimited(CSV) thats all.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2010 11:28 AM
I resolve my Problem,There is no mime type for generate CSV file and we can't generate CSV file by using webscripts also
after generated the HTML file format using webscript then you can copy the output and paste in notepad after that copy the content in notepad and open MS Excel sheet and paste whatevere copied in notepad and save as the file with the extension as comma delimited(CSV) thats all.
Whoops. I'm sorry for misleading you.
Another alternative would have been to use XML export, as Microsoft Excel is able to read XML files directly.
