Webscript overriden but controller is not getting called

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Active Member II

Webscript overriden but controller is not getting called

Hi,

I overridden the calendar create event webscript in my all in one project. When i go to http://localhost:8081/alfresco/s/index I can see the calendar/create webscript. When i go to details it shows me both the webscripts (mine and OOTB).

Custom at Store: classpath:alfresco/extension/templates/webscripts

OITB at Store: classpath:alfresco/templates/webscripts

However, whenever I create a new event, it always calls the OOTB webscript only. I've created the java controller at the same path as OOTB (org.alfresco.repo.web.scripts.calendar.CalendarEntryPost), but my custom java controller is never getting called.

Webscript location:

POST /alfresco/s/calendar/create

Below is my project structure and the webscript entry in the webscript-context.xml.

Thank you

5 Replies
Highlighted
Master

Re: Webscript overriden but controller is not getting called

Which Alfresco version are you using? Since Alfresco has decoupled the Repository and Share, some Repository-tier components required to run Share are shipped as a module (Alfresco Share Services). Between modules, there is no guaranteed order in which Spring configuration files are loaded, so it may very likely be that the bean in your module is actually being overriden by the bean from the Share Services module. Generally, it is very bad style to try to override Spring beans within modules - that is what the extension path is for. Put the Spring context file in alfresco/extension/ and your override will likely work right off the bat.

Highlighted
Active Member II

Re: Webscript overriden but controller is not getting called

Thanks for your reply Axel Faust

I am using Alfresco 5.2.1

I have the JAVA class and ftl, desc.xml file in maven project imported in Intellij. I put the webscript spring entry in C:\alfresco-content-services\tomcat\shared\classes\alfresco\extension\web-scripts-config-custom.xml .

After restarting the server I found it is still not taking the custom implementation! Is there anything that I am missing!?

Thanks,

Sanket Shah

Highlighted
Master

Re: Webscript overriden but controller is not getting called

Why are you suddently naming your file web-scripts-config-custom.xml instead of webscript-context.xml? With that of course it does not work...

Highlighted
Active Member II

Re: Webscript overriden but controller is not getting called

Hi,

In my previous post by mistake I put the wrong file name. The file name is custom-web-context.xml. This is the file at \tomcat\shared\classes\alfresco\extension\ having JAVA webscript controller entries. 

I did it because I found in tomcat\webapps\alfresco\WEB-INF\web-application-context.xml .

 

So I put everything in this file. But it is still not taking!

Thank you for your reply!

Highlighted
Active Member II

Re: Webscript overriden but controller is not getting called

Finally, I solved it.

I was creating the custom class with the same name and in the same package as of OOTB. That was the reason it was not taking it even though I was putting it into custom-web-context.xml.

I renamed my class to something else and it starts picking it up.

Thanks for your time everyone