Re: Get server host from request or url
Re: Get server host from request or url
- Subject: Re: Get server host from request or url
- From: Benoit Cantin <email@hidden>
- Date: Fri, 06 Jul 2007 09:20:00 +0200
Chuck Hill wrote:
Hello Benoit,
How are you handling sessions? When the Flash client requests a web
service, what URL does it use?
Hello Chuck,
Sessions id are transferred to flash client as a flash variable, as well
as server FQDN. Sessions are then restored on the server.
Eventually, problem is solved.
Swf file was loaded from an url, let's say url_1. My webobjects server
sent back a server name from method serverNameFromRequest(WORequest
request). This server name returned was then concatenated to a port
number on the flash client. This returned a new url (url_2) which is
used to get web services wsdls. The problem was that url_1 and url_2
host parts differed, so that the Flash Player tried to get a
crossdomain.xml on the second host (something like
my.local.computer:2002/crossdomain.xml, 2002 is my web services port).
Of course, this returned a 404 status code which made my aplication hang up.
I just simplified my method :
>> public String serverNameFromRequest(WORequest request) {
>> return request.headerForKey("host");
>>
>> }
I am now sure that url_1 and url_2 are the same. Everything seems to
work now :)
Thanks Chuck !
On Jul 5, 2007, at 6:56 AM, Benoit Cantin wrote:
Dear list,
I would like to establish a connexion between a webobjects server and
a flash client.
To do so, I have to transfer the server's FQDN, or the server's IP
adress to the flash client as a flash variable passed to the swf.
The flash client, then, communicate through web services using this
variable.
The problem is that it seems that when the server return its FQDN and
if a try to contact the server through it's IP adress without
specifying the port on which my application instance run, then, I just
can't get my web services.
If I force the server to return it's IP, it just work. But if I try to
contact the server through it FQDN, it fails.
Here is the method involved on the server in returning the host name.
public String serverNameFromRequest(WORequest request) {
String s = request.headerForKey("x-webobjects-server-name");
if (s == null) {
s = request.headerForKey("server_name");
}
if (s == null) {
s = request.headerForKey("host");
}
if (s == null) {
s = request._originatingAddress().getHostAddress();
}
if (s == null) {
s = WOApplication.application().host();
}
return s;
Does anybody ever have this problem ? Any help is appreciated.
Thank you.
--
Benoit Cantin
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
--
Benoit Cantin
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden