hi,

consider usage of either a parameter as part of the URI. This may look 
like that

http://myserver.appspot.com/contacts/{contactId}

with {contactId} replaced by the id of the asked Contact.

Another possibility is working with query strings like that:

http://myserver.appspot.com/contacts?contactId=123

for contact with id 123.

Both is explained in the routing- part of the documentation. You may 
find it here 
http://wiki.restlet.org/docs_2.0/13-restlet/27-restlet/326-restlet.html

Best regards,
Alex

On 11.08.2010 11:21, Alon wrote:
> Hi,
>
> I am a new in using restlet framework. I followed this great tutorial to
> make client(Android)-server(GAE) application
> (http://wiki.restlet.org/docs_2.0/13-restlet/21-restlet/318-restlet/303-restlet.html).
> Everything is working fine. But i would like to add small enhancement in my
> application. To have ability to send parameter in GET method. Please see
> below a code that i have
>
>
> public interface ContactResource {
>      @Get
>      public Contact retrieve(String contactID);
> }
>
> ********************GAE***************************
>
> public class ContactServerResource extends ServerResource implements
> ContactResource {
>      @Get
>      public Contact retrieve(String contactID) {
>          return (Contact)db.GqlQuery("SELECT * FROM MyModel WHERE CONTACTID
> == " + contactID)
>      }
> }
>
>
>
>      public Restlet createInboundRoot() {
>          Router router = new Router(getContext());
>          getConnectorService().getClientProtocols().add(Protocol.FILE);
>
>          // Serve the files generated by the GWT compilation step.
>          Directory dir = new Directory(getContext(),
> LocalReference.createFileReference(new File("war/")));
>          router.attachDefault(dir);
>          router.attach("/contacts", ContactServerResource.class);
>
>          return router;
>
> ********************Android***************************
>
> ClientResource cr = new
> ClientResource("http://myserver.appspot.com/contacts";);
> ContactResource resource = cr.wrap(ContactResource.class);
> Contact contact = resource.retrieve("1234567");
>
> Everything is running without errors, the problem is that contactID has been
> receiving null(empty) in GAE. I didn’t find any suitable examples for @Get
> method which retrieve parameters.
> Is there anyway to send contactID? Did i miss something in my
> implementation,configuration?
>
> Thanks
>

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2646169

Reply via email to