restlet

How can I speed up Restlet for Android when using OData?

I am attempting to use Restlet for Android to query an OData data source. However, I am not impressed with its performance in both the emulator as well on a real device. I have the requests made in a wrapper AsyncTask to make the UI responsive but it still takes over 1 minute to finally return the objects. I get plenty of these in the L...

Restlet Tutorial example

I am having trouble getting the tutorial example to work on GAE. AppEngine Log says: "GET /contacts/123 HTTP/1.1" 404 598 - "Restlet-Framework/2.1snapshot,gzip(gfe)" javax.servlet.ServletContext log: ContactRestlet: [Restlet] Attaching application: com.sem.server.rest.ContactApp@1bbc779 to URI: /contacts/123 This request caused a new pr...

Get key-value pairs from POST body in Restlets

This may or may not be the dumbest question ever. I'm using Restlet. When the client (which I do not control) POSTs to the URL, I can call the function: representation.getText(); Which produces the following example list of key-value pairs in string form: CallStatus=in-progress&CallerCountry=US&CalledZip=24013&ApiVersion=2008-08-01...

How to setup root url for Restlet

At the root of your Restlet web service, something like this: http://localhost:8080/foobarwebservice/ My page is blank... I suspect that when a user/programmer wants to find out resources available on the webservice and how they should be accessed e.g. url format and parameters to pass. Then it should be here - a REST form of a WSDL ...

Java accessing ServletContext from within restlet Resource

I am using Tomcat server in java and wanted to be able to access the ServletContext from the restlet Resource in order to access my cached DataSource object (to pool mysql connections). org.restlet.resource.Resource comes with a Context object but that is not in any way related to the ServletContext. So after some googling around, I foun...

Cookies using App Engine and Restlets

I would like to store an authentication token in a session cookie. I'm using google app engine and restlets. I've done a few searches, but I have no idea even where to begin. I would like to: Store the token in a cookie Read the cookie when the client makes a request through restlet Also, is the session cookie the correct place to...

Set a cookie in restlet

I'm having a heck of a time setting a cookie in restlet, heres what I have so far:: public class CookieTestResource extends ServerResource { @Post public Representation post(Representation representation){ CookieSetting cS = new CookieSetting( 1, "cookieName", "cookieVal...

Restlet ServerResource method parameters?

Hello, This is probably a really stupid/simple question with such an obvious answer that it seems not worth stating in restlet documentation. Where and how (if at all) can Restlet pass parameters to methods in ServerResource classes? Given this class: public class FooServerResource extends ServerResource { @Get public String f...

Work with OData secured service

I want to generate entity classes and Service class of OData secured service. In OData Java extension page it is written that I need to use org.restlet.ext.odata.Generator class that should get uri and output directory parameters. But if my OData service is secured the generator instance is not able to generate service classes without us...

Cookies - Store an authentication token

I'd like to place a cookie on the client that holds an authentication token. After they log in with their credentials, they can just send the token instead of credentials until the server determines the token has expired. Below is the constructor for the cookie. I'm using restlets and am unsure about what to set "path" and "domain" to...

How to add header for http request

I am new to Restlet development, trying to add headers to do a HTTP request. I tried the following code, but got "400 bad request, the header is not valid" String url = "http://xxxxx"; Client c = new Client(Protocol.HTTP); Request request = new Request(Method.GET, url); HashMap attributes = new HashMap(); attributes.put = ("DeviceID",...

Reading the first part of a file using HTTP

I would like to determine the type of a file (generally UTF-8) by reading the first part of the file and analysing the content. (The type is specific to my community but not under my control and not covered by MIME/MediaType which is normally TEXT_PLAIN). I am using the 'org.restlet' library on the client to analyse the header with Req...

Restlet POSTing JSON to Appengine error

We have a small app with Restlet on the GAE server and GWT and Android clients. Restlet serves GWT-serialized replies to GWT clients and JSON to Android clients. All is ok with GWT-serialization both locally and on AppEngine production servers. All is ok with Android (JSON) clients talking to local dev server. Android taking to produc...

Can a log4j (or other Java logger) Appender accept or access request context objects?

I am currently writing a web service using Restlet, and logging with slf4j in front of log4j. Currently I have standard log4j Appenders in place for logging to files. What I was trying to do is also include log output in the HTTP Response, using a custom Appender. The issue I am seeing is that Appenders by default have no ability to...