-
Notifications
You must be signed in to change notification settings - Fork 10
Home
Daniel Gradecak edited this page May 8, 2025
·
22 revisions
Personally I do not like webscripts because of the boilerplate code that comes with them (XML, FTL, Java/Javascript). Also I am not a big fan of javascript on the server side esither, as in a medium sized application this becomes unmaintainable. That is why I wrote Alfresco @MVC.
Alfresco @MVC consists of two libraries: REST and AOP.
<dependency>
<groupId>com.gradecak.alfresco</groupId>
<artifactId>alfresco-mvc-XXX</artifactId>
<version>9.0.0</version>
</dependency>
- support for jakarta servlet
- older ACS versions (prior to 23.x) are not compatible
- Tested on Alfresco Community 23.1.0, 23.2.1
- dispatcherServlet bean added in the ServletContext (allows easier usage of other integrations like Spring Boot, OpenAPI,...)
- Default Servlet context updated to support updated to Jackson2
- removing ResponseMapBuilder class, use a Map builder instead
- Removing @EnableAlfrescoMvcDispatcherServlet and @EnableWebAlfrescoMvc , use @EnableWebMvc and if you are using @AlfrescoDispatcherWebscript(servletContext = CustomServletContext.class) check if you want to @Import(DefaultAlfrescoMvcServletContextConfiguration.class) or provide your own servlet context full configuration
- Removing querytemplate
- tests improved
- maven wrapper added
- droping -RELEASE in the release version name
- Tested on Alfresco Community 6.2.0-ga, 7.1.x, 7.2.x
- Despite not being tested on Alfresco Enterprise it has to be compatible with the respectively tested Alfresco Community distribution
- Possibility to disable parent context servlet behavior @AlfrescoDispatcherWebscript(... servletConfigOptions = {ServletConfigOptions.DISABLED_PARENT_HANDLER_MAPPINGS, ...})
- DispatcherWebscript servlet context can inherit all parent context properties (alfresco global included), or by annotation @AlfrescoDispatcherWebscript(inheritGlobalProperties = true, ...)
- Tested on Alfresco Community 6.2.0-GA, 7.0.0
- Tested on Alfresco Enterprise 6.2
- Possibility to disable parent context servlet behavior
@AlfrescoDispatcherWebscript(... servletConfigOptions = {ServletConfigOptions.DISABLED_PARENT_HANDLER_MAPPINGS, ...})
- DispatcherWebscript servlet context can inherit all parent context properties (alfresco global included), or by annotation
@AlfrescoDispatcherWebscript(inheritGlobalProperties = true, ...)
- dispatchewebscript responses can be used with Alfresco REST API response processing with @AlfrescoRestResponse
@GetMapping(value = "noderefAlfrescoResponse") @AlfrescoRestResponse public ResponseEntity<?> noderefAlfrescoResponse() { ... }
- Alfresco 6 is supported alongside with Spring 5.x MVC features
- Spring Data dependencies for pagination are removed in favor of Alfresco Params pagination
- New annotation @Enabled configuration for Alfresco @MVC Rest
- QueryTemplate was droped in order to reuse the new public apis and their services
- Alfresco @MVC dist (amp distribution) is dropped, since we only provide libraries instead of concrete Alfresco modules. However our samples could still be provided as AMPs too.
- a new project structure is created
- no alfresco modules are registered when the jar/amp files are deployed
- include samples
- include a deployable alfresco project (alfresco-mvc-samples-bom/alfresco-5.2.e). You need to configure the database and alf_data
- an AMP artifact can be build from the source code (mvn clean package). You will find it under alfresco-mvc-dist/target. However, it is better to include the dependencies in your build
In the latest tomcat releases multipart servlet configuration has been disabled by default. This means that if you are uploading files using this library features over webscripts that you might encounter a problem. Therfore I would suggest to create a new servlet mapping for your extension.
- using web fragments
create web-fragment.xml in a META-INF folder on the classpath (usually in resources or config)
<web-fragment>
<servlet>
<servlet-name>myAppServlet</servlet-name>
<servlet-class>org.alfresco.repo.web.scripts.AlfrescoWebScriptServlet</servlet-class>
<multipart-config />
<init-param>
<param-name>authenticator</param-name>
<param-value>webscripts.authenticator.remoteuser</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>myAppServlet</servlet-name>
<url-pattern>/myapp/*</url-pattern>
</servlet-mapping>
</web-fragment>