RTMP/E
setConfig2(key:String, value:String, scope:String) : Object
HTTP
http://www.example.com:1111/admin/setConfig2?auser=username&apswd=password&key=string&value=string&scope=scope
Changes the value of the specified configuration key in a specified configuration file. Adobe Media Server has six server configuration files: Server.xml, Users.xml, Logger.xml, Adaptor.xml, Vhost.xml, and Application.xml. For a description of the XML configuration files, see Adobe Media Server Configuration and Administration Guide.
Virtual host administrators can change the values of configuration keys in the Vhost.xml file and Application.xml files for their own virtual hosts. You must be a server administrator to change the values of most configuration keys in the Server.xml and Adaptor.xml files.
It is possible to have more than one XML tag with the same name at the same level in the XML tree. In the configuration file, you should distinguish such tags by using a name attribute in the XML tag (for example, if you have more than one virtual host: <VirtualHost name="www.redpin.com"></VirtualHost>.) When you call the setConfig() method and specify the configuration subkeys, you can indicate which tag you want by specifying the tag name, followed by a colon and the correct name attribute, for example: Adaptor:_defaultRoot_/VirtualHost:www.redpin.com.
Availability
Flash Media Server 2.0.
Parameters
key
A String indicating the configuration key for which you want to change the value.
A key is specified as a list of subkeys delimited by slashes (/). The first subkey specifies the XML configuration file that contains the desired configuration key. Subsequent subkeys correspond to tags that are relative to that XML configuration file; the hierarchy and names of the subkeys match the tags in the XML file. Here is an example: "/Server/LicenseInfo"
value
A String indicating the value to set for the specified configuration key. If the value specified is a simple string, it is set as the tag data for the specified tag. If the value is valid XML, for example, <foo>bar</foo>, the XML is added as a child tag to the specified tag. If the value is an empty string, the specified tag is removed.
scope
A String indicating which configuration file to search for the configuration tag specified in the key parameter.
Adobe Media Server has six server configuration files: Server.xml, Users.xml, Logger.xml, Adaptor.xml, Vhost.xml, and Application.xml. Depending on your permissions, you can get configuration keys for all these files, as described in the following list:
/ specifies Server.xml.
Users specifies Users.xml for server administrators.
Logger specifies Logger.xml.
Adaptor:<adaptor_name> specifies Adaptor.xml. Specify the adaptor name in place of the <adaptor_name> placeholder. You must have server administrator privileges to access the Adaptor.xml file. If <adaptor_name> is not the name of the adaptor the caller is connected to, the call fails.
Adaptor:<adaptor_name>/VHost:<vhost_name> specifies VHost.xml. Specify the virtual host name in place of the <vhost_name> placeholder. If <adaptor_name> is not the name of the adaptor the caller is connected to, or <vhost_name> is not the name of the virtual host that the caller is connected to, the call fails.
Adaptor:<adaptor_name>/VHost:<vhost_name>/Users.xml specifies Users.xml for virtual host administrators.
Adaptor:<adaptor_name>/VHost:<vhost_name>/App[:<app_name>] specifies Application.xml. If no <app_name> is specified, the default Application.xml file is assumed. Otherwise, the application-specific Application.xml for the specified application is used. If the specified application is not defined, or the application does not have an application-specific Application.xml file, the call fails.
Note: To determine the adaptor or virtual host to which you’re connected, call the getAdminContext() method.
auser
A String indicating the user name of the administrator.
apswd
A String indicating the password of the administrator.
Returns
RTMP/E
If the call succeeds, the server sends a reply information object with a level property of status and a code property of NetConnection.Call.Success. The value of the configuration key is changed.
If the call fails, the server sends a reply information object with a level property of error, a code property of NetConnection.Call.BadValue, and a description property that contains a string describing the cause of the failure.
This call fails if the specified configuration key cannot be found or if you do not have permissions to change its value.
HTTP
If the call succeeds, it returns XML with the following structure:
<result> <level></level> <code></code> <timestamp></timestamp> </result>If the call fails, it returns XML with the following structure:
<result> <level></level> <code></code> <description></description> <timestamp></timestamp> </result>The XML elements contain the same information as the Object properties returned in an RTMP/E call.
Note: The timestamp response over HTTP is formatted differently on Windows (9/23/2007 6:16:40 PM) and Linux (Sun 23 Sep 2007 06:16:40 PM IST).
Examples
The following examples show how to set new values for configuration keys:
tSocket = new NetConnection(); tSocket.connect("rtmp://localhost/admin", "user", "password"); // set tag data in Server.xml key = "Server/LicenseInfo"; val = "SFD150-XXXXX-XXXXX-XXXXX"; tSocket.call("setConfig2", new onSetConfig(), key, val, "/"); // set tag data in Adaptor.xml key = "HostPortList/HostPort"; val = ":1935, 80, 443"; scope = "Adaptor:_defaultRoot_"; tSocket.call("setConfig2", new onSetConfig(), key, val, scope); // set tag data in Vhost.xml key = "AppsDir"; val = "c:\\applications"; scope = "Adaptor:_defaultRoot_/VHost:_defaultVHost_"; tSocket.call("setConfig2", new onSetConfig(), key, val, scope); // set tag data in Application.xml for app "foo" key = "Process/Scope"; val = "inst"; scope = "Adaptor:_defaultRoot_/VHost:_defaultVHost_/App:foo"; tSocket.call("setConfig2", new onSetConfig(), key, val, scope); // add child tag to a tag in default Application.xml key = "Process"; val = "<Scope>inst</Scope>"; scope = "Adaptor:_defaultRoot_/VHost:_defaultVHost_/App"; tSocket.call("setConfig2", new onSetConfig(), key, val, scope); // delete tag in default Application.xml key = "Process"; val = ""; scope = "Adaptor:_defaultRoot_/VHost:_defaultVHost_/App"; tSocket.call("setConfig2", new onSetConfig(), key, val, scope);
See also