Re: ConcurrentModificationException from Resource

2010-02-24 Thread Ruben Hernando
the resource has just one Variant:

getVariants().add(new Variant(MediaType.APPLICATION_XML));


thanks, 
Rubén Hernando



Thierry Boileau thierry.boil...@noelios.com 
22/02/2010 17:25
Por favor, responda a
discuss discuss@restlet.tigris.org


Para
discuss@restlet.tigris.org
cc

Asunto
Re: ConcurrentModificationException from Resource






Hello Ruben,

could you tell us how you define the resource's list of variants?

Best regards,
Thierry Boileau

Hi,
We tried with different versions of restlet (1.1-M1, 1.2-M1, 1.1.8) and we 
are having the same problem.
we have a Resource. it make some access to a database.
when it has severall calls at same time, one or more of them fails and 
throw an exception. We think it happens before entering into the Resource 
class, so we think it can be a bug.
Here is the Stack trace

 GRAVE: Unhandled exception or error intercepted
java.util.ConcurrentModificationException
 at 
java.util.AbstractList$Itr.checkForComodification(AbstractList.java:372)
 at java.util.AbstractList$Itr.next(AbstractList.java:343)
 at 
com.noelios.restlet.Engine.getPreferredVariant(Engine.java:704)
 at 
org.restlet.data.ClientInfo.getPreferredVariant(ClientInfo.java:463)
 at 
org.restlet.resource.Resource.getPreferredVariant(Resource.java:270)
 at 
org.restlet.resource.Resource.handleGet(Resource.java:439)
 at org.restlet.Finder.handle(Finder.java:353)
 at org.restlet.Filter.doHandle(Filter.java:150)
 at org.restlet.Filter.handle(Filter.java:195)
 at org.restlet.Router.handle(Router.java:504)
 at org.restlet.Filter.doHandle(Filter.java:150)
 at org.restlet.Filter.handle(Filter.java:195)
 at org.restlet.Router.handle(Router.java:504)
 at org.restlet.Filter.doHandle(Filter.java:150)
 at org.restlet.Filter.handle(Filter.java:195)
 at org.restlet.Router.handle(Router.java:504)
 at org.restlet.Filter.doHandle(Filter.java:150)
 at 
com.noelios.restlet.StatusFilter.doHandle(StatusFilter.java:130)
 at org.restlet.Filter.handle(Filter.java:195)
 at org.restlet.Filter.doHandle(Filter.java:150)
 at org.restlet.Filter.handle(Filter.java:195)
 at 
com.noelios.restlet.ChainHelper.handle(ChainHelper.java:124)
 at org.restlet.Component.handle(Component.java:673)
 at org.restlet.Server.handle(Server.java:331)
 at 
com.noelios.restlet.ServerHelper.handle(ServerHelper.java:68)
 at 
com.noelios.restlet.http.HttpServerHelper.handle(HttpServerHelper.java:147)
 at 
com.noelios.restlet.ext.servlet.ServerServlet.service(ServerServlet.java:881)
 at 
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
 at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
 at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
 at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
 at 
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
 at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
 at 
org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
 at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
 at 
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
 at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
 at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
 at 
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
 at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
 at 
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
 at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
 at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
 at 
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
 at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
 at 
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
 at 
org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
 at 

Re: How to write an Universal redirector

2010-02-24 Thread Thierry Boileau
Hello,

actually, the second parameter in the Redirector constructor is a 
template using a set of known variables (see [0]).
You should be able to use the shipped Redirector, as follow (or 
something similar)
new Redirector(getContext(), 
http://192.168.100.1:8080/RESTfulServices{rr};, 
Redirector.MODE_CLIENT_DISPATCHER));

Don't forget to declare the client HTTP connector on the component (such 
redirection is seen as a new client call issued by the Component). This 
is done in the web.xml file see ([1])

  servlet
  [...]
  init-param
  param-nameorg.restlet.clients/param-name
  param-valueHTTP/param-value
  /init-param
  [...]
  /servlet

[0] 
http://www.restlet.org/documentation/2.0/jse/api/org/restlet/util/Resolver.html
[1] 
http://www.restlet.org/documentation/2.0/jee/ext/org/restlet/ext/servlet/ServerServlet.html

