URL (HttpRequest property): Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (1 revision)
mNo edit summary
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Template:HttpRequest:URL subtitle}}
{{Template:HttpRequest:URL subtitle}}
The <var>URL</var> method lets you set or examine the whole URL with one method call, instead of setting/getting parts of the URL with the <var>[[Protocol (HttpRequest property)|Protocol]]</var>,
<var>[[Host (HttpRequest property)|Host]]</var>, <var>[[Port (HttpRequest property)|Port]]</var>, and <var>[[Page (HttpRequest property)|Page]]</var> properties.


This method lets you set or examine the whole URL with one
You set the URL for an HTTP request by assigning a value to <var>URL</var>, and you fetch its value by referencing it without any parameters.
method call, instead of setting/getting parts of the URL with the <var>[[Protocol (HttpRequest property)|Protocol]]</var>,
<var>[[Host (HttpRequest property)|Host]]</var>,
<var>[[Port (HttpRequest property)|Port]]</var>, and <var>[[Page (HttpRequest property)|Page]]</var> properties.


You set the URL for an HTTP request by assigning a value to <var>Url</var>,
and you fetch its value by referencing it without any parameters.
==Syntax==
==Syntax==
{{Template:HttpRequest:URL syntax}}
{{Template:HttpRequest:URL syntax}}
===Syntax terms===
===Syntax terms===
<table class="syntaxTable">
<table class="syntaxTable">
<tr><th>%httpreq</th>
<tr><th>%currentString</th>
<td>An instantiated <var>HttpRequest</var> object.
<td>A string or <var>[[Longstrings|Longstring]]</var> variable for the assignment of the current value of <var>URL</var>.</td></tr>
<tr><th>httpRequest</th>
<td>A previously defined and instantiated <var>HttpRequest</var> object.</td></tr>
<tr><th>newString</th>
<td>A string expression that contains a complete URL, potentially including protocol, host, port, and page. The value is parsed and validated, and its parts are then available to the individual property calls (<var>Protocol</var>, <var>Host</var>, <var>Port</var>, <var>Page</var>). If <var class="term">newString</var> cannot be parsed, the request is cancelled.
<p>The default value is the concatenation of the defaults of the properties that return the individual parts of the URL, that is, the URL of a web server running on the same machine as the client:</p>
<p class="code"> http://127.0.0.1:80/</p>
<var>Port</var> defaults to <code>80</code>; <var>Protocol</var> defaults to <code>http://</code>; <var>Host</var> defaults to <code>127.0.0.1</code>; and <var>Page</var> defaults to <code>/</code> (the root page from the domain).
</td></tr>
</td></tr>
<tr><th>urlvalue</th>
</table>
<td>A string expression that contains a complete URL, potentially including protocol, host, port, and page. The value is parsed and validated, and its parts are then available to the individual property calls (Protocol, Host, Port, Page). If ''urlvalue'' cannot be parsed, the request is cancelled.
The default value is the concatenation of the defaults of the properties that return the individual parts of the URL, the URL of a web server running on the same machine as the client: <p class="code"> http://127.0.0.1:80/ </p>
Port defaults to <code>80</code>; Protocol defaults to <code>http://</code>; Host defaults to <code>127.0.0.1</code>; Page defaults to <code>/</code> (the root page from the domain).
</td></tr>
<tr><th>%url</th>
<td>A string or longstring variable for the assignment of the current value of Url.


</td></tr></table>
==Usage notes==
==Usage notes==
<ul>
<li>Referencing <var>URL</var> returns the entire URL, whether it was set in one call using <var>URL</var>, or set in parts using the <var>Protocol</var>, <var>Host</var>, <var>Port</var>, and <var>Page</var> properties.
</ul>


Referencing <var>Url</var> returns the entire URL, whether
it was set in one call using <var>Url</var>, or set in parts
using the <var>Protocol</var>, <var>Host</var>, <var>Port</var>, and <var>Page</var> properties.
==See also==
==See also==
{{Template:HttpRequest:URL footer}}
{{Template:HttpRequest:URL footer}}

Latest revision as of 21:59, 21 June 2011

Target HTTP request URL (HttpRequest class)

The URL method lets you set or examine the whole URL with one method call, instead of setting/getting parts of the URL with the Protocol, Host, Port, and Page properties.

You set the URL for an HTTP request by assigning a value to URL, and you fetch its value by referencing it without any parameters.

Syntax

%currentString = httpRequest:URL httpRequest:URL = newString

Syntax terms

%currentString A string or Longstring variable for the assignment of the current value of URL.
httpRequest A previously defined and instantiated HttpRequest object.
newString A string expression that contains a complete URL, potentially including protocol, host, port, and page. The value is parsed and validated, and its parts are then available to the individual property calls (Protocol, Host, Port, Page). If newString cannot be parsed, the request is cancelled.

The default value is the concatenation of the defaults of the properties that return the individual parts of the URL, that is, the URL of a web server running on the same machine as the client:

http://127.0.0.1:80/

Port defaults to 80; Protocol defaults to http://; Host defaults to 127.0.0.1; and Page defaults to / (the root page from the domain).

Usage notes

  • Referencing URL returns the entire URL, whether it was set in one call using URL, or set in parts using the Protocol, Host, Port, and Page properties.

See also