Re: Command line to STOP Restlet server

2009-01-14 Thread Leshek
> When you stop the parent Component, it stops all the child connectors. 

Sounds like a simple, nice, soft stop for me, but... 

What I am thinking is to respond to URI request like PUT .../shutdown 
(limit to localhost request and run through authentication guard as all 
the other requests). 

How in the resource do I get to parent component when I started Restlet HTTP
server using main in my application as follows, or am I doing something 
silly here? : 

  public static void main(String[] args) {
 try {
 Component component = new Component();
 component.getServers().add(Protocol.HTTP, 8182);
 component.getDefaultHost().attach(new
MyApplication(component.getContext()));
 component.start();

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


POST/PUT requests take more than 2 seconds

2009-01-14 Thread Olivier Bruchez
I actually have the same problem as Avi here:

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

Almost the same configuration, Mac OS 10.5.6. Internal HTTP server.

When handling POST/PUT requests, the Entity.getText() method takes 2 seconds to 
return a string.

Is there any solution to this problem, other than not using the internal HTTP 
server?

Thanks,
Olivier

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


Re: Re: Re: Restlet 1.1-RC1 in OSGi

2009-01-14 Thread Michael Terrington
Hi Jerome,

Thanks, that will indeed help.

Regards,
Michael.

On Wed, Jan 14, 2009 at 3:26 AM, Jerome Louvel
 wrote:
> Hi guys,
>
> Note that in Restlet 1.2, the Restlet API and core engine are merged in the 
> same bundle.
>
> This should simplify OSGi integration by not having to specify bundle loading 
> order.
>
> 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 : >Eneko Taberna [mailto:eneko.tabe...@gmail.com]
> Envoye : lundi 12 janvier 2009 14:24
> A : discuss@restlet.tigris.org
> Objet : RE: Re: Re: Restlet 1.1-RC1 in OSGi
>
> That worked! Thanks Michael, I really apreciate your help.
> regards,
>
> --
> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=1019049
>
> --
> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=1022348
>



Re: Patch to parameterize port numbers in JUnit tests

2009-01-14 Thread Rhett Sutphin
> For Spring it should be possible to inject the static value into the  
> bean property. I don't remember the exact syntax, but we can
> figure this out.

You can configure a PropertyPlaceholderConfigurer into the application  
context:

http://static.springframework.org/spring/docs/2.5.x/api/org/springframework/beans/factory/config/PropertyPlaceholderConfigurer.html

It resolves placeholders from either system properties or a configured  
property file / inline list.

Rhett

On Jan 14, 2009, at 1:59 PM, Jerome Louvel wrote:

> Hi Raif,
>
> That sounds like a useful thing to do. I was trying to apply the  
> patch but got issues with the paths of the patched files.
>
> Could you try to use SVN instead to generate it, starting at the  
> root of the SVN trunk instead?
>
> For Spring it should be possible to inject the static value into the  
> bean property. I don't remember the exact syntax, but we can
> figure this out. Any Spring wizard listening?
>
> 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 : Raif S. Naffah [mailto:tig...@naffah-raif.name]
> Envoye : samedi 10 janvier 2009 07:48
> A : discuss@restlet.tigris.org
> Objet : Patch to parameterize port numbers in JUnit tests
>
> hello there,
>
> the JUnit tests (in org.restlet.test) have hard-wired port numbers  
> which may
> not suit every developer's environment.  this patch introduces a new
> property in the main build.xml, and injects at as a system environment
> variable.
>
> when more than one port is required, the property value is used as a  
> base;
> i.e. second port number is valueOf(property) + 1, etc.
>
> the only test i was not able to parametrize was the Spring test (and  
> its
> .xml file).
>
>
> cheers;
> rsn
>
> --
> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=1024775

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


RE: HttpRequest suggestion

2009-01-14 Thread Jerome Louvel
Hi Rémi,
 
This remark has been made in the past and we have a RFE for this pending:
 
"Add Request#getForwardedAddresses() method"
http://restlet.tigris.org/issues/show_bug.cgi?id=668
 
If you have time to work on a patch that would be welcome! :)
 
Best regards,
Jérôme Louvel
--
Restlet ~ Founder and Lead developer ~   
http://www.restlet.org
Noelios Technologies ~ Co-founder ~   
http://www.noelios.com

  _  

De : remidewi...@gmail.com [mailto:remidewi...@gmail.com] De la part de Rémi 
Dewitte
Envoyé : lundi 12 janvier 2009 17:34
À : discuss@restlet.tigris.org
Objet : HttpRequest suggestion


Hello all,

When using http forward, I would find more convenient to have the real client 
address using request.getClientInfo().getAddress() instead of the forwarder 
component.

It means changing line 227 of HttpRequest from
result.getAddresses().add(addresses[i].trim());
to 
result.getAddresses().add(0,addresses[i].trim());

What do you think ?

Rémi

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

RE: Restlets application designer

2009-01-14 Thread Jerome Louvel
Hi Xavier,
 
We have some RFE for Restlet 1.2 to develop an Eclipse update site and some 
wizard. 
 
In addition, we have plans to provide a higher level support for Eclipse in the 
future. In this context, we would be interested to
know what you would expect from such a solution (in term of features)?
 
Best regards,
Jérôme Louvel
--
Restlet ~ Founder and Lead developer ~   
http://www.restlet.org
Noelios Technologies ~ Co-founder ~   
http://www.noelios.com

  _  

De : xavier.meh...@gmail.com [mailto:xavier.meh...@gmail.com] De la part de 
Xavier Méhaut
Envoyé : mercredi 14 janvier 2009 11:32
À : discuss@restlet.tigris.org
Objet : Restlets application designer


Hello,
I would like to know if someone has already tried to developp a Restlets 
application designer under eclipse? The goal would be to
create graphically the application with the help of a component palette. The 
Toold woule be available as a eclipse RCp application
using the GEF graphical library.
regards
Xavier

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

RE: Patch to parameterize port numbers in JUnit tests

2009-01-14 Thread Jerome Louvel
Hi Raif,

That sounds like a useful thing to do. I was trying to apply the patch but got 
issues with the paths of the patched files. 

Could you try to use SVN instead to generate it, starting at the root of the 
SVN trunk instead?  

For Spring it should be possible to inject the static value into the bean 
property. I don't remember the exact syntax, but we can
figure this out. Any Spring wizard listening?

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 : Raif S. Naffah [mailto:tig...@naffah-raif.name] 
Envoye : samedi 10 janvier 2009 07:48
A : discuss@restlet.tigris.org
Objet : Patch to parameterize port numbers in JUnit tests

hello there,

the JUnit tests (in org.restlet.test) have hard-wired port numbers which may 
not suit every developer's environment.  this patch introduces a new 
property in the main build.xml, and injects at as a system environment 
variable.

when more than one port is required, the property value is used as a base; 
i.e. second port number is valueOf(property) + 1, etc. 

the only test i was not able to parametrize was the Spring test (and its 
.xml file).


cheers;
rsn

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


RE: Restlets and Asynchronous Request Processing

2009-01-14 Thread Jerome Louvel
Hi Tim,
 
The idea is to let the developer, on the server-side, release the calling 
thread if he is planning to block for a long time for
another service before being able to prepare the response. 
 
He would mark the Response to indicate that it isn't ready to be sent/committed 
to the socket. When the invoked service returns (in
an asynchronous way as well but on the client-side), it would callback the 
Resource/Restlet and let it mark the Response instance as
ready to be sent/committed. This would trigger an action on the server 
connector that would wake up and write the response on the
output socket.
 
Now, this only covers part of the asynchronous needs. We also need to cover the 
client-side. We would probably use something similar
to what we did for the Restlet-GWT port: use a callback mechanism. We should 
also leverage the Future interface as you previously
suggested.
 
Am I missing something?
 
Best regards,
Jérôme 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é : mercredi 7 janvier 2009 21:14
À : discuss@restlet.tigris.org
Objet : Re: Restlets and Asynchronous Request Processing


Jérôme,


Could you elaborate on your most recent comments in the "Support asynchronous 
processing" issue? 

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


In particular, what would the Response autoSent property mean?

--tim

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

RE: Command line to STOP Restlet server

2009-01-14 Thread Jerome Louvel
Hi Leshek,

When you stop the parent Component, it stops all the child connectors. 
Otherwise, you can stop each connector individually using the
stop() method. It should stop listening.

If you want to do that from an Application, you have to explicitly/manually 
pass it a reference to the parent Component so it can
call stop() on it when necessary.

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 : news [mailto:n...@ger.gmane.org] De la part de Leshek Fiedorowicz
Envoye : mercredi 14 janvier 2009 06:35
A : discuss@restlet.tigris.org
Objet : Re: Command line to STOP Restlet server

All good, helpful hints, but... by Restlet designed (the best practice?) way 
to stop Restlet internal HTTP server?

Leshek
Ps. I have re-registered with tigris, thank you Jerome!

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

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


RE: Solr integration

2009-01-14 Thread Jerome Louvel
Hi Ilango,
 
Could you describe some concrete integration scenarios where this would be 
useful? How would you mix the technologies?
 
Best regards,
Jérôme Louvel
--
Restlet ~ Founder and Lead developer ~   
http://www.restlet.org
Noelios Technologies ~ Co-founder ~   
http://www.noelios.com

  _  

De : ilango [mailto:ilango...@yahoo.com] 
Envoyé : mercredi 14 janvier 2009 15:55
À : discuss@restlet.tigris.org
Objet : Re: Solr integration


Jerome
I worked with Nutch in the past. I think Nutch and Lucene integrated into 
restlet would be good

ilango



--- On Mon, 1/12/09, R�mi Dewitte  wrote:



From: R�mi Dewitte 
Subject: Re: Solr integration
To: discuss@restlet.tigris.org
Date: Monday, January 12, 2009, 10:38 AM


J�r�me,

Why not to lead the Lucene extension ! I'll do my best.

I think that Lucene integration will be really handy with Semantic Web for 
example to index relations.

Cheers,
R�mi


On Sun, Jan 11, 2009 at 20:37, Jerome Louvel  wrote:


R�mi,
 
Sounds good! 
 
Also, if you are interested (and have enough available time) to lead the whole 
Lucene extension, I would be happy to have you as the extension committer, with 
commit rights, etc. 
 
See details about development process here:
http://wiki.restlet.org/developers/179-restlet/51-restlet.html?branch=docs-1_1 

 &language=en
 


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

  _  


De : remidewi...@gmail.com [mailto:remidewi...@gmail.com] De la part de R�mi 
Dewitte

Envoy� : dimanche 11 janvier 2009 19:17 

� : discuss@restlet.tigris.org
Objet : Re: Solr integration


J�r�me,

I'll try to contribute some documentation as soon as possible and possibly look 
at the Tika stuff too.

Have a nice week !

R�mi


On Sun, Jan 11, 2009 at 17:41, Jerome Louvel  wrote:


Hi R�mi,
 
Sorry for the slow reply! 
 
1) Solr support
 
