Endpoint (Java EE 5)

Java EE API


javax.xml.ws Class Endpoint

java.lang.Object
  extended by javax.xml.ws.Endpoint

public abstract class Endpoint
extends Object


Web 服务端点。

使用在此类中定义的静态方法创建端点。一个端点总是绑定到一个 Binding 和一个实现者,这两项都是在创建端点时设置的。

端点要么处于已发布状态,要么处于未发布状态。可以使用 publish 方法开始发布端点,此时端点开始接受传入请求。相反,可以使用 stop 方法停止接受传入请求并取消端点。一旦停止,就不能再次发布该端点。

可以在端点上设置 Executor 以便更好地控制用来指派传入请求的线程。例如,通过创建 ThreadPoolExecutor 并向端点注册可以启用带有特定参数的线程池。

处理程序链可以使用所含的 Binding 来设置。

端点可以使一个元数据文档(如 WSDL 和 XMLSchema 文档)列表与之绑定。发布时,JAX-WS 实现将根据实现者上存在的注释,尽可能多地重用这些元数据,而不是生成新的元数据。

英文文档:

A Web service endpoint.

Endpoints are created using the static methods defined in this class. An endpoint is always tied to one Binding and one implementor, both set at endpoint creation time.

An endpoint is either in a published or an unpublished state. The publish methods can be used to start publishing an endpoint, at which point it starts accepting incoming requests. Conversely, the stop method can be used to stop accepting incoming requests and take the endpoint down. Once stopped, an endpoint cannot be published again.

An Executor may be set on the endpoint in order to gain better control over the threads used to dispatch incoming requests. For instance, thread pooling with certain parameters can be enabled by creating a ThreadPoolExecutor and registering it with the endpoint.

Handler chains can be set using the contained Binding.

An endpoint may have a list of metadata documents, such as WSDL and XMLSchema documents, bound to it. At publishing time, the JAX-WS implementation will try to reuse as much of that metadata as possible instead of generating new one based on the annotations present on the implementor.

Since:
JAX-WS 2.0
See Also:
Binding, BindingType, SOAPBinding, Executor

Field Summary
static String
static String
 
Constructor Summary
 
Method Summary
static Endpoint
static Endpoint
abstract  Binding
abstract  Executor
abstract  Object
abstract  List<Source>
abstract  Map<String,Object>
abstract  boolean
abstract  void
abstract  void
static Endpoint
abstract  void
abstract  void
abstract  void
abstract  void
 
Methods inherited from class java.lang.Object
 

Field Detail

英文文档:

WSDL_SERVICE

public static final String WSDL_SERVICE
Standard property: name of WSDL service.

Type: javax.xml.namespace.QName

See Also:
Constant Field Values


英文文档:

WSDL_PORT

public static final String WSDL_PORT
Standard property: name of WSDL port.

Type: javax.xml.namespace.QName

See Also:
Constant Field Values

Constructor Detail

public Endpoint()
英文文档:

Endpoint

public Endpoint()
Method Detail

public static Endpoint create(Object implementor)
创建具有指定实现者对象的端点。如果存在通过 BindingType 注释指定的绑定,则必须使用该绑定,否则必须使用默认的 SOAP 1.1 / HTTP 绑定。

可以通过调用 javax.xml.ws.Endpoint#publish(String) 和 javax.xml.ws.Endpoint#publish(Object) 方法之一来发布新创建的端点。

implementor 端点实现者。
return 新创建的端点。

英文文档:

create

public static Endpoint create(Object implementor)
Creates an endpoint with the specified implementor object. If there is a binding specified via a BindingType annotation then it MUST be used else a default of SOAP 1.1 / HTTP binding MUST be used.

The newly created endpoint may be published by calling one of the javax.xml.ws.Endpoint#publish(String) and javax.xml.ws.Endpoint#publish(Object) methods.

Parameters:
implementor - The endpoint implementor.
Returns:
The newly created endpoint.

public static Endpoint create(String bindingId, Object implementor)
创建具有指定绑定类型和实现者对象的端点。

可以通过调用 javax.xml.ws.Endpoint#publish(String) 和 javax.xml.ws.Endpoint#publish(Object) 方法之一来发布新创建的端点。

