Hello everyone,
I've just started out with the restlet framework.
I've written simple server and resource classes to get started. Here's the
code:
Resource:
/import org.restlet.resource.Get;
import org.restlet.resource.ServerResource;
public class HelloWorldResource extends ServerResource {
@Get
public String represent(){
return "Hello World";
}
}/
Server:
/import org.restlet.Server;
import org.restlet.data.Protocol;
public class HelloWorldServer {
public static void main(String[] args) throws Exception {
Server server = new Server(Protocol.HTTP, 8989,
HelloWorldResource.class);
server.start();
}
}
/
When I try to run the code in Chrome by hitting /http://localhost:8989// I
get the following error:
<http://restlet-discuss.1400322.n2.nabble.com/file/n7579436/Capture.png>
This error goes away when I enclose the resource return value in xml tags
like so /<sometag>Hello World</sometag>/ and the default XML template is
displayed in Chrome with "Hello World" in the tags.
Using a /ClientResource/ variable to access the resource via code works just
fine without the tags.
Additionally, while running the same code in IE, it automatically downloads
a JSON file with the message to my computer.
What is the reason behind this kind of behavior?
Thanks.
--
View this message in context:
http://restlet-discuss.1400322.n2.nabble.com/Document-is-empty-error-while-returning-get-response-in-Chrome-tp7579436.html
Sent from the Restlet Discuss mailing list archive at Nabble.com.
------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=3160391