First, let me thank you for contributing this class.
 
I went ahead and created the "org.restlet.ext.lucene" module in SVN trunk with 
the necessary/minimal library dependencies (for Lucene, Tika, Solr). The build 
has been updated to include this extension in the Restlet 1.2 distribution.
 
You will also note that I've moved the internal classes in SolrClientHelper up 
one level to facilitate reuse. I've also completed the Javadocs.
 
So, we are almost there. What is now missing is some proper user documentation. 
I've created a new developer page on the wiki where you and others can provide 
this info:
 
"Lucene extension"
http://wiki.restlet.org/developers/172-restlet/215-restlet.html
 
Once we get the User Guide ready for Restlet 1.2, we'll migrate the user 
related content there.
 
2) Tika support
 
In addition to the Solr client connector, I have also added a 
TikaRepresentation to facilitate the extraction of metadata from any 
representation supported by Tika parsers. Hope this helps!
 


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


  _  

De : remidewi...@gmail.com [mailto:remidewi...@gmail.com] De la part de R�mi 
Dewitte
Envoy� : mardi 30 d�cembre 2008 13:16 

� : discuss@restlet.tigris.org
Objet : Re: Solr integration


Hi !

Basically it allows you to interact with solr with solr:// references the same 
way you would do it through http : 
http://wiki.apache.org/solr/SolrRequestHandler

