Re: cookie setting with safari browser

2010-01-13 Thread Thierry Boileau
Hello,

you can have a look here http://www.p3pwriter.com/LRN_111.asp and here 
http://msdn.microsoft.com/en-us/library/ms537343%28VS.85%29.aspx.
Its about compact policies.

Best regards,
Thierry Boileau

 Hi Marc,
 Strange thing ;-) ... but effectively the requests come from an IFrame ...
 I don't understand what that header is about.
 Do you have more information about hat ?

 Thanks.


 Marc Larue wrote:

 Is the request from an iframe? Had the same prob with my facebook
 app, added this response header and now it works!

 P3P:CP=\NOI DSP COR NID ADM DEV PSA OUR IND UNI PUR COM NAV INT STA\

 /m



  


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

Re: cookie setting with safari browser

2010-01-13 Thread pegpeg
hi, 

that works now with IE6, IE7, IE8, last Safari4 and FF , what I've done is
the following:

code
// NB: version 0 for IE6 compatibility - confirmed
// NB: domain for IE8 - nearly confirmed (tested with P3P header)
CookieSetting cookie = new CookieSetting(0,
getAuthCookieName(),sessionToken, /, getDomainName());

//cookie.setMaxAge(3600);
// NB: max-age commented for Safari - not absolutely sure 

getResponse().getCookieSettings().add(cookie);

// NB: P3P header for Iframe and IE
Form responseHeaders = (Form)
getResponse().getAttributes().get(org.restlet.http.headers);
if (responseHeaders == null) {
responseHeaders = new Form();
getResponse().getAttributes().put(org.restlet.http.headers,
responseHeaders);
}
responseHeaders.add(P3P:CP, \NOI DSP COR NID ADM DEV PSA OUR IND
UNI PUR COM NAV INT STA\);

/code
 
-- 
View this message in context: 
http://n2.nabble.com/cookie-setting-with-safari-browser-tp4271441p4337372.html
Sent from the Restlet Discuss mailing list archive at Nabble.com.

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


RE: Restlet client and setting the request header date

2010-01-13 Thread Garry Turkington
Hi,

I too hit this problem as I wanted to set a specific value for the Date header.

In absence of this ability -- I've seen issue 1001 -- can I get the value of 
the header client side before the request is sent in any way?  I want to set 
another header based on the date.

I thought that setting a Uniform instance as the oncontinue handler of the 
ClientResource would allow this but the handle() method in Uniform doesn't seem 
to be called before the request is actually sent?

Thanks,
Garry

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


RE: Re: Applying multiple security scheme's to a uri

2010-01-13 Thread webpost
Just some feedback.

This is working nicely.

Thank you,
--KD

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


RE: Re: Restlet GWT RPC 2.0

2010-01-13 Thread Kevin Daly
It's now compiling for me. The errors don't seem to cause any issues. I guess 
it will all be worked out in the next milestone.

see this post in the bug tracker.

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

My last post is how I got it all working.

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


Re: Re: Restlet GWT RPC 2.0

2010-01-13 Thread Tim Peierls
It's still pretty annoying to have to drag in servlets. Is it really too
hard to extract the important parts of GwtShellServlet into a Restlet?

--tim

On Wed, Jan 13, 2010 at 8:46 AM, Kevin Daly ked...@sqm.ca wrote:

 It's now compiling for me. The errors don't seem to cause any issues. I
 guess it will all be worked out in the next milestone.

 see this post in the bug tracker.

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

 My last post is how I got it all working.

 --

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


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

RE: servlet mapping question

2010-01-13 Thread webpost
Isn't there a possibility to map all other requests (except /restlet/* and 
/index.html) to a resource?

