restlet

Why is a html form post to a restlet resource not working?

Restlet's (2.0M6 on Google App Engine) annotations are actually sensible to the order of a resource's methods. When posting html form data, make sure that the @Post("html") method stays above the @Post("xml") method in the receiving resource. At least Firefox puts both content types into the request's Accept header, so the first matchin...

AppEngine with Restlet handling requests, NullPointEerexception with DomRepresentation response

After deploying my App Engine app and doing a POST request that is supposed to return XML, I get the following error: org.restlet.engine.http.HttpServerAdapter commit: An exception occured writing the response entity java.io.IOException: Couldn't write the XML representation: java.lang.NullPointerException at org.restlet.ext.xml.Dom...

Fine-grained Authentication with RESTlet

Hi, I want to expose a resource using RESTlet with a fine-grained authentication. My ServerResource should be accessable via GET only for authenticated members (using BASIC Authentication). However, requests using POST should be available also for callers without any authentication. In order to clearify: http://path/myapp/user shoul...

Restlet JUnit test that POSTs multipart form?

I'm working with Restlet 1.1.8 and am trying to write a Resource that parses a multipart form; it needs to allow upload of an Excel spreadsheet. I have the Resource working, when I run it from my web app it's doing The Right Things(tm) so far, but I want to write an acceptance test that POSTs via Java code so I can throw lots of test ca...

Restlet XML parsing xstream

Hi, I'm new to restlet and quite confused. A rest server returns the following xml response: <posts user="a" dt="2010-01-21T08:00:00Z" tag=""> <post href="http://www.opensatnav.org/" hash="a" description="OpenSatNav" tag="android osm" time="2010-01-21T20:55:54Z" extended=""/> <post href="http://www.openrouteservice.org/" hash="a"...

using RESTlet, XStream annotations seem to have no effect

Using @XStreamOmitField in my POJO seems to have no effect whatsoever. the annotated field still gets exposed in the xml or json representation. @XStreamAlias("Pojo") @Entity public class Pojo { private String name; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long key; @XStreamOmitField priv...

Running JUnit Tests on a Restlet Router

Using Restlet I have created a router for my Java application. From using curl, I know that each of the different GET, POST & DELETE requests work for each of the URIs and return the correct JSON response. I'm wanting to set-up JUnit tests for each of the URI's to make the testing process easier. However, I'm not to sure the best way t...

How to share EntityManagerFactory Object across the various Resource files in a Restlet application?

I would like to create one EMF object and use it in various Resource class objects.. any ideas on how to do this? ...

Consume ado.net data service from android 2.1

I have a ado.net data service created using VS 2008 sp 1 that is hosted that I want to consume via HTTP and JSON from Android 2.1? Does anyone have sample code on how to do CRUD operations easily do this? I heard Restlet makes this very easy but can't seem to find sample Android code on doing this. If someone can post a tutorial with som...

Know how to use Restlet to Consume ADO.net Data Service from Android?

Does anyone know how to use Restlet with Android to consume an ADO.net data service? If so, does anyone have sample code/tutorial to do all 4 CRUD operations using JSON and HttpClient? ...

Log response-time in restlet-based webservice

What is the simplest way to log the response-time for a restlet-based webservice? I want to make sure that our webservice has a reasonable response time. So I want to be able to keep an eye on response times, and do something about the requests that take too long. The closest thing I could find is this recipe: http://www.naviquan.com/b...

How do I interact with OData from Java?

OData is Microsoft's repackaging of its Astoria (now WCF Data Services) RESTful query/update protocol. If I want to use Java to create an OData compatible data source, how do I do that? Similarly, if I want to consume an OData data source from Java, how do I do that? http://www.odata.org/ Partial answer below. The OData website sugges...

How to organize and manage multiple database credentials in application?

Okay, so I'm designing a stand-alone web service (using RestLET as my framework). My application is divided in to 3 layers: Data Layer (just above the database, provides APIs for connecting to/querying database, and a database object) Object layer (responsible for serialization from the data layer... provides objects which the client ...

What is the recommended way to set GET parameters on a Restlet request?

What is the recommended way of setting GET query parameters on a Restlet Request object? I think I can see how to get them out of the request using getQueryAsForm(), but how do they get set in the first place? At the moment, I am adding them manually to the URL using a StringBuilder and java.net.URLEncoder, but it seems like there shou...

Best Practice for creating Web Services

To preface I am new to web development. I am looking at creating a core set of RESTful web services around a valuable document library of sorts (initial CRUD abilities). In doing so I am theoretically creating a perfectly re-usable and scalable back-end to be used by unanticipated applications in the future. My question centers around ...

How to submit a Form using Resetlet based GWT client ??

I am trying to develop a GWT client that will call RESTful web services on the server side. Can you please provide a example code that demonstrates how to send a POST HTTP request using GWT FormPanel ? How should I send the data ? Any help will be appreciated. My code is like: // Create the form in GWT final FormPanel signUpForm = n...

Caching Authentication Data

Hi, I'm currently implementing a REST web service using CouchDB and RESTlet. The RESTlet layer is mainly for authentication and some minor filtering of the JSON data served by CouchDB: Clients <= HTTP => [ RESTlet <= HTTP => CouchDB ] I'm using CouchDB also to store user login data, because I don't want to add an additional database ...

Is there a Java API for creating a XHTML document?

I want to provide a simple XHTML representation of each of the resources in a REST web service. At the moment i'm using a StringBuilder to generate these which is both tedious and error prone. I don't see these changing after I publish the service but the process of coding each is a bit painful. Is there a XHTML document writer api? Sh...

Parameter parsing with Java Restlet

I'm trying to make a calculator web service that has more than 10 parameters. Is there any function in the Java Restlet or in Java itself that allows you to see the parameter ids? e.g. http://mywebsite.com/calculator?id1=value1&amp;id2=value2&amp;id3=value3 => I'm trying to access the values of id1, id2, and id3 so that I don't have to ...

Problem with Restlet on GAE

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() { Router router = new Router(getContext...