It can be seen as a way to deploy solr as a Restlet application instead of in a 
servlet container.

I have uploaded the SolrClientHelper.java on 
http://restlet.tigris.org/issues/show_bug.cgi?id=697.

About creating an extension, I still struggle a bit on how define dependencies 
to 3rd party jars.
Is there a tool to create all the boilerplate in librairies/ directory from 
this maven dependency ?

org.apache.solr
solr-core
1.3.0
 

Regards,
R�mi


On Sun, Dec 28, 2008 at 13:17, Jerome Louvel  wrote:


Hi all,
 
Providing Lucene-based search/indexing features sounds like a generic and very 
useful feature. 
 
If the best way to facilitate this integration in Restlet is to leverage Solr, 
then we should definitely consider a new Restlet extension. I've created a RFE 
to track this idea:
 
"Add support for Lucene/Solr"
http://restlet.tigris.org/issues/show_bug.cgi?id=697
 
R�mi, could you describe how your client connector works? Which use cases does 
it handle?
 


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

  _  

De : Ben Johnson [mai

RE: media type adaptor

2009-01-14 Thread Jerome Louvel
Hi all,
 
We have a similar plan in the tube!
 
"Faciliate Resource to Representation mapping"
http://restlet.tigris.org/issues/show_bug.cgi?id=303
 
The idea is to dynamically dispatch the represent(*), acceptRepresentation(*) 
and storeRepresentation(*) to the more specific
versions if available like:
 
representXml(?) for an XML representation ("xml" being mapped in 
MetadataService like for file extensions)
representJson(?) for a JSON representation
...
 
This would handle the dispatching automatically while still allowing a manual 
dispatching by overriding the generic represent(*)
method when more appropriate (and for backward compatibility).
 
How does it sound?
 
Best regards,
Jerome Louvel
--
Restlet ~ Founder and Lead developer ~   
http://www.restlet.org
Noelios Technologies ~ Co-founder ~   
http://www.noelios.com
 


  _  

De : Cliff Binstock [mailto:cliff.binst...@coyotereporting.com] 
Envoye : mardi 13 janvier 2009 17:43
A : discuss@restlet.tigris.org
Objet : RE: media type adaptor



Taylor,

 

I have implemented a solution like this and I highly recommend it.  I actually 
have taken it one step further and bound the routes
(and the implementation) dynamically:  there is very little Java code, mostly 
just XML-based configuration.  In the cases where
configuration does not make sense, then I have subclasses that provide an 
implementation as your message implies.

 

I can tell you that you will want to pass in the request to the callback:  you 
don't always need it, but sometimes you need some
contextual information (see previous post about wanting the original route URI, 
for example).

 

Cliff Binstock
Coyote Reporting

  _  

From: Taylor Cowan [mailto:taylor_co...@yahoo.com] 
Sent: Tuesday, January 13, 2009 7:12 AM
To: discuss@restlet.tigris.org
Subject: media type adaptor

 

I'm new to restlets and would like some feedback from the community on some 
experimentation.  Instead of if/else'ing through the
list of variant types and calling the appropriate logic, I'd like reslets to do 
that for me.

The example "MediaType" below is similar to the restlet version, except that 
each enumeration overrides a call back, for example,
the text/html type calls back to handleTextHTML().


TEXT_HTML("text/html", "HTML document") {
@Override
public Representation callBack(VariantHandler arg0) {
return arg0.handleTextHTML();
}
},

The application developer then extends a resource from BaseResource, and 
implements the methods they'd like to handle.  (like the
AWT MouseEvent adaptors of old) The examples are not complete, I only 
implmented 4 media types.  The BaseResource gets the media
type, converts to the appropriate extended MediaType, and the invokes the 
callback.

