Restlet client version 2.1.6, SSL configuration on Android

2014-01-11 Thread Mark Petrovic
Hello.  I am new to Restlet client programming.  I am attempting to use Restlet 
client 2.1.6 on Android.

I have read the documentation on SSL config by way of DefaultSslContextFactory, 
as well as having read StackOverflow articles on configuring an 
HttpsClientHelper.  I chose the latter route, as I could convince myself that 
the client helper approach installed the helper for all subsequent use of 
ClientResource.  However, I cannot get this approach to work.  I receive this 
error message in an exception from the Restlet client when I attempt to connect 
to the remote server:

Internal connector error 1002

No available client connector supports the required protocol: 2131034127. 
Please add the JAR of a matching connector to your classpath.

Here is my approach in detail:

1) Perform this once before any network calls are made:

ListConnectorHelperClient registeredClients = 
Engine.getInstance().getRegisteredClients();
registeredClients.add(0, new SslHelper(this));

where SslHelper is a subclass of HttpsClientHelper and is defined by 

package com.homosuperiorus.clips.clients;

import android.content.Context;
import android.util.Log;

import com.homosuperiorus.clips.R;

import org.restlet.ext.ssl.HttpsClientHelper;

import java.io.IOException;
import java.io.InputStream;
import java.security.KeyManagementException;
import java.security.KeyStore;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;

import javax.net.ssl.KeyManager;
import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManagerFactory;

public class SslHelper extends HttpsClientHelper {
private final String TAG = SslHelper;
private KeyStore trustStore;

public SslHelper(Context appContext) {
super(null);
InputStream inputStream = 
appContext.getResources().openRawResource(R.raw.keystore);
try {
trustStore = KeyStore.getInstance(BKS);
trustStore.load(inputStream, changeit.toCharArray());
} catch (Exception e) {
Log.d(TAG, Keystore error, e);
throw new RuntimeException(e);
} finally {
try {
inputStream.close();
} catch (IOException e) {
Log.d(TAG, error closing keystore inputStream, e);
}
}
}

@Override
protected SSLContext getSslContext() {
try {
SSLContext sslContext = SSLContext.getInstance(TLS);
TrustManagerFactory tmf = TrustManagerFactory.getInstance(PKIX);
tmf.init(trustStore);
sslContext.init(new KeyManager[0], tmf.getTrustManagers(), null);
setSslContext(sslContext);
return sslContext;
} catch (NoSuchAlgorithmException shouldNeverHappen) {
throw new RuntimeException(shouldNeverHappen);
} catch (KeyStoreException shouldNeverHappen) {
throw new RuntimeException(shouldNeverHappen);
} catch (KeyManagementException shouldNeverHappen) {
throw new RuntimeException(shouldNeverHappen);
}
}
}

The BKS keystore loads successfully.

Next, I setup and make the client call:

public MyStuff getMyStuff() {
ClientResource resource = new ClientResource(BASEURL);
resource.setChallengeResponse(ChallengeScheme.HTTP_BASIC, 
credentials.userName, credentials.password);
resource.accept(MediaType.APPLICATION_JSON);
MyStuff myStuff;
try {
myStuff = resource.getChild(PATH).get(MyStuff.class);
Log.d(TAG, myStuff.toString());
return myStuff;
} catch (ResourceException e) {
String reasonPhrase = e.getStatus().getReasonPhrase();
Log.d(TAG, String.format(Login with GET /mystuff failed:  
status=%d, reason phrase=%s, e.getStatus().getCode(), reasonPhrase));
return null;
}
}

The client throws a ResourceException, with the detail I provided above.

My dependencies on restlet are as follows:

dependencies {
compile 'com.google.android:support-v4:r7'
compile 'com.google.code.gson:gson:2.2.4'
compile group: org.restlet.android, name: org.restlet, version: 
versions.restlet
compile group: org.restlet.android, name: org.restlet.ext.json, 
version: versions.restlet
compile group: org.restlet.android, name: org.restlet.ext.ssl, version: 
versions.restlet
}

I feel like this code is one line from working, but I cannot tell which line.  
It sounds like I need another restlet jar on the classpath, but I cannot take a 
good guess at which one I'm missing.

Your help is much appreciated.

Thank you.

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


RE: Restlet client version 2.1.6, SSL configuration on Android

2014-01-11 Thread Mark Petrovic
I worked more on this, but to no avail.  Here is my new set of dependencies, 
which seems more correct given the net jar and ssl support are both on the 
classpath:

dependencies {
compile 'com.google.android:support-v4:r7'
compile 'com.google.code.gson:gson:2.2.4'
compile group: org.restlet.android, name: org.restlet, version: 
versions.restlet
compile group: org.restlet.android, name: org.restlet.ext.json, 
version: versions.restlet
compile group: org.restlet.android, name: org.restlet.ext.net, version: 
versions.restlet
}

This is a Gradle 1.9 build btw, wagged to some extent by my use of Android 
Studio 0.4x.  I'm ok with the Gradle build, which I mention for the sake of 
completeness.

The problem with this set of dependencies is that it does not change the 
original error 1002.  It also requires, during APK repackaging that I add this 
exclusion to the packaging in the build file:


packagingOptions {
exclude 'META-INF/services/org.restlet.engine.ClientHelper'
}

If I do not exclude the META-INF file, I get this when I build:

validateDebugSigning
:packageDebug
Error: duplicate files during packaging of APK 
/Users/mpetrovic/Projects/ClipsAndroid/build/apk/ClipsAndroid-debug-unaligned.apk
Path in archive: META-INF/services/org.restlet.engine.ClientHelper
Origin 1: 
/Users/mpetrovic/.gradle/caches/modules-2/files-2.1/org.restlet.android/org.restlet.ext.ssl/2.1.6/5c1929b6ed270fe29688f6f76665c281fb898f62/org.restlet.ext.ssl-2.1.6.jar
Origin 2: 
/Users/mpetrovic/.gradle/caches/modules-2/files-2.1/org.restlet.android/org.restlet.ext.net/2.1.6/c0b207da17369e94f1eda18aa107e302d09b9fa2/org.restlet.ext.net-2.1.6.jar
You can ignore those files in your build.gradle:
android {
  packagingOptions {
exclude 'META-INF/services/org.restlet.engine.ClientHelper'
  }
}
:packageDebug FAILED

I'm out of ideas.  Please help.

Thanks.

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


RE: Restlet client version 2.1.6, SSL configuration on Android

2014-01-11 Thread Mark Petrovic
Well, I'm making progress.  My original code failed to expand the Android R 
resource id's into actual strings.  So my URL was horribly mangled.  I fixed 
that.  

But I still see this exception when connecting over https:

 Caused by: Internal Connector Error (1002) - No available client connector 
