cancel
Showing results for 
Search instead for 
Did you mean: 

foundation api: in-process or in-webapp?

dirko
Champ in-the-making
Champ in-the-making
Hello,

i am trying to access the repository from a webapp which sits next to the alfresco webapp. i first tried to use JCR, but left that track. now I am trying to use the Foundation API.

from the wiki i read "It is an in-process API meaning that the client must sit within the same process as the Repository. For example, the Alfresco Web Client uses this API and is packaged together with the Repository in a single .war file for deployment to an application server.". my webapp runs in the same tomcat, so it is in-process, but then i wonder why the example of the .war is given or is it meant that the API can only be used in-webapp/context (which would explain why i have currently trouble getting it to work)?

cheers,
dirk
2 REPLIES 2

pmonks
Star Contributor
Star Contributor
Although your webapp and the Alfresco repository are in the same process from an OS perspective, Java servlet containers (in this case Tomcat) use classloader isolation techniques to "firewall" web applications from one another (more details on this for Tomcat are at http://tomcat.apache.org/tomcat-5.5-doc/class-loader-howto.html - note that most servlet containers have their own unique classloader schemes).

The upshot is that in practice the Foundation Services API is only available from within the Alfresco webapp - for all other uses you'll have to use one of Alfresco's remote APIs:

hbf
Champ on-the-rise
Champ on-the-rise
[…]for all other uses you'll have to use one of Alfresco's remote APIs

You may want to consider Tomcat's crossContext configuration option. I've used this to access, from a second webapp running next to the Web Client, the Alfresco repository (see for instance this wiki page).

Kaspar