@Override
public Representation represent(Variant variant) throws ResourceException {
String mediaType = variant.getMediaType().getName();
return MediaType.value(mediaType).callBack(this);
}


So to handle HTML, the developer just does this:

@Override
public Representation handleTextHTML() {
   // here's where we respond to HTML clients.
}



http://restlets.s3.amazonaws.com/VariantHandler.java
http://restlets.s3.amazonaws.com/BaseResource.java
http://restlets.s3.amazonaws.com/MediaType.java

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

Re: Solr integration

2009-01-14 Thread ilango
Jerome
I worked with Nutch in the past. I think Nutch and Lucene integrated into 
restlet would be good

ilango



--- On Mon, 1/12/09, Rémi Dewitte  wrote:
From: Rémi Dewitte 
Subject: Re: Solr integration
To: discuss@restlet.tigris.org
Date: Monday, January 12, 2009, 10:38 AM

Jérôme,

Why not to lead the Lucene extension ! I'll do my best.

I think that Lucene integration will be really handy with Semantic Web for 
example to index relations.

Cheers,
Rémi


On Sun, Jan 11, 2009 at 20:37, Jerome Louvel  wrote:






Rémi,
 
Sounds good! 
 
Also, if you are interested (and have enough available time) to lead the 
whole Lucene extension, I would be happy to have you as the extension 
committer, 
with commit rights, etc. 
 
See details about development process here:
http://wiki.restlet.org/developers/179-restlet/51-restlet.html?branch=docs-1_1&language=en

 


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



