Re: How to access user:password in servlet

2009-11-23 Thread Thierry Boileau
Hello Macel,

from what I see in the code, these data are not taken into account by 
HTTP. After having a look at the HTTP and URI specifications, it appears 
that HTTP relies on the definition of the host term ([1] and [2]) as 
specified in the URI spec ([3]) which does not take into account the 
userinfo part (4)... That can look quite odd.
Anyway, passing user name and password in the userinfo subcomponent is 
clearly not recommended in the URI spec. Could you tell us more about 
your needs?


best regards,
Thierry Boileau

[1] http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.2.1
[2] http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.2.2
[3] http://tools.ietf.org/html/rfc3986#section-3.2.2
[4] http://tools.ietf.org/html/rfc3986#section-3.2.1
 Hi,

 I want to transfer user and password credentials:

 var loginName = jack;
 var password = 1122;
 var xhr = new XMLHttpRequest();
 xhr.open(GET, link, async, loginName, password);

 In firebug I can see the URL send:

 jack:1...@localhost

 but I have found no way to access it in my restlet servlet (I have tried POST 
 and GET).

 How does this work?

 Thanks
 Marcel

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



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


Re: Expires Header and Conditional GET with status Not Modified

2009-11-23 Thread Thierry Boileau
Hello,

I think the client can stil send a conditional request according to its 
knowledge of the remote representation (its expiration time). If the 
server estimates that the representation needs to be refreshed, then it 
sends its back to the client. Otherwise, a 304 response is sent.

