URL (HttpResponse function): Difference between revisions

From m204wiki
Jump to navigation Jump to search
 
(4 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{Template:HttpResponse:URL subtitle}}
{{Template:HttpResponse:URL subtitle}}
<p>
The <var>URL</var> method returns the actual URL from which a response was obtained.  In the case of server redirects, the URL returned by this method will '''not''' be the URL requested on the <var>HTTPRequest</var> object.
<var>Url</var> is a member of the <var>[[HttpResponse class|HttpResponse]]</var> class.
</p>


This non-settable method returns the actual URL from
which a response was obtained.
In the case of server redirects, the URL returned by this method
will '''not''' be the URL requested on the <var>HTTPRequest</var> object.
==Syntax==
==Syntax==
{{Template:HttpResponse:URL syntax}}
{{Template:HttpResponse:URL syntax}}
Line 13: Line 7:
<table class="syntaxTable">
<table class="syntaxTable">
<tr><th>%string</th>
<tr><th>%string</th>
<td>A string variable for the assignment of the Url property value of ''%httpresp''.
<td>A string variable for the assignment of the URL property value of <var class="term">httpResponse</var>.
</td></tr>
</td></tr>
<tr><th>%httpresp</th>
<tr><th>httpResponse</th>
<td>A reference to an HTTPResponse object that was returned by a <var>[[Get (HttpRequest function)|Get]]</var>, <var>[[Post (HttpRequest function)|Post]]</var>, or <var>[[Send (HttpRequest function)|Send]]</var> method of an HTTPRequest object.
<td>A reference to an <var>[[HttpResponse_class|HttpResponse]]</var> object that was returned by a <var>[[Get_(HttpRequest_function)|Get]]</var>, <var>[[Post_(HttpRequest_function)|Post]]</var>, or <var>[[Send_(HttpRequest_function)|Send]]</var> method of an <var>[[HttpRequest_class|HttpRequest]]</var> object.</td></tr>
 
</table>
</td></tr></table>


==Usage notes==
==Usage notes==
<ul>
<li> The URL method can inform an application that a redirection happened and what the real location of the requested item was.  For example:
<p class="code"> %httpResponse = %httpRequest:get('XMLCLIENT')


The URL method can inform an
  if (%httpResponse:url ne %httpRequest:[[URL_(HttpRequest_property)|url]]) then
application that a redirection happened and what the
real location of the requested item was.
For example:
<p class="code"> %HTTPResponse = %HTTPRequest:Get('XMLCLIENT')
 
  if (%HTTPResponse:URL ne %HTTPRequest:URL) then
     print 'Hey Moe, we got redirected to ' and -
     print 'Hey Moe, we got redirected to ' and -
       %HTTPResponse:URL
       %httpResponse:url
  end if
  end if
</p>
</p></ul>
 
==See also==
==See also==
{{Template:HttpResponse:URL footer}}
{{Template:HttpResponse:URL footer}}

Latest revision as of 19:00, 20 June 2011

URL from which the response was obtained (HttpResponse class)

The URL method returns the actual URL from which a response was obtained. In the case of server redirects, the URL returned by this method will not be the URL requested on the HTTPRequest object.

Syntax

%string = httpResponse:URL

Syntax terms

%string A string variable for the assignment of the URL property value of httpResponse.
httpResponse A reference to an HttpResponse object that was returned by a Get, Post, or Send method of an HttpRequest object.

Usage notes

  • The URL method can inform an application that a redirection happened and what the real location of the requested item was. For example:

    %httpResponse = %httpRequest:get('XMLCLIENT') if (%httpResponse:url ne %httpRequest:url) then print 'Hey Moe, we got redirected to ' and - %httpResponse:url end if

See also