supports the required protocol: 'HTTPS'. Please add the JAR of a matching 
connector to your classpath.
at 
org.restlet.resource.ClientResource.doError(ClientResource.java:612)
at 
org.restlet.resource.ClientResource.handleInbound(ClientResource.java:1202)
at 
org.restlet.resource.ClientResource.handle(ClientResource.java:1026)
at 
org.restlet.resource.ClientResource.handle(ClientResource.java:968)
at org.restlet.resource.ClientResource.get(ClientResource.java:680)
at 
com.homosuperiorus.clips.clients.TransmitsClient.getTransmits(TransmitsClient.java:27)
at 
com.homosuperiorus.clips.models.TransmitsSource.getTransmits(TransmitsSource.java:38)
at 
com.homosuperiorus.clips.fragment.ClipsListFragment$GetTransmitsTask.doInBackground(ClipsListFragment.java:93)
at 
com.homosuperiorus.clips.fragment.ClipsListFragment$GetTransmitsTask.doInBackground(ClipsListFragment.java:83)
at android.os.AsyncTask$2.call(AsyncTask.java:288)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:841)

Here is my latest dependency list:

dependencies {
compile group: 'com.google.android', name: 'support-v4', version: 'r7'
compile group: 'com.google.code.gson', name: 'gson', version: '2.2.4'
compile group: 'joda-time', name: 'joda-time', version: 2.3
compile group: org.restlet.android, name: org.restlet, version: 
versions.restlet
compile group: org.restlet.android, name: org.restlet.ext.jackson, 
version: versions.restlet
compile group: org.restlet.android, name: org.restlet.ext.net, version: 
versions.restlet
}

Anybody?

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


Sample code for using FreeMarker with Restlets

2008-12-25 Thread Mark Petrovic
Good day, and Merry Christmas to all who are celebrating it.

Would someone be kind enough to post a few lines of example config and  
code showing how you use FreeMarker with Restlets in returning html  
views.

Thanks much.

--
Mark Petrovic
m...@petrovic.org
http://www.petrovic.org

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


Re: Application can't find jetty class

2008-10-21 Thread Mark Petrovic

Hugh, good day.

Here are the jars I use under Netbeans 6.1 to avail myself of the  
Jetty connector, all of which (I believe) should be available in the  
Restlet distribution:


com.noelios.restlet.ext.jetty_6.1.jar
org.mortbay.jetty_6.1/org.mortbay.jetty.jar
org.mortbay.jetty.https.jar
org.mortbay.jetty.util.jar
javax.servlet.jar
com.noelios.restlet.jar
org.restlet.jar
org.mortbay.jetty.ajp.jar

Hope that helps.

Mark

On Oct 21, 2008, at 8:34 AM, Hugh Acland wrote:


Hi Jerome (or anyone else..),

I am following your chapter in Restful Web Services by Oreilly and  
am
working on getting the services server up and running. i keep  
getting the

following :

Exception in thread main java.lang.NoClassDefFoundError:
org/mortbay/jetty/Connector

can you please advise on where i find this class? it does seem to be  
in the

restlet download package...

cheers
hugh





Re: Consuming a REST response

2008-10-20 Thread Mark Petrovic

Good day.

I think your question can reside at a number of different levels, but  
I'll take a stab at the simplest and most obvious.  Hopefully this  
isn't so simple as to be of no use.


Here are a few lines of code from one of my JUnit tests, that acts as  
a client doing a GET against a restlet:


void testme() {
   Client client = new Client(Protocol.HTTP);
   baseUri = host + props.getProperty(KEY_URI);

   Request request = new Request(Method.GET, baseUri + / +  
props.getProperty(callsign));

   Response response = client.handle(request);
   Status status = new Status(response.getStatus().getCode());
   assertTrue(test lookup callsign,  
Status.SUCCESS_OK.equals(status));


   System.out.println(response.getEntity().getText());
}

The Javadoc for org.restlet.data.Response shows that you can retrieve  
the entity in a number of different forms, including plain text, a DOM  
representation, and others, and at which point you're free to do with  
it what you will.  I have not seen anything in print in this venue on  
the subject of taking the returned entity and casting it into an  
application POJO.  My guess is that if you want the marshaling that  
attends typical WSDL-based techniques, you'll probably have to arrange  
for it yourself, perhaps with something Castor-like.


Hopefully that helps, and isn't too elementary.

Mark

On Oct 20, 2008, at 3:12 PM, buzzterrier wrote:


Hello,

From trying out the sample apps and searching the web I have a  
pretty good sense
on how to publish a restful service, but not on how to consume one.  
My previous
experience with web services are WSDL based, which are pretty  
straight forward
for marshaling the xml into a pojo. But I am not sure what the best  
approach is

for REST, since there is no XSD to work with.

Can some of you comment on how you are consuming these resources? Am  
I missing

the obvious?g

Thx!








Re: Spring configuration example using com.noelios.restlet.ext.spring package

2008-10-18 Thread Mark Petrovic

Thank you.

Mark

On Oct 17, 2008, at 8:54 AM, Rhett Sutphin wrote:


Hi Mark,

You might also consider using SpringBeanRouter.  If you only have  
one URI mapping per resource, it allows your URIs to be mapped  
directly in the bean definitions.  Your example would be like this  
using SpringBeanRouter (note: not tested):


!-- server bean as before --

bean name=router class=org.restlet.ext.spring.SpringBeanRouter/

bean name=/account/register id=registerResource  
class=com.mspetrovic.server.restlet.RegisterResource  
scope=prototype/
bean name=/account/login id=loginResource  
class=com.mspetrovic.server.restlet.LoginResource  
scope=prototype/
bean name=/account/confirm/{confirmationKey}  
id=confirmationResource  
class=com.mspetrovic.server.restlet.AccountConfirmationResource  
scope=prototype/
bean name=/callsign/bind id=bindCallsignResource  
class=com.mspetrovic.server.restlet.BindCallsignResource  
scope=prototype/
bean name=/license/lookup/{callsign} id=lookupLicenseResource  
class=com.mspetrovic.server.restlet.LookupCallsignResource  
scope=prototype/
bean name=/log/{logname} id=createLogResource  
class=com.mspetrovic.server.restlet.LogResource scope=prototype/
bean name=/log/export/{logname} id=exportLogResource  
class=com.mspetrovic.server.restlet.LogExportResource  
scope=prototype/
bean name=/qso/{logname}/{range} id=qsoResource  
class=com.mspetrovic.server.restlet.QSOResource scope=prototype/


Rhett

On Oct 17, 2008, at 9:10 AM, Mark Petrovic wrote:

I'm posting my take on the Spring config detailed on the wiki.   
Previously I had been using a subclass of Application, with  
multiple invocations of router.attach() (per the FirstResource app)  
to get routing done to specific restlets.


Hope this helps someone out there get over the hump.  In your  
main() method, get the bean server and do a server.start() on it  
as one would normally do with a Component:


bean id=server class=org.restlet.ext.spring.SpringComponent
  property name=server
  bean class=org.restlet.ext.spring.SpringServer
  constructor-arg value=HTTP /
  constructor-arg value=8182 /
  /bean
  /property
  property name=defaultTarget ref=router /
  /bean

  bean id=router class=org.restlet.ext.spring.SpringRouter
  property name=attachments
  map
  entry key=/account/register
  bean class=org.restlet.ext.spring.SpringFinder
  lookup-method name=createResource  
bean=registerResource /

  /bean
  /entry
  entry key=/account/login
  bean class=org.restlet.ext.spring.SpringFinder
  lookup-method name=createResource  
bean=loginResource /

  /bean
  /entry
  entry key=/account/confirm/{confirmationKey}
  bean class=org.restlet.ext.spring.SpringFinder
  lookup-method name=createResource  
bean=confirmationResource /

  /bean
  /entry
  entry key=/callsign/bind
  bean class=org.restlet.ext.spring.SpringFinder
  lookup-method name=createResource  
bean=bindCallsignResource /

  /bean
  /entry
  entry key=/license/lookup/{callsign}
  bean class=org.restlet.ext.spring.SpringFinder
  lookup-method name=createResource  
bean=lookupLicenseResource /

  /bean
  /entry
  entry key=/log/{logname}
  bean class=org.restlet.ext.spring.SpringFinder
  lookup-method name=createResource  
bean=createLogResource /

  /bean
  /entry
  entry key=/log/export/{logname}
  bean class=org.restlet.ext.spring.SpringFinder
  lookup-method name=createResource  
bean=exportLogResource /

  /bean
  /entry
  entry key=/qso/{logname}
  bean class=org.restlet.ext.spring.SpringFinder
  lookup-method name=createResource  
bean=qsoResource /

  /bean
  /entry
  entry key=/qso/{logname}/{range}
  bean class=org.restlet.ext.spring.SpringFinder
  lookup-method name=createResource  
bean=qsoResource /

  /bean
  /entry
  /map
  /property
  /bean

  bean id=registerResource  
class=com.mspetrovic.server.restlet.RegisterResource  
scope=prototype/
  bean id=loginResource  
class=com.mspetrovic.server.restlet.LoginResource  
scope=prototype/
  bean id=confirmationResource  
class=com.mspetrovic.server.restlet.AccountConfirmationResource  
scope=prototype/
  bean id=bindCallsignResource  
class=com.mspetrovic.server.restlet.BindCallsignResource  
scope=prototype/
  bean id=lookupLicenseResource  
class

Re: Restlet-GWT HTTP authentication example

2008-10-18 Thread Mark Petrovic

Thank you.

Mark

On Oct 17, 2008, at 11:26 AM, Thierry Boileau wrote:


Hello Mark,

I've updated the sample application and its description:
http://wiki.restlet.org/docs_1.1/13-restlet/28-restlet/144- 
restlet.html



Best regards,
Thierry Boileau
--
Restlet ~ Core developer ~ http://www.restlet.org
Noelios Technologies ~ Co-founder ~ http://www.noelios.com


Thierry, good day.

Is there sample code available showing how to use the HTTP Digest  
authentication scheme?



Hello Mark,

the current sample GWT application has been updated with  
authentication, and usage of JSON and XML representations.
See http://wiki.restlet.org/docs_1.1/13-restlet/28-restlet/144-restlet.html 
.


Best regards,
Thierry Boileau
--
Restlet ~ Core developer ~ http://www.restlet.org
Noelios Technologies ~ Co-founder ~ http://www.noelios.com
Does anyone have a couple of code snippets, with qualifying and  
explanatory comments, they can share that demonstrate both the  
client and server side of the new Restlet-GWT HTTP  
authentication?  I just might be getting the hang of Restlet  
programming, and authentication and login-state without that  
warm, cozy servlet session state is the last piece I need to  
envision my app end to end.


Thanks.

Mark







Re: Spring configuration example using com.noelios.restlet.ext.spring package

2008-10-17 Thread Mark Petrovic
I'm posting my take on the Spring config detailed on the wiki.   
Previously I had been using a subclass of Application, with multiple  
invocations of router.attach() (per the FirstResource app) to get  
routing done to specific restlets.


Hope this helps someone out there get over the hump.  In your main()  
method, get the bean server and do a server.start() on it as one  
would normally do with a Component:


bean id=server class=org.restlet.ext.spring.SpringComponent
property name=server
bean class=org.restlet.ext.spring.SpringServer
constructor-arg value=HTTP /
constructor-arg value=8182 /
/bean
/property
property name=defaultTarget ref=router /
/bean

bean id=router class=org.restlet.ext.spring.SpringRouter
property name=attachments
map
entry key=/account/register
bean class=org.restlet.ext.spring.SpringFinder
lookup-method name=createResource  
bean=registerResource /

/bean
/entry
entry key=/account/login
bean class=org.restlet.ext.spring.SpringFinder
lookup-method name=createResource  
bean=loginResource /

/bean
/entry
entry key=/account/confirm/{confirmationKey}
bean class=org.restlet.ext.spring.SpringFinder
lookup-method name=createResource  
bean=confirmationResource /

/bean
/entry
entry key=/callsign/bind
bean class=org.restlet.ext.spring.SpringFinder
lookup-method name=createResource  
bean=bindCallsignResource /

/bean
/entry
entry key=/license/lookup/{callsign}
bean class=org.restlet.ext.spring.SpringFinder
lookup-method name=createResource  
bean=lookupLicenseResource /

/bean
/entry
entry key=/log/{logname}
bean class=org.restlet.ext.spring.SpringFinder
lookup-method name=createResource  
bean=createLogResource /

/bean
/entry
entry key=/log/export/{logname}
bean class=org.restlet.ext.spring.SpringFinder
lookup-method name=createResource  
bean=exportLogResource /

/bean
/entry
entry key=/qso/{logname}
bean class=org.restlet.ext.spring.SpringFinder
lookup-method name=createResource  
bean=qsoResource /

/bean
/entry
entry key=/qso/{logname}/{range}
bean class=org.restlet.ext.spring.SpringFinder
lookup-method name=createResource  
bean=qsoResource /

/bean
/entry
/map
/property
/bean

bean id=registerResource  
class=com.mspetrovic.server.restlet.RegisterResource  
scope=prototype/
bean id=loginResource  
class=com.mspetrovic.server.restlet.LoginResource scope=prototype/
bean id=confirmationResource  
class=com.mspetrovic.server.restlet.AccountConfirmationResource  
scope=prototype/
bean id=bindCallsignResource  
class=com.mspetrovic.server.restlet.BindCallsignResource  
scope=prototype/
bean id=lookupLicenseResource  
class=com.mspetrovic.server.restlet.LookupCallsignResource  
scope=prototype/
bean id=createLogResource  
class=com.mspetrovic.server.restlet.LogResource scope=prototype/
bean id=exportLogResource  
class=com.mspetrovic.server.restlet.LogExportResource  
scope=prototype/
bean id=qsoResource  
class=com.mspetrovic.server.restlet.QSOResource scope=prototype/



On Oct 16, 2008, at 8:16 AM, Mark Petrovic wrote:

I took a look at the javadoc for both org.restlet.ext.spring and  
com.noelios.restlet.ext.spring and conclude that the method outlined  
here, based on org.restlet.ext.spring,


http://wiki.restlet.org/docs_1.1/13-restlet/g2/59-restlet.html

is the most viable approach.

Having read through that example, I'm still left with the impression  
that the example contains a mix of specific and general treatments  
of the subject.  For example, I don't understand why this point is  
raised


In this example, the last URI pattern has to be customized to  
accept complete URIs (possibly including slashes) as the last  
component of the pattern. We use Spring's nested properties to drill  
into the configuration of the URI pattern along with Spring's  
mechanism for accessing a static field in a class.


And by don't understand I do not mean I object to the point  
raised, but rather what, in my lack of understanding, is this  
really trying to tell me, and does

Re: Spring configuration example using com.noelios.restlet.ext.spring package

2008-10-16 Thread Mark Petrovic
I took a look at the javadoc for both org.restlet.ext.spring and  
com.noelios.restlet.ext.spring and conclude that the method outlined  
here, based on org.restlet.ext.spring,


http://wiki.restlet.org/docs_1.1/13-restlet/g2/59-restlet.html

is the most viable approach.

Having read through that example, I'm still left with the impression  
that the example contains a mix of specific and general treatments of  
the subject.  For example, I don't understand why this point is raised


In this example, the last URI pattern has to be customized to accept  
complete URIs (possibly including slashes) as the last component of  
the pattern. We use Spring's nested properties to drill into the  
configuration of the URI pattern along with Spring's mechanism for  
accessing a static field in a class.


And by don't understand I do not mean I object to the point  
raised, but rather what, in my lack of understanding, is this really  
trying to tell me, and does it matter in my case?.  The Spring lookup- 
method reference strikes me the same way:  is this central to restlet  
configuration with Spring, or is it an advanced idiom that I can do  
without for now?


I'm not asking for a clarification of this particular point, but  
instead for someone to offer a second standalone example of how to  
configure a simple restlet-based app using Spring.  Many, many times  
in my study of a thing I resort to second and third and fourth  
references on the subject to gain an understanding of what is  
fundamental to a subject's elucidation, vs. what is specific in the  
course of that illustration.  This is one of those times, and I'm sure  
others routinely resort to this same approach.


Would someone be kind enough to post some non-proprietary code showing  
how they configured their restlet app using Spring?  The example would  
configure an app no more complex than the FirstResouce app found  
elsewhere on the site.


Thanks much.  Hopefully posterity will benefit from my supplications  
as much as I do now.


Mark

On Oct 15, 2008, at 1:57 PM, Mark Petrovic wrote:


Good day.

I notice that both the FAQ and Wiki have sections treating the use  
of the org.restlet.ext.spring package to manage a restlet app in a  
Spring container.


Is there a similar example someone might offer on using the  
com.noelios.restlet.ext.spring package to manage a restlet app in  
the same way?  The FAQ says such a configuration option exists, and  
I'd like to read about it.


Thanks.

Mark




Re: Restlet URL parsing idiom question

2008-10-15 Thread Mark Petrovic

Thank you.

Yes, two routes to the same resource bugs me.  It looked a bit strange  
when I when I coded it.


On Oct 15, 2008, at 1:30 AM, Thierry Boileau wrote:


Hello Mark,

you can have a look at the Request#getResourceRef() (that returns an  
instance of the Reference class) and the Reference#getLastSegment()  
methods.
Otherwise, you can wonder why there are 2 distinct routes that point  
to the same resource.
Otherwise, you can define the routes as follow and examine the  
verb property in your resource:

router.attach(/sign/{verb}, SignResource.class);
router.attach(/sign/{verb}/{sign}, SignResource.class);

Best regards,
Thierry Boileau
--
Restlet ~ Core developer ~ http://www.restlet.org
Noelios Technologies ~ Co-founder ~ http://www.noelios.com


Good day.

If I have

router.attach(/sign/bind, SignResource.class);
router.attach(/sign/lookup/{sign}, SignResource.class);

what is a stylish idiom to get at the bind and lookup tokens in  
the URLs above from within the SignResource restlet?  Doing so  
amounts to enabling some finer grain routing within the restlet  
SignResource, which may or may not belie a potentially naive  
attempt to do too much in a single restlet handler.


Thanks.

Mark




Spring configuration example using com.noelios.restlet.ext.spring package

2008-10-15 Thread Mark Petrovic

Good day.

I notice that both the FAQ and Wiki have sections treating the use of  
the org.restlet.ext.spring package to manage a restlet app in a Spring  
container.


Is there a similar example someone might offer on using the  
com.noelios.restlet.ext.spring package to manage a restlet app in the  
same way?  The FAQ says such a configuration option exists, and I'd  
like to read about it.


Thanks.

Mark


Re: Restlet-GWT HTTP authentication example

2008-10-15 Thread Mark Petrovic

Thierry, good day.

Is there sample code available showing how to use the HTTP Digest  
authentication scheme?


On Oct 14, 2008, at 7:08 AM, Thierry Boileau wrote:


Hello Mark,

the current sample GWT application has been updated with  
authentication, and usage of JSON and XML representations.
See http://wiki.restlet.org/docs_1.1/13-restlet/28-restlet/144-restlet.html 
.


Best regards,
Thierry Boileau
--
Restlet ~ Core developer ~ http://www.restlet.org
Noelios Technologies ~ Co-founder ~ http://www.noelios.com
Does anyone have a couple of code snippets, with qualifying and  
explanatory comments, they can share that demonstrate both the  
client and server side of the new Restlet-GWT HTTP authentication?   
I just might be getting the hang of Restlet programming, and  
authentication and login-state without that warm, cozy servlet  
session state is the last piece I need to envision my app end to end.


Thanks.

Mark





Re: Restlet-GWT HTTP authentication example

2008-10-14 Thread Mark Petrovic

Thank you!

Mark

On Oct 14, 2008, at 7:08 AM, Thierry Boileau wrote:


Hello Mark,

the current sample GWT application has been updated with  
authentication, and usage of JSON and XML representations.
See http://wiki.restlet.org/docs_1.1/13-restlet/28-restlet/144-restlet.html 
.


Best regards,
Thierry Boileau
--
Restlet ~ Core developer ~ http://www.restlet.org
Noelios Technologies ~ Co-founder ~ http://www.noelios.com
Does anyone have a couple of code snippets, with qualifying and  
explanatory comments, they can share that demonstrate both the  
client and server side of the new Restlet-GWT HTTP authentication?   
I just might be getting the hang of Restlet programming, and  
authentication and login-state without that warm, cozy servlet  
session state is the last piece I need to envision my app end to end.


Thanks.

Mark





Restlet URL parsing idiom question

2008-10-14 Thread Mark Petrovic

Good day.

If I have

router.attach(/sign/bind, SignResource.class);
router.attach(/sign/lookup/{sign}, SignResource.class);

what is a stylish idiom to get at the bind and lookup tokens in  
the URLs above from within the SignResource restlet?  Doing so amounts  
to enabling some finer grain routing within the restlet SignResource,  
which may or may not belie a potentially naive attempt to do too much  
in a single restlet handler.


Thanks.

Mark



Re: Setting the representation identifier on a response that has no need for an entity

2008-10-09 Thread Mark Petrovic


On Oct 9, 2008, at 1:27 AM, Thierry Boileau wrote:

