JavaScript手册 
目录
此参考中包含
的内容
轻松上手
简介
操作符
语句
核心
文档
窗口
表单
浏览器
事件和
事件句柄
LiveWire
数据库服务
进程管理服务
实用工具
全局函数
LiveConnect
的Java包
索引
版权
 
【目录】 【上一页】 【下一页】 【索引】

server

Contains global data for the entire server.

服务器端对象
实现版本 LiveWire 1.0

创建源

The JavaScript runtime engine on the server automatically creates a single server object to store information common to all JavaScript applications running on the web server.

描述

The JavaScript runtime engine on the server creates a server object when the server starts and destroys it when the server stops. Every application on a server shares the same server object. Use the server object to maintain global data for the entire server. Many applications can run on a server simultaneously, and the server object lets them share information.

The runtime engine creates a server object for each distinct Netscape HTTPD process running on the server.

The properties listed below are read-only properties that are initialized automatically when a server object is created. These properties provide information about the server process. In addition to these predefined properties, you can create custom properties.

You can lock the server object to ensure that different applications do not change its properties simultaneously. When one application locks the server object, other applications must wait before they can lock it.

属性概览

host String specifying the server name, subdomain, and domain name.
hostname String containing the full hostname of the server, including the server name, subdomain, domain, and port number.
port String indicating the port number used for the server.
protocol String indicating the communication protocol used by the server.

方法概览

lock Obtains the lock.
unlock Releases the lock.

示例

The following example displays the values of the predefined server object properties:

<P>server.host = <SERVER>write(server.host);</SERVER>
<BR>server.hostname = <SERVER>write(server.hostname);</SERVER>
<BR>server.protocol = <SERVER>write(server.protocol);</SERVER>
<BR>server.port = <SERVER>write(server.port);</SERVER>
The preceding code displays information such as the following:

server.host = www.myWorld.com
server.hostname = www.myWorld.com:85
server.protocol = http:
server.port = 85

参看

client, project, request

属性

host

A string specifying the server name, subdomain, and domain name.

属性源 server
只读
实现版本 LiveWire 1.0

描述

The host property specifies a portion of a URL. The host property is a substring of the hostname property. The hostname property is the concatenation of the host and port properties, separated by a colon. When the port property is 80 (the default), the host property is the same as the hostname property.

See Section 3.1 of RFC 1738 (http://www.cis.ohio-state.edu/htbin/rfc/rfc1738.html) for complete information about the hostname and port.

参看

server.hostname, server.port, server.protocol

hostname

A string containing the full hostname of the server, including the server name, subdomain, domain, and port number.

属性源 server
只读
实现版本 LiveWire 1.0

描述

The hostname property specifies a portion of a URL. The hostname property is the concatenation of the host and port properties, separated by a colon. When the port property is 80 (the default), the host property is the same as the hostname property.

See Section 3.1 of RFC 1738 (http://www.cis.ohio-state.edu/htbin/rfc/rfc1738.html) for complete information about the hostname and port.

参看

server.host, server.port, server.protocol

port

A string indicating the port number used for the server.

属性源 server
只读
实现版本 LiveWire 1.0

描述

The port property specifies a portion of the URL. The port property is a substring of the hostname property. The hostname property is the concatenation of the host and port properties, separated by a colon.

The default value of the port property is 80. When the port property is set to the default, the values of the host and hostname properties are the same.

See Section 3.1 of RFC 1738 (http://www.cis.ohio-state.edu/htbin/rfc/rfc1738.html) for complete information about the port.

参看

server.host, server.hostname, server.protocol

protocol

A string indicating the communication protocol used by the server.

属性源 server
只读
实现版本 LiveWire 1.0

描述

The protocol property specifies the beginning of the URL, up to and including the first colon. The protocol indicates the access method of the URL. For example, a protocol of "http:" specifies HyperText Transfer Protocol.

The protocol property represents the scheme name of the URL. See Section 2.1 of RFC 1738 (http://www.cis.ohio-state.edu/htbin/rfc/rfc1738.html) for complete information about the protocol.

参看

server.host, server.hostname, server.port

方法

lock

Obtains the lock. If another thread has the lock, this method waits until it can get the lock.

方法源 server
实现版本 LiveWire 1.0

语法

lock()

参数

返回

Nothing.

描述

You can obtain a lock for an object to ensure that different clients do not access a critical section of code simultaneously. When an application locks an object, other client requests must wait before they can lock the object.

Note that this mechanism requires voluntary compliance by asking for the lock in the first place.

参看

Lock, server.lock

unlock

Releases the lock.

方法源 server
实现版本 LiveWire 1.0

语法

unlock()

参数

无。

返回

False if it fails; otherwise, true. Failure indicates an internal JavaScript error or that you attempted to unlock a lock that you don't own.

描述

If you unlock a lock that is unlocked, the resulting behavior is undefined.

参看

Lock, server.unlock


【目录】 【上一页】 【下一页】 【索引】

回页面顶部