De : remidewi...@gmail.com 
[mailto:remidewi...@gmail.com] De la part de Rémi 
Dewitte
Envoyé : dimanche 11 janvier 2009 
19:17
À : discuss@restlet.tigris.org
Objet : Re: 
Solr integration


Jérôme,

I'll try to contribute some documentation as soon as 
possible and possibly look at the Tika stuff too.

Have a nice week 
!

Rémi


On Sun, Jan 11, 2009 at 17:41, Jerome Louvel  
wrote:


  
  Hi 
  Rémi,
   
  Sorry for the slow 
  reply! 
   
  1) Solr 
  support
   
  First, let me thank you 
  for contributing this class.
   
  I went ahead and 
  created the "org.restlet.ext.lucene" module in SVN trunk with the 
  necessary/minimal library dependencies (for Lucene, Tika, Solr). The build 
has 
  been updated to include this extension in the Restlet 1.2 
  distribution.
   
  You will also note that 
  I've moved the internal classes in SolrClientHelper up one level to 
facilitate 
  reuse. I've also completed the Javadocs.
   
  So, we are almost 
  there. What is now missing is some proper user documentation. I've created a 
  new developer page on the wiki where you and others can provide this 
  info:
   
  "Lucene 
  extension"
  http://wiki.restlet.org/developers/172-restlet/215-restlet.html

   
  Once we get the User 
  Guide ready for Restlet 1.2, we'll migrate the user related content 
  there.
   
  2) Tika 
  support
   
  In addition to the Solr 
  client connector, I have also added a TikaRepresentation to facilitate the 
  extraction of metadata from any representation supported by Tika parsers. 
Hope 
  this helps!
  
   
  
  
  Best regards,
Jérôme 
  Louvel
--
Restlet ~ Founder and Lead developer ~ 
  http://www.restlet.org
Noelios Technologies ~ Co-founder ~ http://www.noelios.com

   

  
  
  De : remidewi...@gmail.com 
  [mailto:remidewi...@gmail.com] De la part de Rémi 
  Dewitte
Envoyé : mardi 30 décembre 2008 13:16
  
  
  
À : discuss@restlet.tigris.org
Objet : Re: Solr 
  integration


  
  
  
  Hi !

Basically it allows you to interact with solr with 
  solr:// references the same way you would do it through http : 
http://wiki.apache.org/solr/SolrRequestHandler

It can 
  be seen as a way to deploy solr as a Restlet application instead of in a 
  servlet container.

I have uploaded the SolrClientHelper.java on 
http://restlet.tigris.org/issues/show_bug.cgi?id=697.

About 
  creating an extension, I still struggle a bit on how define dependencies to 
  3rd party jars.
Is there a tool to create all the boilerplate in 
  librairies/ directory from this maven dependency ?
    
      
       
      
   org.apache.solr
    
         
   solr-core
    
         
   1.3.0
       
    

Regards,
Rémi


  On Sun, Dec 28, 2008 at 13:17, Jerome Louvel  
wrote:

  

Hi 
all,
 
Providing 
Lucene-based search/indexing features sounds like a generic and very useful 
feature. 
 
If the best way to 
facilitate this integration in Restlet is to leverage Solr, then we should 
definitely consider a new Restlet extension. I've created a RFE to track 
this idea:
 
"Add support for 
Lucene/Solr"
http://restlet.tigris.org/issues/show_bug.cgi?id=697

 
Rémi, could you 
describe how your client connector works? Which use cases does it 
handle?
 


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




De : Ben Johnson [mailto:ben.john...@jandpconsulting.co.uk] 

Envoyé : vendredi 26 décembre 2008 19:23
À : 
discuss@restlet.tigris.org
Objet : Re: Solr 
integration






Hi Rémi
 
