Re: restlet 2.0 m6 questions

2010-01-19 Thread Thierry Boileau
Hello,

too bad, I'm very late and very sorry...
The only possible mistake I see is the parent classs of the 
HelloWorldResource class. Is it really a Resource or ServerResource 
subclass?
What is the artifact id of the restlet core module?

Best regards,
Thierry Boileau

> Hi Thierry
>
> Thanks for your response.
>
> I have tried the FirstSteps as a webapp and a standalone Java program. I
> took the exact same code given in the link below and it throws the same
> error in both cases on the web page :500.
>
> The server encountered an unexpected condition which prevented it from
> fulfilling the request
>
> You can get technical details here.
> Please continue your visit at our home page.
>
>
> Here is the output from the standalone java i ran using the code attached
>
> java -cp org.restlet.jar;.com.myapp.rest.api.RepoRest
> Jan 7, 2010 5:39:37 PM org.restlet.engine.http.StreamServerHelper start
> INFO: Starting the internal HTTP server
> Jan 7, 2010 5:39:38 PM org.restlet.resource.Finder createFinder
> WARNING: Cannot create a Finder for the given target class, since it is
> neither
> a subclass of Resource nor a subclass of ServerResource.
> Jan 7, 2010 5:40:19 PM org.restlet.routing.Filter doHandle
> WARNING: The filter org.restlet.routing.ro...@c2ff5 was executed without a
> next
> Restlet attached to it.
> Jan 7, 2010 5:40:19 PM org.restlet.engine.log.LogFilter afterHandle
> INFO: 2010-01-0717:40:19127.0.0.1   -   -   8182
> GET /hello  -   500 398 -   47
> http://localhost:8182
> Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.6) Gecko/20091201
> Firef
> ox/3.5.6 (.NET CLR 3.5.30729)   -
> Jan 7, 2010 5:40:19 PM org.restlet.engine.log.LogFilter afterHandle
> INFO: 2010-01-0717:40:19127.0.0.1   -   -   8182
> GET /favicon.ico-   404 363 -   0
> http://localhost
> :8182   Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.6)
> Gecko/200912
> 01 Firefox/3.5.6 (.NET CLR 3.5.30729)   -
> Jan 7, 2010 5:40:22 PM org.restlet.engine.log.LogFilter afterHandle
> INFO: 2010-01-0717:40:22127.0.0.1   -   -   8182
> GET /favicon.ico-   404 363 -   0
> http://localhost
> :8182   Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.6)
> Gecko/200912
> 01 Firefox/3.5.6 (.NET CLR 3.5.30729)   -
>
> I used the exact same code given in the tutorial given below:
> package com.myapp.rest.api;
> import org.restlet.Restlet;
> import org.restlet.Application;
> import org.restlet.Component;
> import org.restlet.data.Protocol;
> import org.restlet.routing.Router;
>   
> public class RepoRest extends Application {
>   
>/**
> * Creates a root Restlet that will receive all incoming calls.
> */
>   
>public synchronized Restlet createInboundRoot() {
>// Create a router Restlet that routes each call to a
>// new instance of HelloWorldResource.
>Router router = new Router(getContext());
>   
>// Defines only one route
>router.attach("/hello", HelloWorldResource.class);
>   
>return router;
>}
> public static void main(String[] args) {
>   try {
> // Create a new Component.
> org.restlet.Component component = new
> org.restlet.Component();
>   
> // Add a new HTTP server listening on port 8182.
> component.getServers().add(Protocol.HTTP, 8182);
>   
> // Attach the sample application.
> component.getDefaultHost().attach(new RepoRest());
>   
> // Start the component.
> component.start();
> } catch (Exception e) {
> // Something is wrong.
> e.printStackTrace();
> }
> }
>   
> }
>
>
>
> Thierry Boileau wrote:
>
>> Hello,
>>
>> 1. the group ids have been changed recently. As there are several editions
>> (see this page for more details
>> http://wiki.restlet.org/docs_2.0/275-restlet.html), the group ids are now:
>> org.restlet..
>> For example, if you wan to get the sources of the org.restlet artefact, go
>> to this URL :
>> http://maven.restlet.org/org/restlet/jse/org.restlet/2.0-M6/
>> You can also get the source code of the whole project from the svn
>> repository, see here for more details:
>> http://restlet.tigris.org/source/browse/restlet/
>>
>> 2. well, I've just tried successfully with the "firstSteps" sample code
>> (available here http://www.restlet.org/documentation/2.0/firstSteps).
>> Could you give more details?
>>
>> Best regards,
>> Thierry Boileau
>>
>>
>>  
>>> 1. Where can I find the sources for the 2.0-M6 releas

problem to POST on resource using netty connector

2010-01-19 Thread Laurent Rustuel
Hello everybody,
I have a problem using Netty connector.
When I use either curl or rest-client (see 
http://code.google.com/p/rest-client/ )
for a POST on a resource, it seems to not tell the client that the 
answer has been sent.
Here, I send using a curl a json
N:\>curl -i -X POST -H "Content-Type: application/json" -d 
{"mode":"production"} http://localhost:8080/server/mode
HTTP/1.1 200 The request has succeeded
Accept-Ranges: bytes
Content-Location: http://localhost:8080/server/status
Content-Type: application/json; charset=UTF-8
Date: Tue, 19 Jan 2010 10:22:32 GMT
Server: Restlet-Framework/2.0m6
Vary: Accept-Charset, Accept-Encoding, Accept-Language, Accept

{"server changed":"production"}
but the curl command didn't end, I have to send the break signal.
Same things with rest-client, I see in my log that the request as been 
handled correctly, but nothing appears in the gui,
and I have to push the stop button.
I don't have this problem with internal connector or jetty.
I tried to discover more informations, so using tcp spy I got the following
*** with jetty *** :
socket (9344) accepting a connection synchronously without blocking
socket (9344) accepted a connection on new socket (9268) 
[addr=127.0.0.1:2299]
socket (9268) specified an event object to be associated with the 
supplied set of network events and enabled its nonblocking mode 
[hEventObject=0, lEvent==0]
socket (9268) disabled its nonblocking mode
socket (9268) enabled its nonblocking mode
socket (9268) set one of its options [level=IPPROTO_TCP, optname=1]
socket (9268) set one of its options [level=SOL_SOCKET, 
optname=SO_LINGER, l_onoff=1, l_linger=1]
socket (9268) receiving data synchronously without blocking [len=4096]
socket (9268) received 217 bytes of data
POST /server/mode HTTP/1.1
Content-Length: 28
Content-Type: application/json; charset=UTF-8
Host: localhost:8080
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.0-beta2 (java 1.5)
Expect: 100-Continue

socket (9268) determined its local name [name=127.0.0.1:8080]
socket (9268) determined its local name [name=127.0.0.1:8080]
socket (9268) sending data synchronously without blocking [len=25]
socket (9268) sent 25 bytes of data
HTTP/1.1 100 Continue

socket (9268) receiving data synchronously without blocking [len=3879]
socket (9268) received 28 bytes of data (Incomplete last line)
  {
   "mode":"production"
}
socket (9268) sending data synchronously without blocking [len=342]
socket (9268) sent 342 bytes of data
HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8
Content-Location: http://localhost:8080/server/status
Date: Tue, 19 Jan 2010 10:09:18 GMT
Vary: Accept-Charset, Accept-Encoding, Accept-Language, Accept
Accept-Ranges: bytes
Server: Restlet-Framework/2.0m6
Transfer-Encoding: chunked

1F
{"server changed":"production"}
socket (9268) sending data synchronously without blocking [len=5]
socket (9268) sent 5 bytes of data
0

socket (9296) sending data synchronously [len=1]
socket (9296) sent 1 bytes of data
  01.
socket (9328) can receive 1 bytes atomically
socket (9328) receiving data synchronously [len=16]
socket (9328) received 1 bytes of data
  01.
socket (9268) receiving data synchronously without blocking [len=4096]
socket (9268) did not receive any data, closed gracefully by peer
socket (9268) retrieved one of its options [level=SOL_SOCKET, 
optname=SO_LINGER, l_onoff=1, l_linger=1]
socket (9268) will be closed when outstanding asynchronous calls finish

*** with netty *** :
socket (9372) accepting a connection synchronously without blocking
socket (9372) could not accept a connection - WSAEWOULDBLOCK (A 
non-blocking socket operation could not be completed immediately)
socket (9372) accepting a connection synchronously without blocking
socket (9372) could not accept a connection - WSAEWOULDBLOCK (A 
non-blocking socket operation could not be completed immediately)
socket (9372) accepting a connection synchronously without blocking
socket (9372) accepted a connection on new socket (9272) 
[addr=127.0.0.1:2369]
socket (9272) specified an event object to be associated with the 
supplied set of network events and enabled its nonblocking mode 
[hEventObject=0, lEvent==0]
socket (9272) disabled its nonblocking mode
socket (9272) determined its local name [name=127.0.0.1:8080]
socket (9272) determined its local name [name=127.0.0.1:8080]
socket (9264) created [family=AF_INET, type=SOCK_STREAM, 
protocol=IPPROTO_IP, dwFlags=WSA_FLAG_OVERLAPPED]
socket (9264) bound [name=127.0.0.1]
socket (9264) established for listening [backlog=50]
socket (9264) determined its local name [name=127.0.0.1:2370]
socket (9264) determined its local name [name=127.0.0.1:2370]
socket (9252) created [family=AF_INET, type=SOCK_STREAM, 
protocol=IPPROTO_IP, dwFlags=WSA_FLAG_OVERLAPPED]
socket (9252) connecting synchronously [name=127.0.0.1:2370]
socket (9252) connected
socket (9252) se

Re: ClientInfo.getPrincipals() vs getUser()

2010-01-19 Thread Thierry Boileau
Hello Arjohn,

Jerome was willing to answer you, but as he is very overloaded and is 
working for a customer, I answer you, very lately. Sorry for this delay.

Just a few words about the security model in the Restlet framework.
The Restlet framework has set up its own model (see here [0], [1]) based 
on some properties of the ClientInfo class: user and roles.
This model gets along with ones that are based on principals that are 
closer or are based on JAAS. These models are distinct, and some bridges 
are required in some situations.

Let's see what may happen, and what may be the bridges.
The security model tries to distinguish the authentication and 
authorization aspects.
First the incoming request is to be authenticated. At this step, the 
credentials taken from the request are verified by a secretVerifier and 
if everything is correct, the latter sets the ClientInfo's user with the 
credential's identifier, and the Enroler defined on the Authenticator 
filter lists the roles of the user.
Then comes the authorization phase. If you decide to follow the Restlet 
model, the user and list of roles are available and ready to be handled.

If you decide to follow a model based on principals, you can use the 
jaas extension that provides a few tools : a  JaasVerifier that takes 
the clientInfo's principals and generates a Subject instance and a 
JaasUtils class that creates a Subject instance with an instance of 
UserPrincipal class (based on the user attribute), and instances of 
RolePrincipals populated with the user's roles. You can of course decide 
to populate the ClientInfo#principals with your own strategy.

In the case of the servlet adapter, some principals already exist (due 
to the configuration of the servlet container). And as you notice, the 
user - and roles - are not retrieved (see [2]), which is from our point 
of view an issue. The idea is to make an application portable. It must 
be possible to make it run as a standalone application with the Restlet 
security model (based on User and Role object), and simply take it 
inside a servlet container. However, there is still a constraint:in 
order to make the list of Role correct, the servlet container and the 
Restlet application must define the same list of roles.

I hope these few words make the things clearer.

Best regards,
Thierry Boileau

[0] 
http://wiki.restlet.org/developers/172-restlet/212-restlet.html#dsy212-restlet_authenticationModel
[1] 
http://wiki.restlet.org/developers/172-restlet/212-restlet.html#dsy212-restlet_authorizationModel
[2] http://restlet.tigris.org/issues/show_bug.cgi?id=503

> Hi all,
>
> I'm having a hard time understanding the differences between
> ClientInfo.getPrincipals() and getUser() and when to use which method.
>
> I'm trying to get hold of the username in a ServerResource and figured I
> should use one of these methods. When using a ChallengeAuthenticator
> from the restlet package, the username is (only) available via
> getUser(). But when running inside Tomcat and relying on a servlet
> security-constraint, the username is only available via the
> getPrincipals() method. I'm using on HTTP Basic authentication in both
> cases.
>
> Looking through the ServerServlet's code, it seems that the user
> principals are copied from the incoming HttpServletRequest.
> HttpServletRequest.getRemoveUser() is never called though. Is this is
> bug in the connector?
>
> Any insights in this subject are highly appreciated!
>
> --
> Arjohn
>
> --
> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2435769
>
>

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

including restlet in a maven project

2010-01-19 Thread Marc Limotte
I need to use restlet in a project which is managed by Maven2.  I'm not too
familiar with Maven, but I think I need a POM file for restlet, and I don't
see one in the maven central repository.  Is there a repo available with
restlet (2.0-r6) in it?

Alternatively, I thought I could add it to my local repo.  I found
this script (below) in the restlet mailing list archives, but it's quite old
and seems to depend on POM files coming with the restlet distribution (under
lib/poms), and there is no such directory in the dist that I downloaded.

What's the easiest way to do this?

Marc

> -Message d'origine-
> De : news [EMAIL PROTECTED] De la part de Vincent
> Envoyé : jeudi 18 janvier 2007 20:36
> À : discuss@restlet.tigris.org
> Objet : Script to install a Restlet distribution into a
> maven2 repository
>
> Hi all,
>
> I use this bash  script to upgrade my local maven2 repository
> each time a new version of Restlet comes up.
> Some of you might find it useful.
>
> -Vincent.
>
> #!/bin/bash
> #
> # This script installs a Restlet disrtribution  into a local
> (filesystem)
> # maven2 repository.
> #
> # Usage: restlet2mvn.bsh 
>  repository>
> #
>
> if [ $# -le 1 ]; then
>echo "Usage: restlet2mvn.bsh  >  maven repository>"
>exit 1;
> fi
> RESTLET_DIST=$1
> MAVEN_REPOSITORY=$2
> MVN=mvn
>
> if [ ! -e $RESTLET_DIST ]
> then
>echo "Restlet distribution not found: $RESTLET_DIST"
>exit 1;
> fi
>
> if [ ! -e $MVN_REPO ]
> then
>echo "Maven repository not found: $MVN_REPO"
>exit 1;
> fi
>
> LIB_DIR=$RESTLET_DIST/lib
> POMS_DIR=$RESTLET_DIST/lib/poms
>
> poms=`ls $POMS_DIR/*.pom`
>
>
> for pom in $poms
> do
>  #  restlet/lib/poms/foo.pom -> restlet/lib/foo.jar
>  jar=`echo $pom | sed s/.pom$/.jar/g | sed s/poms\\\///g`
>  if [ -e $jar ]
>   then
># Extract the group, artifact id, and version number from the POM:
># We assume that the first , ,
>  tags found in
> the pom
># contain the module's group id, artifact id, and version #.
># This will break if the pom contains commented out tags:
>#  foo<.groupId>
>#  
>#  bar
>#  1.0
>group=` grep --regexp '.*'
> --max-count=1   $pom | sed
> 's/[[:space:]]*<[^><]*>[[:space:]]*//g' `
>artifact=` grep --regexp '.*'
> --max-count=1   $pom |
> sed 's/[[:space:]]*<[^><]*>[[:space:]]*//g' `
>version=` grep --regexp '.*'
> --max-count=1   $pom | sed
> 's/[[:space:]]*<[^><]*>[[:space:]]*//g' `
># Now deploy the module
>$MVN   deploy:deploy-file -DgroupId=$group \
>   -DgeneratePom=false \
>   -DpomFile=$pom \
>   -DartifactId=$artifact \
>   -Dversion=$version \
>   -Dpackaging=jar \
>   -Dfile=$jar \
>   -DrepositoryId=local-repository \
>   -Durl=file://$MAVEN_REPOSITORY
>
>   fi
> done
>
> exit
>

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

Re: including restlet in a maven project

2010-01-19 Thread Rhett Sutphin
Hi Marc,

On Jan 19, 2010, at 3:13 PM, Marc Limotte wrote:

> I need to use restlet in a project which is managed by Maven2.  I'm  
> not too familiar with Maven, but I think I need a POM file for  
> restlet, and I don't see one in the maven central repository.  Is  
> there a repo available with restlet (2.0-r6) in it?
>
> Alternatively, I thought I could add it to my local repo.  I found  
> this script (below) in the restlet mailing list archives, but it's  
> quite old and seems to depend on POM files coming with the restlet  
> distribution (under lib/poms), and there is no such directory in the  
> dist that I downloaded.
>
> What's the easiest way to do this?

http://www.restlet.org/downloads/maven

Rhett

>
> Marc
>
> > -Message d'origine-
> > De : news [EMAIL PROTECTED] De la part de Vincent
> > Envoyé : jeudi 18 janvier 2007 20:36
> > À : discuss@restlet.tigris.org
> > Objet : Script to install a Restlet distribution into a
> > maven2 repository
> >
> > Hi all,
> >
> > I use this bash  script to upgrade my local maven2 repository
> > each time a new version of Restlet comes up.
> > Some of you might find it useful.
> >
> > -Vincent.
> >
> > #!/bin/bash
> > #
> > # This script installs a Restlet disrtribution  into a local
> > (filesystem)
> > # maven2 repository.
> > #
> > # Usage: restlet2mvn.bsh 
> >  > repository>
> > #
> >
> > if [ $# -le 1 ]; then
> >echo "Usage: restlet2mvn.bsh  > >  > maven repository>"
> >exit 1;
> > fi
> > RESTLET_DIST=$1
> > MAVEN_REPOSITORY=$2
> > MVN=mvn
> >
> > if [ ! -e $RESTLET_DIST ]
> > then
> >echo "Restlet distribution not found: $RESTLET_DIST"
> >exit 1;
> > fi
> >
> > if [ ! -e $MVN_REPO ]
> > then
> >echo "Maven repository not found: $MVN_REPO"
> >exit 1;
> > fi
> >
> > LIB_DIR=$RESTLET_DIST/lib
> > POMS_DIR=$RESTLET_DIST/lib/poms
> >
> > poms=`ls $POMS_DIR/*.pom`
> >
> >
> > for pom in $poms
> > do
> >  #  restlet/lib/poms/foo.pom -> restlet/lib/foo.jar
> >  jar=`echo $pom | sed s/.pom$/.jar/g | sed s/poms\\\///g`
> >  if [ -e $jar ]
> >   then
> ># Extract the group, artifact id, and version number from the  
> POM:
> ># We assume that the first , ,
> >  tags found in
> > the pom
> ># contain the module's group id, artifact id, and version #.
> ># This will break if the pom contains commented out tags:
> >#  foo<.groupId>
> >#  
> >#  bar
> >#  1.0
> >group=` grep --regexp '.*'
> > --max-count=1   $pom | sed
> > 's/[[:space:]]*<[^><]*>[[:space:]]*//g' `
> >artifact=` grep --regexp '.*'
> > --max-count=1   $pom |
> > sed 's/[[:space:]]*<[^><]*>[[:space:]]*//g' `
> >version=` grep --regexp '.*'
> > --max-count=1   $pom | sed
> > 's/[[:space:]]*<[^><]*>[[:space:]]*//g' `
> ># Now deploy the module
> >$MVN   deploy:deploy-file -DgroupId=$group \
> >   -DgeneratePom=false \
> >   -DpomFile=$pom \
> >   -DartifactId=$artifact \
> >   -Dversion=$version \
> >   -Dpackaging=jar \
> >   -Dfile=$jar \
> >   -DrepositoryId=local-repository \
> >   -Durl=file://$MAVEN_REPOSITORY
> >
> >   fi
> > done
> >
> > exit
> >
>
>
>

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


Re: including restlet in a maven project

2010-01-19 Thread Ben R Vesco
Also that referenced page might not reflect the new structure. You
won't find anything newer than M5 in the "old" groupId of org.restlet.
Instead, use the group id for the edition you are using such as
org.restlet.jse or org.restlet.j2e and so on. Then you can get the M6
and newer releases.


On Tue, Jan 19, 2010 at 1:15 PM, Rhett Sutphin
 wrote:
> Hi Marc,
>
> On Jan 19, 2010, at 3:13 PM, Marc Limotte wrote:
>
>> I need to use restlet in a project which is managed by Maven2.  I'm
>> not too familiar with Maven, but I think I need a POM file for
>> restlet, and I don't see one in the maven central repository.  Is
>> there a repo available with restlet (2.0-r6) in it?
>>
>> Alternatively, I thought I could add it to my local repo.  I found
>> this script (below) in the restlet mailing list archives, but it's
>> quite old and seems to depend on POM files coming with the restlet
>> distribution (under lib/poms), and there is no such directory in the
>> dist that I downloaded.
>>
>> What's the easiest way to do this?
>
> http://www.restlet.org/downloads/maven
>
> Rhett
>
>>
>> Marc
>>
>> > -Message d'origine-
>> > De : news [EMAIL PROTECTED] De la part de Vincent
>> > Envoyé : jeudi 18 janvier 2007 20:36
>> > À : discuss@restlet.tigris.org
>> > Objet : Script to install a Restlet distribution into a
>> > maven2 repository
>> >
>> > Hi all,
>> >
>> > I use this bash  script to upgrade my local maven2 repository
>> > each time a new version of Restlet comes up.
>> > Some of you might find it useful.
>> >
>> > -Vincent.
>> >
>> > #!/bin/bash
>> > #
>> > # This script installs a Restlet disrtribution  into a local
>> > (filesystem)
>> > # maven2 repository.
>> > #
>> > # Usage: restlet2mvn.bsh 
>> > > > repository>
>> > #
>> >
>> > if [ $# -le 1 ]; then
>> >    echo "Usage: restlet2mvn.bsh > > > > > maven repository>"
>> >    exit 1;
>> > fi
>> > RESTLET_DIST=$1
>> > MAVEN_REPOSITORY=$2
>> > MVN=mvn
>> >
>> > if [ ! -e $RESTLET_DIST ]
>> > then
>> >    echo "Restlet distribution not found: $RESTLET_DIST"
>> >    exit 1;
>> > fi
>> >
>> > if [ ! -e $MVN_REPO ]
>> > then
>> >    echo "Maven repository not found: $MVN_REPO"
>> >    exit 1;
>> > fi
>> >
>> > LIB_DIR=$RESTLET_DIST/lib
>> > POMS_DIR=$RESTLET_DIST/lib/poms
>> >
>> > poms=`ls $POMS_DIR/*.pom`
>> >
>> >
>> > for pom in $poms
>> > do
>> >  #  restlet/lib/poms/foo.pom -> restlet/lib/foo.jar
>> >  jar=`echo $pom | sed s/.pom$/.jar/g | sed s/poms\\\///g`
>> >  if [ -e $jar ]
>> >   then
>> >    # Extract the group, artifact id, and version number from the
>> POM:
>> >    # We assume that the first , ,
>> >  tags found in
>> > the pom
>> >    # contain the module's group id, artifact id, and version #.
>> >    # This will break if the pom contains commented out tags:
>> >    #      foo<.groupId>
>> >    #      
>> >    #      bar
>> >    #      1.0
>> >    group=` grep --regexp '.*'
>> > --max-count=1   $pom | sed
>> > 's/[[:space:]]*<[^><]*>[[:space:]]*//g' `
>> >    artifact=` grep --regexp '.*'
>> > --max-count=1   $pom |
>> > sed 's/[[:space:]]*<[^><]*>[[:space:]]*//g' `
>> >    version=` grep --regexp '.*'
>> > --max-count=1   $pom | sed
>> > 's/[[:space:]]*<[^><]*>[[:space:]]*//g' `
>> >    # Now deploy the module
>> >    $MVN   deploy:deploy-file -DgroupId=$group \
>> >           -DgeneratePom=false \
>> >           -DpomFile=$pom \
>> >           -DartifactId=$artifact \
>> >           -Dversion=$version \
>> >           -Dpackaging=jar \
>> >           -Dfile=$jar \
>> >           -DrepositoryId=local-repository \
>> >           -Durl=file://$MAVEN_REPOSITORY
>> >
>> >   fi
>> > done
>> >
>> > exit
>> >
>>
>>
>>
>
> --
> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2440449
>

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


Re: Equivalent of Restlet for C++

2010-01-19 Thread Ben Johnson
Hi Jerome

Not sure if this is what you're after, but I've tried Simple XML 
http://simple.sourceforge.net/ (XML only, not JSON) for an early prototype and 
it seemed to work ok - haven't tried it production though.  From memory you 
need to have a default constructor with no parameters for XML deserialization, 
e.g.

// Needed for deserialization
protected MyObject() {
// Whatever
}

I was following a builder pattern so did not intend to make the constructor 
public, it was accessed through a builder class, but the XML deserialization 
didn't work unless I defined the constructor.

Hope this helps
Ben



From: Jerome Louvel 
Sent: Friday, January 15, 2010 4:51 PM
To: discuss@restlet.tigris.org 
Subject: Equivalent of Restlet for C++


Hi all,

For a customer project, we have a need to provide a RESTful HTTP client and was 
wondering if anyone had experience to share and recommendations. 

Especially, are you aware of equivalents to XStream and Jackson to handle 
serialization/deserialization of XML/JSON?

I know about NanoGear, an effort to port Restlet to C++, but it doesn't look 
usable in production at this stage:
http://code.google.com/p/nanogear/

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

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

RE: Stack Overflow Error in firstSteps 2.0 m6 code?

2010-01-19 Thread webpost
Hey all,
I figured it out...

Like I said, I'm a bit of a Java n00b :D

So the cause of this was that I used the RESTlet J2EE edition with a J2SE 
project... I downloaded the SE version, fired it up in an SE stand alone app 
and it worked perfectly.  So if another poor Java newbie comes along searching 
for this answer tell them they are using the wrong edition lol.

Thanks

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


RE: Stack Overflow Error in firstSteps 2.0 m6 code?

2010-01-19 Thread webpost
Hey all,
Just a quick update... I was able to get the 1.1 engine up and running... still 
no go on 2.0 milestone 6... it appears to be in the registerHelpers method (it 
gets called recursively and the base case is never met).  

Any help with 2.0 would be much appreciated.  Thanks!

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


DirectoryServerResource doesn't correctly handle file names with more than one "."

2010-01-19 Thread webpost
Not sure if this is a bug or I'm doing something incorrectly. Here's the 
scenario:

* SpringBeanRouter with a Directory attached to it  (/resource linked to 
/home/user/resourceDirectory on filesystem)
* File named foo.bar.js located at /home/user/resourceDirectory/foo.bar.js
* Performing a GET on /resource/foo.bar.js results in a 404

After digging through code, I made the following change to 
DirectoryServerResource.java that seems to have fixed the bug for me. Proposed 
patch...

Index: 
modules/org.restlet/src/org/restlet/engine/local/DirectoryServerResource.java
===
--- 
modules/org.restlet/src/org/restlet/engine/local/DirectoryServerResource.java   
(revision 6055)
+++ 
modules/org.restlet/src/org/restlet/engine/local/DirectoryServerResource.java   
(working copy)
@@ -738,7 +738,7 @@
 baseEntryName = fullEntryName;
 
 // Remove the extensions from the base name
-firstDotIndex = fullEntryName.indexOf('.');
+firstDotIndex = fullEntryName.lastIndexOf('.');
 if (firstDotIndex != -1) {
 baseEntryName = fullEntryName.substring(0,
 firstDotIndex);

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