Re: How to use servlet connector?
Alex alexlam.hk at gmail.com writes: Hi, http://www.restlet.org/documentation/1.0/faq#02 Actually, i have followed the instruction above. However, there are a number of queries in mind: Why do we still need a main in a servlet container? Why still need a port in the main while the servlet container has already got one? What is the use of lib/javax.servlet_2.4/javax.servlet.jar and lib/javax.servlet_2.5/javax.servlet.jar? Any relationship with lib/com.noelios.restlet.ext.servlet_2.4.jar? Thanks. Yours, Alex
Etag Issue
Hi, This is an example file : // Prepare the request MediaType mediaWiki = new MediaType(text/x.socialtext-wiki); Request request = new Request(Method.GET, http://c-mambo.rd.francetelecom.fr/data/workspaces/test/pages/Titre2 https://parici.sopragroup.com/basicwebmail/exchweb/bin/redir.asp?URL=http://c-mambo.rd.francetelecom.fr/data/workspaces/test/pages/Titre2 ); ChallengeResponse challengeResponse = new ChallengeResponse(ChallengeScheme.HTTP_BASIC, [EMAIL PROTECTED], crte1234); request.setChallengeResponse(challengeResponse); request.getClientInfo().getAcceptedMediaTypes().add(new PreferenceMediaType(mediaWiki)); // Handle it using an HTTP client connector Client client = new Client(Protocol.HTTP); Response response = client.handle(request); // Write the response entity on the console try { response.getEntity().write(System.out); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } When clien.handle(request). I have an exception INFO: Error while handling an HTTP client call java.lang.IllegalArgumentException: Invalid tag format detected: 20070808090246 at org.restlet.data.Tag.parse(Tag.java:69) at com.noelios.restlet.http.HttpClientCall.getResponseEntity(HttpClientCall.java:279) at com.noelios.restlet.http.HttpClientConverter.commit(HttpClientConverter.java:110) at com.noelios.restlet.http.HttpClientHelper.handle(HttpClientHelper.java:86) at org.restlet.Client.handle(Client.java:110) at org.restlet.Uniform.handle(Uniform.java:97) On wireshark, i see my request send to the server GET /data/workspaces/test/pages/Titre2 HTTP/1.1 User-Agent: Noelios-Restlet-Engine/1.0.1 Accept: text/x.socialtext-wiki Authorization: Basic bGxlY2xlcmMyLmV4dEBvcmFuZ2UtZnRncm91cC5jb206Y3J0ZTEyMzQ= Host: c-mambo.rd.francetelecom.fr HTTP/1.1 200 OK Date: Wed, 08 Aug 2007 09:07:50 GMT Server: Apache/1.3.37 (Unix) mod_perl/1.30 Etag: 20070808090246 Last-modified: Wed, 08 Aug 2007 09:02:46 GMT Transfer-Encoding: chunked Content-Type: text/x.socialtext-wiki; charset=UTF-8 48 Test Test de commentaire _amendement ajout.. par {user: null} _ 0 So I think, i have a problem with Etag but i don't find any solution. Thanks
Re: Etag Issue
Hello, it seems that the Etag value must be surrounded with quotes such as : ETag: xyzzy (see the Http rfc n° 2616, chapter 14.19) Best regards, Thierry Boileau Hi, This is an example file : // Prepare the request MediaType mediaWiki = new MediaType(text/x.socialtext-wiki); Request request = new Request(Method.GET, _http://c-mambo.rd.francetelecom.fr/data/workspaces/test/pages/Titre2_ https://parici.sopragroup.com/basicwebmail/exchweb/bin/redir.asp?URL=http://c-mambo.rd.francetelecom.fr/data/workspaces/test/pages/Titre2); ChallengeResponse challengeResponse = new ChallengeResponse(ChallengeScheme.HTTP_BASIC, [EMAIL PROTECTED], crte1234); request.setChallengeResponse(challengeResponse); request.getClientInfo().getAcceptedMediaTypes().add(new PreferenceMediaType(mediaWiki)); // Handle it using an HTTP client connector Client client = new Client(Protocol.HTTP); Response response = client.handle(request); // Write the response entity on the console try { response.getEntity().write(System.out); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } When clien.handle(request). I have an exception INFO: Error while handling an HTTP client call java.lang.IllegalArgumentException: Invalid tag format detected: 20070808090246 at org.restlet.data.Tag.parse(Tag.java:69) at com.noelios.restlet.http.HttpClientCall.getResponseEntity(HttpClientCall.java:279) at com.noelios.restlet.http.HttpClientConverter.commit(HttpClientConverter.java:110) at com.noelios.restlet.http.HttpClientHelper.handle(HttpClientHelper.java:86) at org.restlet.Client.handle(Client.java:110) at org.restlet.Uniform.handle(Uniform.java:97) On wireshark, i see my request send to the server GET /data/workspaces/test/pages/Titre2 HTTP/1.1 User-Agent: Noelios-Restlet-Engine/1.0.1 Accept: text/x.socialtext-wiki Authorization: Basic bGxlY2xlcmMyLmV4dEBvcmFuZ2UtZnRncm91cC5jb206Y3J0ZTEyMzQ= Host: c-mambo.rd.francetelecom.fr HTTP/1.1 200 OK Date: Wed, 08 Aug 2007 09:07:50 GMT Server: Apache/1.3.37 (Unix) mod_perl/1.30 Etag: 20070808090246 Last-modified: Wed, 08 Aug 2007 09:02:46 GMT Transfer-Encoding: chunked Content-Type: text/x.socialtext-wiki; charset=UTF-8 48 Test Test de commentaire _amendement ajout.. par {user: null} _ 0 So I think, i have a problem with Etag but i don't find any solution. Thanks
RE: How to use servlet connector?
Hi Alex, You don't need a main method anymore nor a Component. Just your Application subclass is necessary for the Servlet adapter. The dependency on Servlet API isn't necessary as the Servlet container will have its own copy. It is only useful for the Jetty connector which needs it. Best regards, Jerome -Message d'origine- De : news [mailto:[EMAIL PROTECTED] De la part de Alex Envoyé : mercredi 8 août 2007 12:51 À : discuss@restlet.tigris.org Objet : Re: How to use servlet connector? Alex alexlam.hk at gmail.com writes: Hi, http://www.restlet.org/documentation/1.0/faq#02 Actually, i have followed the instruction above. However, there are a number of queries in mind: Why do we still need a main in a servlet container? Why still need a port in the main while the servlet container has already got one? What is the use of lib/javax.servlet_2.4/javax.servlet.jar and lib/javax.servlet_2.5/javax.servlet.jar? Any relationship with lib/com.noelios.restlet.ext.servlet_2.4.jar? Thanks. Yours, Alex