java - Get PathVariable using spring integration -



java - Get PathVariable using spring integration -

from url want extract pdf name

localhost:port/server/inboundgateway/pdf/ <int-http:inbound-gateway id="inboundgateway" request-channel="request" reply-channel="response" supported-methods="get,post" request-payload-type="java.lang.string" path="/inboundgateway/{type}" <int-http:header name="type" expression="#pathvariables.type" /> </int-http:inbound-gateway>

in above code (int-http:header name="type" ) type pdf how extract value in java code not able httpservletrequest

i routing on bases of supported-method

<int:router input-channel="request" expression="headers.http_requestmethod"> <int:mapping value="post" channel="contentdownload" /> </int:router> <int:service-activator input-channel="contentdownload" method="extract" ref="downloadpayloadextractor" output-channel="contentrouter"></int:service-activator>

in downloadpayloadextractor want pathvariable

these log's

severe: servlet.service() servlet [inboundgateway] in context path [/mgl-crm-server] threw exception

org.springframework.integration.messagehandlingexception: java.lang.illegalargumentexception: required header not available: type @ org.springframework.integration.handler.methodinvokingmessageprocessor.processmessage(methodinvokingmessageprocessor.java:76) @ org.springframework.integration.handler.serviceactivatinghandler.handlerequestmessage(serviceactivatinghandler.java:64) @ org.springframework.integration.handler.abstractreplyproducingmessagehandler.handlemessageinternal(abstractreplyproducingmessagehandler.java:98) @ org.springframework.integration.handler.abstractmessagehandler.handlemessage(abstractmessagehandler.java:78) @ org.springframework.integration.dispatcher.unicastingdispatcher.dodispatch(unicastingdispatcher.java:110) @ org.springframework.integration.dispatcher.unicastingdispatcher.dispatch(unicastingdispatcher.java:97) @ org.springframework.integration.channel.abstractsubscribablechannel.dosend(abstractsubscribablechannel.java:61) @ org.springframework.integration.channel.abstractmessagechannel.send(abstractmessagechannel.java:157) @ org.springframework.integration.channel.abstractmessagechannel.send(abstractmessagechannel.java:128) @ org.springframework.integration.core.messagingtemplate.dosend(messagingtemplate.java:288) @ org.springframework.integration.core.messagingtemplate.send(messagingtemplate.java:149) @ org.springframework.integration.router.abstractmessagerouter.handlemessageinternal(abstractmessagerouter.java:220) @ org.springframework.integration.handler.abstractmessagehandler.handlemessage(abstractmessagehandler.java:78) @ org.springframework.integration.dispatcher.unicastingdispatcher.dodispatch(unicastingdispatcher.java:110) @ org.springframework.integration.dispatcher.unicastingdispatcher.dispatch(unicastingdispatcher.java:97) @ org.springframework.integration.channel.abstractsubscribablechannel.dosend(abstractsubscribablechannel.java:61) @ org.springframework.integration.channel.abstractmessagechannel.send(abstractmessagechannel.java:157) @ org.springframework.integration.core.messagingtemplate.dosend(messagingtemplate.java:288) @ org.springframework.integration.core.messagingtemplate.dosendandreceive(messagingtemplate.java:318) @ org.springframework.integration.core.messagingtemplate.sendandreceive(messagingtemplate.java:239) @ org.springframework.integration.gateway.messaginggatewaysupport.dosendandreceive(messaginggatewaysupport.java:233) @ org.springframework.integration.gateway.messaginggatewaysupport.sendandreceivemessage(messaginggatewaysupport.java:207) @ org.springframework.integration.http.inbound.httprequesthandlingendpointsupport.dohandlerequest(httprequesthandlingendpointsupport.java:271) @ org.springframework.integration.http.inbound.httprequesthandlingmessaginggateway.handlerequest(httprequesthandlingmessaginggateway.java:95) @ org.springframework.web.context.support.httprequesthandlerservlet.service(httprequesthandlerservlet.java:67) @ javax.servlet.http.httpservlet.service(httpservlet.java:727) @ org.apache.catalina.core.applicationfilterchain.internaldofilter(applicationfilterchain.java:303) @ org.apache.catalina.core.applicationfilterchain.dofilter(applicationfilterchain.java:208) @ org.apache.catalina.core.standardwrappervalve.invoke(standardwrappervalve.java:220) @ org.apache.catalina.core.standardcontextvalve.invoke(standardcontextvalve.java:122) @ org.apache.catalina.authenticator.authenticatorbase.invoke(authenticatorbase.java:501) @ org.apache.catalina.core.standardhostvalve.invoke(standardhostvalve.java:171) @ org.apache.catalina.valves.errorreportvalve.invoke(errorreportvalve.java:103) @ org.apache.catalina.valves.accesslogvalve.invoke(accesslogvalve.java:950) @ org.apache.catalina.core.standardenginevalve.invoke(standardenginevalve.java:116) @ org.apache.catalina.connector.coyoteadapter.service(coyoteadapter.java:408) @ org.apache.coyote.http11.abstracthttp11processor.process(abstracthttp11processor.java:1070) @ org.apache.coyote.abstractprotocol$abstractconnectionhandler.process(abstractprotocol.java:611) @ org.apache.tomcat.util.net.jioendpoint$socketprocessor.run(jioendpoint.java:314) @ java.util.concurrent.threadpoolexecutor$worker.runtask(threadpoolexecutor.java:886) @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:908) @ org.apache.tomcat.util.threads.taskthread$wrappingrunnable.run(taskthread.java:61) @ java.lang.thread.run(thread.java:662) caused by: java.lang.illegalargumentexception: required header not available: type @ org.springframework.util.assert.istrue(assert.java:65) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:39) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:25) @ java.lang.reflect.method.invoke(method.java:597) @ org.springframework.expression.spel.support.reflectivemethodexecutor.execute(reflectivemethodexecutor.java:58) @ org.springframework.expression.spel.ast.methodreference.getvalueinternal(methodreference.java:104) @ org.springframework.expression.spel.ast.compoundexpression.getvalueinternal(compoundexpression.java:57) @ org.springframework.expression.spel.ast.ternary.getvalueinternal(ternary.java:55) @ org.springframework.expression.spel.ast.methodreference.getvalueinternal(methodreference.java:60) @ org.springframework.expression.spel.ast.compoundexpression.getvalueinternal(compoundexpression.java:57) @ org.springframework.expression.spel.ast.spelnodeimpl.gettypedvalue(spelnodeimpl.java:102) @ org.springframework.expression.spel.standard.spelexpression.getvalue(spelexpression.java:102) @ org.springframework.integration.util.abstractexpressionevaluator.evaluateexpression(abstractexpressionevaluator.java:126) @ org.springframework.integration.util.messagingmethodinvokerhelper.processinternal(messagingmethodinvokerhelper.java:225) @ org.springframework.integration.util.messagingmethodinvokerhelper.process(messagingmethodinvokerhelper.java:125) @ org.springframework.integration.handler.methodinvokingmessageprocessor.processmessage(methodinvokingmessageprocessor.java:73) ... 42 more

since framewrok gets deal message<?> , gor right way populate pathvariable messageheaders.

the 1 thing remains improve code question "how access type header?". well, pojo method should improved this:

public object extract(object payload, @header("type") string type) { .... }

and that's all.

see more info in reference manual.

update

required header not available: type

well, add together config:

<wire-tap channel="logging"> <logging-channel-adapter id="logging" log-full-message="true" level="error"/>

and share here logs after receiving request , until exception.

java spring-integration

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -