Re: Obtain the name of a server in WO
Re: Obtain the name of a server in WO
- Subject: Re: Obtain the name of a server in WO
- From: Stephane Guyot <email@hidden>
- Date: Sat, 9 Sep 2006 09:45:37 +0200
Gilles,
there is a non documented ( not yet public but perhaps in the future if
Apple Open-souce WO :-) ) API on the WORequest : public String
_serverName()
WebObjects use it internally for the isSecure bindings on the
WOHyperlink
HTH,
Stephane
Le 9 sept. 06, à 05:27, Gilles MATHURIN a écrit :
Hello list,
After a few search in the WO documentations and experimentation, and
owe to the people who send me clue and their way of doing, i think i
found a way to have the server name, yet i hope so.
I used the WOContext request() method. As u surely know (in fact i
write this for the other newbie like me :-)) (WOContext context) is an
argument of the constructor of ur WOComponent. So i wrote a few more
line in it, to get what i want.
=== Example ===
At first u have this :
public MoviePage(WOContext context) {
super(context);
}
==============
I added this :
public MoviePage(WOContext context) {
super(context);
WORequest request = context.request();
String serverName = request.headerForKey("host");
System.out.println("Server Name is :"+serverName); // For
verification
}
==============
after going to the MoviePage when i check the console i obtain this :
Server Name is : g-five.local.
That's what i should obtain. Then when i use the ivar serverName in a
method who built a static URL like :
====
String dynamicVideoUrl = "http://"+serverName+"/folder/movie.mov"
====
the movie is displayed. Now i only hope that the server name is really
the "apache domain name" (the static one). As the http server and the
application server are on the same machine, it seems impossible to
figure it out.
Maybe the more experienced WODeveloper could tell us ?
Regards.
GM.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
email@hidden
This email sent to email@hidden
_______________________________________________
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