Changes for page Development-Tips and Tricks
Last modified by Johann Werner on 2011/11/30 09:44
From version 8.1
edited by Pascal Robert
on 2007/09/03 14:47
on 2007/09/03 14:47
Change comment:
There is no comment for this version
To version 11.2
edited by Johann Werner
on 2011/11/30 09:44
on 2011/11/30 09:44
Change comment:
Changed document parent to [xwiki:documentation.Home.How-tos.WebHome].
Summary
-
Page properties (5 modified, 0 added, 0 removed)
Details
- Page properties
-
- Title
-
... ... @@ -1,1 +1,1 @@ 1 - Web Applications-Development-Tips and Tricks1 +Development-Tips and Tricks - Parent
-
... ... @@ -1,0 +1,1 @@ 1 +documentation.Home.How-tos.WebHome - Author
-
... ... @@ -1,1 +1,1 @@ 1 -XWiki. probert1 +XWiki.jw - Tags
-
... ... @@ -1,0 +1,1 @@ 1 +wikireview - Content
-
... ... @@ -4,13 +4,14 @@ 4 4 5 5 There are several different URL's associated with your application, all of which can be retrieved from various methods on WOApplication. Here is a quick cheat sheet of them: 6 6 7 -* WOApplication.application().baseURL() = /WebObjects 8 8 * WOApplication.application().applicationBaseURL() = /WebObjects 9 -* WOApplication.application().cgiAdaptorURL() = [[http://hostname/cgi-bin/WebObjects]] 10 -* WOApplication.application().directConnectURL() = [[http://hostname:port/cgi-bin/WebObjects/MyApplication.woa]] 8 +* WOApplication.application().baseURL() = /WebObjects 9 +* WOApplication.application().cgiAdaptorURL() = [[http:~~/~~/hostname/cgi-bin/WebObjects>>url:http://hostname/cgi-bin/WebObjects||shape="rect"]] 10 +* WOApplication.application().directConnectURL() = [[http:~~/~~/hostname:port/cgi-bin/WebObjects/MyApplication.woa>>url:http://hostname:port/cgi-bin/WebObjects/MyApplication.woa||shape="rect"]] 11 11 * WOApplication.application().frameworksBaseURL() = /WebObjects/Frameworks 12 -* WOApplication.application().servletConnectURL() = [[http://hostname/cgi-bin/WebObjects/MyApplication.woa]] 13 -* WOApplication.application().webserverConnectURL() = [[http://hostname/cgi-bin/WebObjects/MyApplication.woa/-port]] 12 +* WOApplication.application().host() = hostname 13 +* WOApplication.application().servletConnectURL() = [[http:~~/~~/hostname/cgi-bin/WebObjects/MyApplication.woa>>url:http://hostname/cgi-bin/WebObjects/MyApplication.woa||shape="rect"]] 14 +* WOApplication.application().webserverConnectURL() = [[http:~~/~~/hostname/cgi-bin/WebObjects/MyApplication.woa/-port>>url:http://hostname/cgi-bin/WebObjects/MyApplication.woa/-port||shape="rect"]] 14 14 15 15 == Browser IP == 16 16 ... ... @@ -46,22 +46,18 @@ 46 46 It's in the docs, but NSArray's implementation of KeyValueCoding is not really what I was expecting. To get an object at a specific numeric index of an NSArray, you'd use the 47 47 48 48 {{panel}} 49 - 50 50 objectAtIndex() 51 - 52 52 {{/panel}} 53 53 54 54 method. So what does 55 55 56 56 {{panel}} 57 - 58 58 NSArray.valueForKey(String key) 59 - 60 60 {{/panel}} 61 61 62 62 return? 63 63 64 -Well, first read the docs: [[file:///OSX/Developer/Documentation/WebObjects/Reference/com/webobjects/foundation/NSArray.html#valueForKey(java.lang.String]]) 61 +Well, first read the docs: [[file:~~/~~//OSX/Developer/Documentation/WebObjects/Reference/com/webobjects/foundation/NSArray.html#valueForKey(java.lang.String>>url:file:///OSX/Developer/Documentation/WebObjects/Reference/com/webobjects/foundation/NSArray.html#valueForKey(java.lang.String||shape="rect"]]) 65 65 66 66 It turns out that calling valueForKey on an array is the same as calling valueForKey for each element of that array. So if you have an NSArray of Users, calling valueForKey("email"); will return an NSArray of email addresses. calling valueForKey("documents"); will return an NSArray of NSArrays containing document objects. In hindsight (and from looking at the way WOBuilder handles key paths for arrays) this is kind of obvious. But I think the real lesson here is that it is easy to ignore the docs towards the end of an alphabetical page... 67 67 ... ... @@ -76,5 +76,4 @@ 76 76 return (StringUtils.substringBeforeLast(StringUtils.abbreviate((HTMLUtil.stripHTMLTags(htmlString)), numberOfChar), " ")) + "..."; 77 77 } 78 78 79 - 80 80 {{/code}}