mercredi 1 avril 2015

How to convert socket input to String in TcpInboundGateway?

I have a TcpInboundGateway receiving content from a socket. A telnet connection already works fine, exception one thing: I'm getting the decimal representation of the input, instead of real letters.



@MessageEndpoint
public class MyEndpoint {
@ServiceActivator(inputChannel = "chan")
public String hello(String input) throws Exception {
System.out.println("Server returning: " + input);
return "Server returning: " + input;
}

@Bean
public MessageChannel chan() {
return new DirectChannel();
}

//@Bean TcpInboundGateway
//@Bean TcpConnectionFactoryFactoryBean "server"
}


Now, when I use eg a telnet connection, the input string received at the ServiceActivator is like "120,120,120" instead of "xxx" (which is decimal of ascii code).


How can I tell the gateway to automatically convert the decimal to utf-8 letters?


Aucun commentaire:

Enregistrer un commentaire