Hello,
I just discover Ceylon after the nice talk of Stéphane at the Riviera JUG and I found this language really nice.
So I start to play with it and I'm currently trying to do a server-side REST application just to see how it would look in Ceylon.
I read the tour and docs I found on the site and I started a test project using io.netty '3.5.0.Final' for the http server part.
I'm able to receive requests and to reply, but I'm having a little issue when trying to convert the HTTP message body Buffer into a String
I'm getting the input buffer using
org.jboss.netty.handler.codec.http.HttpRequest.contentIt is of type
org.jboss.netty.buffer.ChannelBufferWhen I look at the documentation of that interface, there is several toString() overloaded methods to convert the buffer to a string
http://static.netty.io/3.5/api/org/jboss/netty/buffer/ChannelBuffer.html#toString%28java.lang.String%29So I decide to use the simplest one for my test which is:
String toString(String charsetName) (it is a deprecated one but I'd like to stay simple to start)
My call is written as below:
return buffer.string("UTF-8");
But when I compile, I have the following error raised by the compiler:
.../test/source/main/HttpServerHandler.ceylon:62: error: invoked expression must be callable: String is not a subtype of Callable
return buffer.string("UTF-8");
Which seems normal as string is an attribute in ceylon.
Si I tried to see if using an alias in the import would solve the issue.
import org.jboss.netty.buffer { ChannelBuffer {convertToString=toString} }
and change my call to:
return buffer.convertToString("UTF-8");
And the compilation output:
.../test/source/main/HttpServerHandler.ceylon:63: error: cannot find symbol
return buffer.convertToString("UTF-8");
^
symbol: method $toString(String)
location: variable buffer of type ChannelBufferFor information, in eclipse, I have a compile error with both notations but with the second one, on a mouse over the method call, the following declaration is found by eclipse:
formal String toString(String? string)which looks pretty good
I'm using ceylon 0.4
I don't know if I'm missing something or if there is a bug in the interop with java toString() overloaded methods
If it is a bug, just tell me and I will open a bug report for it.
I'm using ceylon 0.4
Regards,
Loic
--
You received this message because you are subscribed to the Google Groups "ceylon-dev" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/ceylon-dev/-/l04EHnMFgKYJ.
To post to this group, send email to
ceylo...@googlegroups.com.
To unsubscribe from this group, send email to
ceylon-dev+...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/ceylon-dev?hl=en.