In your case, you don't want to send an entity but still want to set  
the Location header. Thus, don't set the response's entity but  
call the Response#setLocationRef method (see also this link [2] for  
more details about the mapping HTTP headers/Restlet API).


Thank you.  That works very well.

Mark


How to add a cookie to a pending request, and send that request

2008-10-08 Thread Mark Petrovic

Good day.

I read this post

http://restlet.tigris.org/servlets/ReadMsg?listName=discussmsgNo=5135

because the subject sounded similar to my current problem.

My existing newbie model consists of a run-up to a PUT that looks like  
this:


Client client = new Client(Protocol.HTTP);
String baseUri = /someuri;
String cookie = thecookie;
// somehow set this cookie on the Request, but how?
Response response = client.put(baseUri, createEntityRep());
// ... postprocessing

So I can see from the post above how one can create a new Request,  
then set the cookie on the request via setCoookies(), but I don't see  
how one takes that Request and slipstreams back into the Client  
semantics, where Protocol.HTTP has been set and appears to await the  
ensuing put.


Can someone post some complete sample code showing how, or whether,  
Client still participates in this flow when request headers must be  
set prior to send.


Thank you.




Re: How to add a cookie to a pending request, and send that request

2008-10-08 Thread Mark Petrovic

Beautiful.

I was aware of the notion of handle, but it reminds me of event  
handling, after a fact, rather than a priori driving an event or fact.


Thank you.

On Oct 8, 2008, at 8:40 AM, Thierry Boileau wrote:


Hi Mark,

the client can simply handle your request since it inherits from the  
Uniform class [1]:


Request request = new Request(Method.PUT, http://blabla/;);
request.getCookies().add(name, value);
Client client = new client(Protocol.HTTP);
Response response = client.handle(request);


[1] http://www.restlet.org/documentation/1.1/api/org/restlet/Uniform.html
You will see that all methods such as get, put, post are defined in  
the Uniform class which is quite central in the framework = http://www.restlet.org/documentation/1.1/tutorial#conclusion



Best regards,
Thierry Boileau
--
Restlet ~ Core developer ~ http://www.restlet.org
Noelios Technologies ~ Co-founder ~ http://www.noelios.com



Good day.

I read this post

http://restlet.tigris.org/servlets/ReadMsg? 
listName=discussmsgNo=5135


because the subject sounded similar to my current problem.

My existing newbie model consists of a run-up to a PUT that looks  
like this:


Client client = new Client(Protocol.HTTP);
String baseUri = /someuri;
String cookie = thecookie;
// somehow set this cookie on the Request, but how?
Response response = client.put(baseUri, createEntityRep());
// ... postprocessing

So I can see from the post above how one can create a new Request,  
then set the cookie on the request via setCoookies(), but I don't  
see how one takes that Request and slipstreams back into the Client  
semantics, where Protocol.HTTP has been set and appears to await  
the ensuing put.


Can someone post some complete sample code showing how, or whether,  
Client still participates in this flow when request headers must be  
set prior to send.


Thank you.




Setting the representation identifier on a response that has no need for an entity

2008-10-08 Thread Mark Petrovic

Good day.

The First Resource app has code similar to this for setting the  
location of created resource:


String entity = Items created;

Representation rep = new StringRepresentation(entity,  
MediaType.TEXT_PLAIN);
rep.setIdentifier(getRequest().getResourceRef().getIdentifier() + /  
+ so.getId().toString());

getResponse().setEntity(rep);
...

However, my app, that does something similar, has no need to set an  
actual entity value.  So I set entity=, but which results in this  
warning on the server side when the response is returned:


WARNING: A response with an unavailable entity was returned. Ignoring  
the entity for resource http://localhost:8182/log/AVal


I'd rather not return an entity with nonzero length if no agent will  
use it - and no agent of mine does.


How should I handle this, all the while avoiding the warning in the  
server log?


Thanks.



How to set the HTTP response code in a restlet response

2008-10-06 Thread Mark Petrovic

Good day.

Would someone be kind enough to explain how to set, or induce, the  
Restlet response to a request to a particular value?


Thanks.


Restlet-GWT HTTP authentication example

2008-10-06 Thread Mark Petrovic
Does anyone have a couple of code snippets, with qualifying and  
explanatory comments, they can share that demonstrate both the client  
and server side of the new Restlet-GWT HTTP authentication?  I just  
might be getting the hang of Restlet programming, and authentication  
and login-state without that warm, cozy servlet session state is the  
last piece I need to envision my app end to end.


Thanks.

Mark


Re: On the use of adding Variants to a Resource

2008-10-03 Thread Mark Petrovic

I see.  Thank you.

Mark

On Oct 3, 2008, at 4:34 AM, Jerome Louvel wrote:



Hi Mark,

In a Resource, the actual methods using getVariants() are:

1) handleGet() which needs to computer the preferred variant for  
content

negotiation.

2) handlePut() which needs the preferred variant for condition PUTs.

3) getPreferredVariant() used by handleGet() and handlePut().

When the content negotiation is disabled, the logic above can also get
manually the first variant in the list.

Best regards,
Jerome Louvel
--
Restlet ~ Founder and Lead developer ~ http://www.restlet.org
Noelios Technologies ~ Co-founder ~ http://www.noelios.com


