Problem with Restlet on GAE
Posted
by Leaf
on Stack Overflow
See other posts from Stack Overflow
or by Leaf
Published on 2010-04-13T07:39:22Z
Indexed on
2010/04/13
7:43 UTC
Read the original article
Hit count: 333
I'm trying to implement a calculator web service on GAE using Java Restlets... it works perfectly fine on localhost but when I upload my project to the Google App Engine everytime I try the web service link it says the link is broken. Here's the code I used:
public Restlet createInboundRoot() { // Create a router Restlet that routes each call to a // new instance of HelloWorldResource. Router router = new Router(getContext());
Restlet restlet = new Restlet() {
public void handle(Request request, Response response) {
// Print the requested URI path
String parameters = request.getResourceRef().getRemainingPart();
String message;
if(parameters.charAt(0)=='?'){
message = "" + Calculator.calculate(parameters.substring(1));
} else {
message = "";
}
response.setEntity(message, MediaType.TEXT_PLAIN);
}
};
// Defines only one route
router.attachDefault(restlet);
return router;
}
The Application it's on is mapped to the /calcservice but as I said when I upload to GAE it comes back with a broken link error. I'm developing on Eclipse 3.4 and I'm wondering if there are any parameters I have to change to include the Restlet classes.
© Stack Overflow or respective owner