com.supermap.services.providers
类 RestProviderBase
- java.lang.Object
-
- com.supermap.services.providers.RestProviderBase
-
- 所有已实现的接口:
- Disposable
- 直接已知子类:
- RestAddressMatchProvider, RestDataProvider, RestMapProvider, RestPlotProvider, RestRealspaceProvider, RestSpatialAnalystProvider, RestTrafficTransferAnalystProvider, RestTransportationAnalystProvider
public abstract class RestProviderBase extends java.lang.Object implements Disposable
基于iServer Rest服务的提供者基类
-
-
嵌套类概要
嵌套类 限定符和类型 类和说明 static class
RestProviderBase.CacheModel
缓存模式。protected static class
RestProviderBase.RestRequestException
-
字段概要
字段 限定符和类型 字段和说明 protected static java.lang.String
JAVA_POSTFIX
protected static JavaStreamConverter
javaConverter
protected static java.lang.String
JSON_POSTFIX
protected JsonConverter
jsonConverter
protected static JsonDecoder
jsonDecoder
static java.util.concurrent.locks.ReentrantLock
lock
protected static LocLogger
logger
protected static ResourceManager
message
protected static java.lang.String
XML_POSTFIX
protected static XMLDecoder
xmlDecoder
-
构造器概要
构造器 构造器和说明 RestProviderBase()
构造函数。
-
方法概要
方法 限定符和类型 方法和说明 void
clearCache()
清除缓存。void
dispose()
释放资源对象。protected <T> T
executeRequest(Request request, java.lang.Class<T> clz)
执行请求返回对象。protected <T> T
executeRequest(Request request, java.lang.Class<T> clz, boolean useCache)
执行请求返回对象。protected <T> T
executeRequest(Request request, java.lang.Class<T> clz, RestProviderBase.CacheModel cacheModel)
执行请求返回对象。protected byte[]
executeRequestByApacheHttpClientForByteArray(Request request, RestProviderBase.CacheModel cacheModel)
protected byte[]
executeRequestByRestletClientForByteArray(Request httpRequest, RestProviderBase.CacheModel cacheModel, Client restMapClient)
protected byte[]
executeRequestForByteArray(Request request)
执行请求返回字节数组。protected byte[]
executeRequestForByteArray(Request request, boolean useCache)
执行请求返回字节数组。protected byte[]
executeRequestForByteArray(Request request, RestProviderBase.CacheModel cacheModel)
执行请求返回字节数组。protected byte[]
executeRequestForByteArray(Request request, RestProviderBase.CacheModel cacheModel, Client restMapClient)
protected <T> java.util.List<T>
executeRequestForList(Request request, java.lang.Class<T> clz)
执行请求返回数组。protected <T> java.util.List<T>
executeRequestForList(Request request, java.lang.Class<T> clz, boolean useCache)
执行请求返回数组。protected <T> java.util.List<T>
executeRequestForList(Request request, java.lang.Class<T> clz, RestProviderBase.CacheModel cacheModel)
执行请求返回数组。protected <T> java.util.List<T>
executeRequestForList(Request request, java.lang.Class<T> clz, RestProviderBase.CacheModel cacheModel, Client restMapClient)
protected java.io.InputStream
executeRequestForStream(Request request)
执行请求返回Stream。protected java.io.InputStream
executeRequestForStream(Request request, boolean useCache)
执行请求返回Stream。protected java.io.InputStream
executeRequestForStream(Request request, RestProviderBase.CacheModel cacheModel)
执行请求返回Stream。protected java.lang.String
executeRequestForText(Request request)
执行请求,返回字符串。protected java.lang.String
executeRequestForText(Request request, boolean useCache)
执行请求,返回字符串。protected java.lang.String
executeRequestForText(Request request, RestProviderBase.CacheModel cacheModel)
执行请求,返回字符串。protected CloseableHttpClient
getApacheHttpClient()
protected static org.restlet.Request
getRestletRequest(Request request)
protected abstract RestProviderSetting
getRestProviderSetting()
返回REST服务提供者配置信息。void
handleExeption(RestProviderBase.RestRequestException ex)
protected void
init(RestProviderSetting setting)
根据RestProviderSetting初使化对象。CloseableHttpClient
initHttpClient()
protected Client
newAndSetClient(java.lang.String socketTimeout)
protected java.lang.String
rectifyRestServiceRootURL(java.lang.String restUrl)
校正REST URL,去除URL结尾的“/”。
-
-
-
字段详细资料
-
lock
public static final java.util.concurrent.locks.ReentrantLock lock
-
message
protected static final ResourceManager message
-
logger
protected static final LocLogger logger
-
javaConverter
protected static final JavaStreamConverter javaConverter
-
jsonDecoder
protected static final JsonDecoder jsonDecoder
-
xmlDecoder
protected static final XMLDecoder xmlDecoder
-
JSON_POSTFIX
protected static final java.lang.String JSON_POSTFIX
-
JAVA_POSTFIX
protected static final java.lang.String JAVA_POSTFIX
-
XML_POSTFIX
protected static final java.lang.String XML_POSTFIX
-
jsonConverter
protected final JsonConverter jsonConverter
-
-
方法详细资料
-
getApacheHttpClient
protected CloseableHttpClient getApacheHttpClient()
-
initHttpClient
public CloseableHttpClient initHttpClient()
-
dispose
public void dispose()
从接口复制的说明:Disposable
释放资源对象。
- 指定者:
dispose
在接口中Disposable
-
clearCache
public void clearCache()
清除缓存。
-
init
protected void init(RestProviderSetting setting)
根据RestProviderSetting初使化对象。- 参数:
setting
-
-
executeRequestForText
protected java.lang.String executeRequestForText(Request request) throws RestProviderBase.RestRequestException
执行请求,返回字符串。- 参数:
request
- request请求。- 返回:
- 抛出:
RestProviderBase.RestRequestException
-
executeRequestForText
protected java.lang.String executeRequestForText(Request request, boolean useCache) throws RestProviderBase.RestRequestException
执行请求,返回字符串。- 参数:
request
- request请求。useCache
- 是否使用缓存。- 返回:
- 抛出:
RestProviderBase.RestRequestException
-
executeRequestForText
protected java.lang.String executeRequestForText(Request request, RestProviderBase.CacheModel cacheModel) throws RestProviderBase.RestRequestException
执行请求,返回字符串。- 参数:
request
- request请求。cacheModel
- 缓存模式。- 返回:
- 抛出:
RestProviderBase.RestRequestException
-
executeRequest
protected <T> T executeRequest(Request request, java.lang.Class<T> clz) throws RestProviderBase.RestRequestException
执行请求返回对象。- 参数:
request
- request请求。clz
- 对象类型。- 返回:
- 抛出:
JSONException
RestProviderBase.RestRequestException
-
executeRequest
protected <T> T executeRequest(Request request, java.lang.Class<T> clz, boolean useCache) throws RestProviderBase.RestRequestException
执行请求返回对象。- 参数:
request
- request请求。clz
- 对象类型。useCache
- 缓存。- 返回:
- 抛出:
JSONException
RestProviderBase.RestRequestException
-
executeRequest
protected <T> T executeRequest(Request request, java.lang.Class<T> clz, RestProviderBase.CacheModel cacheModel) throws RestProviderBase.RestRequestException
执行请求返回对象。- 参数:
request
- request请求。clz
- 对象类型。cacheModel
- 缓存模式。- 返回:
- 抛出:
RestProviderBase.RestRequestException
JSONException
-
executeRequestForByteArray
protected byte[] executeRequestForByteArray(Request request) throws RestProviderBase.RestRequestException
执行请求返回字节数组。- 参数:
request
- request请求。- 返回:
- 抛出:
RestProviderBase.RestRequestException
-
executeRequestForByteArray
protected byte[] executeRequestForByteArray(Request request, boolean useCache) throws RestProviderBase.RestRequestException
执行请求返回字节数组。- 参数:
request
- request请求。useCache
- 是否使用缓存。- 返回:
- 抛出:
RestProviderBase.RestRequestException
-
executeRequestForByteArray
protected byte[] executeRequestForByteArray(Request request, RestProviderBase.CacheModel cacheModel) throws RestProviderBase.RestRequestException
执行请求返回字节数组。- 参数:
request
- request请求。cacheModel
- 缓存模式。- 返回:
- 抛出:
RestProviderBase.RestRequestException
-
executeRequestForByteArray
protected byte[] executeRequestForByteArray(Request request, RestProviderBase.CacheModel cacheModel, Client restMapClient) throws RestProviderBase.RestRequestException
- 参数:
request
-cacheModel
-restMapClient
- RestMapProvider使用的client- 返回:
- 抛出:
RestProviderBase.RestRequestException
-
executeRequestByApacheHttpClientForByteArray
protected byte[] executeRequestByApacheHttpClientForByteArray(Request request, RestProviderBase.CacheModel cacheModel) throws RestProviderBase.RestRequestException
-
getRestletRequest
protected static org.restlet.Request getRestletRequest(Request request)
-
executeRequestByRestletClientForByteArray
protected byte[] executeRequestByRestletClientForByteArray(Request httpRequest, RestProviderBase.CacheModel cacheModel, Client restMapClient) throws RestProviderBase.RestRequestException
-
executeRequestForList
protected <T> java.util.List<T> executeRequestForList(Request request, java.lang.Class<T> clz) throws RestProviderBase.RestRequestException
执行请求返回数组。
- 参数:
request
- request请求。clz
- 对象类型。- 返回:
- 抛出:
JSONException
RestProviderBase.RestRequestException
-
executeRequestForList
protected <T> java.util.List<T> executeRequestForList(Request request, java.lang.Class<T> clz, boolean useCache) throws RestProviderBase.RestRequestException
执行请求返回数组。
- 参数:
request
- request请求。clz
- 对象类型。useCache
- 是否使用缓存。- 返回:
- 抛出:
JSONException
RestProviderBase.RestRequestException
-
executeRequestForList
protected <T> java.util.List<T> executeRequestForList(Request request, java.lang.Class<T> clz, RestProviderBase.CacheModel cacheModel) throws RestProviderBase.RestRequestException
执行请求返回数组。
- 参数:
request
- request请求。clz
- 对象类型。cacheModel
- 缓存模式。- 返回:
- 抛出:
RestProviderBase.RestRequestException
-
executeRequestForList
protected <T> java.util.List<T> executeRequestForList(Request request, java.lang.Class<T> clz, RestProviderBase.CacheModel cacheModel, Client restMapClient) throws RestProviderBase.RestRequestException
- 参数:
request
-clz
-cacheModel
-restMapClient
- RestMapProvider使用的client- 返回:
- 抛出:
RestProviderBase.RestRequestException
-
executeRequestForStream
protected java.io.InputStream executeRequestForStream(Request request) throws RestProviderBase.RestRequestException
执行请求返回Stream。- 参数:
request
- request请求。- 返回:
- 抛出:
RestProviderBase.RestRequestException
-
executeRequestForStream
protected java.io.InputStream executeRequestForStream(Request request, boolean useCache) throws RestProviderBase.RestRequestException
执行请求返回Stream。- 参数:
request
- request请求。useCache
- 是否使用缓存。- 返回:
- 抛出:
RestProviderBase.RestRequestException
-
executeRequestForStream
protected java.io.InputStream executeRequestForStream(Request request, RestProviderBase.CacheModel cacheModel) throws RestProviderBase.RestRequestException
执行请求返回Stream。- 参数:
request
- request请求。cacheModel
- 缓存模式。- 返回:
- 抛出:
RestProviderBase.RestRequestException
-
rectifyRestServiceRootURL
protected java.lang.String rectifyRestServiceRootURL(java.lang.String restUrl)
校正REST URL,去除URL结尾的“/”。
- 参数:
restUrl
-- 返回:
-
getRestProviderSetting
protected abstract RestProviderSetting getRestProviderSetting()
返回REST服务提供者配置信息。- 返回:
-
newAndSetClient
protected Client newAndSetClient(java.lang.String socketTimeout)
-
handleExeption
public void handleExeption(RestProviderBase.RestRequestException ex)
-
-