Saturday, October 1, 2011

Spring Surf Runtime settings & Development Mode in Share


What is the difference between the different "runtime" settings?

It seems there are these options: classpath, webapp, local, alfresco:

The runtime settings let you quickly configure Surf to look for its model objects, templates and web scripts from different places.

The default is "classpath" which means that Surf will only use the classpath to discover these files. This is good if 100% of your web application's presentation is built into a WAR file (for example). Similarly, if you specify "webapp", then Surf will look in the WEB-INF directory to discover templates and webscripts.


The "local" setting tells Surf to pick up files from a disk location outside of the web application. This means that you can change files while the web application is running and Surf will reflect the changes. This is really good for deployment scenarios where you want to publish out new pages or templates to Surf and have them get picked up without restarting the server.

Finally, the "alfresco" setting tells Surf to pick up settings from an Alfresco runtime. Shortly, this will mean that Surf can connect inherently to an Alfresco CMIS runtime and pull back your Surf objects from workspaces inside of the repository. This is really nice because it lets you add content management facilities around your Surf objects in real time - such as workflow, forms, desktop integration and renditions.




The out-of-the-box configuration is in  Alfresco\tomcat\webapps\share\WEB-INF\surf.xml file.
 
 <autowire>
 
          <!-- Pick the runtime: classpath, webapp, local, alfresco -->               
            <runtime>alfresco</runtime>            
 
          <!-- Pick the mode: development, production -->             
            <mode>production</mode>
</autowire>        
   
 
What is Spring Surf Development mode ?

Spring Surf has a number of autowire configuration modes: 1) production, 2) development.

By default Share is configured in the “production” mode – this ensures that web-tier JavaScript and FreeMarker templates are compiled and cached for maximum performance.

For development, it is much more useful to have JavaScript and Templates not cached. As mentioned above this allows simple scripts to quickly copy over new versions of files and see the results immediately in the application – no restarts required.


For that Change the setting in
Alfresco\tomcat\shared\classes\alfresco\web-extension\share-config-custom.xml file.

<!--  This is for Development mode. It should be removed when in Production --> 
 <config evaluator="string-compare" condition="WebFramework">
       <web-framework
  <autowire>
    <mode>development</mode>
   </autowire>   
</web-framework></config>   
  


1 comment:

  1. Hi Ava,

    Sure, I would to do that. :)

    Thanks a lot for appreciation.

    ReplyDelete