Possible GAE Client issue.

2009-06-24 Thread Matt
Hi there,

I'm getting the following error whenever I attempt to use the client class
from within the GAE.

Client client = new Client(Protocol.HTTP);
Response response = client.get("http://www.google.com";);

Internal Connector Error (1002) - access denied (java.net.SocketPermission
www.google.com resolve)

NB: I'm not using anything other than the default provided by restlet i.e.
I'm not using apache's HttpClient.

I've updated the gae jar to be the latest snapshot as of yesterday but I'm
still getting this problem.

Any suggestions? Or is it a potential bug? 

Thanks,
Matt




-- 
View this message in context: 
http://n2.nabble.com/Possible-GAE-Client-issue.-tp3151643p3151643.html
Sent from the Restlet Discuss mailing list archive at Nabble.com.

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


Architecture question

2009-06-24 Thread Schley Andrew Kutz
I have moved my application from sub-classing Restlets to sub-classing  
Resources and am now relying on annotations to process incoming  
requests (@Get for ex.). However, one of the nice side-effects of  
processing requests with the catch-all handle method is that it allows  
me to have one place to catch exceptions. My question is this: Is  
there a way to catch all exceptions with one method (an onError event  
handler for ex.) so that I can decide what to do with them there?  
Thanks!

-- 
-a

"Ideally, a code library must be immediately usable by naive  
developers, easily customized by more sophisticated developers, and  
readily extensible by experts." -- L. Stein

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


Re: Content Negotiation for Safari 4. Any way to override?

2009-06-24 Thread Bruno Harbulot
Hi Thierry,

I'm not entirely sure what the intended behaviour of the TunnelService 
(regarding user-agents) is. Could you confirm this should be as follow 
(assuming the user agent tunnel is switched on in the service)?


Step 1. The TunnelService parses the 'User-Agent' header and compares it 
to "org/restlet/data/agent.properties", therefore populating agent 
attributes in the client info class.

For example (with Safari 4):
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_7; en-us) 
AppleWebKit/530.18 (KHTML, like Gecko) Version/4.0.1 Safari/530.18

->
{agentOsShortName=Macintosh, osData= en-us, agentName=Safari, 
mozillaVersion=5.0, appleWebKitComment=KHTML, like Gecko, 
familyVersion=4.0.1, agentVersion=530.18, agentOs=Intel Mac OS X 10_5_7, 
appleWebKitVersion=530.18}

Step 2. The service then looks into 
"org/restlet/service/accept.properties", if the 'agentName' (in a given 
block in this file) matches the 'agentName' in the agent attributes and 
if the 'acceptOld' line (in the same block) matches the original 
'Accept' header in the request, then 'Accept' is replaced with the value 
in 'acceptNew'.



In the test above, the agentName is detected properly, but it seems the 
blank line in the acceptOld config file doesn't mean it's a wildcard, so 
there should probably be the actual Accept header sent by Safari in this 
configuration file. This may be the reason why it doesn't work (it seems 
to work when that line is configured to match the Accept header sent).


Best wishes,

Bruno.



P.S.: Below are a few User-Agent and Accept headers I've been able to 
gather.

- Firefox 2 on XP:
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.20) 
Gecko/20081217 Firefox/2.0.0.20 (.NET CLR 3.5.30729)
Accept: 
text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5

(I was surprised to see that this one doesn't seem to be recognised as 
'agentName=Firefox' but 'Mozilla'; here are the attributes: 
{agentName=Mozilla, osData=Windows NT 5.1; en-GB; rv:1.8.1.20) 
Gecko/20081217 Firefox/2.0.0.20 (.NET CLR 3.5.30729, agentVersion=5.0, 
agentOs=Windows}.)


- Browser in the GWT Eclipse plugin:
User-Agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US; rv:1.7.12) 
Gecko/20050920
Accept: 
text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5