In the end it should be like this:
resourceA - localhost/myapp/restlet/*
index.html - localhost/myapp/
resourceB - localhost/myapp/*

Please help :)

 hello!
 
 I run a restlet application inside a j2ee container.
 
 in my web xml are the following entries:
 
 servlet-mapping  
  servlet-nameRestletServlet/servlet-name  
  url-pattern/restlet/*/url-pattern
 /servlet-mapping
 
 and
 
 welcome-file-list
  welcome-fileindex.html/welcome-file
 /welcome-file-list
 
 Now every call to the server like localhost:8080/MyApplication/restlet/* is 
 mapped to the application.
 If I just type localhost:8080/MyApplication/ i get redirected to 
 localhost:8080/MyApplication/index.html
 
 How can I redirect every other call (i.e. 
 localhost:8080/MyApplication/othercall to 
 localhost:8080/MyApplication/error.html ?
 
 Thanks in advance!

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


VirtualHosts in ServerServlet

2010-01-13 Thread Erick Fleming
Do VirtualHost work when deploying via a ServerServlet (tomcat6) or only
when using Restlet as stand-alone server?

-- 
Erick Fleming

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

Re: Re: Restlet GWT RPC 2.0

2010-01-13 Thread Niclas Hedhman
On Wed, Jan 13, 2010 at 9:46 PM, Kevin Daly ked...@sqm.ca wrote:
 It's now compiling for me. The errors don't seem to cause any issues. I guess 
 it will all be worked out in the next milestone.

 see this post in the bug tracker.

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

Not sure if we are observing the same problem.

I have all the while had the GWT served from one webapp (.war) and the
Restlet based server in a different webapp. All the while the GWT
edition of org.restlet (and servlet) has been separated from the JEE
edition during compile, so I don't think it is related. (Or do I
misunderstand your explaination?)

I have worked off the HEAD for a while, but can't pinpoint the time of
breakage, whether it was something that changed in Restlet, my
introduction of GWT 2.0 OR some statement that I have added that
triggers the problem. After all, doesn't GWT only traverse the usage
graphs of classes when it decides what to be pulled in?


I'll see if I can pull together a really tiny testcase...

Cheers
-- 
Niclas Hedhman, Software Developer
http://www.qi4j.org - New Energy for Java

I  live here; http://tinyurl.com/2qq9er
I  work here; http://tinyurl.com/2ymelc
I relax here; http://tinyurl.com/2cgsug

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


Re: servlet mapping question

2010-01-13 Thread Thierry Boileau
Hello,

I think your question is a matter of configuration of the web.xml file 
which is specific to jee and not to the Restlet framework.
Another solution is to let your Restlet application catch all incoming 
requests and route them:
Router router = new Router(getContext());

// handle the restlet routes
router.attach(/restlet ...);
// if the other resources are static files, let us use the Directory
router.attachDefault(new Directory(getContext(), war:///);


best regards,
Thierry Boileau

 Isn't there a possibility to map all other requests (except /restlet/* and 
 /index.html) to a resource?

 In the end it should be like this:
 resourceA -  localhost/myapp/restlet/*
 index.html -  localhost/myapp/
 resourceB -  localhost/myapp/*

 Please help :)


 hello!

 I run a restlet application inside a j2ee container.

 in my web xml are the following entries:

 servlet-mapping
   servlet-nameRestletServlet/servlet-name
   url-pattern/restlet/*/url-pattern
 /servlet-mapping

 and

 welcome-file-list
   welcome-fileindex.html/welcome-file
 /welcome-file-list

 Now every call to the server like localhost:8080/MyApplication/restlet/* 
 is mapped to the application.
 If I just type localhost:8080/MyApplication/ i get redirected to 
 localhost:8080/MyApplication/index.html

 How can I redirect every other call (i.e. 
 localhost:8080/MyApplication/othercall to 
 localhost:8080/MyApplication/error.html ?

 Thanks in advance!
  
 --
 http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2437032



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


Re: VirtualHosts in ServerServlet

2010-01-13 Thread Thierry Boileau
Hello Erik,

VirtualHosts are operational when used inside a Servlet container too.

Best regards,
Thierry Boileau

 Do VirtualHost work when deploying via a ServerServlet (tomcat6) or 
 only when using Restlet as stand-alone server?
 -- 
 Erick Fleming

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


RE: Re: servlet mapping question

2010-01-13 Thread webpost
thank you very much!

I used your solution and it works good. But there is still a small problem:

application class:

router.attach( /restlet/myresource,MyResourceA.class );
router.attach( /*, MyResourceB.class );
router.attachDefault(new Directory(getContext(), war:///));

I want to call MyResourceB when I type something like 
localhost/MyRestletApp/requesturl but this doesn't work. It always tries to 
convert the target to war:///requesturl

What is wrong?
Thanks in advance!

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


RE: Re: How to get HttpServletResponse object in restlet

2010-01-13 Thread Sam Bloomquist
Ok, I have a related question.  I've found out how to get to the 
HttpServletResponse object and have passed that to the Blobstore API, where it 
was successfully written to and committed.  Is there an example of how to turn 
that HttpServletResponse object into a Representation that can be returned to 
the Restlet framework?  I'm guessing I want to use the OutputRepresentation, 
but I'm not super clear on how that should work.

Thanks,
Sam

 Hello Sam,
 
 At this moment, nothing is available in the framework to get access to 
 the servlet's response which could help you to support the Blobstore API.
 You can have a look at the code of the ServerServlet and Servlet Call 
 classes of the Servlet extension.
 There is also an issue in order to support this feature: 
 http://restlet.tigris.org/issues/show_bug.cgi?id=998.
 
 Best regards,
 Thierry Boileau
 
  I'm using Restlet with GAE, and the GAE Blobstore API requires a 
  HttpServletRequest object for uploading blobs and a HttpServletResponse 
  object for serving them.  I found the static 
  ServletCall#getRequest(Request) method to get the HttpServletRequest object 
  from a restlet Request object, but is there a similar way to get the 
  HttpServletResponse object from the restlet Response?
 
  Thanks,
  Sam
 
  --
  http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2435938
 
 

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


Modeling button presses that invoke server side actions via REST

2010-01-13 Thread kevinpauli
Hi, I'm embarking on a new web app and have chosen RESTlet.  Now it is time
to begin designing the interactions, and something sorta basic about REST 
has me stumped.  I am trying to figure out the best way to mediate the
impedance mismatch between REST and OO without falling down the slippery
slope of RPC.  Let me give a (contrived) example.

Widgets can be created, modified, and then submitted for review.

To modify a widget with the id of 123, the user does a PUT to
/myapp/widget/123 and the new form data.  The restlet repackages all the
form data as a POJO and hands it off to the logic layer for validation and
subsequent persistence, invoking WidgetManager.update(widgetPojo).

To submit a widget for review, the user clicks a button, which also does a
PUT to /myapp/widget/123, but now the form data  just has has one field, a
status of submitted (I don't send all the form data again, just the field
I want to change).  However, now the restlet needs to invoke a different
business object, WidgetStateManager.updateState(123, submitted), which is
going to do some other specialized processing in addition to updating the
state. 

So, in an attempt to be RESTful, I've modeled both the widget updates and
the submit for review action as PUTs to the same URL, /myapp/widget/123.  So
now, in my restlet, I need to figure out what a particular PUT request means
in terms of the business functions, and therefore which business function(s)
to invoke.

But how can I reliably determine which function to invoke merely by
inspecting the values in the form data?  It is SOOO tempting to pass an
action field along with the form data, with a value like update or
submit for review in the PUT!  Then my restlet could do a switch based on
that value.  But that of course is not RESTful and is nothing more than
dressed up RPC.

It just doesn't seem safe or scalable to infer what button was clicked just
by examining the form data with a bunch of if-then-elses in the restlet.  I
can imagine dozens of different actions that could be taken on a widget, and
therefore dozens of if-then-elses.  What am I missing here?  My gut tells me
I haven't modeled my resources correctly, or I'm missing a particular
resource abstraction that would help.

-- 
View this message in context: 
http://n2.nabble.com/Modeling-button-presses-that-invoke-server-side-actions-via-REST-tp4375243p4375243.html
Sent from the Restlet Discuss mailing list archive at Nabble.com.

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


Re: Modeling button presses that invoke server side actions via REST

2010-01-13 Thread Tim Peierls
It sounds like you have one URI for two distinct resources: the contents of
widget 123 and the submission status of widget 123. Why not just use two
URIs?

/myapp/widget/123   // for the contents of widget 123
/myapp/widget/123/status // for the status of widget 123

--tim

On Wed, Jan 13, 2010 at 4:32 PM, kevinpauli ke...@thepaulis.com wrote:

 Hi, I'm embarking on a new web app and have chosen RESTlet.  Now it is time
 to begin designing the interactions, and something sorta basic about REST
 has me stumped.  I am trying to figure out the best way to mediate the
 impedance mismatch between REST and OO without falling down the slippery
 slope of RPC.  Let me give a (contrived) example.

 Widgets can be created, modified, and then submitted for review.

 To modify a widget with the id of 123, the user does a PUT to
 /myapp/widget/123 and the new form data.  The restlet repackages all the
 form data as a POJO and hands it off to the logic layer for validation and
 subsequent persistence, invoking WidgetManager.update(widgetPojo).

 To submit a widget for review, the user clicks a button, which also does a
 PUT to /myapp/widget/123, but now the form data  just has has one field, a
 status of submitted (I don't send all the form data again, just the field
 I want to change).  However, now the restlet needs to invoke a different
 business object, WidgetStateManager.updateState(123, submitted), which is
 going to do some other specialized processing in addition to updating the
 state.

 So, in an attempt to be RESTful, I've modeled both the widget updates and
 the submit for review action as PUTs to the same URL, /myapp/widget/123.
  So
 now, in my restlet, I need to figure out what a particular PUT request
 means
 in terms of the business functions, and therefore which business
 function(s)
 to invoke.

 But how can I reliably determine which function to invoke merely by
 inspecting the values in the form data?  It is SOOO tempting to pass an
 action field along with the form data, with a value like update or
 submit for review in the PUT!  Then my restlet could do a switch based on
 that value.  But that of course is not RESTful and is nothing more than
 dressed up RPC.

 It just doesn't seem safe or scalable to infer what button was clicked just
 by examining the form data with a bunch of if-then-elses in the restlet.  I
 can imagine dozens of different actions that could be taken on a widget,
 and
 therefore dozens of if-then-elses.  What am I missing here?  My gut tells
 me
 I haven't modeled my resources correctly, or I'm missing a particular
 resource abstraction that would help.

 --
 View this message in context:
 http://n2.nabble.com/Modeling-button-presses-that-invoke-server-side-actions-via-REST-tp4375243p4375243.html
 Sent from the Restlet Discuss mailing list archive at Nabble.com.

 --

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


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

Re: Modeling button presses that invoke server side actions via REST

2010-01-13 Thread Rhett Sutphin
Hi,

Tim's idea is a good one.  You might also consider having a review queue 
resource to which you POST widgets that are ready to be reviewed.  GET on this 
resource would be a natural way to expose the widgets that are ready for review 
to the reviewers.

Rhett

On Jan 13, 2010, at 3:47 PM, Tim Peierls wrote:

 It sounds like you have one URI for two distinct resources: the contents of 
 widget 123 and the submission status of widget 123. Why not just use two URIs?
 
 /myapp/widget/123   // for the contents of widget 123
 /myapp/widget/123/status // for the status of widget 123
 
 --tim
 
 On Wed, Jan 13, 2010 at 4:32 PM, kevinpauli ke...@thepaulis.com wrote:
 Hi, I'm embarking on a new web app and have chosen RESTlet.  Now it is time
 to begin designing the interactions, and something sorta basic about REST
 has me stumped.  I am trying to figure out the best way to mediate the
 impedance mismatch between REST and OO without falling down the slippery
 slope of RPC.  Let me give a (contrived) example.
 
 Widgets can be created, modified, and then submitted for review.
 
 To modify a widget with the id of 123, the user does a PUT to
 /myapp/widget/123 and the new form data.  The restlet repackages all the
 form data as a POJO and hands it off to the logic layer for validation and
 subsequent persistence, invoking WidgetManager.update(widgetPojo).
 
 To submit a widget for review, the user clicks a button, which also does a
 PUT to /myapp/widget/123, but now the form data  just has has one field, a
 status of submitted (I don't send all the form data again, just the field
 I want to change).  However, now the restlet needs to invoke a different
 business object, WidgetStateManager.updateState(123, submitted), which is
 going to do some other specialized processing in addition to updating the
 state.
 
 So, in an attempt to be RESTful, I've modeled both the widget updates and
 the submit for review action as PUTs to the same URL, /myapp/widget/123.  So
 now, in my restlet, I need to figure out what a particular PUT request means
 in terms of the business functions, and therefore which business function(s)
 to invoke.
 
 But how can I reliably determine which function to invoke merely by
 inspecting the values in the form data?  It is SOOO tempting to pass an
 action field along with the form data, with a value like update or
 submit for review in the PUT!  Then my restlet could do a switch based on
 that value.  But that of course is not RESTful and is nothing more than
 dressed up RPC.
 
 It just doesn't seem safe or scalable to infer what button was clicked just
 by examining the form data with a bunch of if-then-elses in the restlet.  I
 can imagine dozens of different actions that could be taken on a widget, and
 therefore dozens of if-then-elses.  What am I missing here?  My gut tells me
 I haven't modeled my resources correctly, or I'm missing a particular
 resource abstraction that would help.
 
 --
 View this message in context: 
 http://n2.nabble.com/Modeling-button-presses-that-invoke-server-side-actions-via-REST-tp4375243p4375243.html
 Sent from the Restlet Discuss mailing list archive at Nabble.com.
 
 --
 http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2437165


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


Starting my own threads from a Restlet request

2010-01-13 Thread Marc Limotte
I'm creating a web service, which aggregates data from multiple calls
to an external servers (these calls are done over RMI through a 3rd
party library).  I'd lke to use a pool of threads from the Java
Concurrent library to make multiple requests at once.

So, my first question is whether Restlet supports the ability to write
multi-threaded representation methods in a ServerResource?

I ask, because I've tried it and it partially works, but I also see an
exception:

Jan 13, 2010 11:26:47 AM org.restlet.engine.http.StreamServerCall complete
WARNING: Unable to shutdown server socket
java.net.SocketException: Socket is not connected
at sun.nio.ch.SocketChannelImpl.shutdown(Native Method)
at 
sun.nio.ch.SocketChannelImpl.shutdownInput(SocketChannelImpl.java:640)
at sun.nio.ch.SocketAdaptor.shutdownInput(SocketAdaptor.java:360)
at 
org.restlet.engine.http.StreamServerCall.complete(StreamServerCall.java:108)
at 
org.restlet.engine.http.HttpServerAdapter.commit(HttpServerAdapter.java:478)
at 
org.restlet.engine.http.HttpServerHelper.handle(HttpServerHelper.java:150)
at 
org.restlet.engine.http.StreamServerHelper$ConnectionHandler.run(StreamServerHelper.java:89)
at 
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at 
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:637)

I'm not sure what this exception is telling me.  I'd appreciate it if
anyone could shed some light on the meaning of this exception.

Marc

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


RE: Re: servlet mapping question

2010-01-13 Thread webpost
I can't get this to work like I want:

TemplateRoute route = router.attach( /, MyResourceA.class );
route.setMatchingMode(Template.MODE_STARTS_WITH);
router.attachDefault(new Directory(getContext(), war:///));

this always loads MyResourceA, because the main url (localhost/MyApp/) also 
starts with a /. But this should be attached to the war:/// directory instead 
of MyResourceA

So I tried to attach MyResourceA as default and in this resource I evaluate the 
relative reference with getRequest().getResourceRef().getRelativeRef()

But how can I forward to Directory(getContext(), war:///) in case the 
relativeRef is . ?



 Hi,
 
 by default, the router matches the routes using the equals mode.
 In your case, you seem to need something which is more like starts with:
 
 TemplateRoute route = router.attach( /, MyResourceB.class );
 route.setMatchingMode(Template.MODE_STARTS_WITH);
 
 
 
 Best regards,
 Thierry Boileau
 
  thank you very much!
 
  I used your solution and it works good. But there is still a small problem:
 
  application class:
 
  router.attach( /restlet/myresource,MyResourceA.class );
  router.attach( /*, MyResourceB.class );
  router.attachDefault(new Directory(getContext(), war:///));
 
  I want to call MyResourceB when I type something like 
  localhost/MyRestletApp/requesturl but this doesn't work. It always tries 
  to convert the target to war:///requesturl
 
  What is wrong?
  Thanks in advance!
 
 

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


Re: servlet mapping question

2010-01-13 Thread Thierry Boileau
Hi,

could you list the distinct URIs you want to define and their taret 
(resource, static files, etc) ?

Best regards,
Thierry Boileau

 I can't get this to work like I want:

 TemplateRoute route = router.attach( /, MyResourceA.class );
 route.setMatchingMode(Template.MODE_STARTS_WITH);
 router.attachDefault(new Directory(getContext(), war:///));

 this always loads MyResourceA, because the main url (localhost/MyApp/) also 
 starts with a /. But this should be attached to the war:/// directory 
 instead of MyResourceA

 So I tried to attach MyResourceA as default and in this resource I evaluate 
 the relative reference with getRequest().getResourceRef().getRelativeRef()

 But how can I forward to Directory(getContext(), war:///) in case the 
 relativeRef is . ?




 Hi,

 by default, the router matches the routes using the equals mode.
 In your case, you seem to need something which is more like starts with:

 TemplateRoute route = router.attach( /, MyResourceB.class );
 route.setMatchingMode(Template.MODE_STARTS_WITH);



 Best regards,
 Thierry Boileau

  
 thank you very much!

 I used your solution and it works good. But there is still a small problem:

 application class:

 router.attach( /restlet/myresource,MyResourceA.class );
 router.attach( /*, MyResourceB.class );
 router.attachDefault(new Directory(getContext(), war:///));

 I want to call MyResourceB when I type something like 
 localhost/MyRestletApp/requesturl but this doesn't work. It always tries 
 to convert the target to war:///requesturl

 What is wrong?
 Thanks in advance!





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