-Message d'origine-
De : Mark Petrovic [mailto:[EMAIL PROTECTED]
Envoye : jeudi 2 octobre 2008 17:54
A : discuss@restlet.tigris.org
Objet : On the use of adding Variants to a Resource

Good day.

The FirstResource reference app makes it clear that a Resource can
have Variants added to it, and that entity variants can be tested in
the event of the GET, POST, etc, received operations.  But it doesn't
make clear why, in a Resource's constructor, those Resource's Variants
are actually set or for whose consumption.  In other words, in what
scenarios beyond setting a new Variant in the Resource constructor are
the results of getVariants() used by an application?

Thanks.





On the use of adding Variants to a Resource

2008-10-02 Thread Mark Petrovic

Good day.

The FirstResource reference app makes it clear that a Resource can  
have Variants added to it, and that entity variants can be tested in  
the event of the GET, POST, etc, received operations.  But it doesn't  
make clear why, in a Resource's constructor, those Resource's Variants  
are actually set or for whose consumption.  In other words, in what  
scenarios beyond setting a new Variant in the Resource constructor are  
the results of getVariants() used by an application?


Thanks.


Re: Using the standalone server

2008-10-01 Thread Mark Petrovic


On Sep 30, 2008, at 4:14 PM, Mark Petrovic wrote:



My app is pretty simple, and thus far has no traditional state I  
need to maintain - except the notion of is logged in.


I'd like to use the Jetty connector.

As I said, I'm using the Simple connector in my FirstResource-like  
app, and when I remove from my runtime classpath


estlet-1.1rc2/lib/org.simpleframework_3.1/org.simpleframework.jar

and add

restlet-1.1rc2/lib/org.mortbay.jetty_6.1/org.mortbay.jetty.jar
restlet-1.1rc2/lib/javax.servlet_2.5/javax.servlet.jar

per

http://www.restlet.org/documentation/1.1/connectors#jetty

I get on startup:

Exception in thread main java.lang.NoClassDefFoundError: simple/ 
http/ProtocolHandler


which indicates that something in my build is still looking for  
Simple connector support.  I looked to the Configuration section here


http://www.restlet.org/documentation/1.1/connectors#server_connectors

to understand how to code the server's main() entry point, but  
couldn't see how my FirstResource-like app, with its Component,  
subclassed Application, and Routers ( and router.attach()'s )  
translates.  If in fact translation is necessary?  That is, perhaps  
the NoClassDefError owes to something else?





My mistake:  I had two Simple support jars on my runtime classpath,  
but removed only one of them in the transition to using Jetty  
connectors.  Having removed both Simple jars and adding all the Jetty  
support jars, my unmodified FirstResource-like app now works again,  
using the jetty connector.


Thanks.


Using the standalone server

2008-09-30 Thread Mark Petrovic

Good day.

This is a well-intentioned albeit somewhat ignorant question:  is  
anyone using the Noelios standalone server in a production scenario?   
I think of all the hundreds of person-years in something like servlet  
technology and wonder if the standalone server is more of a  
development tool than a production platform.


If you're using the standalone server, how are you doing basic session  
management?  With cookies?


Thanks.




Re: Using the standalone server

2008-09-30 Thread Mark Petrovic
Thank you, Rob, Stephan.  I'm triangulating as fast as I can, and  
appreciate your feedback.


inline below...

On Sep 30, 2008, at 12:16 PM, Rob Heittman wrote:


If you mean the Net connector in Restlet 1.1 (which does not depend on
any robust external HTTP connector), this is indeed only appropriate
for development or lightly loaded scenarios.  We use it for some
production embedded applications, for example, some software that runs
as a service and needs to trivially receive and emit HTTP requests for
the local web server.  But it does not compete with the capacity of
the other connectors.

We do use Restlet in standalone mode in many production
applications, including our most heavily loaded multi-site client web
servers.  In terms of number of requests and sheer data volume, these
are VERY active production services.  However, by standalone mode
here we mean not using the Net adapter, but rather using one of the
other embedded connectors.  Jetty is our favorite, as it is both
lightweight and robust, and its NIO support is very good.  Grizzly is
looking promising for the future.



Taking a look at this (which I discovered a few minutes ago)

http://www.restlet.org/documentation/1.1/connectors

I see that I am in fact using the Simple connector, as per the  
FirstResource tutorial, I went out of my way to put its jar on the  
classpath.  This configuration is what I meant by 'standalone server'.



As Stephan mentioned ... here we are deploying applications designed
completely around the REST paradigm, the server does not keep any
session state for the client.  Clients are responsible for keeping
their own state and transferring the relevant bits of it to the server
when a request is made.  This is an intentional design decision.  We
do set cookies for unique browser identification purposes, mainly for
logging anonymous access.

Intelligent clients are a great help in making this design work well
(Java, AJAX, GWT, Flex/RIA, etc.).  Much of the Servlet model, and the
frameworks stacked upon it, consists of ingenious workarounds to make
a web server capable of producing and managing all tiers of an
application, given a very dumb HTML-and-forms based user agent on
the other end of the HTTP connection.  Unfortunately, this is hard on
the server, decentralizes little of the computing load, and makes
fielding a production web service much more expensive than it ought to
be.



I'm just making this up as I go along, but I'm not opposed to learning  
something in the process :-)  So I had envisioned that my Restlet  
application would have two logical clients:  1) the browser for some  
requests, and 2) embedded Ajax for others.  And I'm starting to wonder  
if I can reconcile that bipartite model with a stateless server.  I  
seem to recall reading something about this client side state in the  
O'Reilly book on RESTful web services.  I should go back and read up  
on this.  But frankly, the only state I had in mind to track at this  
point is whether the user is logged in or not.  Any suggestions on  
how you fellows handle something simple like this would be much  
appreciated.


Mark




- Rob

On Tue, Sep 30, 2008 at 2:45 PM, Mark Petrovic  
[EMAIL PROTECTED] wrote:

Good day.

This is a well-intentioned albeit somewhat ignorant question:  is  
anyone
using the Noelios standalone server in a production scenario?  I  
think of
all the hundreds of person-years in something like servlet  
technology and

wonder if the standalone server is more of a development tool than a
production platform.

If you're using the standalone server, how are you doing basic  
session

management?  With cookies?

Thanks.







Practicing the use of Context#createChildContext()

2008-09-29 Thread Mark Petrovic

Good day.

I've been following the first resource example as I teach myself  
restlet 1.1 programming, in the context of using the simple standalone  
server:


http://www.restlet.org/documentation/1.1/firstSteps

However, doing so in the 1.1-RC2 release leads to what I assume are  
new deprecation-like messages


Sep 29, 2008 9:48:44 AM com.noelios.restlet.Engine fireContextChanged
SEVERE: For security reasons, don't pass the component context to  
child Restlets anymore. Use the Context#createChildContext() method  
instead.class com.noelios.restlet.application.TunnelFilter


Can someone illustrate this new recommendation with a simple code  
example?



Thanks.


Re: Practicing the use of Context#createChildContext()

2008-09-29 Thread Mark Petrovic
Answering my own question, I *think* the log message means one should  
do this when setting up the standalone server:


restletComponent = new Component();
restletComponent.getServers().add(Protocol.HTTP, 8182);
Context context =  
restletComponent 
.getContext().createChildContext(); 
diff this

restletComponent.getDefaultHost().attach(new MyApplication(context));

instead of (as in the tutorial) this:

restletComponent = new Component();
restletComponent.getServers().add(Protocol.HTTP, 8182);
Context context =  
restletComponent 
.getContext 
();  
 diff this

restletComponent.getDefaultHost().attach(new MyApplication(context));


Can someone please confirm this?

Thanks.

On Sep 29, 2008, at 10:07 AM, Mark Petrovic wrote:


Good day.

I've been following the first resource example as I teach myself  
restlet 1.1 programming, in the context of using the simple  
standalone server:


http://www.restlet.org/documentation/1.1/firstSteps

However, doing so in the 1.1-RC2 release leads to what I assume are  
new deprecation-like messages


Sep 29, 2008 9:48:44 AM com.noelios.restlet.Engine fireContextChanged
SEVERE: For security reasons, don't pass the component context to  
child Restlets anymore. Use the Context#createChildContext() method  
instead.class com.noelios.restlet.application.TunnelFilter


Can someone illustrate this new recommendation with a simple code  
example?



Thanks.




Re: Practicing the use of Context#createChildContext()

2008-09-29 Thread Mark Petrovic

Our emails crossed in the mail...

Got it.  Thank you.

Mark

On Sep 29, 2008, at 12:13 PM, Rob Heittman wrote:


To avoid the warning: change the example code:

   // Attach the sample application.
   component.getDefaultHost().attach(
   new FirstStepsApplication(component.getContext()));

To

   // Attach the sample application.
   component.getDefaultHost().attach(
   new
FirstStepsApplication(component.getContext().createChildContext()));

The follow on action for Noelios would be to update this in the First
Resource example ... :-)

