|
QuickStart
Download & SourcesIt is recommended to use the latest version from the Download page InstallationInstall the Alfreco @MVC jar file in you application or container lib directory. Once installed this webscript enables the usage of Spring MVC within Alfresco. Configure the webscriptA common place would be the module-context.xml file <bean id="webscript.#XXX#.dispatch.post" class="com.gradecak.alfresco.mvc.DispatcherWebScript" parent="webscript" scope="prototype">
<property name="contextConfigLocation" value="/YOUR_MODULE_PATH/servlet-context.xml"/>
</bean>
and the descriptor (this is an example) <webscript>
<shortname>Dispatcher web script</shortname>
<description>Dispatcher web script</description>
<url>/PATH/{path}</url>
<url>/PATH</url>
<format default="json" />
<authentication>none</authentication>
<transaction>none</transaction>
</webscript>
servlet-context.xmlSimply enable Spring annotations and use all the Spring config supported by Spring release included in Alfresco. Sure, do not forget to include the package scanner in order to let Spring know about your annotated classes. <context:component-scan base-package="com.gradecak.spring.controller" /> Spring controller@Controller
@RequestMapping("/user/*")
public class UserController {
@RequestMapping(value = "get", method = RequestMethod.GET)
public String getUser(@RequestParam String userId) {
....
}
}
|
► Sign in to add a comment
Give as some example app :). Please.
probably I will during this month.