cancel
Showing results for 
Search instead for 
Did you mean: 

How to get a handle to a webscript package

neelesh100
Champ in-the-making
Champ in-the-making
Hi,

I want to create a custom webscript similar to the indexpackage webscript except I would like to just browse one particular package and I would like to be able to specify the package.  Once this is done, I can get a list of webscripts and the data related to it.

I tried resuing the indexpackagecode but when I specfiy the package in a ftl file as follows (in fact, I even tried using the indexpackage webscript):
.
.
.
<table>
          <@recurseuri package="${url.serviceContext}/index/package${pkgName}"/>
       </table>
       <br>
   
    <#macro recurseuri package>
       <#list package.children as childpath>
          <#if childpath.scripts?size &gt; 0>
            <tr><td><a href="${url.serviceContext}/index/package${childpath.path}">${childpath.path}</a>
          </#if>
          <@recurseuri package=childpath/>
       </#list> 

etc.

I get the following error:

freemarker.template.TemplateException - Expected hash. package evaluated instead to freemarker.template.SimpleScalar


I have even tried <#assign package={pkgname}> and other similar things, but most of the time I get the above mentioned error or  something like "package undefined"


Could someone please tell me how to accomplish this.


I was also wondering if I can multiple .html.ftl files for one webscript.(perhaps I could describe this in the desc.xml file) and if this is possible, somehow use the current indexpackage webscript to meet my requirements, although I would prefer the first solution.




Thanks in advance.
NS.
3 REPLIES 3

davidc
Star Contributor
Star Contributor
I don't really understand your request.

However, I can provide some info that may be of help.

First, the indexpackage web script already lists the contents of a single package - the package to list is provided in the url.  e.g. to list the samples package…

/alfresco/service/index/package/org/alfresco/sample

I was also wondering if I can multiple .html.ftl files for one webscript.(perhaps I could describe this in the desc.xml file) and if this is possible, somehow use the current indexpackage webscript to meet my requirements, although I would prefer the first solution.

You can't have multiple .html.ftl files for a single web script.  Either create a new web script, or create a new web script format of type text/html (http://wiki.alfresco.com/wiki/Web_Scripts_Framework#HTTP_Response_Formats).

neelesh100
Champ in-the-making
Champ in-the-making
Thanks for the info. It was helpful.

neelesh100
Champ in-the-making
Champ in-the-making
Hi,

Is the indexpackage webscript backed by a java bean. If so, where is this bean loacted?

thanks
Neelesh