cancel
Showing results for 
Search instead for 
Did you mean: 

Web Script AMP

cgonzalez
Champ on-the-rise
Champ on-the-rise
Hello.

It is posible to include Web Scripts in an AMP file.


If it's posible, how should i do this?

Thanks
13 REPLIES 13

alex888
Champ in-the-making
Champ in-the-making
Hi Jean,

I'm developing an AMP that includes a variation of the code from your famous article about how to implement dependant combo boxes based on Lucene Queries.

As you know, to make that code work, you have to change two jsf configuration files: faces-config-beans.xml and faces-config-repo.xml (i'm not completelly sure about filenames). i would like to make my AMP configure this automatically, could you please suggest me how to do it?.

Bye the way, I'm not sure if I should had been opening a new thread but I wanted to ask directly to you, Jean. I apologize if I'm bothering somebody …

Many thanks and kind regards.

chandu7ee
Champ in-the-making
Champ in-the-making
Check the article i composed to create an amp for alfresco

http://aboutalfresco.blogspot.com/2010/01/creating-amps-in-alfresco-to-change.html

mastro
Champ in-the-making
Champ in-the-making
Hi,

Because there's not good way to uninstall AMP right now and this make not easy testing the bootstrap I have changed the context-model.xml to add a new webscipt.classpathstore as follow.

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>

<beans>
  <import resource="classpath:alfresco/module/mymodule/context/bootstrap-context.xml" />
 
  <bean parent="webscripts.classpathstore">
    <property name="classPath"><value>alfresco/module/mymodule/webscripts/</value></property>
  </bean>
   
</beans>

I think this is a better solution than use the bootstrapt. Because you don't have to install over and over again. You just can add an remove web scripts from your amp file.


I hope it helps.

Hi gonzales

I'd like to try your proposal but I don't know where to put my webscripts in the amp module

where am I supposed to place webscripts? in which directory of the module?


can I change the classpath from

alfresco/module/mymodule/webscripts/

like:

com.mycompany.com/mymodule/webscripts/rest-serviceses/

?

thanks

mastro
Champ in-the-making
Champ in-the-making
Solved finally…

following this:
http://wiki.alfresco.com/wiki/Web_Scripts#Deciding_Where_to_Place_Web_Script_Implementation

These files need to be stored in a folder somewhere. They can live in either the Alfresco Repository or the Java ClassPath. The following folders are listed in the sequence in which Alfresco searches for Web Script implementation files:
    repository folder: /Company Home/Data Dictionary/Web Scripts Extensions
  • repository folder: /Company Home/Data Dictionary/Web Scripts

  • class path folder: /alfresco/extension/templates/webscripts

  • class path folder: /alfresco/templates/webscripts
Within any of these folders, you can use subfolders to organize web scripts.

This means that in the AMP file you just have to make sure the files end up under <war>/WEB-INF/classes/alfresco/extension/templates/webscripts or <war>/WEB-INF/classes/alfresco/templates/webscripts.

It is advised to create a folder structure with package style (com/yourcompany/projectname/module/…) inside those directories to avoid conflicts with other webscripts.

Choosing /alfresco/extension/templates/webscripts as directory you have to make your files end up in /config/alfresco/extension/templates/webscripts/ in your AMP file: doing so with the maven-alfresco plugin means placing them in  src/main/resources/alfresco/extension/templates/webscripts/

hope this help somebody else Smiley Wink