Thanks Bruno, I've applied your patch in both 1.1 branch and SVN trunk.

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 Bruno Harbulot
Envoyé : jeudi 18 juin 2009 19:00
À : discuss@restlet.tigris.org
Objet : Re: Relative URI in GWT Restlet

Hello,

I'm having the very same problem (regarding relative URIs).

I think I've traced the problem: it's a client-side issue, and an 
exception is currently thrown if the URI doesn't start with "http". I'd 
like to suggest the following patch to allow for relative URIs too:


diff --git 
a/modules/org.restlet.gwt/src/org/restlet/gwt/engine/http/GwtHttpClientCall.java
 
b/modules/org.restlet.gwt/src/org/restlet/gwt/engine/http/GwtHttpClientCall.java
index 7fd564d..8876e79 100644
--- 
a/modules/org.restlet.gwt/src/org/restlet/gwt/engine/http/GwtHttpClientCall.java
+++ 
b/modules/org.restlet.gwt/src/org/restlet/gwt/engine/http/GwtHttpClientCall.java
@@ -86,7 +86,9 @@ public class GwtHttpClientCall extends HttpClientCall {
              String requestUri, boolean hasEntity) {
          super(helper, method, requestUri);

-        if (requestUri.startsWith("http")) {
+        Reference requestRef = new Reference(requestUri);
+        if (requestRef.isRelative()
+                || requestRef.getScheme().startsWith("http")) {
              this.requestBuilder = new RequestBuilder(method, requestUri) {
              };
 
this.requestBuilder.setTimeoutMillis(getHelper().getTimeout());


Best wishes,

Bruno.


Jerome Louvel wrote:
> Hi Wish,
> 
> What is your ServletContainer? There is a known bug with WebLogic regarding
> port 80:
> 
> "Locating REST resources on Port 80, Receive 404"
> http://restlet.tigris.org/issues/show_bug.cgi?id=710
> 
> We have very recently checked in a workaround in SVN trunk for this. Could
> you try again with a recent Restlet 2.0 snapshot?
> 
> 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 : wgandhi [mailto:wgan...@hotmail.com] 
> Envoyé : samedi 6 juin 2009 08:31
> À : discuss@restlet.tigris.org
> Objet : Relative URI in GWT Restlet
> 
> Hi !
> I have code that uses a GWT restlet class in the client. I generate the
> request like this:
> Request request = new
> Request(Method.GET,"http://localhost:8080/entApp-war/resources/Items/stock/";
> +symbol+"/");
> An existing web service is running on the servlet container at :8080.
> 
> When I deploy the web application, I want to use apache to serve the static
> content which will be on port :80. I have wired up my apache server to
> forward to the servlet container when I access directory /entApp-war. On the
> development platform, I use :8080 for everything and things work fine. When
> I deploy, I dont want to change my code to include the address of the
> correct server.
> Everything would work for me, if I get to specify a relative URL. example:
> Request request = new
> Request(Method.GET,"/entApp-war/resources/Items/stock/"+symbol+"/");
> 
> I tried that and it did not work. I get an "Unable to create request"-type
> message from the Restlet class. Is there a workaround this issue?
> 
> -Wish
>

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

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

Reply via email to