- R

On Mon, Sep 29, 2008 at 1:07 PM, Mark Petrovic  
[EMAIL PROTECTED] wrote:


Can someone illustrate this new recommendation with a simple code  
example?






On a Resource, when and by what is getRepresentation() called?

2008-09-28 Thread Mark Petrovic

Good day.

I'm studying the flow of the Resource example here

http://www.restlet.org/documentation/1.0/firstResource#part03

We see in this code that the method public void post(Representation  
entity) does some processing, then instantiates and returns an  
appropriate Representation.  I further note that there are methods on  
the Resource base class available for override of the POST, PUT, and  
DELETE methods, but not obviously for the GET method.


Is it the case that the Resource method public Representation  
getRepresentation(Variant variant) is the method to override to  
handle an HTTP GET on the resource?  If yes, how would one acquire  
references to any parameters to the GET call (e.g., the x and foo in / 
res?x=foo).  If not, when is this method called and typically by whom  
or what?


Thanks much.



Re: On a Resource, when and by what is getRepresentation() called?

2008-09-28 Thread Mark Petrovic

I see.  Thank you.

Mark

On Sep 28, 2008, at 4:39 PM, Rob Heittman wrote:

Because the names of the high level methods in 1.0 were confusing, a  
fair bit of this was changed for Restlet 1.1.  In 1.1, you are  
principally working with represent(...) for GET and  
acceptRepresentation(...) for POST.


In either 1.0 or 1.1, the getRequest and getResponse methods allow  
you to interact with these objects.   
getRequest().getResourceReference().getQueryAsForm() is probably  
what you want.


I will pedantically observe that if you are using query strings, you  
may not have an optimally resource-oriented API.  Query strings are  
frequently (though not always) indicative of an imperative, non-REST  
design.  If you already know this and or/don't care, ignore the  
pedantry ...


- Rob

On Sun, Sep 28, 2008 at 6:38 PM, Mark Petrovic  
[EMAIL PROTECTED] wrote:
Is it the case that the Resource method public Representation  
getRepresentation(Variant variant) is the method to override to  
handle an HTTP GET on the resource?  If yes, how would one acquire  
references to any parameters to the GET call (e.g., the x and foo  
in /res?x=foo).  If not, when is this method called and typically by  
whom or what?






Re: GWT + Restlet examples?

2008-09-11 Thread Mark Petrovic

Fantastic, Thierry.  Thanks much.

Dumb question:  how, or should, one integrate the notion of allow  
post/allow put, etc, in the TestServer code?


Mark

On Sep 11, 2008, at 3:03 AM, Thierry Boileau wrote:


Mail sent on the 09/02 and apparently lost.
---

Hello Mark,

it may be too late, but I send a you a very simple application  
composed of two parts.
One part is developped with the gwt technology and aims at building  
a simple HTML page. It integrates also a simple AJAX call to the  
server part therefore it relies also on the org.rest.gwt.jar  
package which is the integration of both GWT and Restlet (client  
only) technologies. All sources and libraries (except GWT) are  
located in the gwt-Foo.zip file attached to this mail. It contains  
only one source file called Foo.java.
The other part is the server part based exclusively on the Restlet  
technology. It allows first to serve the files generated by GWT and  
then to reply to the AJAX call. I just provide the code of the  
unique class (TestServer). You will need 2 restlet packages  
org.restlet.jar and com.noelios.restlet.jar.


I hope it will help you a little bit.

Best regards,
Thierry Boileau
--
Restlet ~ Core developer ~ http://www.restlet.org
Noelios Technologies ~ Co-founder ~ http://www.noelios.com

NB : as said Rob, it is planned to add a more developped example (http://restlet.tigris.org/issues/show_bug.cgi?id=541 
).


Good day.  I'm new here, but not new to Java and its supporting  
technologies.


I'm embarking on teaching myself GWT using Restlets, neither of  
which I have programmed before, although I have read the  
documentation for each.  I know that at the time the Restlet-GWT  
code was released, a whopping 6 weeks ago :-), there were no  
examples illustrating its use.  Perhaps there are snippets of  
examples the community can share now, some weeks after the  
release.  If you have such examples, I would be quite grateful to  
study them, as would be, I'm sure, other newcomers to these  
subjects.  I am particularly interested in running the server side  
using the Restlet NET connector.


All the pieces are in front of me; at this point a few well placed  
examples would help bring it all together.


Thank you.


gwt-Foo.zippackage gwt;

import org.restlet.Component;
import org.restlet.Directory;
import org.restlet.Restlet;
import org.restlet.data.LocalReference;
import org.restlet.data.MediaType;
import org.restlet.data.Protocol;
import org.restlet.data.Request;
import org.restlet.data.Response;
import org.restlet.data.Status;
import org.restlet.resource.StringRepresentation;

public class TestServer extends Component {
   public static void main(String[] args) throws Exception {
   Component server = new TestServer();
   server.start();
   }

   public TestServer() {
   super();
   getServers().add(Protocol.HTTP, 8182);
   getClients().add(Protocol.FILE);
   Restlet restlet = new Restlet() {

   @Override
   public void handle(Request request, Response response) {
   response.setEntity(new StringRepresentation(This is  
a test,

   MediaType.TEXT_PLAIN));
   response.setStatus(Status.SUCCESS_OK);
   }
   };

   // Path to the directory where are located the gwt client  
pages.
   String gwtClientPagesDir = /home/thierry/workspace/ 
restlet-1.1/Foo/www/com.example.foo.Foo;

   // Simple Directory that serves the gwt client pages.
   Directory directory = new  
Directory(getContext().createChildContext(),

   LocalReference.createFileReference(gwtClientPagesDir));

   // Will be targeted from Internet browser (e.g.
   // http://localhost:8182/testClient/Foo
   getDefaultHost().attach(/testClient, directory);
   // Will be targeted by the gwt sample page via AJAX request
   getDefaultHost().attach(/testServer, restlet);
   }

}





Re: GWT + Restlet examples?

2008-09-11 Thread Mark Petrovic
Thank you.  In fact, that example made it to hardcopy and accompanied  
me to lunch twice this week.  Good stuff.


Mark

On Sep 11, 2008, at 10:06 AM, Rob Heittman wrote:

In a real application, it is usually better to write high-level  
Resources than Restlets, though wiring in a Restlet as in the  
Foo.zip example is often the briefest way to return an HTTP  
response.  Have a look at this tutorial, if you haven't already:


http://www.restlet.org/documentation/1.1/firstResource

Resources are at a higher level of abstraction.  A new instance of a  
Resource is created to handle each Request, which frees you from  
some thread safety concerns.  Restlet instances are permanently  
wired in to your application, and can handle Requests from many  
threads, so they must be thread safe.  By overriding methods like  
allowPost() to return true, the Resource signals what's allowed  
higher up the chain.  Methods like represent() and  
acceptRepresentation() allow you to expose the representational  
details of your object, and let the Restlet API handle the rest of  
the connector infrastructure (magically coping with hard stuff like  
ETag assignment and dealing with conditional GETs in HTTP).


