abdera-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Takasho <taka...@gmail.com>
Subject Trying to create a working spring example
Date Fri, 15 Feb 2008 09:52:40 GMT
Hi All,

I am using the trunk code and I am trying to get a very simple spring
example working. I have read through the online docs, pilfered bits
from unit tests and worked through the server re-factor pdf. I have
now hit a bit of a wall as I'm pretty sure what I have should work but
it just throws errors.

I have an applicationContext.xml:

<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:a="http://abdera.apache.org"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="
    http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
    http://abdera.apache.org http://abdera.apache.org/schemas/abdera-spring.xsd"
>

	<bean id="dao" class="org.example.dao.CustomerDAOMemoryImpl" />

	<bean id="adapter" class="org.example.CustomerCollectionAdapter">
		<property name="dao" ref="dao" />
	</bean>

	<a:provider>
		<property name="workspaces">
    		<ref bean="simpleWorkspace"/>
    	</property>
		<a:targetResolver>
			<a:regexTargetResolver>
				<a:collection>/atom/feed(\?[^#]*)?</a:collection>
				<a:entry>/atom/feed/([^/#?]+)(\?[^#]*)?</a:entry>
				<a:service>/atom(\?[^#]*)?</a:service>
			</a:regexTargetResolver>
		</a:targetResolver>
	</a:provider>
	
	<bean id="simpleWorkspace"
class="org.apache.abdera.protocol.server.impl.SimpleWorkspaceInfo">
  	<property name="title" value="Customer Workspace"/>
  	<property name="collections">
  		<list>
  			<bean class="org.example.CustomerCollectionAdapter"/>
      		<ref bean="adapter"/>
  		</list>
  	</property>
  </bean>
</beans>

And a web.xml containing:

<context-param>
		<param-name>contextConfigLocation</param-name>
		<param-value>/WEB-INF/applicationContext.xml</param-value>
	</context-param>

	<listener>
		<listener-class>
			org.springframework.web.context.ContextLoaderListener
		</listener-class>
	</listener>

	<servlet id="abdera">
		<servlet-name>Abdera</servlet-name>
		<servlet-class>
			org.apache.abdera.spring.SpringAbderaServlet
		</servlet-class>
	</servlet>

	<servlet-mapping id="abdera-mapping">
		<servlet-name>Abdera</servlet-name>
		<url-pattern>/atom/*</url-pattern>
	</servlet-mapping>

And then my customer collection adapter just extends
AbstractEntityCollectionAdapter. I have a simple pojo for a Customer
object and an in-memory map storing collections of customers.

The code is deployed as a war to jetty and sucessfully initializes:

11957 [Timer-0] INFO org.springframework.web.context.ContextLoader -
Root WebApplicationContext: initialization completed in 567 ms

When I hit any URI in the application it throws the following error:

25725 [btpool0-4] ERROR
org.apache.abdera.protocol.server.servlet.AbderaServlet - Error
servicing request
java.lang.ClassCastException:
org.apache.abdera.protocol.server.impl.RegexTargetResolver cannot be
cast to org.apache.abdera.protocol.server.TargetBuilder
	at org.apache.abdera.protocol.server.impl.DefaultProvider.getTargetBuilder(DefaultProvider.java:118)
	at org.apache.abdera.protocol.server.impl.AbstractProvider.urlFor(AbstractProvider.java:93)
	at org.apache.abdera.protocol.server.context.AbstractRequestContext.urlFor(AbstractRequestContext.java:183)
	at org.apache.abdera.protocol.server.impl.AbstractCollectionAdapter.getHref(AbstractCollectionAdapter.java:61)
	at org.apache.abdera.protocol.server.impl.DefaultWorkspaceManager.getCollectionAdapter(DefaultWorkspaceManager.java:25)
	at org.apache.abdera.protocol.server.impl.AbstractProvider.process(AbstractProvider.java:116)
	at org.apache.abdera.protocol.server.FilterChain.next(FilterChain.java:42)
	at org.apache.abdera.protocol.server.servlet.AbderaServlet.service(AbderaServlet.java:90)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)

At this point I am stuck as the code is internal to Abdera and I'm
hoping that someone has seen where I'm going wrong or has a very
simple working example I can dismantle and build on.

Thanks,

Takasho

Mime
View raw message