I have been considering using Solr with Tika 
(http://lucene.grantingersoll.com/2008/12/06/tika-and-solr/) to index 
text-based documents - mainly PDF I think 
- with associated XML 'metadata' documents (which would also be 
indexed with Solr) via R

Re: REST web service accepting a POST using Restlet - Best Practice

2009-01-14 Thread Thierry Boileau
Hello Simon,

you can use two kinds of "XML representations": DomRepresentation and 
SaxRepresentation.
You can instantiate both of them with the posted representation. E.g.:
DomRepresentation xmlRep = new DomRepresentation(rep);

The DomRepresentation gives you access to the Dom document. The 
SaxRepresentation allows you to parse the XML doc with your own 
contentHandler.
See the javadocs here [1] and here [2].

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

[1] 
http://www.restlet.org/documentation/1.1/api/org/restlet/resource/DomRepresentation.html
[2] 
http://www.restlet.org/documentation/1.1/api/org/restlet/resource/SaxRepresentation.html
> I have my resource and they typical overridden method to handle POST requests.
>
> public void acceptRepresentation(Representation rep) {
>
>   if (MediaType.APPLICATION_XML.equals(rep.getMediaType())) {
>   //Do stuff here
>   }
>   else {
>   //complain!
>   }
> }
>
> What I want to know is the best practice to handle my packet of XML. I see a 
> lot of examples using a Form - but surely there is a way to work with the 
> Representation object itself or cast it to some useful XML object???
>
> Any help on how you should and do parse incoming XML in your resource is much 
> appreciated.
>
> --
> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=1023840
>
>

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


Re: ChunkedOutputStream

2009-01-14 Thread Thierry Boileau
Hello Hélia,

that's weird, because the ChunkedOuptStream is located in another 
package (com.noelios.restlet.http) in the 1.1.1 release.
Are you sure to use the Grizzly extension from the 1.1.1 release?

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

> Hi to all,
>
> I recently update the restlet 1.1.1 version. After minor modification in 
> my code, I launched my restlet server and tried to access to an 
> application. Then I get the following exception:
> GRAVE: WorkerThreadImpl unexpected exception:
> java.lang.NoClassDefFoundError: com/noelios/restlet/util/ChunkedOutputStream
> at 
> com.noelios.restlet.ext.grizzly.HttpParserFilter.execute(HttpParserFilter.java:61)
> at 
> com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:124)
> at 
> com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
> at 
> com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:75)
> at 
> com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
> at 
> com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
> at com.sun.grizzly.util.WorkerThreadImpl.run(WorkerThreadImpl.java:154)
> Caused by: java.lang.ClassNotFoundException: 
> com.noelios.restlet.util.ChunkedOutputStream
> at java.net.URLClassLoader$1.run(Unknown Source)
> at java.security.AccessController.doPrivileged(Native Method)
> at java.net.URLClassLoader.findClass(Unknown Source)
> at java.lang.ClassLoader.loadClass(Unknown Source)
> at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
> at java.lang.ClassLoader.loadClass(Unknown Source)
> at java.lang.ClassLoader.loadClassInternal(Unknown Source)
> ... 7 more
>
> Any idea ?
>
> Thanks in advance
>
> --
> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=1023971

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


Re: Re: Re: Tomcat appears to swallow Allow: header

2009-01-14 Thread Rob Heittman
Which I do!  I will switch our GoGoEgo dependencies to use the 1.1
branch snapshot so we can drop the hacks.

On Wed, Jan 14, 2009 at 7:51 AM, Jerome Louvel
 wrote:
> Thierry has fixed the redirect issue. FYI, there is a browsable directory 
> with all the releases available. Useful if you need a
> snapshot of 1.1 branch :-)
> http://www.restlet.org/downloads/archives

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


RE: Re: Re: Tomcat appears to swallow Allow: header

2009-01-14 Thread Jerome Louvel
Awesome!! The fix has been apply to the 1.1 branch in SVN. Thanks Rob for 
testing this.

Thierry has fixed the redirect issue. FYI, there is a browsable directory with 
all the releases available. Useful if you need a
snapshot of 1.1 branch :-)
http://www.restlet.org/downloads/archives

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 : Rob Heittman [mailto:rob.heitt...@solertium.com] 
Envoye : mercredi 14 janvier 2009 02:41
A : discuss@restlet.tigris.org
Objet : Re: Re: Re: Tomcat appears to swallow Allow: header

Much weeping and gnashing of teeth later ... I took out the entity
hacks from GoGoEgo, ran on Restlet 1.1, observed the Tomcat problems
under GWT hosted mode, ported to Restlet 1.2 snapshot, took out the
entity hacks, and am not seeing the adverse behavior.  Barring a more
scientific analysis ... I think this fix really solves the problem!
Sweet!

Unrelated - did you know that when you download snapshot ("development
version - unstable") from www.restlet.org/downloads you get redirected
to the 1.1 snapshot?  This is a bit confusing  :-)  I had to guess the
URL for the 1.2 snapshot.

On Tue, Jan 13, 2009 at 5:31 PM, Jerome Louvel
 wrote:
> The latest snapshot (Restlet 1.2) already contains the fix:
> http://www.restlet.org/documentation/snapshot/changes

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

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


