Re: Question on context().request().uri()
Re: Question on context().request().uri()
- Subject: Re: Question on context().request().uri()
- From: Kieran Kelleher <email@hidden>
- Date: Thu, 1 Sep 2005 14:01:27 -0400
Yes, that helps. I have found that when switching between HTTP and
HTTPS (my page subclass takes responsibility for this in
appendToResponse based on a page flag), I need to use
context.componentActionURL() (as per Marker's book) to build my full
redirect URL for a component action request and use
context.request().uri() (as per Chuck's book) to build my full redirect
URL for direct action requests.
I found if I used context.request().uri() for HTTPS redirect URLs for
both type of requests, the component action request landed me back on
the same page. And I don't want to use componentActionURL for direct
action request redirects since that creates a session. So, I ended up
using the request.requestHandlerKey() to determine how to construct the
redirect URL and it works fine, but I needed to understand why.
Thanks again, Kieran
On Sep 1, 2005, at 1:14 PM, Chuck Hill wrote:
On Sep 1, 2005, at 10:03 AM, Kieran Kelleher wrote:
I have a question on understanding....
What is the significance/meaning/difference between
context.request().uri() and
This is the URL, requested by the browser, that caused the request
which your code is currently processing. It came from the page that
the user is currently viewing.
context().componentActionURL()
This is the URL that will cause an action to be directed to the
component currently being registered. Usually this is called in
subcomponents / dynamic elements to generate the action URL to include
in the response. This come from / will be in the page that the user
will see once this request is returned to them.
When I log them in appendToResponse for a page generated from
Component Action request, I get these values.....
371583 DEBUG [WorkerThread9] (PageWrapper, appendToResponse, 168) -
aContext.request().uri() =
/cgi-bin/WebObjects/cheetah.woa/-52040/wo/24OtRDbKizRKH6C2t7xjUM/
4.0.9.1
4 = 5th request from this session
0.9.1 = the second part (1), of the 10th part (9) of the page (0).
0.9.1 indicates the exact node within the tree of elements which make
up the page. Static HTML bits are elements within the tree too. This
is how WO maps URLs to objects.
371585 DEBUG [WorkerThread9] (PageWrapper, appendToResponse, 169) -
aContext.componentActionURL() =
/cgi-bin/WebObjects/cheetah.woa/-52040/wo/24OtRDbKizRKH6C2t7xjUM/6.0
6 = 7th request from this session
0 = page
Does that help?
Chuck
.... and here is the context itself......
369855 DEBUG [WorkerThread9] (PageWrapper, appendToResponse, 122) -
WOComponent.context() = <er.extensions.ERXWOContext contextID=6
requestSenderID=0.9.1 elementID=0 sessionID=24OtRDbKizRKH6C2t7xjUM
request=<er.extensions.ERXRequest (<er.extensions.ERXRequest
httpVersion=HTTP/1.1 headers={remote_host = (127.0.0.1);
user-agent = (Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US;
rv:1.7.10) Gecko/20050716 Firefox/1.0.6);
keep-alive = (300);
document_root = (/Library/WebServer/Documents);
accept-charset = (ISO-8859-1,utf-8;q=0.7,*;q=0.7);
accept =
(text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/
plain;q=0.8,image/png,*/*;q=0.5);
x-webobjects-adaptor-version = ("Apache");
server_name = (127.0.0.1);
referer =
(http://127.0.0.1/cgi-bin/WebObjects/cheetah.woa/-52040/wa/page?
wosid=24OtRDbKizRKH6C2t7xjUM&page=WzdNC_ProductType);
remote_port = (60521);
remote_addr = (127.0.0.1);
x-webobjects-request-id = (43145a2300000150000000dd);
server_software = (Apache/1.3.28);
script_filename =
(/cgi-bin/WebObjects/cheetah.woa/-52040/wo/24OtRDbKizRKH6C2t7xjUM/
4.0.9.1);
x-webobjects-request-method = (GET);
accept-encoding = (gzip,deflate);
server_port = (80);
host = (127.0.0.1);
accept-language = (en-us,en;q=0.5);
connection = (close);
} content-length=0 cookies=null userInfo=null>) method=GET
uri=/cgi-bin/WebObjects/cheetah.woa/-52040/wo/24OtRDbKizRKH6C2t7xjUM/
4.0.9.1 defaultFormValueEncoding=ISO8859_1
formValueEncodingDetectionEnabled=NO formValueEncoding=ISO8859_1
formValues={} > response=<com.webobjects.appserver.WOResponse
(<com.webobjects.appserver.WOResponse httpVersion=HTTP/1.1
headers={content-type = ("text/html; charset=iso-8859-1");
} content-length=0 cookies=null userInfo=null>) status=200>
pageElement=<WzdNC_Geography name: WzdNC_Geography subcomponents:
null > pageComponent=<WzdNC_Geography name: WzdNC_Geography
subcomponents: null > currentComponent=<PageWrapper name: PageWrapper
subcomponents: null > url=/cgi-bin/WebObjects/cheetah.woa/-52040
urlApplicationNumber=-52040 distributionEnabled=false
pageChanged=true pageReplaced=false>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
village.net
This email sent to email@hidden
--
Practical WebObjects - a book for intermediate WebObjects developers
who want to increase their overall knowledge of WebObjects, or those
who are trying to solve specific application development problems.
http://www.global-village.net/products/practical_webobjects
_______________________________________________
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