java - Mule REST Component Return type -
i trying implement rest component in mule flow , able expose rest services , response coming client also. when put mule java component access properties of rest component response, not able that. below code of mule message processor,
public class restresponseprocessor implements callable{ @override public object oncall(muleeventcontext eventcontext) throws exception { object messagepayload = eventcontext.getmessage().getpayload(); system.out.println("message payload class " + messagepayload.getclass()); org.mule.module.jersey.jerseyresourcescomponent jerseyresponse = (org.mule.module.jersey.jerseyresourcescomponent) messagepayload; system.out.println("jerseyresponse.getclass() " + jerseyresponse.getclass()); return eventcontext; } }
the output first sysout message payload class class org.mule.module.jersey.jerseyresourcescomponent$2
when trying cast org.mule.module.jersey.jerseyresourcescomponent
object, giving classcastexception, java.lang.classcastexception: org.mule.module.jersey.jerseyresourcescomponent$2 cannot cast org.mule.module.jersey.jerseyresourcescomponent
$2 means after class name , can possible solution this.
basically trying route message based on rest component response before sending response client.
hope clear question.
i got answer mule forum.
$2 anonymous class of type org.mule.api.transport.outputhandler created jersey component.
i tried using "byte array string" , worked. solved purpose.