RE: Tomcat with Restlet behind Proxy: Communication Error (1001)

2010-03-10 Thread asdfasdf
Hi,

I have done so, and in the startup-arguments I have set to following:

-DproxySet=true 
-DproxyHost=proxy.intern
-DproxyPort=8080
-DproxyUsername=myUsername
-DproxyPassword=mySecret
-Dhttp.nonProxyHosts=localhost|127.0.0.1|192.168.100.210

Now the Redirector does try to access the resource via proxy, but I get 407
- Proxy Authentication Required. The -DproxyUser and -DproxyPassword seem
not to work... do you know perhaps why?

Thank you,

ab

jlouvel wrote:
 
 It is however possible to replace it with a client connector based on
 HttpURLConnection. This is the purpose of the org.restlet.ext.net
 extension. Just add its JAR in your classpath and try again :)


-- 
View this message in context: 
http://n2.nabble.com/Tomcat-with-Restlet-behind-Proxy-Communication-Error-1001-tp2992998p4710456.html
Sent from the Restlet Discuss mailing list archive at Nabble.com.

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


RE: How to write an Universal redirector

2010-02-26 Thread asdfasdf
Hi,

It is really nice of you to help me. It is quite possible, that my problem
is in the project set-up. The RestLet libraries are from 25.2.2010.

I have minimized the Eclipse project to a single onModuleLoad function and
the minimum of server-side classes (2). What it large makes are the
libraries I use… You can see the project setup in the image file I have also
attached.

http://www.kybernetika.de/tmp/restlet/TestRestlet.zip
http://www.kybernetika.de/tmp/restlet/TestRestlet.zip 
http://www.kybernetika.de/tmp/restlet/TestRestlet.gif
http://www.kybernetika.de/tmp/restlet/TestRestlet.gif 

The best of all would be, if I could use on the client side something like
this:
ClientResource client = new
ClientResource(“http://weather.yahooapis.com/forecastrss?w=615702”);
without having to implement ANY server side stuff…

A BIG BIG thank you one more time!
Have a nice weekend.

ab


jlouvel wrote:
 
 Hi ab,
 
 It would help if you could package a small project reproducing your issue.
 There is really nothing in Restlet that should prevent you from doing this
 reverse proxy scenario.
 
 Best regards,
 Jerome Louvel
 

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

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


Re: How to write an Universal redirector

2010-02-25 Thread asdfasdf
Hi,

I have made some tests with Fiddler2.
I have executed the same Request/Headers that I have posted above, and got a
normal/JSON answer from my Tomcat running on 8080.

The Question is: If the StdOut says Redirecting via client dispatcher to:
http://localhost:8080/RESTful; who submits this Request? Browser, or
Server?

Please help me going... I am really stuck...

Best wishes,

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

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


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 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

GWT, ClientResource, Same Origin Policy (SOP)

2010-02-23 Thread asdfasdf
Good evening everyone,


What do I need to make from GWT a simple (GET and PUT) request to a
non-localhost service without having to implement any server side code? The
following example does not work. (Probably becouse of the Same Origin
Policy):

ClientResource r = new
ClientResource(http://xxx.xxx.xxx.xxx:/services/my_service;);
r.setOnReceived(new Uniform() {
public void handle(Request request, Response response) {
System.out.println(response.getStatus());
}
});
r.get();


Cheers,


ab

-- 
View this message in context: 
http://n2.nabble.com/GWT-ClientResource-Same-Origin-Policy-SOP-tp4619686p4619686.html
Sent from the Restlet Discuss mailing list archive at Nabble.com.

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

How to write an Universal redirector

2010-02-23 Thread asdfasdf
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: 
http://n2.nabble.com/How-to-write-an-Universal-redirector-tp4620578p4620578.html
Sent from the Restlet Discuss mailing list archive at Nabble.com.

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