cancel
Showing results for 
Search instead for 
Did you mean: 

Overriding default Alfresco java-backed webscripts

dgenard
Champ on-the-rise
Champ on-the-rise
Hi,
I'm trying to modify the behaviour of OpenSearch integrated into Alfresco Explorer interface, which is actually implemented by the KeywordSearch class.

So I did create a KeywordSearch subclass, named CustomKeywordSearch.
Then I had to override the webscript bean declaration "webscript.org.alfresco.repository.search.keywordsearch.get" in web-scripts-application-context.xml, to link it to my custom class.

But it seems that there is no way to override Alfresco webscript beans in a clean way, because all custom spring files (even in modules and extension) are loaded before the Alfresco web-scripts-application-context.xml. So we can't override those webscript bean definition.

I know, it would be possible to patch the KeywordSearch class, or modify default spring files, but it won't be very clean, and could cause problems for future upgrades.

Any idea on good way to achieve this ?

Denis
3 REPLIES 3

openpj
Elite Collaborator
Elite Collaborator
In order to override the standard Java-Backed WebScripts in Alfresco you have to put your bean definitions inside this classpath:

/alfresco/extension/custom-web-context.xml

This because this is the last Spring context that is loaded by Spring in Alfresco.

Hope this helps.

I am following same approach but its not working.

nikhilesh_s1vak
Confirmed Champ
Confirmed Champ
Hi Denis,

Did you find solution for this?