There's no difference in server-side Restlet programming for a GWT  
client and a non-GWT client, so all the existing 1.1 documentation  
applies.


On Thu, Sep 11, 2008 at 12:49 PM, Mark Petrovic  
[EMAIL PROTECTED] wrote:

Fantastic, Thierry.  Thanks much.

Dumb question:  how, or should, one integrate the notion of allow  
post/allow put, etc, in the TestServer code?


Mark





Re: GWT + Restlet examples?

2008-09-09 Thread Mark Petrovic
Does someone have a single snippet of code that shows how the Restlet- 
GWT API would work with the GWT tutorial w/RPC in StockWatcher?   
Pseudo code would be fine.


http://code.google.com/docreader/#p=google-web-toolkit- 
doc-1-5s=google-web-toolkit-doc-1-5t=GettingStartedRPC


That is, what would the -Async and Service interface look like, and  
what part, if any, do annotations like  
@RemoteServiceRelativePath(stockPrices) play when using Restlet-GWT?


Thanks.

On Sep 8, 2008, at 6:14 AM, Rob Heittman wrote:

Restlet's GWT (Server) Extension, being just a wrapper around  
ServerServlet that can also pass calls to the GWT Hosted Mode  
adapter, is one small class file that has been in 1.1 milestone  
builds for almost a year now.  My company uses it in a number of  
large production and in-development applications.  These do not use  
Restlet-GWT API yet (though we are starting to port), but use GWT's  
built in facilities or JSNI to talk to a Restlet-powered server.


The Restlet-GWT API (the port of the core Restlet API to work under  
GWT 1.5) was a much larger undertaking afflicted by a lot of design  
complexity, the moving target of GWT 1.5, and requiring the wisdom  
and time of Jerome, the Restlet project founder, to accomplish.


- Rob

On Sun, Sep 7, 2008 at 11:18 PM, Mark Petrovic  
[EMAIL PROTECTED] wrote:

Thank you for the kind and speedy response, Rob.

I intend to spend the week, and then some, on this subject, and  
would be happy to receive any guidance or code you can muster.  In  
return, I can post my newcomer questions and results.


I'm curious:  how is it that the hosted mode Restlet GWT Extension  
is heavily exercised, but the Restlet-GWT API is not?  And what is  
the difference again?


Mark

On Sep 7, 2008, at 8:10 PM, Rob Heittman wrote:

Hi Mark, I've been working on a longish example (Chesstlet) that  
pulls together a number of Restlet and GWT techniques, but this  
won't be ready until November, due to some commitments I have in  
early October that complicate my availability.  In the meantime,  
maybe the best thing to do would be to pull together a small  
illustration based on the test case already in the Restlet source  
-- just beefing it up to do some useful things beyond hello,  
world.  I will try to get that together (or ask someone else at the  
office to do so) in the next day or two.


The Restlet-GWT API is still largely unexercised (as opposed to the  
Restlet GWT Extension, which is just the hosted mode wrapper for  
ServerServlet, which is very heavily exercised) so we are  
discovering all sorts of new issues as we try it out.  So you  
should probably be working from a Restlet snapshot to pick up all  
the latest commits.  I think the latest important thing was an  
infinite recursion that Thierry removed.  Now that GWT 1.5 is final  
and we don't have to chase a moving target any more, it will be  
easier to stabilize this.


- Rob

On Sun, Sep 7, 2008 at 10:48 PM, Mark Petrovic  
[EMAIL PROTECTED] wrote:
Good day.  I'm new here, but not new to Java and its supporting  
technologies.


I'm embarking on teaching myself GWT using Restlets, neither of  
which I have programmed before, although I have read the  
documentation for each.  I know that at the time the Restlet-GWT  
code was released, a whopping 6 weeks ago :-), there were no  
examples illustrating its use.  Perhaps there are snippets of  
examples the community can share now, some weeks after the  
release.  If you have such examples, I would be quite grateful to  
study them, as would be, I'm sure, other newcomers to these  
subjects.  I am particularly interested in running the server side  
using the Restlet NET connector.


All the pieces are in front of me; at this point a few well placed  
examples would help bring it all together.


Thank you.








GWT + Restlet examples?

2008-09-07 Thread Mark Petrovic
Good day.  I'm new here, but not new to Java and its supporting  
technologies.


I'm embarking on teaching myself GWT using Restlets, neither of which  
I have programmed before, although I have read the documentation for  
each.  I know that at the time the Restlet-GWT code was released, a  
whopping 6 weeks ago :-), there were no examples illustrating its  
use.  Perhaps there are snippets of examples the community can share  
now, some weeks after the release.  If you have such examples, I would  
be quite grateful to study them, as would be, I'm sure, other  
newcomers to these subjects.  I am particularly interested in running  
the server side using the Restlet NET connector.


All the pieces are in front of me; at this point a few well placed  
examples would help bring it all together.


Thank you.


Re: GWT + Restlet examples?

2008-09-07 Thread Mark Petrovic

Thank you for the kind and speedy response, Rob.

I intend to spend the week, and then some, on this subject, and would  
be happy to receive any guidance or code you can muster.  In return, I  
can post my newcomer questions and results.


I'm curious:  how is it that the hosted mode Restlet GWT Extension is  
heavily exercised, but the Restlet-GWT API is not?  And what is the  
difference again?


Mark

On Sep 7, 2008, at 8:10 PM, Rob Heittman wrote:

Hi Mark, I've been working on a longish example (Chesstlet) that  
pulls together a number of Restlet and GWT techniques, but this  
won't be ready until November, due to some commitments I have in  
early October that complicate my availability.  In the meantime,  
maybe the best thing to do would be to pull together a small  
illustration based on the test case already in the Restlet source --  
just beefing it up to do some useful things beyond hello, world.  I  
will try to get that together (or ask someone else at the office to  
do so) in the next day or two.


The Restlet-GWT API is still largely unexercised (as opposed to the  
Restlet GWT Extension, which is just the hosted mode wrapper for  
ServerServlet, which is very heavily exercised) so we are  
discovering all sorts of new issues as we try it out.  So you should  
probably be working from a Restlet snapshot to pick up all the  
latest commits.  I think the latest important thing was an infinite  
recursion that Thierry removed.  Now that GWT 1.5 is final and we  
don't have to chase a moving target any more, it will be easier to  
stabilize this.


- Rob

On Sun, Sep 7, 2008 at 10:48 PM, Mark Petrovic  
[EMAIL PROTECTED] wrote:
Good day.  I'm new here, but not new to Java and its supporting  
technologies.


I'm embarking on teaching myself GWT using Restlets, neither of  
which I have programmed before, although I have read the  
documentation for each.  I know that at the time the Restlet-GWT  
code was released, a whopping 6 weeks ago :-), there were no  
examples illustrating its use.  Perhaps there are snippets of  
examples the community can share now, some weeks after the release.   
If you have such examples, I would be quite grateful to study them,  
as would be, I'm sure, other newcomers to these subjects.  I am  
particularly interested in running the server side using the Restlet  
NET connector.


All the pieces are in front of me; at this point a few well placed  
examples would help bring it all together.


Thank you.