bindingId 一个 URI,指定要使用的绑定。如果 bindingID 为 null 并且没有通过 BindingType 注释指定任何绑定,则必须使用默认的 SOAP 1.1 / HTTP 绑定。
implementor 端点实现者。
return 新创建的端点。

英文文档:

create

public static Endpoint create(String bindingId,
                              Object implementor)
Creates an endpoint with the specified binding type and implementor object.

The newly created endpoint may be published by calling one of the javax.xml.ws.Endpoint#publish(String) and javax.xml.ws.Endpoint#publish(Object) methods.

Parameters:
bindingId - A URI specifying the binding to use. If the bindingID is null and no binding is specified via a BindingType annotation then a default SOAP 1.1 / HTTP binding MUST be used.
implementor - The endpoint implementor.
Returns:
The newly created endpoint.

abstract public Binding getBinding()
返回此端点的绑定。
return 此端点的绑定
英文文档:

getBinding

public abstract Binding getBinding()
Returns the binding for this endpoint.

Returns:
The binding for this endpoint

abstract public Object getImplementor()
返回此端点的实现对象。
return 此端点的实现者
英文文档:

getImplementor

public abstract Object getImplementor()
Returns the implementation object for this endpoint.

Returns:
The implementor for this endpoint

abstract public void publish(String address)
在给定地址处发布此端点。JAX-WS 实现将使用一些默认的配置创建和配置所需的服务器基础设施。若要更多地控制服务器配置,请使用 javax.xml.ws.Endpoint#publish(Object) 方法。
address 一个 URI,指定要使用的地址。地址必须与创建端点时指定的绑定兼容。
ThrowsIllegalArgumentException: 如果提供的地址 URI 不能与端点的绑定结合使用。
ThrowsIllegalStateException: 如果已发布端点或者已停止端点。
英文文档:

publish

public abstract void publish(String address)
Publishes this endpoint at the given address. The necessary server infrastructure will be created and configured by the JAX-WS implementation using some default configuration. In order to get more control over the server configuration, please use the javax.xml.ws.Endpoint#publish(Object) method instead.

Parameters:
address - A URI specifying the address to use. The address must be compatible with the binding specified at the time the endpoint was created.
Throws:
IllegalArgumentException - If the provided address URI is not usable in conjunction with the endpoint's binding.
IllegalStateException - If the endpoint has been published already or it has been stopped.

public static Endpoint publish(String address, Object implementor)
在给定地址处针对指定的实现者对象创建并发布端点。

JAX-WS 实现将使用一些默认的配置创建和配置所需的服务器基础设施。 若要更多地控制服务器配置,请使用 javax.xml.ws.Endpoint#create(String,Object) 和 javax.xml.ws.Endpoint#publish(Object) 方法。

address 指定要使用的地址和传输/协议的 URI。一个 http 地址:URI 必须指向正使用的 SOAP 1.1/HTTP。实现可以支持其他 URI 方案。
implementor 端点实现者。
return 新创建的端点。

英文文档:

publish

public static Endpoint publish(String address,
                               Object implementor)
Creates and publishes an endpoint for the specified implementor object at the given address.

The necessary server infrastructure will be created and configured by the JAX-WS implementation using some default configuration. In order to get more control over the server configuration, please use the javax.xml.ws.Endpoint#create(String,Object) and javax.xml.ws.Endpoint#publish(Object) method instead.

Parameters:
address - A URI specifying the address and transport/protocol to use. A http: URI must result in the SOAP 1.1/HTTP binding being used. Implementations may support other URI schemes.
implementor - The endpoint implementor.
Returns:
The newly created endpoint.

abstract public void publish(Object serverContext)
在提供的服务器上下文中发布此端点。服务器上下文封装了用于特定传输的服务器基础设施和寻址信息。要成功调用该方法,作为参数传递给它的服务器上下文必须与端点的绑定兼容。
serverContext 表示发布端点所用服务器上下文的对象。
ThrowsIllegalArgumentException: 如果实现不支持提供的服务器上下文,或者被证明无法与端点的绑定结合使用。
ThrowsIllegalStateException: 如果已发布端点或者已停止端点。
英文文档:

publish

public abstract void publish(Object serverContext)
Publishes this endpoint at the provided server context. A server context encapsulates the server infrastructure and addressing information for a particular transport. For a call to this method to succeed, the server context passed as an argument to it must be compatible with the endpoint's binding.

Parameters:
serverContext - An object representing a server context to be used for publishing the endpoint.
Throws:
IllegalArgumentException - If the provided server context is not supported by the implementation or turns out to be unusable in conjunction with the endpoint's binding.
IllegalStateException - If the endpoint has been published already or it has been stopped.

abstract public void stop()
停止发布此端点。 如果端点未处于已发布状态,则此方法无效。
英文文档:

stop

public abstract void stop()
Stops publishing this endpoint. If the endpoint is not in a published state, this method has not effect.


abstract public boolean isPublished()
如果端点已处于发布状态,则返回 true。
return 如果端点已处于发布状态,则返回 true
英文文档:

isPublished

public abstract boolean isPublished()
Returns true if the endpoint is in the published state.

Returns:
true if the endpoint is in the published state.

abstract public java.util.List<E> getMetadata()
返回服务的元数据文档列表。
return List<javax.xml.transform.Source> 服务的元数据文档列表
英文文档:

getMetadata

public abstract List<Source> getMetadata()
Returns a list of metadata documents for the service.

Returns:
List<javax.xml.transform.Source> A list of metadata documents for the service

英文文档:

setMetadata

public abstract void setMetadata(List<Source> metadata)
Sets the metadata for this endpoint.

Parameters:
metadata - A list of XML document sources containing metadata information for the endpoint (e.g. WSDL or XML Schema documents)
Throws:
IllegalStateException - If the endpoint has already been published.

abstract public java.util.concurrent.Executor getExecutor()
返回此 Endpoint 实例的执行程序。 执行程序用于向实现者对象指派传入请求。
return 将用来指派请求的 java.util.concurrent.Executor
See also java.util.concurrent.Executor
英文文档:

getExecutor

public abstract Executor getExecutor()
Returns the executor for this Endpointinstance. The executor is used to dispatch an incoming request to the implementor object.

Returns:
The java.util.concurrent.Executor to be used to dispatch a request.
See Also:
Executor

abstract public void setExecutor(java.util.concurrent.Executor executor)
设置此 Endpoint 实例的执行程序。 执行程序用于向实现者对象指派传入请求。 如果此 Endpoint 使用 publish(Object) 方法发布,并且指定的服务器上下文定义它自己的线程行为,则可以忽略执行程序。
executor 将用来指派请求的 java.util.concurrent.Executor
ThrowsSecurityException: 如果出于安全的原因(例如,缺少必要的权限),实例不支持设置执行程序。
See also java.util.concurrent.Executor
英文文档:

setExecutor

public abstract void setExecutor(Executor executor)
Sets the executor for this Endpoint instance. The executor is used to dispatch an incoming request to the implementor object. If this Endpoint is published using the publish(Object) method and the specified server context defines its own threading behavior, the executor may be ignored.

Parameters:
executor - The java.util.concurrent.Executor to be used to dispatch a request.
Throws:
SecurityException - If the instance does not support setting an executor for security reasons (e.g. the necessary permissions are missing).
See Also:
Executor

abstract public java.util.Map<K, V> getProperties()
返回此 Endpoint 实例的属性包。
return Map<String,Object>,与此实例关联的属性包。
英文文档:

getProperties

public abstract Map<String,Object> getProperties()
Returns the property bag for this Endpoint instance.

Returns:
Map<String,Object> The property bag associated with this instance.

英文文档:

setProperties

public abstract void setProperties(Map<String,Object> properties)
Sets the property bag for this Endpoint instance.

Parameters:
properties - The property bag associated with this instance.


Submit a bug or feature

Copyright 2007 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.

一看就知道只有菜鸟才干这么无知的事啦。

PS : 未经我党受权你也可自由散发此文档。 如有任何错误请自行修正;若因此而造成任何损失请直接找人民主席,请勿与本人联系。谢谢!