best regards,
Thierry Boileau

 I have written a Restlet Web Service and a (Restlet) Client and my own Cache 
 solution on the client. The server is very simple, only example code from 
 restlet.org

 My client does a GET for a resource, the server sends back a Representation 
 and the Expires Header is set. My client use the Representation from the 
 Cache for a specific time because of the Expires Header. Fine :)

 Later (after the Expires Timestamp) the client does a Conditional GET for the 
 resource in order to see if the resource was changed. I see in Wireshark the 
 If-Modified-Since header. Fine :)

 I can set the status on the server to Status.REDIRECTION_NOT_MODIFIED (304) 
 for the response. I do not have to send back the respresentation. I say only, 
 that it is valid. Fine :)

 But now the client doesn't know how long he can use his representation.

 After a Conditional GET i want to say the client, that his representation 
 should be used for a specific time again, because it is valid. The Client 
 should use the representation from his cache for a specific time and after 
 that he should do a Conditional GET again. This is why i want to set the 
 Expires Header after a Conditional GET.

 I could not set the Expires Header on the server, because this is only 
 possible if i use a Representation for the Response. (If i want to send back 
 a representation with REDIRECTION_NOT_MODIFIED, the Expires Header is not set 
 in the restlet server (i see it in Wireshark), but it works if i do a 
 normal GET.

 I tried to set the header via getAttributes() but after that a warning 
 appeared, that i have to set the Expires Header via the restlet method 
 (setExpirationDate()).
 I can set my own Header ExpiresWorkaround and it works, but i can not set 
 the Expires Header.

 What should i do?
 (or is it wrong to set the Expires Header after a conditional GET, but then 
 what should i do to get the above behaviour?)

 Thank you very much.

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



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


Re: Newbie question about passing JSON object in a get request

2009-11-23 Thread Thierry Boileau
Hi,

I also add that this sounds quite odd to send an object in the URI.
If you intend to use a GET method in order to not get the state of a 
resource, you're surely missing something and going on a wrong way.

Best regards,
Thierry Boileau

 If you're passing the JSON object as part of the URL it must be URL encoded.

 Dave

 On Sat, Nov 21, 2009 at 7:51 PM, Steven  Headley shead...@swbell.net wrote:
   
 I am trying to pass a JSON object in a restlet client get request as follows:

 final Client client = new Client(Protocol.HTTP);
 Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â 
 Log.info( json = +json);
 Â  Â  Â  Â client.get(http://localhost:8080/greet+/+json, new Callback() 
 {
 Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â 
  Â  Â @Override
 Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â 
  Â  Â public void onEvent(Request request, Response response) {

 This get request gives me the following error:

 2009-11-21 22:49:08,921 [FATAL] Uncaught Exception:
 java.lang.IllegalArgumentException:
 Invalid character detected in URI reference at index '28': {

 any help would be appreciated.

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

 

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



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


Re: URI pattern handling

2009-11-23 Thread Thierry Boileau
Hello Vlatko,

you can have a look at this page of the wiki [1] (for restlet 2.0), 
especially the paragraph Matching of template variables.
It allows you define variables in the URI pattern that catch  al kinds 
of characters. By doing so you can define two kinds of routes:

/channels/{subscriptionPath}/subscriptions
/channels/{channel}

where channel and subscriptionPath are of type TYPE_ALL.

You may also have to configure the routing of the router (using the 
first match mode), in order that the subscriptions resources are not 
being kept by the catch-all pattern /channels/{channel}.

Best regards,
Thierry Boileau

[1] http://wiki.restlet.org/docs_2.0/143-restlet.html

 I am implementing a RESTful publish subscribe protocol using Restlet. For 
 this purpose, anything under the pattern /channels should be considered as a 
 channel. For example:
 /channels/building
 /channels/building/floor1/room101
 are both channels.

 However, I would like to capture the pattern subscriptions under each channel 
 as a different Restlet resource:
 /channels/building/subscriptions
 /channels/building/floor1/room101/subscriptions

 Any easy hint to achieve this in the most convenient way?

 Thanks!
 Vlatko

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



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


Re: Web Hooks

2009-11-23 Thread Thierry Boileau
Hello,

can you elaborate a bit more? What are your needs?

Best regards,
Thierry Boileau

 how can i use Web Hooks with Restlet?

 Thank you.

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


Re: How to access user:password in servlet

2009-11-23 Thread Stephan Koops
Hi Marcel,

do you tried to observer the TCP/IP traffic directly?
Are the credentials available there?

best regards
   Stephan

Macel Ruff schrieb:
 Hi,

 I want to transfer user and password credentials:

 var loginName = jack;
 var password = 1122;
 var xhr = new XMLHttpRequest();
 xhr.open(GET, link, async, loginName, password);

 In firebug I can see the URL send:

 jack:1...@localhost

 but I have found no way to access it in my restlet servlet (I have tried POST 
 and GET).

 How does this work?

 Thanks
 Marcel

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


Setting Http Authorization header (part 2)

2009-11-23 Thread Alex Dobjanschi
Hello Jerome and all Restlet fans!

I have spent my last 2 days trying to set the authorization header to a
certain value, using the restlet gwt api. However, I was unsuccessful, so I
started looking at the source code. You specifically said in the previous
message that an authorization header is automatically created for you when
you specify a ChallengeResponse object (also mentioned in wiki), but the
only code that actually does something with the ChallengeResponse object is
located in GwtHttpClientHelper lines 86-92:

if (request.getChallengeResponse() != null) {
result.getRequestBuilder().setUser(
request.getChallengeResponse().getIdentifier());
result.getRequestBuilder().setPassword(
String.valueOf(request.getChallengeResponse()
.getSecret()));
}

I have tried all kind of value combinations, but none showed the
Authorization header in Firebug. WHAT AM I MISSING here? PS: I don't need
a password set here, just a association between Authorization - Id in
headers map

Thanks, Alex
-- 
View this message in context: 
http://n2.nabble.com/Setting-Http-Authorization-header-part-2-tp4051325p4051325.html
Sent from the Restlet Discuss mailing list archive at Nabble.com.

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


Re: How to access user:password in servlet

2009-11-23 Thread Macel Ruff
Hi,

thanks for taking care.

As

xMLHttpRequest.open(GET, link, async, loginName, password);

explicitely supports it, I had assumed it is the standard Ajax way to 
transfer the credentials.

But as it is send in clear text in the URL (and deprecated according to 
you links)
I now prefer to send it inside a form as a hidden field and like
this it is properly protected when send as https.

regards
Marcel


Thierry Boileau schrieb:
 Hello Macel,

 from what I see in the code, these data are not taken into account by 
 HTTP. After having a look at the HTTP and URI specifications, it appears 
 that HTTP relies on the definition of the host term ([1] and [2]) as 
 specified in the URI spec ([3]) which does not take into account the 
 userinfo part (4)... That can look quite odd.
 Anyway, passing user name and password in the userinfo subcomponent is 
 clearly not recommended in the URI spec. Could you tell us more about 
 your needs?


 best regards,
 Thierry Boileau

 [1] http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.2.1
 [2] http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.2.2
 [3] http://tools.ietf.org/html/rfc3986#section-3.2.2
 [4] http://tools.ietf.org/html/rfc3986#section-3.2.1
   
 Hi,

 I want to transfer user and password credentials:

 var loginName = jack;
 var password = 1122;
 var xhr = new XMLHttpRequest();
 xhr.open(GET, link, async, loginName, password);

 In firebug I can see the URL send:

 jack:1...@localhost

 but I have found no way to access it in my restlet servlet (I have tried 
 POST and GET).

 How does this work?

 Thanks
 Marcel

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


 

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



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


RE: Default routing mode change

2009-11-23 Thread Jerome Louvel
Hi all,

 

Thanks for the valuable design feed-back. This indirectly relates to the
lack of usage of interfaces in the Restlet API and the pros/cons of this
design choice. I think this is important to keep those concerns in mind and
reevaluate them in the next major API version (3.0). I’ve entered a new
task:

 

“Reconsider usage of enumerations”

http://restlet.tigris.org/issues/show_bug.cgi?id=956

 

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

 

 

 

 

De : tpeie...@gmail.com [mailto:tpeie...@gmail.com] De la part de Tim
Peierls
Envoyé : jeudi 12 novembre 2009 16:18
À : discuss@restlet.tigris.org
Objet : Re: Default routing mode change

 

On Wed, Nov 11, 2009 at 11:40 AM, Ben R Vesco bve...@gmail.com wrote:

 Regarding the enums, we did consider them in several places but they
prevent
 addition of new constants by the framework or by the developer,
especially
 without breaking existing code. 

 

Framework users wouldn't be able to add RouterMatchMode values (but see
below), but framework developers most certainly could. The enum facility was
designed so that changes to an enum type would not break binary
compatibility. One of our key design goals in JSR 201 was to ensure that it
would be possible to add values to an enum without requiring recompilation
of existing clients of the enum type.

 

 

They also produce extra artifacts in the Javadocs cluttering them.

 

Compare the int constants in Router to any of the nested enums in the
standard library (e.g., java.Text.Normalizer.Form), and I think it's clear
that putting the values in a separate artifact is a *good* thing. It makes
the enclosing type easier to read, because you don't have to wade through a
lot of constants before getting to the point of the class.

 

Effective Java, 2nd edition, Item 30 has a passionate endorsement of enums
over int constants.

 

 

Regarding enums and extensibility, this pattern works quite well:


interface MatchMode;

enum RouterMatchMode implements MatchMode {
   BEST,
   CUSTOM,
   FIRST,
   LAST,
   NEXT,
   RANDOM,
   ;
}

void Router::setDefaultMatchingMode(MatchMode mode);

Then a developer wanting to extend the match mode need only implement
the marker interface MatchMode on their new enum and they are
interchangable with those provided by the library. This implementation
style also makes it easier to extend the match modes because you don't
have to sit around thinking and double checking, now should my new
mode be index 5 or is that used by one in the lib already?

 

For more about this approach, see EJ2ed, Item 34: Emulate extensible enums
with interfaces.

 

This could be a huge win for Restlet.

 

--tim

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

RE: DomRepresentation setIndent bug

2009-11-23 Thread Jerome Louvel
Hi Remi,

 

Thanks for spotting this. I’ve applied your fix in SVN trunk.

 

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

 

 

 

De : remidewi...@gmail.com [mailto:remidewi...@gmail.com] De la part de Rémi 
Dewitte
Envoyé : jeudi 12 novembre 2009 12:11
À : discuss@restlet.tigris.org
Objet : Re: DomRepresentation setIndent bug

 

Thierry,

Unfortunately this is buggy :
java.lang.IllegalArgumentException: Serialization parameter {indent} must have 
the value yes or no

Boolean.toString(isIndent()) should be replaced by:
isIndent() ? yes : no

Cheers,
Rémi

On Thu, Nov 12, 2009 at 09:34, Thierry Boileau thierry.boil...@noelios.com 
wrote:

Hi,

thanks for your report, the fix is available in the svn repository.

Best regards,
Thierry Boileau


 Hi,

 There seems to be a bug in DocRepresentation#createTransformer. Why this:

 transformer.setOutputProperty(
javax.xml.transform.OutputKeys.INDENT, Boolean
  .toString(isIndent()));

 is inside the if (docType != null).

 The setIndent is not working because of this.

 Thanks


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

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

RE: suggest jsonRepresentation update

2009-11-23 Thread Jerome Louvel
Hi Neel,

 

It’s would be hard to support all the JSON libraries around. Another one we
have in our radar is Jackson for its better JSON - Object serialization
mechanism:

 

“Add support for Jackson”

http://restlet.tigris.org/issues/show_bug.cgi?id=812

 

How would JSON-Lib compare to our current JSON and XStream/Jettison
extensions, and to Jackson? 

 

In any case, you could build your own extension for JSON-Lib and propose it.
See the detailed process:

http://wiki.restlet.org/developers/179-restlet/295-restlet.html

 

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

 

 

 

 

De : neel [mailto:guozhe...@sina.com] 
Envoyé : vendredi 13 novembre 2009 04:31
À : discuss@restlet.tigris.org
Objet : suggest jsonRepresentation update

 

Jsonlib is good tool for parsing the json data, but there are no support in
the restlet. i suggest the jsonRepresentation update to use the jsonlib to
parsing data

 

2009-11-13 

  _  

guozhen07

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

RE: memory leak in JaxbRepresentation

2009-11-23 Thread Jerome Louvel
Hi Sid,

I've just look at the code and don't see why it wouldn't GC if the parent
request does GC. Could you share more details or investigate more? 

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 : Sid [mailto:s...@golestane.com] 
Envoyé : jeudi 12 novembre 2009 22:33
À : discuss@restlet.tigris.org
Objet : memory leak in JaxbRepresentation

I have a resource that for GET returns a large XML.
I've notice that when ever client doesn't read the entire response,
Marshaller in JaxbRepresentation holds on to passed in objects and they
don't get garbage collected.

Is there way to prevent this

Memory leak in JaxbRepresentation if client doesn't consume the entire
response

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

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


RE: Restlet HANGS

2009-11-23 Thread Jerome Louvel
Hi Mohamed,

You should try to monitor your JVM to see which thread is blocked and where.
Something like a thread dump would help see the root of your problem.

Which version of Restlet are you using, in which environment?

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 : Thierry Boileau [mailto:thierry.boil...@noelios.com] 
Envoyé : lundi 16 novembre 2009 13:06
À : discuss@restlet.tigris.org
Objet : Re: Restlet HANGS

Hello Mohamed,

are you aware of any changes that may have happened on the server? Did 
you changes the application's binaries?
Did you try to stop/start the application?

Best regards,
Thierry Boileau
 Hi,

 Couple of months ago i've developed a restlet applications with many
 resources and many representations that i can upload files to, process
these
 in way or another and download them when finished. My application worked
 perfectly for more than five months (and it's been used several times
 everyday) till just from two days ago it started to HANG may be every 12
 hours or something (i notice the hang when i refresh the interface page on
 my browser which is an HTML representation). I've checked everything and
log
 files and didn't even find a single exception; so i've no clues on what
made
 this happen (i even didn't change anything in the application's code) i
also
 checked firewalls, network and internet connection and found nothing ..
it's
 killing me
 So please if anyone can provide me a list of possible reasons that could
 make this happen so i can check for it ii'd be real grateful ... 


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

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


RE: New Book - 'Restful Java Web Services'

2009-11-23 Thread Jerome Louvel
Hi Suneel,

Thanks for posting this news. This looks like a good reference to compare
the various technologies available for RESTful dev in Java. Restlet coverage
looks solid, looking at the table of contents.

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 : Suneel Marthi [mailto:suneel.mar...@gmail.com] 
Envoyé : lundi 16 novembre 2009 17:25
À : discuss@restlet.tigris.org
Objet : New Book - 'Restful Java Web Services'

Hi Restlet Users,

'Restful Java Web Services' by Jose Sandoval (published by PACKT) has been
released on Nov 14. The ebook is available online.

Chapter 6 covers the Restlet framework extensively (both Restlet 1.1 and
Restlet 2.0).

Chapter 9 talks about using Restlet Clients/Servers.

This book would be a useful reference for all developers building REST Web
services using the various REST frameworks out there (Restlet, Jersey and
RESTEasy).

Happy RESTing.
-- 
View this message in context:
http://n2.nabble.com/New-Book-Restful-Java-Web-Services-tp4012949p4012949.ht
ml
Sent from the Restlet Discuss mailing list archive at Nabble.com.

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

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


RE: Examples of org.restlet.routing.Validator?

2009-11-23 Thread Jerome Louvel
Hi Ben,

Not yet, but it is very straightforward. Actually this feature existed in
Restlet 1.1 but was hidden in the Route class. Looking at the API again, I
noticed an issue: the validate() method should be public instead of
protected. This is fixed in SVN trunk.

You just need to call this method for each request attribute that you want
to check for presence and/or for format. You can provide its format as a
Java Regex.

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 : Ben R Vesco [mailto:bve...@gmail.com] 
Envoyé : lundi 16 novembre 2009 19:52
À : discuss@restlet.tigris.org
Objet : Examples of org.restlet.routing.Validator?

Are there any examples or instructions showing use of the new-ish
Validator filter?

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

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


RE: Validator : not required attribute and fails if not found

2009-11-23 Thread Jerome Louvel
Hi Laurent,

This isn't correct indeed. I've fixed the behavior and added a test case as
well (see attached) in SVN trunk.

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 : Laurent Rustuel [mailto:laurent.rust...@genesyslab.com] 
Envoyé : mercredi 18 novembre 2009 17:01
À : discuss@restlet.tigris.org
Objet : Validator : not required attribute and fails if not found

Hello,
I have take a look at the new Validator class. Reading the method
beforeHandle(Request request, Response response) I don't can't 
understand why, when an attribute is not required, it return a Status 
CLIENT_ERROR_BAD_REQUEST if the value is not found. But if the value is 
not required, you should not return a client error.

Maybe in the beforeHandle(Request request, Response response) method, 
you should first test if the attribute is required or not, and then test 
accordingly.
I hope I'm clear enough.

Regards,
Laurent.

-- 
Laurent Rustuel,
Alten contractor for Genesys, an Alcatel-Lucent Company

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

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

ValidatorTestCase.java
Description: Binary data


Re: RestletGWTSimpleExample - Error while handling an HTTP client call

2009-11-23 Thread Thierry Boileau
Hello josef,

sorry for the delay of my answer. I've successfully tested the 
application using the current snapshot.
However, as I've refactored the sample code using the ClientResource, I 
suggest you get the sample zip I've just uploaded. It is available here: 
http://wiki.restlet.org/docs_2.0/188-restlet.html.
Tomorow I will rewrite the documentation, in order to reflect the 
changes of the code (basically the use of ClientResource, and the usage 
of the restlet editions gwt and jee).

Best regards,
Thierry Boileau

 could anyone confirm running successfully the RestletGWTSimpleExample?
 thanks,
 josef

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



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


RE: Re: Web Hooks

2009-11-23 Thread webpost
I have a client and a server. If an event happend on the server, i want to send 
a notification to the client.
I don't want to poll the server. I don't want to use HTTP Push or Long Polling.

information:
http://webhooks.pbworks.com/
or
http://webhooks.pbworks.com/RESTful-WebHooks

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


RE: Dependency injection in Restlet 2.0 with Guice

2009-11-23 Thread Jerome Louvel
Hi Tim and Harald,

 

The goal and main value is see is to ensure the maximum portability of a
Restlet Application from one deployment environment to another
(JSE/standalone, JEE, GAE, etc.). 

 

GAE/J only provides HTTP listening through the Servlet API, so we have to
use our Servlet/Restlet adaptation layer. The default way is to leverage our
ServerServlet class from org.restlet.ext.servlet, but we also provide a
ServletAdapter class to manual adaptation.

 

It feels like both approaches should merge as soon as we configure the inner
of the Restlet Application with Guice. Same GuiceRouter and GuiceFinder
should be usable. I’ve added a comment on the related RFE:

 

“Add support for Guice”

http://restlet.tigris.org/issues/show_bug.cgi?id=546

 

Harald, would you be willing to contribute your code to the Guice extension
developed by Tim (with the help of Bruno Harbulot recently) and to
collaborate on creating the best Guice extension possible? The current
extension code is in Restlet Incubator but should find its official place in
the next Restlet 2.1 version.

 

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

 

 

 

 

De : tpeie...@gmail.com [mailto:tpeie...@gmail.com] De la part de Tim
Peierls
Envoyé : dimanche 22 novembre 2009 22:36
À : discuss@restlet.tigris.org
Objet : Re: Dependency injection in Restlet 2.0 with Guice

 

I thought that the GAE Edition of Restlet hid the servlet-ness and made it
possible to write standalone Restlet components that run in GAE. Is that not
the case?

 

--tim

 

On Sun, Nov 22, 2009 at 4:09 PM, webp...@tigris.org wrote:

Hi there,

I was looking for dependency injection with guice, as I found the post from
Tim. The approach described there, seems to best for a standalone setup. As
I'm currently developing an application using the Google AppEngine, I was
looking for an integration with a servlet based setup. I described my
approach in my blog under a
href=http://haraldpehl.blogspot.com/2009/11/google-appengine-restlet.html;
http://haraldpehl.blogspot.com/2009/11/google-appengine-restlet.html/a

Greetings
Harald

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

RE: POST ignored in RESTlet 2.0Mx

2009-11-23 Thread Jerome Louvel
Hi Dustin,

We did fixed a related issue in the recent past. I would encourage upgrading to 
the newly released Restlet 2.0 M6 version.

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 : Dustin N. Jenkins [mailto:dustin.jenk...@nrc-cnrc.gc.ca] 
Envoyé : vendredi 20 novembre 2009 16:29
À : discuss@restlet.tigris.org
Objet : Re: POST ignored in RESTlet 2.0Mx

Hi Thierry,

That's right, my @Post method is not being called.  I'm expecting the 
additional @Get as part of the redirect, but the initial @Post should 
still be called.  If I restart my Tomcat container, then it works for 
one, maybe two requests, then it simply goes straight to the @Get 
method, but the logs still show a POST request.  I've also attached my 
debugger to the @Post and @Get methods to be sure, and only the @Get 
method is called, and if I call getMethod() from within there, it says 
it's a POST, so it's a little confusing.  This is why I was thinking 
that something is cached and the @Post is skipped, but it's just a guess.

The latest snapshot seems better, though, so I'm going to work with that 
for a while to see if it stays more stable.

Thanks for the reply,
Dustin



Thierry Boileau wrote:
 Hi Dustin,

 something is not clear for me. When you send a post request to your 
 resource, is your post method called or not?
 If not, there is a problem. Otherwise, as said Stephan, a redirection 
 makes your browser makes automatically an additional GET request the new 
 location.

 Best regards,
 Thierry Boileau

   
 Hi Dustin,

 303 (see other) says, that the result is at the given location, and you 
 have to get it with GET. So the behaviour is right.
 Use 301 (Moved Permanently) or 307 (Temporary redirect).
 See http://en.wikipedia.org/wiki/List_of_HTTP_status_codes#3xx_Redirection

 best regards
Stephan

 Dustin N. Jenkins schrieb:
   
 
 I'm using Java 6, Tomcat 6.0.20, RESTlet 2.0M5 on a Linux platform.

 After my business operations in my POST call, I simply call 
 redirectSeeOther().  When I make POST calls to the Resource now, the log 
 records it as a POST call, but my @Get method is being called instead.  
 Does the redirectSeeOther() get cached somewhere or something?  Normally 
 I'd see a POST followed by a GET in the log.  Is this a bug in the 
 current 2.0 tree?  The snapshot is doing the same thing.

 I've used wget and browser clients just to test this.

 Thanks,
 Dustin

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


 

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

-- 


Dustin N. Jenkins | Tel/Tél: 250.363.3101 | dustin.jenk...@nrc-cnrc.gc.ca

facsimile/télécopieur: (250) 363-0045

National Research Council Canada | 5071 West Saanich Rd, Victoria BC. 
V9E 2E7

Conseil national de recherches Canada | 5071, ch. West Saanich, Victoria 
(C.-B) V9E 2E7

Government of Canada | Gouvernement du Canada

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

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


Client API for HTTP_DIGEST Auth in 2.0M6

2009-11-23 Thread webpost
I just migrated our client and server from 2.0m3 to 2.0M6. All of the changes 
were fairly easy to figure out except those related to adding  
ChallengeResponse for HTTP_DIGEST authentication. Our code was based upon the 
example in the user guide (which is still the example in today's version. 

We would build a form with the username, ri, nonce, realm, domain, algorithm 
and QOP from the result, and then calculate and add the d5 digest. The we call 
request.setCredentialComponents(form). 

Since setCredentialComponents() is gone, I tried to find an alternative example 
and was not able to find one, I tried calling the individual setters for each 
of the prpoerties that had been placed into the form, and then call 
Request.setChallengeResponse(). This compiles fine, but I get the following 
warning and the a 401 response.

Nov 23, 2009 10:36:49 AM org.restlet.engine.security.AuthenticatorUtils 
formatResponse
WARNING: Challenge scheme HTTP_DIGEST not supported by the Restlet engine.
Nov 23, 2009 10:36:49 AM org.restlet.engine.security.AuthenticatorUtils 
parseMessage
WARNING: Couldn't find any helper support the HTTP_Digest challenge scheme.

Is there a current example I should be looking at? If not, can you point me in 
the right direction.

Thanks for your help
Rich

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


RE: Re: Expires Header and Conditional GET with status Not Modified

2009-11-23 Thread webpost
Hello,

yes, i know. The behaviour, you described, works fine, but I want more.

I want to send back always a Expires Header! If the client does a Conditional 
GET, the server can send back a new representation with a new Expires header 
OR say Not Modified without Expires header, but if i do not send back the 
Expires Header, from now on the client doesn't use the cache and does always a 
Conditional GET.

ONLY if i do a normal Get, then the representation is sent back with the 
Expires Header and then the client use the cache again until the Expiration 
time.

I'm asking for a possibility to say Not Modified AND set the Expires Header, 
but i can't do that with Restlet. See below...

Thank you.

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


RE : Client API for HTTP_DIGEST Auth in 2.0M6

2009-11-23 Thread Jerome Louvel
Hi Rich,

You should add the org.restlet.ext.crypto.jar to your classpath.

Cheers,
Jérôme

Le 23 nov. 2009, 7:20 PM, webp...@tigris.org a écrit :

I just migrated our client and server from 2.0m3 to 2.0M6. All of the
changes were fairly easy to figure out except those related to adding
 ChallengeResponse for HTTP_DIGEST authentication. Our code was based upon
the example in the user guide (which is still the example in today's
version.

We would build a form with the username, ri, nonce, realm, domain, algorithm
and QOP from the result, and then calculate and add the d5 digest. The we
call request.setCredentialComponents(form).

Since setCredentialComponents() is gone, I tried to find an alternative
example and was not able to find one, I tried calling the individual setters
for each of the prpoerties that had been placed into the form, and then call
Request.setChallengeResponse(). This compiles fine, but I get the following
warning and the a 401 response.

Nov 23, 2009 10:36:49 AM org.restlet.engine.security.AuthenticatorUtils
formatResponse
WARNING: Challenge scheme HTTP_DIGEST not supported by the Restlet engine.
Nov 23, 2009 10:36:49 AM org.restlet.engine.security.AuthenticatorUtils
parseMessage
WARNING: Couldn't find any helper support the HTTP_Digest challenge scheme.

Is there a current example I should be looking at? If not, can you point me
in the right direction.

Thanks for your help
Rich

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

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

RE: RE : Client API for HTTP_DIGEST Auth in 2.0M6

2009-11-23 Thread webpost
Jerome,

Thanks for the reply.  Unfortuanately, I already have 
org.restlet.ext.crypto.jar on my classpath.

Do you have any other ideas?

Thanks 
Rich


 Hi Rich,
 
 You should add the org.restlet.ext.crypto.jar to your classpath.
 
 Cheers,
 Jérôme
 
 Le 23 nov. 2009, 7:20 PM, webp...@tigris.org a écrit :
 
 I just migrated our client and server from 2.0m3 to 2.0M6. All of the
 changes were fairly easy to figure out except those related to adding
  ChallengeResponse for HTTP_DIGEST authentication. Our code was based upon
 the example in the user guide (which is still the example in today's
 version.
 
 We would build a form with the username, ri, nonce, realm, domain, algorithm
 and QOP from the result, and then calculate and add the d5 digest. The we
 call request.setCredentialComponents(form).
 
 Since setCredentialComponents() is gone, I tried to find an alternative
 example and was not able to find one, I tried calling the individual setters
 for each of the prpoerties that had been placed into the form, and then call
 Request.setChallengeResponse(). This compiles fine, but I get the following
 warning and the a 401 response.
 
 Nov 23, 2009 10:36:49 AM org.restlet.engine.security.AuthenticatorUtils
 formatResponse
 WARNING: Challenge scheme HTTP_DIGEST not supported by the Restlet engine.
 Nov 23, 2009 10:36:49 AM org.restlet.engine.security.AuthenticatorUtils
 parseMessage
 WARNING: Couldn't find any helper support the HTTP_Digest challenge scheme.
 
 Is there a current example I should be looking at? If not, can you point me
 in the right direction.
 
 Thanks for your help
 Rich
 
 --
 http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2423509

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


Restlet 2.0 Best Practices

2009-11-23 Thread webpost
Hi,

I am evaluating Restlet 2.0 vs. Spring 3.0 for a new project that is starting 
soon. I have done a lot of reading on the website and have written a couple of 
small programs with Restlet 2.0M6 to get the feel for it. I am looking to hear 
from people who have been using it into production about their configuration 
choices. 

1) What connector are you using with Restlet in production?

I very much like the idea of not having to run inside of a web container, but I 
am not sure from the list of available connectors which are the best for 
production, and what are the pros and con's of each connector. Any advice from 
the community on this is appreciated. 

2) How are you dealing with Caching on the server side?

The app I am working on does a lot of DB interactions and caching results 
between requests would improve performance. What caching solutions are people 
using with Restlets. 

3)  Are you finding that the Services / Data Access Layers in Standard Web Apps 
don’t apply in the Restlet World?

Given that we are exposing resources and no longer exposing services and 
functionality, do you find that the need for Data Access Objects is gone? As i 
think about what the app will do, I keep noticing that it is easier to put the 
data access for a resource into the Restlet instead of making a Data Access 
Object. After all PUT, POST, and DELETE will do something to the persistent 
state of the resource and GET will just query it. Thoughts about this from the 
community are highly appreciated. 

4) What does your Restlet production setup look like?

Thanks
Adib

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


FirstResource Example - What is Item

2009-11-23 Thread webpost
From the FirstResource example I can't resolve 'Item'. Should this be 
specified from one of the imports?

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


Re: Dependency injection in Restlet 2.0 with Guice

2009-11-23 Thread Tim Peierls
I like how Harald extends Router to be injector-aware in order to avoid
requiring the explicit use of FinderFactory. In fact, I have been
experimenting with a Router extension that adds two more methods:

public TemplateRoute attach(String pathTemplate, Class? extends
ServerResource targetClass, Class? extends Annotation targetAnnotation) {
return attach(pathTemplate,
finderFactory.finderOf(Key.get(targetClass, targetAnnotation)));
}

public TemplateRoute attachDefault(Class? extends ServerResource
targetClass, Class? extends Annotation targetAnnotation) {
return attachDefault(finderFactory.finderOf(Key.get(targetClass,
targetAnnotation)));
}

This allows users to attach to resource classes qualified by an annotation,
which was the only thing that I felt was missing from Harald's GuiceRouter.

In order to smooth the way to JSR-330 integration, however, I think it would
be better to call this class QualifiedRouter and make it abstract, with
DI-framework-specific concrete subclasses. Ideally, construction could be
left to a factory class that would produce the correct concrete subclass
without having to mention it explicitly in the user code.

I'd like to see if it's possible to avoid having any extra machinery to deal
with servlets -- good support for servlets already comes with Guice and
Spring (and others I'm sure), so I'm working on a way to get the
injector-awareness passed in at the Application level so it doesn't leak
into Restlet wiring code. I wouldn't want to require a particular
structure for the linkage between Servlet and Restlet worlds.

Another topic: What about scopes? Servlets need scopes like request,
session, conversation, etc. Only the first of those makes any sense in
Restlet, but I'm having trouble imagining a strong need for it in practice,
given that Resources are fundamentally request-scoped. Does anyone have an
example of a need for binding in request scope that isn't trivially
satisfied by Restlet already?

--tim


On Mon, Nov 23, 2009 at 1:19 PM, Jerome Louvel jerome.lou...@noelios.comwrote:

  Hi Tim and Harald,



 The goal and main value is see is to ensure the maximum portability of a
 Restlet Application from one deployment environment to another
 (JSE/standalone, JEE, GAE, etc.).



 GAE/J only provides HTTP listening through the Servlet API, so we have to
 use our Servlet/Restlet adaptation layer. The default way is to leverage our
 ServerServlet class from org.restlet.ext.servlet, but we also provide a
 ServletAdapter class to manual adaptation.



 It feels like both approaches should merge as soon as we configure the
 inner of the Restlet Application with Guice. Same GuiceRouter and
 GuiceFinder should be usable. I’ve added a comment on the related RFE:



 “Add support for Guice”

 http://restlet.tigris.org/issues/show_bug.cgi?id=546



 Harald, would you be willing to contribute your code to the Guice extension
 developed by Tim (with the help of Bruno Harbulot recently) and to
 collaborate on creating the best Guice extension possible? The current
 extension code is in Restlet Incubator but should find its official place in
 the next Restlet 2.1 version.



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









 *De :* tpeie...@gmail.com [mailto:tpeie...@gmail.com] *De la part de* Tim
 Peierls
 *Envoyé :* dimanche 22 novembre 2009 22:36

 *À :* discuss@restlet.tigris.org
 *Objet :* Re: Dependency injection in Restlet 2.0 with Guice



 I thought that the GAE Edition of Restlet hid the servlet-ness and made
 it possible to write standalone Restlet components that run in GAE. Is that
 not the case?



 --tim



 On Sun, Nov 22, 2009 at 4:09 PM, webp...@tigris.org wrote:

 Hi there,

 I was looking for dependency injection with guice, as I found the post from
 Tim. The approach described there, seems to best for a standalone setup. As
 I'm currently developing an application using the Google AppEngine, I was
 looking for an integration with a servlet based setup. I described my
 approach in my blog under a href=
 http://haraldpehl.blogspot.com/2009/11/google-appengine-restlet.html;
 http://haraldpehl.blogspot.com/2009/11/google-appengine-restlet.html/a

 Greetings
 Harald




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

Re: FirstResource Example - What is Item

2009-11-23 Thread Bruno Harbulot
Hello,

I'm not sure where you got your examples from (perhaps there's a 
packaging error somewhere), but it's in the same package, in the 
subversion repository:

http://restlet.tigris.org/source/browse/restlet/trunk/modules/org.restlet.example/src/org/restlet/example/firstResource/

Best wishes,

Bruno.

webp...@tigris.org wrote:
 From the FirstResource example I can't resolve 'Item'. Should this be 
 specified from one of the imports?
 
 --
 http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2423562


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


RE: Dependency injection in Restlet 2.0 with Guice

2009-11-23 Thread Leigh L. Klotz, Jr.
Sorry for joining in the middle and not paying attention. Do you mean a scope 
annotation on the Resource class itself?  I have so far not seen a need for any 
scope other than the implicit request scope. We do make use of objects from 
other scopes from within Resources, but I believe you're not asking that 
question.
 
Leigh.
 


From: tpeie...@gmail.com [mailto:tpeie...@gmail.com] On Behalf Of Tim Peierls
Sent: Monday, November 23, 2009 2:35 PM
To: discuss@restlet.tigris.org
Subject: Re: Dependency injection in Restlet 2.0 with Guice


  snip 

Another topic: What about scopes? Servlets need scopes like request, session, 
conversation, etc. Only the first of those makes any sense in Restlet, but I'm 
having trouble imagining a strong need for it in practice, given that Resources 
are fundamentally request-scoped. Does anyone have an example of a need for 
binding in request scope that isn't trivially satisfied by Restlet already?

--tim

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

Re: Dependency injection in Restlet 2.0 with Guice

2009-11-23 Thread Tim Peierls
I meant whether you would find it useful/necessary to be able to bind
something in request scope and have it injected into your resources. An
artificial example off the top of my head:

// binding code
bind(Scratchpad.class).in(RequestScoped.class);

// Resource code
public class MyResource extends ServerResource {
@Inject MyResource(Scratchpad scratchPad) { ... }
...
}

It's not hard to accomplish if it doesn't have to be related to servlet
request scope, but I wonder if there's any point to it. I have a feeling I'm
forgetting something obvious.

--tim


On Mon, Nov 23, 2009 at 5:50 PM, Leigh L. Klotz, Jr.
leigh.kl...@xerox.comwrote:

  Sorry for joining in the middle and not paying attention. Do you mean a
 scope annotation on the Resource class itself?  I have so far not seen a
 need for any scope other than the implicit request scope. We do make use of
 objects from other scopes from within Resources, but I believe you're not
 asking that question.

 Leigh.

  --
 *From:* tpeie...@gmail.com [mailto:tpeie...@gmail.com] *On Behalf Of *Tim
 Peierls
 *Sent:* Monday, November 23, 2009 2:35 PM

 *To:* discuss@restlet.tigris.org
 *Subject:* Re: Dependency injection in Restlet 2.0 with Guice

   snip

 Another topic: What about scopes? Servlets need scopes like request,
 session, conversation, etc. Only the first of those makes any sense in
 Restlet, but I'm having trouble imagining a strong need for it in practice,
 given that Resources are fundamentally request-scoped. Does anyone have an
 example of a need for binding in request scope that isn't trivially
 satisfied by Restlet already?

 --tim



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

Re: Restlet 2.0 Best Practices

2009-11-23 Thread Ben R Vesco
 1) What connector are you using with Restlet in production?


Tomcat due to ops guys' familiarity with it.


 2) How are you dealing with Caching on the server side?


Hibernate managed cache.


 3)  Are you finding that the Services / Data Access Layers in Standard Web 
 Apps don’t apply in the Restlet World?


I'm still using a DAO layer on top of Hibernate with my Restlet based framework.

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