Thanks so much for the response chris, I've taken a look at what you've suggested.
It appears that the alfresco wcm configs that you were referring to are identical to what 'surf install' gives you when you run it from roo (there are a bunch of other beans but I think for what I'm trying to get working, roo provides everything I need). I've reverted back to what roo has provided.
So I'm still unable to get an annotated controller to execute. Could you take a quick glance at these relevant files and let me know what I have mis-configured? When the webapp deploys, I don't see any logs indicating that it has picked up my annotated controller and 'mapped' it to a specific URL.
My web-application-config.xml:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:jdbc="http://www.springframework.org/schema/jdbc"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">
<!-- SURF: required infrastructure imports -->
<import resource="surf-config.xml"/>
<!-- Maps requests to @Controllers based on @RequestMapping("path") annotation values
If no annotation-based path mapping is found, Spring MVC sends a 404 response and logs a pageNotFound warning. -->
<bean class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping">
<property name="order" value="1" />
<!--SURF: required interceptors -->
<property name="interceptors">
<list>
<ref bean="requestContextInterceptor"/>
<ref bean="themeInterceptor"/>
<ref bean="previewContextInterceptor"/>
</list>
</property>
</bean>
<!-- SURF: interoperability with annotated controllers -->
<!-- Enables annotated @Controllers; responsible for invoking an annotated POJO @Controller when one is mapped. -->
<bean id="annotationMethodHandlerAdapter" class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter"/>
<!-- SURF: interoperability with simple controllers -->
<!-- Support for Default Surf Controllers -->
<bean id="simpleControllerHandlerAdapter" class="org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter"/>
<!-- Configures Apache Commons Fileupload -->
<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
<property name="maxUploadSize" value="10000000"/>
</bean>
</beans>
My urlrewrite.xml file:
Code:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE urlrewrite PUBLIC "-//tuckey.org//DTD UrlRewrite 3.0//EN" "http://tuckey.org/res/dtds/urlrewrite3.0.dtd">
<urlrewrite default-match-type="wildcard">
<!-- Spring Surf -->
<rule>
<from>/proxy**</from>
<to>/service/proxy/$1</to>
</rule>
<rule>
<from>/res/**</from>
<to>/service/resource/$1</to>
</rule>
<rule>
<from>/service/**</from>
<to>/service/$1</to>
</rule>
<rule>
<from>/**/prodDetails/**</from>
<to>/service/ProductDetailsPage?prodid=$1</to>
</rule>
<rule>
<from>/**</from>
<to>/service/$1</to>
</rule>
<outbound-rule>
<from>/service/**</from>
<to>/$1</to>
</outbound-rule>
</urlrewrite>
My surf-config.xml:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<!-- Import Web Scripts Framework -->
<import resource="classpath*:org/springframework/extensions/webscripts/*-context.xml" />
<!-- Import Surf Framework -->
<import resource="classpath*:org/springframework/extensions/surf/*-context.xml" />
<!-- Set up to auto-resolve to url based views -->
<bean id="handlerMappings" parent="webframeworkHandlerMappings">
<property name="order" value="0" />
<!-- Remove the default handler for interoperability with other handlers -->
<property name="defaultHandler">
<bean class="org.springframework.web.servlet.mvc.UrlFilenameViewController" />
</property>
</bean>
</beans>
My annotated controller:
Code:
package com.soundstrue.directweb.spring.controller;
import com.soundstrue.directweb.Person;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
/**
*
* @version 1.0
* @since Sep 20, 2010
*/
@Controller
public class LoginController {
protected final Log logger = LogFactory.getLog(getClass());
/**
* For every request for this controller, this will
* create a person instance for the form.
*/
@ModelAttribute
public Person newRequest(@RequestParam(required=false) Integer id) {
logger.debug("public Person newRequest(Integer id)");
return (new Person());
}
/**
* <p>Person form request.</p>
*
* <p>Expected HTTP GET and request '/person/form'.</p>
*/
@RequestMapping(value="/person/form", method=RequestMethod.GET)
public void form() {
logger.debug("public void form() method");
}
}
When I try to hit the following URL I receive a 404:
http://localhost:8080/directweb/person/form