Best regards,
Thierry Boileau

 Hello everybody,

 Could please anyone help me to write a universal redirector to match 
 all requests and to redirected them to a remote host?
 Example:
 Start:   /redirect/RESTfulServices/resources/customers/pkey/2176172632
 Finish:  
 http://192.168.100.1:8080/RESTfulServices/resources/customers/pkey/2176172632


 GWT Client side:
 ClientResource r = new 
 ClientResource(/redirect/RESTfulServices/resources/customers/pkey/2176172632);


 Server side class TestRestletApplication extends Application (my 
 web.xml was changed to forward all /redirect/* requests to 
 TestRestletApplication)
 Router router = new Router(getContext());
 router.attach(/RESTfulServices, new MyRedirector(getContext(), null));  
 //-- this is wrong

 and MyRedirector class:
 public class MyRedirector extends Redirector {

  public MyRedirector(Context context, String targetTemplate) {
  // By default, the mode is MODE_CLIENT_DISPATCHER
  super(context, targetTemplate);
  }

  @Override
  protected Reference getTargetRef(Request request, Response response) {
  Reference ref = request.getResourceRef();
  ref.setHostDomain(192.168.100.1);
  ref.setHostPort(8080);
  //-- here is missing something
  return ref;
  }
 }
 Thank you for helping me.

 ab
 
 View this message in context: How to write an Universal redirector 
 http://n2.nabble.com/How-to-write-an-Universal-redirector-tp4620578p4620578.html
 Sent from the Restlet Discuss mailing list archive 
 http://n2.nabble.com/Restlet-Discuss-f1400322.html at Nabble.com.

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

Re: How to write an Universal redirector

2010-02-24 Thread asdfasdf
Hallo Thierry,


After I have changed the mode to Redirector.MODE_SERVER_DISPATCHER my
createInboundRoot method looks like this:
@Override
public synchronized Restlet createInboundRoot() {

Router router = new Router(getContext());
router.setDefaultMatchingMode(Template.MODE_STARTS_WITH);
router.attach(/RESTfulServices, new Redirector(getContext(),
http://localhost:8080/RESTfulServices{rr};,
Redirector.MODE_SERVER_DISPATCHER));
return router;

}


but I still receive no answer. My std output looks like this:

24.02.2010 10:51:00 org.restlet.engine.http.connector.HttpClientHelper start
INFO: Starting the default HTTP client
24.02.2010 10:51:00 org.restlet.routing.Redirector handle
INFO: Redirecting via server dispatcher to:
http://localhost:8080/RESTfulServices/resources/customers/pkey/2176172632
24.02.2010 10:51:00 org.restlet.engine.log.LogFilter afterHandle
INFO: 2010-02-2410:51:00127.0.0.1   -   127.0.0.1   
GET
/RESTfulServices/resources/customers/pkey/2176172632-   404 363 
-   16
http://127.0.0.1:   Restlet-Framework/2.0snapshot
http://127.0.0.1:/testrestlet/hosted.html?testrestlet
[WARN] 404 - GET
/redirect/RESTfulServices/resources/customers/pkey/2176172632 (127.0.0.1)
363 bytes
   Request headers
  Host: 127.0.0.1:
  User-Agent: Restlet-Framework/2.0snapshot
  Accept: */*
  Accept-Language: de-de,de;q=0.8,en-us;q=0.5,en;q=0.3
  Accept-Encoding: gzip,deflate
  Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
  Keep-Alive: 115
  Connection: keep-alive
  Referer: http://127.0.0.1:/testrestlet/hosted.html?testrestlet
   Response headers
  Content-Type: text/html; charset=ISO-8859-1
  Date: Wed, 24 Feb 2010 09:51:00 GMT
  Accept-Ranges: bytes
  Server: Restlet-Framework/2.0m7
  Content-Length: 363



and my Firefox shows 404 with message The server has not found anything
matching the request URI.


May be this will help you helping me ;)


Thank you again,


ab
-- 
View this message in context: 
http://n2.nabble.com/How-to-write-an-Universal-redirector-tp4620578p4624772.html
Sent from the Restlet Discuss mailing list archive at Nabble.com.

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

Re: How to write an Universal redirector

2010-02-24 Thread asdfasdf
Hi Thierry,


thank you for your help.