REST web service accepting a POST using Restlet - Best Practice

2009-01-14 Thread Simon Earnshaw
I have my resource and they typical overridden method to handle POST requests.

public void acceptRepresentation(Representation rep) {

  if (MediaType.APPLICATION_XML.equals(rep.getMediaType())) {
  //Do stuff here
  }
  else {
  //complain!
  }
}

What I want to know is the best practice to handle my packet of XML. I see a 
lot of examples using a Form - but surely there is a way to work with the 
Representation object itself or cast it to some useful XML object???

Any help on how you should and do parse incoming XML in your resource is much 
appreciated.

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


ChunkedOutputStream

2009-01-14 Thread Hélia Pouyllau
Hi to all,

I recently update the restlet 1.1.1 version. After minor modification in 
my code, I launched my restlet server and tried to access to an 
application. Then I get the following exception:
GRAVE: WorkerThreadImpl unexpected exception:
java.lang.NoClassDefFoundError: com/noelios/restlet/util/ChunkedOutputStream
at 
com.noelios.restlet.ext.grizzly.HttpParserFilter.execute(HttpParserFilter.java:61)
at 
com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:124)
at 
com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
at 
com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:75)
at 
com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
at 
com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
at com.sun.grizzly.util.WorkerThreadImpl.run(WorkerThreadImpl.java:154)
Caused by: java.lang.ClassNotFoundException: 
com.noelios.restlet.util.ChunkedOutputStream
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
... 7 more

Any idea ?

Thanks in advance

--
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=1023971begin:vcard
fn;quoted-printable:H=C3=A9lia Pouyllau
n;quoted-printable:Pouyllau;H=C3=A9lia
org:Bell Labs France;Networking & Networks/Semantic Autonomous Technologies
adr:;;route de Villejust;Nozay;;91620;France
email;internet:helia.pouyl...@alcatel-lucent.com
tel;work:+33 130 776 311 
version:2.1
end:vcard



Restlets application designer

2009-01-14 Thread Xavier Méhaut
Hello,
I would like to know if someone has already tried to developp a Restlets
application designer under eclipse? The goal would be to create graphically
the application with the help of a component palette. The Toold woule be
available as a eclipse RCp application using the GEF graphical library.
regards
Xavier


Re: JsonRepresentation(JSONArray jsonArray) Not working

2009-01-14 Thread Jerome Louvel
Hi Daniel,

The fix is part of Restlet 1.1.1. I've done a test with SVN trunk (Restlet 1.2 
snapshot) and it worked:

JSONArray jsonFeedEntry = new JSONArray();
jsonFeedEntry.put("Red");
jsonFeedEntry.put("Blue");
System.out.println("VALUES:"+jsonFeedEntry.toString());
Representation jr = new JsonRepresentation(jsonFeedEntry);
jr.write(System.out);

returns:

VALUES:["Red","Blue"]
["Red","Blue"]

Could you try to code above with Restlet 1.1.1 and let me know if it works?

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 : Daniel Woo [mailto:daniely...@hotmail.com] 
Envoye : vendredi 9 janvier 2009 19:40
A : discuss@restlet.tigris.org
Objet : Re: JsonRepresentation(JSONArray jsonArray) Not working

In Restlet 1.1.1 the result is still

{"class":"class org.json.JSONArray"}

which version or patch you will have it?

So far, it's a little clumsy to query a list of resources like /rest/cars 
without JSONArray

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

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


RE: JSON-Lib and Restlet

2009-01-14 Thread Jerome Louvel
Hi guys,

The JSON extension that we propose does have some limitations. I'd like to 
offer a stronger alternative in the future but I'm not
sure yet which library is the best.

JSON-Lib is richer and stable but lacks streaming parser which might be 
important for larger documents and more responsive dynamic
resources. I've been looking at a new Jackson project which looks promising:

"Alternative JSON support"
http://restlet.tigris.org/issues/show_bug.cgi?id=656

Otherwise, using JSON-Lib directly should be easy. Just write a subclass like 
this:

public class JsonLibRepresentation extends WriterRepresentation {

// JSON value to serialize
net.sf.json.JSON json;

public JsonLibRepresentation(net.sf.json.JSON json){
super(MediaType.APPLICATION_JSON);
setCharacterSet(CharacterSet.UTF_8);
this.json = json;
}

@Override
public void write(Writer writer) throws IOException{
json.write(writer);
}
}

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 : news [mailto:n...@ger.gmane.org] De la part de Evgeny Shepelyuk
Envoye : lundi 12 janvier 2009 10:04
A : discuss@restlet.tigris.org
Objet : Re: JSON-Lib and Restlet

