Link Search Menu Expand Document

NetObject.Get Method

Explanation Download CRS file from the WEB server and execute it.

Search the target CRSfile specified in the URL in the following order.
  1. If it is already cached on the loacal computer, it will be read from the cache.
  2. If it is included in the CRSarchive (CARfile) imported in advance, it will be read from archive.
  3. Send a request to the web server and get the CRS file.

The acquire content is immediately excuted as a CRS script. If possible, save the CRS file obtained from the WEB server in cache.
For cache control, see controlling cache with HTTPheaders below.

If you do not specify param, thebe sent HTTPGET.
If you specify paramthebe sent HTTPPOST.

If the web server does not return 200 ($HTTP_OK) for the HTTP status code, a CRS-331 exeption will occur.
Added since Ver.4.0.5., Mobile Ver.3.0.0 It is now possible to raise arbitrary excption using HTTP response headers. SEE Controlling Exceptions with HTTP Headers below for more informartion.

The current scope (this) of the acquired CRSscript is the object that excuted the Get method. For example, excuting the get method inside the OnTouch event handler of the Button class will create an object as a child of the Button object. When getting the CRS that defines the screen (Form claass), it is common to excute the Get method on the Root object. (//) or Form object.

The Get method does not return until the excution of the acquired CRS script is completed.
Call format obj.Get( URL [, param1 [, param2 [, ... ] ] ] )
Return value None
Arguments String URL URL of the CRS file
The URL is determined by the following rules.

Specified from protocol
If specified from a protocol such as http:// , the request will be sent as it is.The URL cannot start with the host name. If want to specify the host name, be sure to specify it from the protocol.
example:-
Get("http://server/path/form1.crs");
Get("https://server/path/form1.crs");

Absolute path specification
URLs starting with "/" are absolute paths. Send the request to the server that downloaded the CRS file that executed the Get method.
Example:- When the CRS that executes the Get method is downloaded from http://server/path1/form1.crs
Get("/path2/form2.crs");

Get("http://server/path2/form2.crs")

Relative path specification
URLs that do not start with "/" are relative paths. Send the request to the same path on the server where you downloaded the CRS file that executed the Get method.
Example:- When the CRS that executes the Get method is downloaded from http://server/path/form1.crs
Get("form3.crs");

Get("http://server/path/form3.crs")

Using the APPROOT property of the SYS object behaves differently than above with relative path specifications. The APPROOT property is left for compatibility with versions prior to version 3.0 and should not be used in new programs.
Object param Parameters to be added to the request.
There is no limit to the number of parameters that can be specified.
It is converted to a character string and added to the request according to the conversion rules for each object type specified in the parameter.
Exception CRS-331 Communication error
The Exception object has the following structure.
Exception {
    String RequestURL;  /* URL of the request that caused the exception */
    Number StatusCode;  /* HTTP status code */
    String ContentType; /* Content-Type of HTTP header */
    String Body;        /* Response body */
}
Example of use
Function OnTouch(e) {
    //.Form1.Delete();
    //.Get("Form2.crs");
}
Related item Cache, CSVDocument.Get methods

Conversion rule for each type of object specified in param

Type Explanation
String literal
例)"key=100"、"abc"
When "=" is included in the specified character string, the left side of "=" is the parameter name and the right side is the data value.
If "=" is not included, "argN" ( N is a number according to the position of the parameter) is used as the parameter name, and the entire character string is used as the data value.
Numeric literal
Example) 100 , 1.2
"argN" ( N is a number according to the position of the parameter) is the parameter name, and the character string converted in the standard format of Number type is the data value.
String
UString
The object name is the parameter name, and the entire character string of the Value property is the data value. UString is converted to String .
Since ,if more anonymous object is specified, it behaves the same as a string literal.
Number
Fixed
Date
The object name is the parameter name and the Value property is the data value.
The value of the Value property is converted to a string in the standard format according to the data type.
Since ,if more anonymous object is specified, use "argN" ( N is a number according to the position of the parameter) in the parameter name.
Spread
PulldownList
OptionButton
ListBox (single selection)
It is a single-selection composite object.
The object name is the parameter name and the Value property is the data value.
The Value property represents the currently selected element. -1 if no element is selected .
The value of the Value property is converted to a string.
CheckBox
ListBox (multiple selection)
This is a multi-select compound object.
The object name is the parameter name, and the Selected property of each element ( CheckItem , ListItem ) is the data value.
Parameters are generated for all elements.
example)
CheckBox CheckBox1 {
CheckItem item[3];
}
In this example, three parameters with the same name "CheckBox1" are generated, and the data values are item [0] .Selected , item [1] .Selected , and item [2] .Selected .
It is "1" in the selected state and "0" in the non-selected state .
Root
Dialog
Doc
Form
Record
TabForm
SplitterFrame
SplitterForm
GraphAxis
SpreadRow
Finds child objects and uses all found objects as parameters.
The object name is the parameter name and the default property is the data value.
example)
Form Form1 {
Button Button1;
Label Label1;
String String1;
}
In this example, we will generate three parameters named "Button1" , "Label1" , and "String1" , and set their default properties as data values.
The value of the default property is converted to a string in the standard format according to the data type.
Objects other than above The object name is the parameter name and the default property is the data value.
The value of the default property is converted to a string in the standard format according to the data type.
Since ,if more anonymous object is specified, use "argN" ( N is a number according to the position of the parameter) in the parameter name.

Controlling the cache with HTTP headers

If the HTTP response header returned from the server is specified as no-cache by the standard HTTP headers Cache-Control header and Pragma header, Biz / Browser will not cache the retrieved file.

Featurs added since Ver.4.0.6, Mobile Ver.3.0.0–>
The CRS-Cache-Control header, which is a Biz / Browser - specific header, can control the cache in preference to the standard HTTP header cache control ( Cache-Control , Pragma header).

CRS-Cache-Control: no-cache
or
CRS-Cache-Control: cache

If no-cache is specified in the CRS-Cache-Control header, it will not be cached. If cache is specified, it will be cached.

This function can be used when you want to perform different cache control in Biz / Browser with a proxy server that relays HTTP messages . For example, if you specify no-cache in the Cache -Control header and cache in the CRS-Cache-Control header, it will not be cached by the relay proxy server, and Biz / Browser can instruct the cache operation.
<– Up to here

Controlling exceptions with HTTP headers


Featurs added since Ver.4.0.5, Mobile Ver.3.0.0–>
Arbitrary exceptions can be raised by using the header of the HTTP response returned from the server . This function can be used for application-specific communication error handling. By specifying the CRS-Exception header in the response header with HTTP status code 200 ( $ HTTP_OK ), you can raise an exception even in normal communication.

Specify the CRS-Exception header in the following format.

CRS-Exception: Method: Method ; Code: Code ; Message: Message ;

Method , Code , and Message correspond to properties of the same name in the Exception class. The content of the Method is set in the Method property. If Method is not specified, “Server-Error” will be displayed. The contents of the Code are set in the Code property. If Code is not specified, it will be 0 . The content of the Message is set in the Message property. If you do not specify Message , the entire CRS-Exception header is set to Message .

The Exception object of the exception that occurs has the same structure as the CRS-331 exception and stores the same information ( RequestURL , StatusCode , etc.).
<– Up to here