It seems, that the redirection works now, but in my GWT application I can
not see any correct answer. Firefox/Firebug sais:
Request header:
GET /redirect/RESTfulServices/resources/customers/pkey/2176172632 HTTP/1.1
Host: 127.0.0.1:
User-Agent: Restlet-Framework/2.0snapshot
Accept: */*
Accept-Language: de-de,de;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
Connection: keep-alive
Referer: http://127.0.0.1:/testrestlet/hosted.html?testrestlet



Answer header:
HTTP/1.1 400 Bad Request
Content-Location:
http://localhost:8080/RESTfulServices/resources/customers/pkey/2176172632
Date: Wed, 24 Feb 2010 09:10:34 GMT
Accept-Ranges: bytes
Server: Apache-Coyote/1.1
Transfer-Encoding: chunked


When I open the
http://localhost:8080/RESTfulServices/resources/customers/pkey/2176172632 in
a separate Firefox window, a correct answer is returned... (Is it because of
the same origin policy?) It seems that this URL is called from the browser
and not tunneled through the server...


Thanks,


ab
-- 
View this message in context: 
http://n2.nabble.com/How-to-write-an-Universal-redirector-tp4620578p4624601.html
Sent from the Restlet Discuss mailing list archive at Nabble.com.

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

Re: How to write an Universal redirector

2010-02-24 Thread Thierry Boileau
Guten Tag ab,

you should keep the MODE_CLIENT_DISPATCHER mode.
Could you trace the sent requests/response with wireshark, for example? 
Or let netcat listen on the 8080 (instead of your real server) port as 
follow :

$nc -l -p 8080

It will show you the request that arrives from the server listening on 
port .

Best regards,
Thierry Boileau


 Hallo Thierry,

 After I have changed the mode to Redirector.*MODE_SERVER_DISPATCHER* 
 my createInboundRoot method looks like this:
 @Override
 public synchronized Restlet createInboundRoot() {

   Router router = new Router(getContext());
   router.setDefaultMatchingMode(Template.MODE_STARTS_WITH);
   router.attach(/RESTfulServices, new Redirector(getContext(),
   http://localhost:8080/RESTfulServices{rr};, 
 Redirector.MODE_SERVER_DISPATCHER));
   return router;

 }
 but I still receive no answer. My std output looks like this:

 24.02.2010 10:51:00 org.restlet.engine.http.connector.HttpClientHelper start
 INFO: Starting the default HTTP client
 24.02.2010 10:51:00 org.restlet.routing.Redirector handle
 INFO: Redirecting via server dispatcher to: 
 http://localhost:8080/RESTfulServices/resources/customers/pkey/2176172632
 24.02.2010 10:51:00 org.restlet.engine.log.LogFilter afterHandle
 INFO: 2010-02-24  10:51:00127.0.0.1   -   127.0.0.1   
 GET /RESTfulServices/resources/customers/pkey/2176172632- 
   404 363 -   16  http://127.0.0.1:   
 Restlet-Framework/2.0snapshot   
 http://127.0.0.1:/testrestlet/hosted.html?testrestlet
 [WARN] 404 - GET 
 /redirect/RESTfulServices/resources/customers/pkey/2176172632 (127.0.0.1) 363 
 bytes
 Request headers
Host: 127.0.0.1:
User-Agent: Restlet-Framework/2.0snapshot
Accept: */*
Accept-Language: de-de,de;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
Connection: keep-alive
Referer: http://127.0.0.1:/testrestlet/hosted.html?testrestlet
 Response headers
Content-Type: text/html; charset=ISO-8859-1
Date: Wed, 24 Feb 2010 09:51:00 GMT
Accept-Ranges: bytes
Server: Restlet-Framework/2.0m7
Content-Length: 363


 and my Firefox shows 404 with message The server has not found 
 anything matching the request URI.

 May be this will help you helping me ;)

 Thank you again,

 ab
 
 View this message in context: Re: How to write an Universal redirector 
 http://n2.nabble.com/How-to-write-an-Universal-redirector-tp4620578p4624772.html
 Sent from the Restlet Discuss mailing list archive 
 http://n2.nabble.com/Restlet-Discuss-f1400322.html at Nabble.com.

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

Re: How to write an Universal redirector

2010-02-24 Thread asdfasdf
Hi Thierry,


With WireShark I am not able to listen on the localhost communication but
here is the NetCat output:


D:\Programme\NCatncat -l -p 8080
GET /RESTfulServices/resources/customers/pkey/2176172632 HTTP/1.1
Transfer-Encoding: chunked
Date: Wed, 24 Feb 2010 13:19:10 GMT
Accept: */*
Accept-Charset: ISO-8859-1, UTF-8;q=0.7, *;q=0.7
Accept-Encoding: gzip, deflate
Accept-Language: de-de, de;q=0.8, en-us;q=0.5, en;q=0.3
Referer: http://127.0.0.1:/testrestlet/hosted.html?testrestlet
User-Agent: Restlet-Framework/2.0snapshot
Cookie:
http%3A%2F%2F127.0.0.1%3A%2Feintragspflege%2Ftheme=%7B%22state%22%3A%7B%22id%22%3A%22s%3Ablue%22%2C%20%22file%22%3A%22s%3Agxt-all.css%22%7D%7D

0

^C
D:\Programme\NCat

I have set up my RESTfulServices on another machine and I can send you the
WireShark communication if it might help… 


Gruß, Cheers,


ab

Thierry Boileau wrote:
 
 Guten Tag ab,

 

 you should keep the MODE_CLIENT_DISPATCHER mode.

 Could you trace the sent requests/response with wireshark, for example?
 
 Or let netcat listen on the 8080 (instead of your real server) port as
 follow :

 

 $nc -l -p 8080

 

 It will show you the request that arrives from the server listening on
 port .

 

 Best regards,

 Thierry Boileau
 

-- 
View this message in context: 
http://n2.nabble.com/How-to-write-an-Universal-redirector-tp4620578p4625967.html
Sent from the Restlet Discuss mailing list archive at Nabble.com.

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

RE: Re:Access to HttpSession from Restlet ...

2010-02-24 Thread Stephan Koops
Hi Stefan,

why do you want to access the session id? The architectural style REST forbid 
server session state.
If you want to comply to the REST architecture, than you must not use it. Or do 
you want explicit ignore this restriction?

best regards
   Stephan

-Ursprüngliche Nachricht-
Von: Stefan Meissner 
Gesendet: 24.02.2010 17:10:42
An: discuss@restlet.tigris.org
Betreff: RE: Re:Access to HttpSession from Restlet ...

OK, does the same constraint apply for SSL sessions? 
Is it possible to get the SSL session IDs using Simple HTTPS server connector?

Can the SSLSessionContext IDs be used in the same way as in servlet API like 
this:

String sslID = 
(String)request.getAttribute(javax.servlet.request.ssl_session);

What I did so far:

Server server = component.getServers().add(Protocol.HTTPS, 8183);
SeriesParameter param = server.getContext().getParameters();

param.add(keystorePath, ./mySrvKeystore);
param.add(keystorePassword, 123456);
   
HttpsServerHelper helper = new HttpsServerHelper(server);
   
SSLContext sslContext;
try {
   helper.start();
   sslContext = helper.getSslContext();

Enumeration sessionIDs = sslcontext.getServerSessionContext().getIds();

component.getDefaultHost().attach(new FilterApplication(sslContext));
   
// Start the component.
component.start();
   
} catch (Exception e) {
   e.printStackTrace();
}

I also called the getIds() method inside the FilterApplication (beforeHandle), 
but in most of the cases there is no session ID present upon request. And if 
there is one ID it contains weird characters such as the follwing 
session ID: K?7?%?[?s?#1GGb?2???^?a??

I've tried several charsets using:
String sID = new String(id,UTF-8);
but I never get a better representation of the ID.

Can someone please give me a clue what I'm doing wrong.

Best regards
Stefan
___
WEB.DE DSL: Internet, Telefon und Entertainment für nur 19,99 EUR/mtl.!
http://produkte.web.de/go/02/

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


RE: Re:Access to HttpSession from Restlet ...

2010-02-24 Thread Stefan Meissner
OK, does the same constraint apply for SSL sessions? 
Is it possible to get the SSL session IDs using Simple HTTPS server connector?

Can the SSLSessionContext IDs be used in the same way as in servlet API like 
this:

String sslID = 
(String)request.getAttribute(javax.servlet.request.ssl_session);

What I did so far:

Server server = component.getServers().add(Protocol.HTTPS, 8183);
SeriesParameter param = server.getContext().getParameters();

param.add(keystorePath, ./mySrvKeystore);
param.add(keystorePassword, 123456);

HttpsServerHelper helper = new HttpsServerHelper(server);

SSLContext sslContext;
try {
helper.start();
sslContext = helper.getSslContext();

Enumerationbyte[] sessionIDs = sslcontext.getServerSessionContext().getIds();

component.getDefaultHost().attach(new FilterApplication(sslContext));

// Start the component.
component.start();

} catch (Exception e) {
e.printStackTrace();
}

I also called the getIds() method inside the FilterApplication (beforeHandle), 
but in most of the cases there is no session ID present upon request. And if 
there is one ID it contains weird characters such as the follwing 
session ID: K?7?%?[?s?#1GGb?2???^?a??

I've tried several charsets using:
String sID = new String(id,UTF-8);
but I never get a better representation of the ID.

Can someone please give me a clue what I'm doing wrong.

Best regards
Stefan

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


RE: Re:Access to HttpSession from Restlet ...

2010-02-24 Thread webpost
Is it possible to get the SSL session IDs using Simple HTTPS server connector?

Can the SSLSessionContext IDs be used in the same way as in servlet API like 
this:

String sslID = 
(String)request.getAttribute(javax.servlet.request.ssl_session);

What I did so far:

Server server = component.getServers().add(Protocol.HTTPS, 8183);
SeriesParameter param = server.getContext().getParameters();

param.add(keystorePath, ./mySrvKeystore);
param.add(keystorePassword, 123456);

HttpsServerHelper helper = new HttpsServerHelper(server);

SSLContext sslContext;
try {
helper.start();
sslContext = helper.getSslContext();

Enumerationbyte[] sessionIDs = sslcontext.getServerSessionContext().getIds();

component.getDefaultHost().attach(new FilterApplication(sslContext));

// Start the component.
component.start();

} catch (Exception e) {
e.printStackTrace();
}

I also called the getIds() method inside the FilterApplication (beforeHandle), 
but in most of the cases there is no session ID present upon request. And if 
there is one ID it contains weird characters such as the follwing 
session ID: K?7?%?[?s?#1GGb?2???^?a??

I've tried several charsets using:
String sID = new String(id,UTF-8);
but I never get a better representation of the ID.

Can someone please give me a clue what I'm doing wrong.

Best regards
Stefan

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


Re: Object serialization problem with gwt

2010-02-24 Thread Thierry Boileau
Hello Xavier,

thanks a lot for your report. This helped fixing a bug that avoids a 
correct behavior when the annotated interface declares only a GET 
method...
Unfortunately, it took a huge to understand there was a problem.

Best regards,
Thierry Boileau

 Hi Kevin,
 Thanks for the pointer ; unfortunately I've still the same pb... In my 
 previous post there are source codes, and her the libs I use (latest 
 snapshot)
 server side web-inf/lib :
 /testGwtRestlet-server/war/WEB-INF/lib/gwt-dev.jar
 /testGwtRestlet-server/war/WEB-INF/lib/gwt-servlet.jar
 /testGwtRestlet-server/war/WEB-INF/lib/gwt-user.jar
 /testGwtRestlet-server/war/WEB-INF/lib/org.json.jar
 /testGwtRestlet-server/war/WEB-INF/lib/org.restlet.ext.crypto.jar
 /testGwtRestlet-server/war/WEB-INF/lib/org.restlet.ext.gwt.jar
 /testGwtRestlet-server/war/WEB-INF/lib/org.restlet.ext.json.jar
 /testGwtRestlet-server/war/WEB-INF/lib/org.restlet.ext.servlet.jar
 /testGwtRestlet-server/war/WEB-INF/lib/org.restlet.ext.xml.jar
 /testGwtRestlet-server/war/WEB-INF/lib/org.restlet.ext.xstream.jar
 /testGwtRestlet-server/war/WEB-INF/lib/org.restlet.jar

 Server side lib :
 /testGwtRestlet-server/lib/gwt-dev.jar
 /testGwtRestlet-server/lib/gwt-user.jar
 /testGwtRestlet-server/lib/org.json.jar
 /testGwtRestlet-server/lib/org.restlet.ext.json.jar
 /testGwtRestlet-server/lib/org.restlet.ext.xml.jar
 /testGwtRestlet-server/lib/org.restlet.jar
 Client side web_inf lib :

 Client side web-inf lib :
 /testGwtRestlet/war/WEB-INF/lib/gwt-dev.jar
 /testGwtRestlet/war/WEB-INF/lib/gwt-servlet.jar
 /testGwtRestlet/war/WEB-INF/lib/gwt-user.jar
 /testGwtRestlet/war/WEB-INF/lib/org.restlet.ext.gwt.jar
 /testGwtRestlet/war/WEB-INF/lib/org.restlet.ext.servlet.jar

 Client side lib :
 /testGwtRestlet/lib/gwt-dev.jar
 /testGwtRestlet/lib/gwt-user.jar
 /testGwtRestlet/lib/org.restlet.ext.json.jar
 /testGwtRestlet/lib/org.restlet.ext.xml.jar
 /testGwtRestlet/lib/org.restlet.jar

 any clue?
 regards
 Xavier

 2010/1/28 Kevin Daly ked...@sqm.ca mailto:ked...@sqm.ca

 We're using the latest snapshot and having pretty good success,
 with a few exceptions.

 To do this see

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

 The last post will give you some insight on how to set this up.

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



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

Re: Object serialization problem with gwt

2010-02-24 Thread Thierry Boileau
Hi Xavier,

please note also that the objects to be serialized need a constructor 
without parameter.

Best regards,
Thierry Boileau

 Hi Kevin,
 Thanks for the pointer ; unfortunately I've still the same pb... In my 
 previous post there are source codes, and her the libs I use (latest 
 snapshot)
 server side web-inf/lib :
 /testGwtRestlet-server/war/WEB-INF/lib/gwt-dev.jar
 /testGwtRestlet-server/war/WEB-INF/lib/gwt-servlet.jar
 /testGwtRestlet-server/war/WEB-INF/lib/gwt-user.jar
 /testGwtRestlet-server/war/WEB-INF/lib/org.json.jar
 /testGwtRestlet-server/war/WEB-INF/lib/org.restlet.ext.crypto.jar
 /testGwtRestlet-server/war/WEB-INF/lib/org.restlet.ext.gwt.jar
 /testGwtRestlet-server/war/WEB-INF/lib/org.restlet.ext.json.jar
 /testGwtRestlet-server/war/WEB-INF/lib/org.restlet.ext.servlet.jar
 /testGwtRestlet-server/war/WEB-INF/lib/org.restlet.ext.xml.jar
 /testGwtRestlet-server/war/WEB-INF/lib/org.restlet.ext.xstream.jar
 /testGwtRestlet-server/war/WEB-INF/lib/org.restlet.jar

 Server side lib :
 /testGwtRestlet-server/lib/gwt-dev.jar
 /testGwtRestlet-server/lib/gwt-user.jar
 /testGwtRestlet-server/lib/org.json.jar
 /testGwtRestlet-server/lib/org.restlet.ext.json.jar
 /testGwtRestlet-server/lib/org.restlet.ext.xml.jar
 /testGwtRestlet-server/lib/org.restlet.jar
 Client side web_inf lib :

 Client side web-inf lib :
 /testGwtRestlet/war/WEB-INF/lib/gwt-dev.jar
 /testGwtRestlet/war/WEB-INF/lib/gwt-servlet.jar
 /testGwtRestlet/war/WEB-INF/lib/gwt-user.jar
 /testGwtRestlet/war/WEB-INF/lib/org.restlet.ext.gwt.jar
 /testGwtRestlet/war/WEB-INF/lib/org.restlet.ext.servlet.jar

 Client side lib :
 /testGwtRestlet/lib/gwt-dev.jar
 /testGwtRestlet/lib/gwt-user.jar
 /testGwtRestlet/lib/org.restlet.ext.json.jar
 /testGwtRestlet/lib/org.restlet.ext.xml.jar
 /testGwtRestlet/lib/org.restlet.jar

 any clue?
 regards
 Xavier

 2010/1/28 Kevin Daly ked...@sqm.ca mailto:ked...@sqm.ca

 We're using the latest snapshot and having pretty good success,
 with a few exceptions.

 To do this see

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

 The last post will give you some insight on how to set this up.

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



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

Re: Access to HttpSession from Restlet ...

2010-02-24 Thread Stephan Koops
Hi Stefan,

but that doesn't hinder you to use Restlet.
I'm just implementing a SOAP Web Service on top of Restlet, also if it 
is not the idea behind it, just because it's easy to use with HTTP.

best regards
   Stephan

best regards
  Stephan

Stefan Meissner schrieb:
 Hi Stephan,

 the use of SSL ID is required in the project I am working on. But as you 
 said, REST might be not the right choice for the implementation then.

 thanks for your reply
 Stefan


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


Re: Starting/stopping restlets

2010-02-24 Thread Stephan Koops
Hi Tal,

you could do some initialization and finalization work in your own Restlets.

best regards
   Stephan

Tal Liron schrieb:
 This is a basic attribute of any Restlet, but it seems like nowhere in 
 the framework is it used.

 My expectation was that routers, filters, etc., would not pass requests 
 on to a stopped target restlet. However, it seems that stopping restlets 
 has no effect.

 Is this by design? In which case, what is the purpose of starting/stopping?

 -Tal

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


Re: Access to HttpSession from Restlet ...

2010-02-24 Thread Bruno Harbulot
Hi,

It currently isn't possible to retrieve the SSL session ID (in the same 
way as it's possible to retrieve the cipher suite or the client 
certificates from the Restlet Request.
It could make sense to implement this, and I wouldn't mind contributing 
a patch to do so. Feel free to put an RFE in the issue tracker.

However, the SSL sessions have nothing to do with the Servlet's session 
(and they're unlikely to be suitable as a replacement for such sessions 
anyway). It would be interesting to see your particular use-case.

(As Stefan was saying, if you're using sessions to maintain state 
between requests, REST and Restlet are probably not the right tool for 
your project, although sometimes cookies are a necessary compromise for 
storing authentication tokens, even with REST services.)



On 24/02/2010 16:10, Stefan Meissner wrote:
 OK, does the same constraint apply for SSL sessions?
 Is it possible to get the SSL session IDs using Simple HTTPS server connector?

 Can the SSLSessionContext IDs be used in the same way as in servlet API like 
 this:

 String sslID = 
 (String)request.getAttribute(javax.servlet.request.ssl_session);

 What I did so far:

 Server server = component.getServers().add(Protocol.HTTPS, 8183);
 SeriesParameter  param = server.getContext().getParameters();

 param.add(keystorePath, ./mySrvKeystore);
 param.add(keystorePassword, 123456);
   
 HttpsServerHelper helper = new HttpsServerHelper(server);
   
 SSLContext sslContext;
 try {
   helper.start();
   sslContext = helper.getSslContext();

 Enumerationbyte[]  sessionIDs = 
 sslcontext.getServerSessionContext().getIds();

 component.getDefaultHost().attach(new FilterApplication(sslContext));
   
 // Start the component.
 component.start();
   
 } catch (Exception e) {
   e.printStackTrace();
 }

 I also called the getIds() method inside the FilterApplication 
 (beforeHandle), but in most of the cases there is no session ID present upon 
 request. And if there is one ID it contains weird characters such as the 
 follwing
 session ID: K?7?%?[?s?#1GGb?2???^?a??

 I've tried several charsets using:
 String sID = new String(id,UTF-8);
 but I never get a better representation of the ID.


I'd guess what you get is an enumeration of byte arrays, not Strings. An 
hexadecimal serialisation into string would probably be more 
appropriate. This being said, you won't necessarily get the right ID 
from this enumeration if there's more than one. Passing the SSLContext 
to your resources doesn't sound like good design either (again, it 
depends on what you do).



Best wishes,

Bruno.

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


Re: Starting/stopping restlets

2010-02-24 Thread Tal Liron
True.

So, I guess the only way to remove turn off routes/restlets is to detach
them?

On Wed, Feb 24, 2010 at 2:33 PM, Stephan Koops stephan.ko...@web.de wrote:

 Hi Tal,

 you could do some initialization and finalization work in your own
 Restlets.

 best regards
   Stephan

 Tal Liron schrieb:
  This is a basic attribute of any Restlet, but it seems like nowhere in
  the framework is it used.
 
  My expectation was that routers, filters, etc., would not pass requests
  on to a stopped target restlet. However, it seems that stopping restlets
  has no effect.
 
  Is this by design? In which case, what is the purpose of
 starting/stopping?
 
  -Tal

 --

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


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

RE: Re: Matlab With Restlet

2010-02-24 Thread webpost
hi Thierry 

  Sorry for late reply for ur post.Actually i have found the reason for the 
behaviour.The problem was in my code in matlab.Im really sorry for taking up ur 
time but without ur help i would not have found the problem in side matlab 
code.Im really thankful for your support.(i guess u can also cancel the bug 
created for the issue).

The problem was from the matlab i was passing invaild scheme name.But client 
was getting created with out any errors
for eg.client(Protocol.HTTP).Thats the reason why i was getting a negative 
return from containAll().
Because of my in experience with the api i had feeling that it would give an 
error when i pass a invalid scheme name as string to the constructor for 
creating the client.

Thanks a lot for helping me out.Any how im using the API so if i have any more 
doubts i will get back to u.

regards
Rashik.T

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


RE: Re:Access to HttpSession from Restlet ...

2010-02-24 Thread Stefan Meissner
Hi Stephan,

the use of SSL ID is required in the project I am working on. But as you said, 
REST might be not the right choice for the implementation then.

thanks for your reply
Stefan

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


firstResource tutorial: item put vs. items post

2010-02-24 Thread Daniel Rocco
hello everyone,

I'm a new user working through the Restlet tutorials (Restlet 2.0m7, 
java 1.6, running standalone (no servlet container) from eclipse). So 
far I'm enjoying using Restlet, which seems very straightforward, 
especially compared to other java web technologies.

 From the firstResource tutorial, I'm trying to understand the 
distinction between creating a new item via PUT (ItemResource) vs. POST 
(ItemsResource). The two methods appear to do the same thing—create a 
new Item—with the only distinction being that apparently PUT updates an 
existing item if found whereas the POST implementation complains if you 
try to change or re-add an existing item.

What is the rationale for this apparent duplication?

Thanks in advance,
dan

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


Re: Matlab With Restlet

2010-02-24 Thread Thierry Boileau
Hello Rashik,

no problems.

bye,
Thierry

 hi Thierry

Sorry for late reply for ur post.Actually i have found the reason for 
 the behaviour.The problem was in my code in matlab.Im really sorry for taking 
 up ur time but without ur help i would not have found the problem in side 
 matlab code.Im really thankful for your support.(i guess u can also cancel 
 the bug created for the issue).

 The problem was from the matlab i was passing invaild scheme name.But client 
 was getting created with out any errors
 for eg.client(Protocol.HTTP).Thats the reason why i was getting a negative 
 return from containAll().
 Because of my in experience with the api i had feeling that it would give an 
 error when i pass a invalid scheme name as string to the constructor for 
 creating the client.

 Thanks a lot for helping me out.Any how im using the API so if i have any 
 more doubts i will get back to u.

 regards
 Rashik.T

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



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

Re: firstResource tutorial: item put vs. items post

2010-02-24 Thread Thierry Boileau
Hello Daniel,

apparently PUT updates an existing item if found

yes, and it creates it if not found. One important condition is that you 
know (by advance, if the resource does not exist yet) the resource's 
identifier (its URI).

POST is a more generalist operation that allows the target resource to 
act on its own state (if it exists...). It is used, for example, to 
create a resource when you don't know by advance its URI. By convention, 
you send a POST request to an container resource (such as items), 
and in return, you can get the URI of the created resource (if the 
container validates the request).

I hope this makes the things clearer.

Best regards,
Thierry Boileau

 hello everyone,

 I'm a new user working through the Restlet tutorials (Restlet 2.0m7,
 java 1.6, running standalone (no servlet container) from eclipse). So
 far I'm enjoying using Restlet, which seems very straightforward,
 especially compared to other java web technologies.

   From the firstResource tutorial, I'm trying to understand the
 distinction between creating a new item via PUT (ItemResource) vs. POST
 (ItemsResource). The two methods appear to do the same thingâEURcreate a
 new ItemâEURwith the only distinction being that apparently PUT updates an
 existing item if found whereas the POST implementation complains if you
 try to change or re-add an existing item.

 What is the rationale for this apparent duplication?

 Thanks in advance,
 dan

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



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