Hi

+1 on this queistion.
Some time ago personally i asked the same question. But we still don't  
have impelmentaiton :)
Maybe you can produce it ?

In my projects i've been usign StringRepresentaion and other 'hacks' to  
produce output
using Json-lib and not internal Restlet JSON support.

> I am a new user of Restlet (and quite hapy with it, too), but I found  
> that using the JSON classes that come with it do not work well enough  
> for me.  They do serialize basic classes, but do not work on things like  
> HashMap, or really anything nested.  I checked the main JSON website to  
> see if there were newer versions of those classes (there are), but they  
> still do not on nested objects.
>
> JSON-Lib does work well for this, so I switched to using that.  However,  
> when I want to create a representation out of the new (JSON-Lib)  
> JSONObject, it does not accept the type.
>
>Representation representation = new JsonRepresentation(json);
>
> The warning is: "Type safety: The expression of type JSONObject needs  
> unchecked conversion to conform to Map"
>
> The reason is because "json" is of type "net.sf.json.JSONObject" instead  
> of "org.json.JSONObject".  Ultimately, the best solution is for  
> "net.sf.json.JSONObject" to extend "org.json.JSONObject", as is done  
> with other JSON libraries I have tested, but I seriously doubt this is  
> going to happen.  I can "fix" the issue by doing this instead:
>
>Representation representation = new  
> JsonRepresentation(json.toString());
>
> It just seems wasteful to have a usable JSONObject, convert it to a  
> string and then pass it to a constructor.
>
> Has anyone successfully used JSON-Lib with Restlet without resorting to  
> a hack like this?  Also, is there a reason that Restlet only works with  
> the basic "org.json.*" library?  I would think that JSONObject should be  
> handled in the way logging is handled:  you can use the basic built-in  
> logging in the JDK, or use something else, like Log4J.  Can this also be  
> done with "org.json.*" and other JSON implementations, too?
>
> I very much would appreciate any replies / suggestions.
>
> Mike V.
>
> --
> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=1014233
>

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

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


Re: Looking for a way to access Date header

2009-01-14 Thread Thierry Boileau
Hello Carlos,

according to the roadmap (http://www.restlet.org/about/roadmap), the 1.2 
is planned for Q4 of this year.

best regards,
Thierry Boileau
> Hi Jerome,
>
> Thanks for the feedback, Restlet 1.2 looks pretty interesting, there is a 
> date set for this release?
>
> --
> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=1023335
>
>

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


Re: Where is status header in Response.getAttributes?

2009-01-14 Thread Thierry Boileau
Hi Carlos,

yes it is. The status is directly available on the response object.
Strictly speaking, we consider the status line is not a header field of 
the response. We follow the distinction introduced by the HTTP RFc 
(http://www.w3.org/Protocols/rfc2616/rfc2616-sec6.html#sec6.1)

best regards,
Thierry Boileau

> It seems that the status header associated with a Response does not appear in 
> the list (Form) of attributes obtained by calling getAttributes.
>
> I would like to know if this is the expected behavior for you.
>
> --
> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=1023042
>
>

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


Re: Tomcat appears to swallow Allow: header

2009-01-14 Thread Thierry Boileau
Hi Rob,

thanks for your report. The snapshot is now redirected to the 1.2 
snapshot...

best regards,
Thierry Boileau


> Much weeping and gnashing of teeth later ... I took out the entity
> hacks from GoGoEgo, ran on Restlet 1.1, observed the Tomcat problems
> under GWT hosted mode, ported to Restlet 1.2 snapshot, took out the
> entity hacks, and am not seeing the adverse behavior.  Barring a more
> scientific analysis ... I think this fix really solves the problem!
> Sweet!
>
> Unrelated - did you know that when you download snapshot ("development
> version - unstable") from www.restlet.org/downloads you get redirected
> to the 1.1 snapshot?  This is a bit confusing  :-)  I had to guess the
> URL for the 1.2 snapshot.
>
> On Tue, Jan 13, 2009 at 5:31 PM, Jerome Louvel
>  wrote:
>   
>> The latest snapshot (Restlet 1.2) already contains the fix:
>> http://www.restlet.org/documentation/snapshot/changes
>> 
>
> --
> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=1023299
>
>

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