cancel
Showing results for 
Search instead for 
Did you mean: 

How to get server context from within workflow action?

gyro_gearless
Champ in-the-making
Champ in-the-making
Hi friends,

something that puzzles me:

I'd like to send notification EMails from within some workflow actions to user. These emails contain a list of documents involved in the workflow; and i would like to have each document shown in the email to be a clickable link into the Alfresco repository.

So, how would i get the server name and the application context from within  a workflow action? I.e, the "http://alfresco.acme-corp.com:8080/alfresco" prefix necessary to create the proper links? Is there some bean which i could query? (The workflow action is implemented as Java class, so i would have access to all Spring beans around).

Any hint welcome… 🙂

Cheers
Gyro
1 REPLY 1

brian_robinson
Champ in-the-making
Champ in-the-making
Assuming you've configured SPP support to do this, you can make use of this bean and its properties (this is in "/opt/Alfresco/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/module/org.alfresco.module.vti/context/vti-handler-alfresco3-context.xml" by the way):

    <bean id="shareUtils" class="org.alfresco.module.vti.handler.alfresco.v3.ShareUtils">      
        <property name="shareContext">
                <value>${vti.share.shareContext}</value>
        </property>
        <property name="shareHostWithPort">
                <value>${vti.share.shareHostWithPort}</value>
        </property>
        <property name="alfrescoContext">
                <value>${vti.alfresco.deployment.context}</value>
        </property>
        <property name="alfrescoHostWithPort">
                <value>${vti.alfresco.alfresoHostWithPort}</value>
        </property>
    </bean>

Also, note that to configure these values according to best practices, you should be using /opt/Alfresco/tomcat/shared/classes/alfresco/extension/custom-vti.properties to do so (not the vti.properties file in the actual alfresco web application).