java - Passing date input when invoking via cxf jaxrs:client -


maybe trivial, somehow have not been able around finding why doesn't work!

i have service exposed via cxf's jaxrs:server directive

<jaxrs:server id="specialservicers"     address="http://localhost:8080/specialservicers">     <jaxrs:servicebeans>         <ref bean="specialservice" />     </jaxrs:servicebeans>     <jaxrs:providers>         <bean id="jaxbprovider"             class="org.apache.cxf.jaxrs.provider.jaxbelementprovider">             <property name="marshallasjaxbelement" value="true" />             <property name="unmarshallasjaxbelement" value="true" />         </bean>         <bean class="org.codehaus.jackson.jaxrs.jacksonjsonprovider">             <property name="mapper" ref="jacksonmapper" />         </bean>         <bean class="com.kilo.progressivedatehandler" />     </jaxrs:providers> </jaxrs:server> <bean id="jacksonmapper" class="org.codehaus.jackson.map.objectmapper">     <property name="serializationconfig.dateformat">         <bean class="java.text.simpledateformat">             <constructor-arg value="yyyymmddhh:mm:ss.s" />         </bean>     </property>     <property name="deserializationconfig.dateformat">         <bean class="java.text.simpledateformat">             <constructor-arg value="yyyymmddhh:mm:ss.s" />         </bean>     </property> </bean> 

to able handle dates correctly, added date handler - progressivedatehandler - parameterhandler , paramconverter. seems work fine when invoked via browser - when invoked via java based client configured via cxf's jaxrs:client directive,

<jaxrs:client id="specialserviceclient" serviceclass="com.kilo.specialserviceimpl"     address="http://localhost:8080/specialservicers">     <jaxrs:providers>         <bean class="org.codehaus.jackson.jaxrs.jacksonjsonprovider">             <property name="mapper" ref="jacksonmapper" />         </bean>         <bean class="com.kilo.progressivedatehandler" />     </jaxrs:providers> </jaxrs:client> <bean id="jacksonmapper" class="org.codehaus.jackson.map.objectmapper"> </bean> 

i following error:

java.lang.illegalargumentexception: null value on 0 position @ org.apache.cxf.jaxrs.impl.uribuilderimpl.tostringlist(uribuilderimpl.java:767) @ org.apache.cxf.jaxrs.impl.uribuilderimpl.queryparam(uribuilderimpl.java:660) @ org.apache.cxf.jaxrs.client.abstractclient.addmatrixorquerytobuilder(abstractclient.java:671) @ org.apache.cxf.jaxrs.client.abstractclient.convertmatrixorquerytobuilder(abstractclient.java:661) @ org.apache.cxf.jaxrs.client.abstractclient.addmatrixqueryparamstobuilder(abstractclient.java:638) @ org.apache.cxf.jaxrs.client.clientproxyimpl.handlequeries(clientproxyimpl.java:432) @ org.apache.cxf.jaxrs.client.clientproxyimpl.invoke(clientproxyimpl.java:162) @ org.apache.cxf.common.util.cglibproxyhelper$1.intercept(cglibproxyhelper.java:67) @ com.kilo.specialserviceimpl$$enhancerbycglib$$f5c4ae3f.getsomestringswithdateinput(<generated>) @ com.kilo.specialservicejaxrstest.testgetsomestringswithdateinput(specialservicejaxrstest.java:57) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:57) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) @ java.lang.reflect.method.invoke(method.java:601) @ org.junit.runners.model.frameworkmethod$1.runreflectivecall(frameworkmethod.java:44) @ org.junit.internal.runners.model.reflectivecallable.run(reflectivecallable.java:15) @ org.junit.runners.model.frameworkmethod.invokeexplosively(frameworkmethod.java:41) @ org.junit.internal.runners.statements.invokemethod.evaluate(invokemethod.java:20) @ org.springframework.test.context.junit4.statements.runbeforetestmethodcallbacks.evaluate(runbeforetestmethodcallbacks.java:74) @ org.springframework.test.context.junit4.statements.runaftertestmethodcallbacks.evaluate(runaftertestmethodcallbacks.java:83) @ org.springframework.test.context.junit4.statements.springrepeat.evaluate(springrepeat.java:72) @ org.springframework.test.context.junit4.springjunit4classrunner.runchild(springjunit4classrunner.java:231) @ org.springframework.test.context.junit4.springjunit4classrunner.runchild(springjunit4classrunner.java:88) @ org.junit.runners.parentrunner$3.run(parentrunner.java:231) @ org.junit.runners.parentrunner$1.schedule(parentrunner.java:60) @ org.junit.runners.parentrunner.runchildren(parentrunner.java:229) @ org.junit.runners.parentrunner.access$000(parentrunner.java:50) @ org.junit.runners.parentrunner$2.evaluate(parentrunner.java:222) @ org.springframework.test.context.junit4.statements.runbeforetestclasscallbacks.evaluate(runbeforetestclasscallbacks.java:61) @ org.springframework.test.context.junit4.statements.runaftertestclasscallbacks.evaluate(runaftertestclasscallbacks.java:71) @ org.junit.runners.parentrunner.run(parentrunner.java:292) @ org.springframework.test.context.junit4.springjunit4classrunner.run(springjunit4classrunner.java:174) @ org.eclipse.jdt.internal.junit4.runner.junit4testreference.run(junit4testreference.java:50) @ org.eclipse.jdt.internal.junit.runner.testexecution.run(testexecution.java:38) @ org.eclipse.jdt.internal.junit.runner.remotetestrunner.runtests(remotetestrunner.java:467) @ org.eclipse.jdt.internal.junit.runner.remotetestrunner.runtests(remotetestrunner.java:683) @ org.eclipse.jdt.internal.junit.runner.remotetestrunner.run(remotetestrunner.java:390) @ org.eclipse.jdt.internal.junit.runner.remotetestrunner.main(remotetestrunner.java:197) 

on further debugging, looks using org.apache.cxf.jaxrs.provider.providerfactory$legacyparamconverter instead of paramconverter viz. progressivedatehandler. appreciate if point out going wrong - have configured incorrectly, because thisseems advertised working out of box when configuring handler.

thanks in advance!

p.s.: have test setup if wants see in action.

looks correct way use paramconverter implement paramconverterprovider interface indicated here.

@suppresswarnings("unchecked") @override public <t> paramconverter<t> getconverter(class<t> rawtype,         type generictype, annotation[] annotations) {     if (rawtype == date.class) {         return (paramconverter<t>) this;     }     return null; } 

not warming concept of 2 interfaces helping in achieving same thing sergey said on jsr-339 mailing list - got follow specs! :)

that seems rid of error - hope helps else well. also, if taking incorrect route, feel free correct me. thanks!


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

javascript - Clean way to programmatically use CSS transitions from JS? -

android - send complex objects as post php java -