All,
Let me tell you a quick story... Got an error in my app which I'm sure
some of you have seen:
Failure writing parameter value of component
app/controllist/consignment/EditControl:departmentid: Coercion of null
to type java.lang.Integer (via null --> String, String --> Long, Long
--> Integer) failed: null
I thought to myself... well I guess that makes sense... let me add a
Module definition and contribute the coercion for nulls to Integers.
So I check my web xml (abridged):
<context-param>
<param-name>tapestry.app-package</param-name>
<param-value>com.foo.web</param-value>
</context-param>
<filter>
<filter-name>app</filter-name>
<filter-class>org.apache.tapestry.spring.TapestrySpringFilter</filter-cl
ass>
</filter>
And conclude that I need to create the following file:
package com.foo.web.services;
import org.apache.tapestry.ioc.Configuration;
import org.apache.tapestry.ioc.services.Coercion;
import org.apache.tapestry.ioc.services.CoercionTuple;
public class AppModule {
public static void contributeTypeCoercer(
Configuration<CoercionTuple> configuration) {
System.out.println("Coercion added!");
add(configuration, void.class, Integer.class,
new Coercion<Void, Integer>() {
public Integer coerce(Void
input) {
return null;
}
});
}
private static <S, T> void add(Configuration<CoercionTuple>
configuration,
Class<S> sourceType, Class<T> targetType,
Coercion<S, T> coercion) {
CoercionTuple<S, T> tuple = new CoercionTuple<S,
T>(sourceType,
targetType, coercion);
configuration.add(tuple);
}
}
Problem is... I never see the System.out, so I can only assume that my
module never loaded (and of course, I still get the error).
Can anyone spot my flaw? I'm totally stumped.
Joel
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]