Re: Connection Header

2010-05-03 Thread CB
hi,

This issue is still not resolved -

any help is appreciated,

thanks,

Chen.

On Sun, May 2, 2010 at 22:54, C B  wrote:

> hi,
>
> I'm using the GAE version (2.0 Snapshot (2010-04-09))
>
> Unfortunately - I can't use an alternative connector. I'm using the
> iPhone's HTTPClient SDK for doing async HTTP GET/POST calls .
>
> Do you have any clue?
>
> Thanks,
>
> Chen.
>
>
> On Sun, May 2, 2010 at 21:38, Jerome Louvel wrote:
>
>> Hi Chen,
>>
>> Which version of Restlet are you using? Also, which connector are you
>> using? Did you try with another connector to compare?
>>
>> Best regards,
>> Jerome
>>
>>
>>
>> 2010/5/2 CB 
>>
>> hi,
>>>
>>> I have a ServerResource which returns an ArrayList of Objects.
>>>
>>> When accessing the resource from a browser I get the JSON just fine.
>>>
>>> Running the GET request using XHR from an iPhone I get a 200 OK with an
>>> empty response.
>>>
>>> Using a sniffer I noticed that the HTTP request header contains
>>> Connection: Closed  which is why the server returns and empty response.
>>>
>>> Is this a bug in Restlet? why does Restlet requires a keep-alive
>>> connection?
>>>
>>> btw - for single objects the above does not occur - only for list based
>>> responses.
>>>
>>> Any help is appreciated.
>>>
>>> Thanks,
>>>
>>> Chen.
>>>
>>
>>
>

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

Re: Client Custom Header

2010-05-03 Thread Jean-Philippe Steinmetz
Hi Stephan,

Thank you for the response. I've implemented a filter and created one while
setting the "next" property to be my client but I am not getting any calls
to the beforeHandle function. My code looks like the following.

class MyFilter extends Filter
{
public MyFilter() { this(null);
public MyFilter(Context context) { this(context, null); }
public MyFilter(Context context, Restlet next) { super(context, next); }

public int beforeHandle(Request request, Response response)
{
System.out.println("HIT!");
return CONTINUE;
}
}

And my Spring configuration looks like this...
















What am I missing? Thanks again.

Jean-Philippe

On Sat, May 1, 2010 at 3:49 AM, Stephan Koops  wrote:

> Hi Jean,
>
> the access is on both sides the same. That's an advantage of Restlet.
> To add the header for every request you could create a filter. It adds
> the header. Instead of send the request directly by the Client object
> you set the Client as next Restlet in the filter and your application
> sends all request via the filter.
> (I hope that's right ...)
>
> best regards
>   Stephan
>
> Jean-Philippe Steinmetz schrieb:
> > Hi,
> >
> > I'm trying to add a custom HTTP header to outgoing requests when using
> > the restlet client API. Ideally i'm looking for some way to implement
> > a helper class that can inject my header into every request as they
> > are processed. However in looking through the documentation i'm not
> > really finding what i'm looking for. I see in the FAQ it's possible to
> > access headers but this seems to be from the server perspective. How
> > do I get access from a client perspective?
> >
> > Thanks in advance,
> >
> > Jean-Philippe Steinmetz
>
> --
>
> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2600427
>

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

304 responses cause WARN logging

2010-05-03 Thread David Fogel
We recently updated to the newest RC (actually to revision 6570 of
trunk), and now every single 304 response our server returns causes a
WARN-level message to appear in the logs, like this:

WARNING: Responses with a 304 (Not modified) status can't have an
entity. Only adding entity headers for resource
"http://localhost:8080/some/path/here/";.

This doesn't seem desirable.

This message is generated in the ServerAdapter.commit() method, if the
status us 304 and isEntityAvailable() returns true.  This implies it
is incorrect for an representation at this stage (having gone through
condition request handling) to be available.

One change from 3 weeks ago that I found looking at SVN commits was a
change to EmptyRepresentation.java which makes it "available", instead
of unavailable.  (It now passes 'true' instead of 'false' to
setAvailable() in its constructor).  This seems like a pretty
significant change, especially given that there isn't much
documentation for how the EmptyRepresenation is supposed to behave.

In fact, it was our impression that the only way for us to return any
entity metadata during a 304 was in fact to use a subclass of
EmptyRepresentation.  (Although I also noticed a current restlet issue
which claims that this metadata is not, in fact, being actually sent!)

So now, since an EmptyRepresentation is "available", the ServerAdapter
is WARNing about a 304 with a, entity.

However, I don't think the problem is just with EmptyRepresentation,
something else must have changed, maybe in the conditional request
handling, because we have other resources which have no special code
in them at all, but which happen to publish an eTag in the
representation subclass, and which therefor sometimes cause a 304 when
requested, and we also see this warning showing up now for these
requests.

1) what should the state of a representation be after conditional
request handling?
2) how is the EmptyRepresentation supposed to be used?
3) Why is there a warning during a 304 response with an entity?

thanks,
  -Dave Fogel

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


Re: Beginner feedback

2010-05-03 Thread Rajeev Sampath
On Mon, Apr 26, 2010 at 1:58 PM, Alex Objelean wrote:

> Hi!
> Recently I dedicated a couple of hours to learn about restlet (2.0-RC3).
> Maybe it is too little time, but I think my feedback may be important for
> restlet improvement.
>
> I've used as a documentation this link:
> http://www.restlet.org/documentation/2.0/firstSteps
> It is well documented. Unfortunately, I had some troubles in running the
> example. I have downloaded the distribution, created an eclipse project.
> The
> first problem was to set up the classpath of the project. There a dozen of
> dependencies. I didn't know which of them to add to the classpath. This is
> where maven would be useful. I use maven for all my projects and find it
> very easy to get started with other open source project. All you have to
> do,
> is to run mvn eclipse:eclipse and maven takes care about all project
> dependencies. It would be very useful for restelet adoption to 'mavenize'
> the project. Also, it could be useful to have a archetype - to generate a
> template of the project ready to run.
>
> The next problem, was to start the hello world example. I would expect to
> add the minimum dependencies to make it work. It seems very strange that
> hello world requires more than 10 dependencies to work (even java mail,
> grizzly, etc).. It seems a little bit strange, but maybe there is a reason.
>

I too was a beginner but it required me to have only two dependencies
(to run it as a standalone app)
org.restlet.jar   -> API
com.noelios.restlet.jar  -> reference impl.


>
> I like the way restlet is implemented, I would like to understand it better
> and use it when I'll have an opportunity. My purpose is not to criticize,
> but to help improve restlet.
>
> Thank you for your work!
> Alex
>
>
> --
> View this message in context:
> http://restlet-discuss.1400322.n2.nabble.com/Beginner-feedback-tp4961544p4961544.html
> Sent from the Restlet Discuss mailing list archive at Nabble.com.
>
> --
>
> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2595725
>

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

Re: How do I locate a post?

2010-05-03 Thread Stephan Koops
Hi Muack,

take a look at 
http://restlet.tigris.org/servlets/CTSearch?dsForumId=4447&dsNav=APzAESz .
Perhaps you must log in to tigris, I don't know.

best regards
   Stephan

webp...@tigris.org schrieb:
> Hey all, could somebody be so kind and help me out? I got here another day by 
> means of yahoo but now can not find once more the post I have been reading 
> that time :(. And before someone asks, no I am not blond simply not that 
> excellent with computers hehe. 
> Muack
>

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


RE: Re: SSL modifications since 2.0 RC 1 ?

2010-05-03 Thread Nicolas Rinaudo
Hi Bruno,

You certainly put a lot of effort into that !

I have to admit that some of it went over my head - you obviously are a bit of 
an expert on the matter, which I'm not.

If I understand you properly, the problem isn't Restlet, Safari, or even Java 
specific - it's a generic flaw (?) in client certificates management ?

Which means that in my very specific, very selfish case, I should disable 
client certificate requests to make the problem go away. Which also means 
getting rid of the Simple connector, since this is hardcoded and can't be 
modified.

Is that a fair summary, or did I misunderstand you even more badly than I 
thought ?

Nicolas

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


create inbound root override problem

2010-05-03 Thread holograham
Hello,

I just downloaded restlet for gwt. I am attempting to integrate it into an
existing gwt application. I am attempting to bring the test application into
my project to ensure its configured properly. I get a sole compiler error
saying that the createInboudRoot() method must override a supertype method.
So it appears the version of Application.class I am using does not have this
method which I find very strange. Why would this like that and how can I fix
it?

 I am uing Maven to manage my dependencies and currently use org.restlet.gwt
artifact id org.restlet. I suspect this may be the problem

Thanks
-- 
View this message in context: 
http://restlet-discuss.1400322.n2.nabble.com/create-inbound-root-override-problem-tp4956547p4956547.html
Sent from the Restlet Discuss mailing list archive at Nabble.com.

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


RE: Re: Proxying with Redirector with Restlet 1.1.1

2010-05-03 Thread webpost
Hey Rob,

How can we avoid this 'lock up' situation your saying. I'm doing proxying too 
and I believe I'm encountering that issue. Here's a sample code to better 
explain.

public static void main(String[] args) throws Exception 
{  
Component component = new Component();
  
component.getServers().add(Protocol.HTTP, 8182);  
component.getClients().add( Protocol.HTTP );

component.getDefaultHost().attach(new Redirector(null, 
"http://localhost:80{rr}";));
  
component.start(); 
}  

I'm using Restlet 2.0 RC 3.

Ok here's my concern. Basically I want some request to redirect to a certain 
server:
1)On my first request (http://localhost:80/items/item), everything works as 
expected. 
2) I shutdown the server running at localhost:80 
3) Try to request again at the same resource (http://localhost:80/items/item) 
and the 'lock up' begins.

Can anyone explain to me what's going on? What am I missing? What do I need 
else?

> Here's the usual incantation I use for proxying:
> 
>   root.attach("/redirectme/", new Redirector(getContext(),
>   "http://targethost/targetpath/{rr}";,
>   Redirector.MODE_DISPATCHER));
> 
> Here's the pointer to the Javadoc for predefined route variables:
> 
> http://www.restlet.org/documentation/1.1/api/org/restlet/util/Resolver.html#createResolver(org.restlet.data.Request,%20org.restlet.data.Response)
> 
> Unsolicited: Careful of using the HttpClient connector if you're
> proxying, it can lock up in some situations due to its behavior with
> entities that don't get fully consumed.  At the very least, you may
> need to increase the maximum connections allowed per host.  The more
> simpleminded Net connector usually works better for me to do HTTP
> request proxying.
> 
> > I appreciate any pointers...
> >
> > -jeff

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


Beginner feedback

2010-05-03 Thread Alex Objelean
Hi!
Recently I dedicated a couple of hours to learn about restlet (2.0-RC3).
Maybe it is too little time, but I think my feedback may be important for
restlet improvement. 

I've used as a documentation this link:
http://www.restlet.org/documentation/2.0/firstSteps
It is well documented. Unfortunately, I had some troubles in running the
example. I have downloaded the distribution, created an eclipse project. The
first problem was to set up the classpath of the project. There a dozen of
dependencies. I didn't know which of them to add to the classpath. This is
where maven would be useful. I use maven for all my projects and find it
very easy to get started with other open source project. All you have to do,
is to run mvn eclipse:eclipse and maven takes care about all project
dependencies. It would be very useful for restelet adoption to 'mavenize'
the project. Also, it could be useful to have a archetype - to generate a
template of the project ready to run. 

The next problem, was to start the hello world example. I would expect to
add the minimum dependencies to make it work. It seems very strange that
hello world requires more than 10 dependencies to work (even java mail,
grizzly, etc).. It seems a little bit strange, but maybe there is a reason. 

I like the way restlet is implemented, I would like to understand it better
and use it when I'll have an opportunity. My purpose is not to criticize,
but to help improve restlet. 

Thank you for your work! 
Alex


-- 
View this message in context: 
http://restlet-discuss.1400322.n2.nabble.com/Beginner-feedback-tp4961544p4961544.html
Sent from the Restlet Discuss mailing list archive at Nabble.com.

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


can i deploy restlet services on android with ijetty?

2010-05-03 Thread webpost
hi:
  i use ijetty as a server on android,and i try to deploy restlet service,the 
helloworld example, to my android emulator. And i want to access it from my 
laptop. The ijetty says that it deploys successfully but i can't access it from 
the android emulator's web explorer.it says service_unavailable. so i wonder 
whether i can deploy restlet service on ijetty,and if it is possible,what 
should i do.thanks a lot.
  keith

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


can i deploy restlet services using ijetty as a server

2010-05-03 Thread keith
hi:
  i use ijetty as a server on android,and i try to deploy restlet service,the 
helloworld example, to my android emulator. And i want to access it from my 
laptop. The ijetty says that it deploys successfully but i can't access it from 
the android emulator's web explorer.it says service_unavailable. so i wonder 
whether i can deploy restlet service on ijetty,and if it is possible,what 
should i do.thanks a lot.
  keith

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


Nested Routing problem

2010-05-03 Thread Jocelyn Raymond
Hi,
I have been trying to modify one of the example in the restlet.org site 
(http://wiki.restlet.org/docs_2.0/13-restlet/27-restlet/46-restlet.html - the 
security sample at the bottom of page).  I am using restlet 2 RC3 (from April 
23 I think).

Here is my problem.  I have the following routes:
/ --> show me a welcome page
/staff --> ask for login then show me AResource
/staff/{item-id} --> DOES NOT WORK
/staff/{item-id}/pdf --> DOES NOT WORK
/admin --> ask for login or refuses if I am a staff (so its good).

My question is simply: what is wrong with my routes? (see below)

So here is the code for those routes:

public class App  extends Application {
  @Override
  public Restlet createInboundRoot(){
   Router root  = new Router(getContext());
   Router pub   = new Router(getContext());
   Router admin = new Router(getContext());

   ChallengeAuthenticator guard = new 
  ChallengeAuthenticator(getContext(), 
  ChallengeScheme.HTTP_BASIC, "my realm");
   guard.setVerifier(new UserVerifier());
   guard.setEnroler(new UserEnroler());
   guard.setNext(root);

   RoleAuthorizer ra  = new RoleAuthorizer();
   ra.getAuthorizedRoles().add(UserEnroler.PUBLISHER);
   RoleAuthorizer raa = new RoleAuthorizer();
   raa.getAuthorizedRoles().add
(UserEnroler.ADMINISTRATOR);

   root.attach("", PublicResource.class);
   root.attach("/staff", ra);
   root.attach("/admin", raa);

   ra.setNext(pub);
   raa.setNext(admin);

   pub.attach("", AResource.class);
   //** FOLLOWING TWO ROUTES DOES NOT WORK!!?
   pub.attach("/{item-id}", ItemResource.class);
   pub.attach("/{item-id}/pdf", 
  PdfResource.class);

   admin.attach("", AResource.class);
   admin.attach("/test", AResource.class);
   return guard;


Few Note:
1. I tested my resources classes to make sure they work.
2. I tried several "variations" of routes but nothing worked.
3. What I am trying to do, ultimately, is to have:
   / --> public page
   /staff  --> staff protected resources 
   /admin  --> admin protected resources
   /staff/{item-id}/... staff protected resources
   /admin/{something}/... admin protected resources


Can anyone help?
What is wrong with my routes?

Thank you in advance.
Jocelyn

BTW: I bought the book (actually our office) and I was wondering if anyone know 
when chapter 6 is coming out - because I think it might help me understanding 
these routes pattern?

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


Restlet URL reserved characters

2010-05-03 Thread Bhallamudi Venkata Siva Kamesh
Hi all,
  Are there any reserved characters in the url.If so
what is their purpose.

Thanks in advance

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


Problems getting POST/GET parameter from request

2010-05-03 Thread webpost
Hi,

I'm trying to get the send parameters on a @Post request, but the result is 
always null.

My approach is (still works on another resource): 

Form form = new Form();
Representation requestEntity = getRequestEntity();
if (getRequestEntity().getSize() > 0) {
FormUtils.parse(form, requestEntity);
}
String param = form.getFirstValue("param");

But param is always null.

Using 

 HttpServletRequest servletRequest = ServletUtils.getRequest(getRequest());
String param = servletRequest.getParameter("param");

works, but I don't want to go via the ServletRequest.

Any suggestions?

Thanks,

Adrian

I'm using 2.0-RC2

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


Problems getting POST/GET parameter from request

2010-05-03 Thread Adrian Mörchen
Hi,

 

I'm trying to get the send parameters on a @Post request, but the result is 
always null.

 

My approach is (still works on another resource): 

 

Form form = new Form();

Representation requestEntity = getRequestEntity();

if (getRequestEntity().getSize() > 0) {

FormUtils.parse(form, requestEntity);

}

String param = form.getFirstValue("param");

 

But param is always null.

 

Using 

 

 HttpServletRequest servletRequest = ServletUtils.getRequest(getRequest());

String param = servletRequest.getParameter("param");

 

works, but I don't want to go via the ServletRequest.

 

Any suggestions?

 

Thanks,

 

Adrian

 

I'm using 2.0-RC2

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

IRQ when a problem occurs?

2010-05-03 Thread Xavier M.
Hello,
Zfs is fine, and raidz too :) The goal of redundancy is not to loose data
when a disk or more crash. But I've only seen a means to know if there is a
disk corruption or disk lost , ie polling through the "zpool status"
command.
I would like to know if it exists a means to be notified through a
interruption or a callback function, ie privileging push instead of pull?
It is quite weird if it doesn't exist, that we need to do polling which is
not a real time mechanism for high critical applications for instance.
best regards
Xavier

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

Discussion topic of 2010-04-27 gone?

2010-05-03 Thread Raymond, Jocelyn
Hi,
I don't want to add this email content to your "discussion" topic on
tigris
(http://restlet.tigris.org/ds/viewForumSummary.do?viewType=thread&viewMo
de=summary&dsForumId=4447&orderBy=lastPostDate&orderType=desc¤tPag
e=1&countPerPage=25&totalPages=102)
 
I just want to mention that the posts of 2010-04-27 seems to be all gone
(which include mine :-).  I also know that there were some maintenance
scheduled on that day; perhaps it affected the posts on that day.  Or
perhaps there is another reason and I should be more patient ;-)
Anyway, I thought that I should mention it.
 
Thanks,
Jocelyn Raymond (jraymond1967)

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

Nested Routing Problem

2010-05-03 Thread Jocelyn Raymond
First, I must apologies as I couldn't not reply to my previous post (I couldn't 
find any 'reply' link for some reason; probably because it wasn't approved by 
moderator yet).

Anyway, this post is to show the solution to my problem and perhaps show a bug.

The code I showed previously was (shortened for readability):

Router root  = new Router(getContext());
Router pub   = new Router(getContext());

ChallengeAuthenticator guard = new ChallengeAuthenticator(getContext(), 
ChallengeScheme.HTTP_BASIC, "my realm");
guard.setVerifier(new UserVerifier());
guard.setEnroler(new UserEnroler());
guard.setNext(root);

RoleAuthorizer ra  = new RoleAuthorizer();
ra.getAuthorizedRoles().add(UserEnroler.PUBLISHER);

root.attach("", PublicResource.class);
root.attach("/staff", ra);

ra.setNext(pub);

pub.attach("", AResource.class);
pub.attach("/{item-id}", ItemResource.class);
pub.attach("/{item-id}/pdf", PdfResource.class);

return guard;

The above give the following result:
/staff  --> WORKS
/staff/123  --> DOES NOT WORK
/staff/123/pdf  --> DOES NOT WORK

How to fix this?  Can you spot the differences?
Here is the code that works:

Router root  = new Router(getContext());
Router pub   = new Router(getContext());

ChallengeAuthenticator guard = new ChallengeAuthenticator(getContext(), 
ChallengeScheme.HTTP_BASIC, "my realm");
guard.setVerifier(new UserVerifier());
guard.setEnroler(new UserEnroler());
guard.setNext(root);

