• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: directActionURLForActionNamed() generating complete URLs under WO 5.4.3
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: directActionURLForActionNamed() generating complete URLs under WO 5.4.3


  • Subject: Re: directActionURLForActionNamed() generating complete URLs under WO 5.4.3
  • From: "Mr. Pierre Frisch" <email@hidden>
  • Date: Wed, 6 May 2009 13:53:15 -0700

In order to get the correct server name you need to add an Apache directive:
ServerName www.foo.com

The exact algorithm is the following:
public String _serverName() {
// This is set if we are running in a Servlet Container
String serverName = headerForKey("x-webobjects-servlet-server-name");

if ((serverName == null) || (serverName.length() == 0)) {
if (isUsingWebServer()) {
serverName = headerForKey("x-webobjects-server-name");
if ((serverName == null) || (serverName.length() == 0)) {
serverName = headerForKey("server_name");
}
if ((serverName == null) || (serverName.length() == 0)) {
serverName = headerForKey("host");
}
if ((serverName == null) || (serverName.length() == 0)) {
throw new NSForwardException(new WOURLFormatException("<" + getClass().getName() + ">: Unable to build complete url as no server name was provided in the headers of the request."));
}
} else {
serverName = WOApplication.application().host();
}
}
return serverName;
}

So if server name is wrong....

You can run Apache 1.3.9 although I don't recommend it. It works but you will not be able to recompile the adaptor if you need it.


Pierre
--
Pierre Frisch
email@hidden


On May 6, 2009, at 9:31, Ricardo J. Parada wrote:


On May 6, 2009, at 11:36 AM, Mr. Pierre Frisch wrote:

Item 3 Can you elaborate on the wrong server name? Thanks


Hi Pierre,

Thanks for your response.  

Regarding item #3 -  "The generated direct action URL has the wrong server name" : 

The situation is as follows, when the application is deployed it is accessed securely with a URL that begins with https://www.mpv.com/app/WebObjects/...[etc]...  

Now, the URLs generated by calling the directActionURLForActionNamed(String,NSDictionary) method have a server name of web1-bu instead of www.mpv.com.  In other words, the URLs looked something like this:

http://web1-bu/app/WebObjects/OurApp.woa/1/wa/MPVAjaxAction/MPVContractPicker?wosid=vh5ESREs0GHHbDbjIkwTGw

Notice web1-bu as the server name in that URL instead of the expected www.mpv.com.  I could not figure out where that was coming from so I started inspecting the HTTP request headers to see if that server name was present anywhere.  That's where I found a server_name header with a value of web1-bu.  So I'm suspecting WO is simply looking at different things to determine the server name and that it might have picked up the server name from the server_name HTTP request header.  Here are the list of HTTP request headers from the application:

accept:             text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8   
accept-charset:     ISO-8859-1,utf-8;q=0.7,*;q=0.7   
accept-encoding:    gzip,deflate   
accept-language:    en-us,en;q=0.5   
connection:         close   
cookie:             ...omitted on purpose...   
document_root:      /usr/local/apache/htdocs:   
host:               www.mpv.com   
https:              on   
keep-alive:         300   
remote_addr:        10.0.0.119   
remote_host:        10.0.0.119   
remote_port:        51710   
script_filename:    /app/WebObjects/OurApp.woa/1/wo/MPVAppInfo.wo   
server_admin:       email@hidden   
server_name:        web1-bu   
server_port:        443   
server_software:    Apache/1.3.9   
unique_id:          SftpowoCAQEAAFxms0Q   
user-agent:         Mozilla/5.0:    (Macintosh;    U;    Intel    Mac    OS    X    10.5;    en-US;    rv:1.9.0.10)    Gecko/2009042315 Firefox/3.0.10   
x-webobjects-adaptor-version:   Apache 
x-webobjects-request-id:        49f11956000039fd00000027   
x-webobjects-request-method:    GET

We looked at the configuration files for Apache on Solaris which is our web server and in particular we looked at the httpd.conf file and the sslInclude.conf file which is included from httpd.conf.  But we still can't figure out why server_name has a value of web1-bu.  :-/

Now, the other question I have is this: is it mandatory that we upgrade Apache and the WebObjects adaptor in order to deploy our WO 5.4.3 application?  Or can we still use Apache 1.3.9 and its corresponding WebObjects adaptor for our WO 5.4.3 application?

Thanks a million,

Ricardo J. Parada
Medical Present Value, Inc.


Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
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

References: 
 >Re: directActionURLForActionNamed() generating complete URLs,> under WO 5.4.3 (From: Susanne Schneider <email@hidden>)
 >Re: directActionURLForActionNamed() generating complete URLs, > under WO 5.4.3 (From: "Ricardo J. Parada" <email@hidden>)
 >Re: directActionURLForActionNamed() generating complete URLs under WO 5.4.3 (From: "Ricardo J. Parada" <email@hidden>)
 >Re: directActionURLForActionNamed() generating complete URLs under WO 5.4.3 (From: "Mr. Pierre Frisch" <email@hidden>)
 >Re: directActionURLForActionNamed() generating complete URLs under WO 5.4.3 (From: "Ricardo J. Parada" <email@hidden>)

  • Prev by Date: Re: Need some advice for integrating a Cocoa and WO app
  • Next by Date: Re: Need some advice for integrating a Cocoa and WO app
  • Previous by thread: Re: directActionURLForActionNamed() generating complete URLs under WO 5.4.3
  • Next by thread: No snapshot for gid _EOIntegralKeyGlobalID
  • Index(es):
    • Date
    • Thread