WebScript declaration using Spring Annotations

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

WebScript declaration using Spring Annotations

Jump to solution

Hello everybody,

I'd like to use annotations to declare webscripts. I found these 2 projects:

GitHub - andreacomo/alfresco-annotations: Spring stereotype annotations for simplifying Alfresco dev... 

GitHub - xenit-eu/dynamic-extensions-for-alfresco: Rapid development of Alfresco repository extensio... 

Official Alfresco documentation ( Registering a Java-backed web script | Alfresco Documentation  ), says that

all web script bean declarations must have the parent 'webscript'

Looking in the Spring configurations, 'webscript' bean it's only an alias.

Is it only a convention, or are there other logics that risk to be ignored using the projects that I found?

1 Solution

Accepted Solutions
afaust
Master

Re: WebScript declaration using Spring Annotations

Jump to solution

The parent "webscript" is only convention to simply writing your own web scripts without actually knowing how everything is actually wired up at runtime. The two projects you have linked basically just add their specific take on different sets of conventions to follow, and take care of the plumbing for you, just as the parent "webscript" takes care of (some of) the plumbing for you in the default convention.

View solution in original post

3 Replies
afaust
Master

Re: WebScript declaration using Spring Annotations

Jump to solution

The parent "webscript" is only convention to simply writing your own web scripts without actually knowing how everything is actually wired up at runtime. The two projects you have linked basically just add their specific take on different sets of conventions to follow, and take care of the plumbing for you, just as the parent "webscript" takes care of (some of) the plumbing for you in the default convention.

4535992
Senior Member

Re: WebScript declaration using Spring Annotations

Jump to solution

The answer of Axel is right, but if you need to use annotations of spring anyway i suggest to you the project:

GitHub - dgradecak/alfresco-mvc: Glue between SpringMVC and Alfresco 

of dgradecak like alternative to the other two.

in the docuemntation you can find some example with the webscripts:

@Bean(name = { "webscript.alfresco-mvc.mvc.post", "webscript.alfresco-mvc.mvc.get", "webscript.alfresco-mvc.mvc.delete", "webscript.alfresco-mvc.mvc.put" })
public DispatcherWebscript dispatcherWebscript() {
DispatcherWebscript dispatcherWebscript = new DispatcherWebscript();
dispatcherWebscript.setContextClass(org.springframework.web.context.support.AnnotationConfigWebApplicationContext.class);
dispatcherWebscript.setContextConfigLocation(AlfrescoMvcHateoasConfig.class.getName());
return dispatcherWebscript;
}

ruudg
Active Member II

Re: WebScript declaration using Spring Annotations

Jump to solution

Thank you for your suggestion. I will check this project for sure.