RoleAuthorizer ra  = new RoleAuthorizer();
ra.getAuthorizedRoles().add(UserEnroler.PUBLISHER);
ra.setNext(pub);

root.attach("", PublicResource.class);
root.attach("/staff", ra);

pub.attach("", AResource.class);
pub.attach("/{item-id}", ItemResource.class);
pub.attach("/{item-id}/pdf", PdfResource.class);

return guard;


All I did is to move "ra.setnext(pub);" three lines up.  So for some reason if 
we attach a RoleAuthorizer before we use the setNext(...) method, it does not 
work.  Is this a bug?  

Thanks,
Jocelyn Raymond

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


How to use Redirector with authentication?

2010-05-03 Thread Stefan Ukena
Hi everyone,

I am using the Redirector-class to proxy client requests (let's call it "client 
A") from server A to server B (i.e. MODE_SERVER_OUTBOUND):

client A <=> server A <=> server B

Now I want to guard access to the resources of server B with (digest) 
authentication. So I added the necessary guard to server B. Obviously, now 
users of client A have to enter a username and password.

But I want the Redirector to "take care of this". I.e. I want to provide the 
username and password to the Redirector of server A so that client B does not 
require a username and password.

How should I go about this? Do I need to create my own implementation of 
Redirector?

Thanks for taking the time!

BTW I am using restlet 2 RC3.

Best regards,
Stefan

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


How do I locate a post?

2010-05-03 Thread webpost
Hey all, could somebody be so kind and help me out? I got here another day by 
means of yahoo but now can not find once more the post I have been reading that 
time :(. And before someone asks, no I am not blond simply not that excellent 
with computers hehe. 
Muack

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