public class WmClient
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static WmClient |
create(java.lang.String scheme,
java.lang.String host,
java.lang.String port,
java.lang.String baseURI)
Creates an instance of a WURFL Microservice client
|
void |
destroyConnection()
Deallocates all resources used by client.
|
int[] |
getActualCacheSizes() |
java.lang.String[] |
getAllDeviceMakes() |
Model.JSONModelMktName[] |
getAllDevicesForMake(java.lang.String make) |
Model.JSONMakeModel[] |
getAllMakeModel()
Deprecated.
since version 1.2.0.0 Use getAllDeviceMakes and getAllDevicesForMake(String make) instead
|
java.lang.String[] |
getAllOSes() |
java.lang.String[] |
getAllVersionsForOS(java.lang.String osName)
returns a slice
|
java.lang.String |
getApiVersion() |
java.lang.String[] |
getImportantHeaders() |
Model.JSONInfoData |
getInfo() |
java.lang.String[] |
getStaticCaps() |
java.lang.String[] |
getVirtualCaps() |
boolean |
hasStaticCapability(java.lang.String capName) |
boolean |
hasVirtualCapability(java.lang.String capName) |
Model.JSONDeviceData |
lookupDeviceId(java.lang.String wurflId)
Returns the device matching the given WURFL ID
|
Model.JSONDeviceData |
lookupRequest(javax.servlet.http.HttpServletRequest httpRequest)
Performs a device detection using an HTTP request object, as passed from Java Web applications
|
Model.JSONDeviceData |
lookupUseragent(java.lang.String useragent)
Performs a device detection against a user agent header
|
void |
setCacheSize(int uaMaxEntries)
Sets the client cache size
|
void |
setRequestedCapabilities(java.lang.String[] capsList) |
void |
setRequestedStaticCapabilities(java.lang.String[] capsList) |
void |
setRequestedVirtualCapabilities(java.lang.String[] vcapsList) |
public static WmClient create(java.lang.String scheme, java.lang.String host, java.lang.String port, java.lang.String baseURI) throws WmException
scheme
- protocol schemehost
- host of the WM serverport
- port of the WM serverbaseURI
- any base URI which must be added after the host (NOT including the endpoints, which are handled by the client).
This may be useful, for example, with thrird parties VMs (like docker or AWS). Leave empty or null if not needed.WmException
- In case a connection error occurspublic Model.JSONInfoData getInfo() throws WmException
WmException
- If server cannot send data or incomplete data are sent@Deprecated public Model.JSONMakeModel[] getAllMakeModel() throws WmException
WmException
- In case a connection error occurs or malformed data are sentpublic java.lang.String[] getAllDeviceMakes() throws WmException
WmException
- In case a connection error occurs or malformed data are sentpublic Model.JSONModelMktName[] getAllDevicesForMake(java.lang.String make) throws WmException
make
- a brand nameModel.JSONModelMktName
that contain values for model_name
and marketing_name (the latter, if available).WmException
- In case a connection error occurs, malformed data are sent, or the given brand name parameter does not exist in WM server.public java.lang.String[] getAllOSes() throws WmException
WmException
- In case a connection error occurs or malformed data are sentpublic java.lang.String[] getAllVersionsForOS(java.lang.String osName) throws WmException
osName
- a device OS name
WmException
public Model.JSONDeviceData lookupUseragent(java.lang.String useragent) throws WmException
useragent
- a user agent headerWmException
- In case any error occurs during device detectionpublic Model.JSONDeviceData lookupDeviceId(java.lang.String wurflId) throws WmException
wurflId
- a WURFL device identifierWmException
- In case any error occurspublic Model.JSONDeviceData lookupRequest(javax.servlet.http.HttpServletRequest httpRequest) throws WmException
httpRequest
- an instance of HTTPServletRequestWmException
- In case any error occurs during device detectionpublic void setRequestedStaticCapabilities(java.lang.String[] capsList)
public void setRequestedVirtualCapabilities(java.lang.String[] vcapsList)
public boolean hasStaticCapability(java.lang.String capName)
capName
- capability namepublic boolean hasVirtualCapability(java.lang.String capName)
capName
- capability namepublic void setRequestedCapabilities(java.lang.String[] capsList)
public void destroyConnection() throws WmException
WmException
- In case of closing connection errors.public java.lang.String[] getStaticCaps()
public java.lang.String[] getVirtualCaps()
public java.lang.String[] getImportantHeaders()
public void setCacheSize(int uaMaxEntries)
uaMaxEntries
- maximum cache dimensionpublic java.lang.String getApiVersion()
public int[] getActualCacheSizes()