- iPod Touch (FW 2.2.1, not the latest):
User-Agent: Mozilla/5.0 (iPod; U; CPU iPhone OS 2_2_1 like Mac OS X; 
en-us) AppleWebKit/525.18.1 (KHTML, like Gecko) Version/3.1.1 
Mobile/5H11 Safari/525.20
Accept: 
text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5

- MSIE 8 on XP:
Accept: */*
User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; 
Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727; InfoPath.1; .NET CLR 
3.0.4506.2152; .NET CLR 3.5.30729)

- Safari 4 on XP:
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) 
AppleWebKit/530.17 (KHTML, like Gecko) Version/4.0 Safari/530.17
Accept: 
application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5

- Safari 4 on OSX:
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_7; en-us) 
AppleWebKit/530.18 (KHTML, like Gecko) Version/4.0.1 Safari/530.18
Accept: 
application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5

Thierry Boileau wrote:
> Hi Bruce,
> 
> can you send us the content of the "user-agent" header? We will complete 
> the default "agent.properties" file.
> 
> best regards,
> Thierry Boileau
>> Hi guys,
>>
>> I'm setting up a restlet app at the moment, and I'd like to set it up so 
>> that if a user uses a browser to access a resource, he gets given a nicely 
>> formatted HTML page, but if he separately asks for XML or JSON he gets a 
>> machine parsable response.  Its all working well on Firefox, but I'm having 
>> some issues getting it working on Safari 4.
>>
>> It looks like the problem is the Accept: header that is being sent in by 
>> Safari.  Its 
>>
>> application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
>>
>> This causes the content negotiation process to favor xml as an output over 
>> html, as html has a priority of 0.9.  I tried xhtml, which has the same 
>> priority as xml, but it looks like it still chooses xml (presumably it is 
>> random which response you get if they have the same priority).
>>
>> Is there a way I can override Safari's preferences?  I know that it is 
>> asking to have xml as the highest priority, but frankly I think that is 
>> wrong.
>>
>> Any suggestions that you can give would be appreciated.
>>
>> Bruce.

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


Re: chaining restlets question

2009-06-24 Thread Thierry Boileau
Brendan,

The Finder class is a kind of factory mostly used (in the Restlet 
framework) for instantiating "resources" (I mean instance of Handler 
such as Resource, or ServerResource). The global scheme is that such 
Restlet is able to delegate a call to a new instance "resource".
Restlet and "resources" differ by the fact that a Restlet is a kind of a 
singleton and handle each incoming call, whereas a "resource" is 
designed to handle a single request/response.

You can have a look of the code of the Router class. It simply uses the 
Finder#createFinder method.

Best regards,
Thierry Boileau

> Thanks Thierry,
>
> That seems fine, one LAST question, can you send some sample code that  
> demonstrates the usage
> of the "Finder" Restlet?  How to use this seems unclear to me.
>
> Thanks again,
> Brendan...
>
> On 24 Jun 2009, at 13:44, Thierry Boileau wrote:
>
>   
>> Hi,
>>
>> well, instances of the Application class, are rather designed to be
>> independent. Hosted by a Component, the primary goal was to keep them
>> unaware of the other applications hosted by the component. However,  
>> that
>> does not mean one cannot communicate with another one. I think of the
>> HTTP, for example, or RIAP protocols.
>> Therefore, unless your need is very special, there should be no need  
>> to
>> attach an application to another one via a router. But two  
>> applications
>> can share code, resources, of course and manage they own URI space.
>> I hope I've answered your question.
>>
>> Best regards,
>> Thierry Boileau
>>
>>
>> 
>>> Thanks Thierry,
>>>
>>> Can you route between  "Applications" within a component or is  
>>> routing
>>> restricted to within a single "Application" as you have showed in
>>> your sample code.
>>>
>>> Thanks again for all your help,
>>> Regards,
>>> Brendan...
>>>
>>> On 24 Jun 2009, at 11:40, Thierry Boileau wrote:
>>>
>>>
>>>   
 Hello Brendan,

 Filter instances can pre and post process request/response via the
 "beforeHandle" and "afterHandle" methods, thus it gives you a  
 complete
 control.
 Having said that, the "beforeHandle" method is a more a place  
 where to
 enrich the context of the incoming request, or even update the
 request,
 whereas the "afterHandle" is the place where to update the response
 generated by the end point (generally a resource). It let the end-
 point
 generates a response according to the current request and its  
 context,
 not from a prepared response which seems odd (from my point of  
 view).
 But you're totally free, of course.

 best regards,
 Thierry Boileau


 
> Thanks Thierry,
>
> Thats exactly what I was looking for, can I partially build the
> response as it passes from one restlet to the next, or does the
> final restlets response overwrite the proceeding ones?
>
> Regards,
> Brendan...
>
> --
> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2364860
>
>
>
>   
 --
 http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2364868

 
>>> --
>>> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2364891
>>>
>>>
>>>   
>> --
>> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2364913
>> 
>
> --
> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2364943
>
>

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


Re: chaining restlets question

2009-06-24 Thread brendan murphy
Thanks Thierry,

That seems fine, one LAST question, can you send some sample code that  
demonstrates the usage
of the "Finder" Restlet?  How to use this seems unclear to me.

Thanks again,
Brendan...

On 24 Jun 2009, at 13:44, Thierry Boileau wrote:

> Hi,
>
> well, instances of the Application class, are rather designed to be
> independent. Hosted by a Component, the primary goal was to keep them
> unaware of the other applications hosted by the component. However,  
> that
> does not mean one cannot communicate with another one. I think of the
> HTTP, for example, or RIAP protocols.
> Therefore, unless your need is very special, there should be no need  
> to
> attach an application to another one via a router. But two  
> applications
> can share code, resources, of course and manage they own URI space.
> I hope I've answered your question.
>
> Best regards,
> Thierry Boileau
>
>
>> Thanks Thierry,
>>
>> Can you route between  "Applications" within a component or is  
>> routing
>> restricted to within a single "Application" as you have showed in
>> your sample code.
>>
>> Thanks again for all your help,
>> Regards,
>> Brendan...
>>
>> On 24 Jun 2009, at 11:40, Thierry Boileau wrote:
>>
>>
>>> Hello Brendan,
>>>
>>> Filter instances can pre and post process request/response via the
>>> "beforeHandle" and "afterHandle" methods, thus it gives you a  
>>> complete
>>> control.
>>> Having said that, the "beforeHandle" method is a more a place  
>>> where to
>>> enrich the context of the incoming request, or even update the
>>> request,
>>> whereas the "afterHandle" is the place where to update the response
>>> generated by the end point (generally a resource). It let the end-
>>> point
>>> generates a response according to the current request and its  
>>> context,
>>> not from a prepared response which seems odd (from my point of  
>>> view).
>>> But you're totally free, of course.
>>>
>>> best regards,
>>> Thierry Boileau
>>>
>>>
 Thanks Thierry,

 Thats exactly what I was looking for, can I partially build the
 response as it passes from one restlet to the next, or does the
 final restlets response overwrite the proceeding ones?

 Regards,
 Brendan...

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



>>> --
>>> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2364868
>>>
>>
>> --
>> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2364891
>>
>>
>
> --
> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2364913

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


Restlet v 1.1.5 multiple times allow method checked

2009-06-24 Thread Alin Popa
Hi,

Very soon I noticed something strange(?) when using Restlet Resources:

if a http method is not allowed, it will go and check all allow methods:
e.g.

When using DELETE http method and only POST is allowed,  it will go and
check
allowDelete, allowGet, allowPut.

Why is not doing just one check for allowDelete and stops ?
Is this the normal behavior ? If yes, is there a way to suppress returned
message within a Resource ?


Thanks.

-- 
Regards,

Alin

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

Re: Content Negotiation for Safari 4. Any way to override?

2009-06-24 Thread Thierry Boileau
Hi Bruce,

can you send us the content of the "user-agent" header? We will complete 
the default "agent.properties" file.

best regards,
Thierry Boileau
> Hi guys,
>
> I'm setting up a restlet app at the moment, and I'd like to set it up so that 
> if a user uses a browser to access a resource, he gets given a nicely 
> formatted HTML page, but if he separately asks for XML or JSON he gets a 
> machine parsable response.  Its all working well on Firefox, but I'm having 
> some issues getting it working on Safari 4.
>
> It looks like the problem is the Accept: header that is being sent in by 
> Safari.  Its 
>
> application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
>
> This causes the content negotiation process to favor xml as an output over 
> html, as html has a priority of 0.9.  I tried xhtml, which has the same 
> priority as xml, but it looks like it still chooses xml (presumably it is 
> random which response you get if they have the same priority).
>
> Is there a way I can override Safari's preferences?  I know that it is asking 
> to have xml as the highest priority, but frankly I think that is wrong.
>
> Any suggestions that you can give would be appreciated.
>
> Bruce.
>
> --
> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2364881
>
>

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


Re: Content Negotiation for Safari 4. Any way to override?

2009-06-24 Thread Thierry Boileau
Hello Bruce,

could you have a look at this page [1] of the user guide? And at the 
javadocs of the tunnelService class [2], and ClientInfo class [3].
The solution is based on two properties files.
One (agent.properties), helps to match the user-agent string (sent by 
the browser) and extract some information such as the agent name 
(Safari, for example). Some browsers have been identified (especially 
Safari 2 and 3).
The other one is called accept.properties, and helps to override the 
accept header of a browser.
If you want to activate this mechanism, turn on the "UserAgentTunnel" 
attribute of the Application#tunnelService.


best regards,
Thierry Boileau
[1] http://wiki.restlet.org/docs_1.2/207-restlet.html
[2] 
http://www.restlet.org/documentation/2.0/api/org/restlet/service/TunnelService.html
[3] 
http://www.restlet.org/documentation/1.1/api/org/restlet/data/ClientInfo.html#getAgentAttributes()


> Hi guys,
>
> I'm setting up a restlet app at the moment, and I'd like to set it up so that 
> if a user uses a browser to access a resource, he gets given a nicely 
> formatted HTML page, but if he separately asks for XML or JSON he gets a 
> machine parsable response.  Its all working well on Firefox, but I'm having 
> some issues getting it working on Safari 4.
>
> It looks like the problem is the Accept: header that is being sent in by 
> Safari.  Its 
>
> application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
>
> This causes the content negotiation process to favor xml as an output over 
> html, as html has a priority of 0.9.  I tried xhtml, which has the same 
> priority as xml, but it looks like it still chooses xml (presumably it is 
> random which response you get if they have the same priority).
>
> Is there a way I can override Safari's preferences?  I know that it is asking 
> to have xml as the highest priority, but frankly I think that is wrong.
>
> Any suggestions that you can give would be appreciated.
>
> Bruce.
>
> --
> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2364881
>
>

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


Re: Handling different attributes in the same resource class

2009-06-24 Thread Thierry Boileau
Hello Simon,

during the routing process, the incoming URI is matched against one of 
the declared URI templates. If several routes match the request's URI, 
then, a choice is made according to the politics of the router (by 
default "best score", but it could be "first match", etc.).
In your case, and unless you override the default type of the declared 
variables "{status}" and "{id}", I'm afraid the first template will be 
chosen.
If you want more details about the routing process, have a look at the 
user guide [1], accessible from here [2] (for Restlet 2.0)

There is a question: do the two resources (the one that answers to GET 
request, the one that answers to PUT request) finally represent the same 
concept (e.g. "current weather in Topeka")? Is there actually only one 
resource, one concept?
If so, the meaning of the variable must be the same in both case, so 
there should be only one route.

If not, you have to define two routes to two resources (these could 
share the same code, but...). Can you tell us more about how to make the 
distinction between a URI that goes to resource "status", and the one to 
resource "id"?

 >having this code causes an error:
oh, what kind of error?

best regards,
Thierry Boileau



[1] http://wiki.restlet.org/docs_1.2/143-restlet.html
[2] http://www.restlet.org/documentation/2.0/
> I have a class that extends Resource - it handles GET and POST requests.
>
> For the GET reqeust it uses a passed in attribute from the client - e.g.
>
> myuri/{status}
>
> everything works ok.  However I thought about handling a PUT request in the 
> same class but this time it would use a different value an id:
>
> myuri/{id}
>
> However it seems that I can't have a variable amount of attributes passed to 
> a resource i.e. having this code causes an error:
>
> status = (String) request.getAttributes().get("status");
>
> id = (String) request.getAttributes().get("id");
>
>
> It seems like you can only get attributes one time only from only one kind of 
> URI- you can't have various URIs with different paramaters routed to the same 
> class i.e.:
>
> router.attach("/myuri/{status}", foo.class); //GET   
>
> router.attach("/myuri/{id}", foo.class); //PUT
>
> Am I right in my thinking here?
>
> --
> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2364867
>
>

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


Re: chaining restlets question

2009-06-24 Thread Thierry Boileau
Hi,

well, instances of the Application class, are rather designed to be 
independent. Hosted by a Component, the primary goal was to keep them 
unaware of the other applications hosted by the component. However, that 
does not mean one cannot communicate with another one. I think of the 
HTTP, for example, or RIAP protocols.
Therefore, unless your need is very special, there should be no need to 
attach an application to another one via a router. But two applications 
can share code, resources, of course and manage they own URI space.
I hope I've answered your question.

Best regards,
Thierry Boileau


> Thanks Thierry,
>
> Can you route between  "Applications" within a component or is routing  
> restricted to within a single "Application" as you have showed in
> your sample code.
>
> Thanks again for all your help,
> Regards,
> Brendan...
>
> On 24 Jun 2009, at 11:40, Thierry Boileau wrote:
>
>   
>> Hello Brendan,
>>
>> Filter instances can pre and post process request/response via the
>> "beforeHandle" and "afterHandle" methods, thus it gives you a complete
>> control.
>> Having said that, the "beforeHandle" method is a more a place where to
>> enrich the context of the incoming request, or even update the  
>> request,
>> whereas the "afterHandle" is the place where to update the response
>> generated by the end point (generally a resource). It let the end- 
>> point
>> generates a response according to the current request and its context,
>> not from a prepared response which seems odd (from my point of view).
>> But you're totally free, of course.
>>
>> best regards,
>> Thierry Boileau
>>
>> 
>>> Thanks Thierry,
>>>
>>> Thats exactly what I was looking for, can I partially build the  
>>> response as it passes from one restlet to the next, or does the  
>>> final restlets response overwrite the proceeding ones?
>>>
>>> Regards,
>>> Brendan...
>>>
>>> --
>>> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2364860
>>>
>>>
>>>   
>> --
>> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2364868
>> 
>
> --
> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2364891
>
>

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


Handling different attributes in the same resource class

2009-06-24 Thread Simon Earnshaw
I have a class that extends Resource - it handles GET and POST requests.

For the GET reqeust it uses a passed in attribute from the client - e.g.

myuri/{status}

everything works ok.  However I thought about handling a PUT request in the 
same class but this time it would use a different value an id:

myuri/{id}

However it seems that I can't have a variable amount of attributes passed to a 
resource i.e. having this code causes an error:

status = (String) request.getAttributes().get("status");

id = (String) request.getAttributes().get("id");


It seems like you can only get attributes one time only from only one kind of 
URI- you can't have various URIs with different paramaters routed to the same 
class i.e.:

router.attach("/myuri/{status}", foo.class); //GET   

router.attach("/myuri/{id}", foo.class); //PUT

Am I right in my thinking here?

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


Content Negotiation for Safari 4. Any way to override?

2009-06-24 Thread Bruce Cooper
Hi guys,

I'm setting up a restlet app at the moment, and I'd like to set it up so that 
if a user uses a browser to access a resource, he gets given a nicely formatted 
HTML page, but if he separately asks for XML or JSON he gets a machine parsable 
response.  Its all working well on Firefox, but I'm having some issues getting 
it working on Safari 4.

It looks like the problem is the Accept: header that is being sent in by 
Safari.  Its 

application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5

This causes the content negotiation process to favor xml as an output over 
html, as html has a priority of 0.9.  I tried xhtml, which has the same 
priority as xml, but it looks like it still chooses xml (presumably it is 
random which response you get if they have the same priority).

Is there a way I can override Safari's preferences?  I know that it is asking 
to have xml as the highest priority, but frankly I think that is wrong.

Any suggestions that you can give would be appreciated.

Bruce.

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


Re: chaining restlets question

2009-06-24 Thread brendan murphy
Thanks Thierry,

Can you route between  "Applications" within a component or is routing  
restricted to within a single "Application" as you have showed in
your sample code.

Thanks again for all your help,
Regards,
Brendan...

On 24 Jun 2009, at 11:40, Thierry Boileau wrote:

> Hello Brendan,
>
> Filter instances can pre and post process request/response via the
> "beforeHandle" and "afterHandle" methods, thus it gives you a complete
> control.
> Having said that, the "beforeHandle" method is a more a place where to
> enrich the context of the incoming request, or even update the  
> request,
> whereas the "afterHandle" is the place where to update the response
> generated by the end point (generally a resource). It let the end- 
> point
> generates a response according to the current request and its context,
> not from a prepared response which seems odd (from my point of view).
> But you're totally free, of course.
>
> best regards,
> Thierry Boileau
>
>> Thanks Thierry,
>>
>> Thats exactly what I was looking for, can I partially build the  
>> response as it passes from one restlet to the next, or does the  
>> final restlets response overwrite the proceeding ones?
>>
>> Regards,
>> Brendan...
>>
>> --
>> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2364860
>>
>>
>
> --
> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2364868

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


Re: chaining restlets question

2009-06-24 Thread Thierry Boileau
Hello Brendan,

Filter instances can pre and post process request/response via the 
"beforeHandle" and "afterHandle" methods, thus it gives you a complete 
control.
Having said that, the "beforeHandle" method is a more a place where to 
enrich the context of the incoming request, or even update the request, 
whereas the "afterHandle" is the place where to update the response 
generated by the end point (generally a resource). It let the end-point 
generates a response according to the current request and its context, 
not from a prepared response which seems odd (from my point of view).
But you're totally free, of course.

best regards,
Thierry Boileau

> Thanks Thierry,
>
> Thats exactly what I was looking for, can I partially build the response as 
> it passes from one restlet to the next, or does the final restlets response 
> overwrite the proceeding ones?
>
> Regards,
> Brendan...
>
> --
> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2364860
>
>

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


RE: Re: chaining restlets question

2009-06-24 Thread brendan murphy
Thanks Thierry,

Thats exactly what I was looking for, can I partially build the response as it 
passes from one restlet to the next, or does the final restlets response 
overwrite the proceeding ones?

Regards,
Brendan...

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


Re: chaining restlets question

2009-06-24 Thread Thierry Boileau
Hello Brendan,

I send you a sample application that illustrates the usage of Filter 
subclasses.
I hope this will help you.

best regards,
Thierry Boileau

> Hi,
>
> I'm new to Restlets and need help on how to use separate "restlets" to  
> handle different parts of a single URI, is this possible?
>
> e.g  take the URI "/employee/manager/john".
>
> I'd like to attach 3 different "restlet" objects to the router, one to  
> handle each part of the URI path. The first restlet would handle  
> "employee" and pass "/manager/john" to
> the next restlet.
>
> If this is possible, how is coded using the restlet API?
>
> Any help would be appreciated,
> Regards,
> Brendan...
>
> --
> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2364814
>
>

--
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2364827package routing;

import org.restlet.Application;
import org.restlet.Component;
import org.restlet.Restlet;
import org.restlet.data.MediaType;
import org.restlet.data.Protocol;
import org.restlet.data.Request;
import org.restlet.data.Response;
import org.restlet.resource.ClientResource;
import org.restlet.routing.Filter;
import org.restlet.routing.Router;

public class TestRoutingApplication extends Application {
public static void main(String[] args) throws Exception {
Component component = new Component();
component.getServers().add(Protocol.HTTP, 8182);
component.getDefaultHost().attachDefault(new TestRoutingApplication());

component.start();
ClientResource res = new ClientResource("http://localhost:8182/employee/manager/john";);
res.get().write(System.out);
component.stop();
}

@Override
public Restlet createRoot() {
Router router1 = new Router(getContext());
Router router2 = new Router(getContext());
Router router3 = new Router(getContext());

MyFilter filter1 = new MyFilter("path1");
MyFilter filter2 = new MyFilter("path2");
MyFilter filter3 = new MyFilter("path3");

router1.attach("/employee", filter1);
filter1.setNext(router2);

router2.attach("/manager", filter2);
filter2.setNext(router3);

router3.attach("/john", filter3);
filter3.setNext(new Restlet(getContext()) {
@Override
public void handle(Request request, Response response) {
response.setEntity("hello, world", MediaType.TEXT_PLAIN);
}
});

return router1;
}

private static class MyFilter extends Filter {
private String message;

public MyFilter(String message) {
super();
this.message = message;
}

@Override
protected int beforeHandle(Request request, Response response) {
System.out.println("filter = " + message);
return super.beforeHandle(request, response);
}

}

}


Re: Source for javax packages

2009-06-24 Thread Thierry Boileau
Hello Jennifer,

Here are the home site for the jaxb and statx libraries

 - https://jaxb.dev.java.net/
 - http://java.sun.com/webservices/docs/2.0/sjsxp/index.html


best regards,
Thierry Boileau
>
> I was wondering if someone from the Restlet team could tell me where 
> the two packages javax.xml.bind and javax.xml.stream were downloaded 
> from and where I might be able to get the source code?
>
> Jennifer Carlucci
>

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


Source for javax packages

2009-06-24 Thread Jennifer Carlucci
I was wondering if someone from the Restlet team could tell me where the 
two packages javax.xml.bind and javax.xml.stream were downloaded from and 
where I might be able to get the source code?

Jennifer Carlucci

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

chaining restlets question

2009-06-24 Thread webpost
Hi,

I'm new to Restlets and need help on how to use separate "restlets" to handle 
different parts of a single URI, is this possible?

e.g  take the URI "/employee/manager/john".

I'd like to attach 3 different "restlet" objects to the router, one to handle 
each part of the URI path. The first restlet would handle "employee" and pass 
"/manager/john" to
the next restlet.

If this is possible, how is coded using the restlet API?

Any help would be appreciated,
Regards,
Brendan...

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


chaining restlets question

2009-06-24 Thread brendan murphy
Hi,

I'm new to Restlets and need help on how to use separate "restlets" to  
handle different parts of a single URI, is this possible?

e.g  take the URI "/employee/manager/john".

I'd like to attach 3 different "restlet" objects to the router, one to  
handle each part of the URI path. The first restlet would handle  
"employee" and pass "/manager/john" to
the next restlet.

If this is possible, how is coded using the restlet API?

Any help would be appreciated,
Regards,
Brendan...

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