I have four environment in worklight project which are Android
, Iphone
, Ipad
and Windows
. My doubt is how to get which environment is requesting on adapter when hitting from client.
For example if i am hitting adapter from iPhone
then how will i come to know request is coming from iPhone
so that i can get it on adapter side and log it in api request.
There is no built-in feature to get the current environment from an adapter, however you can still find out that information by other ways. For example:
var request = WL.Server.getClientRequest(); var userAgent = request.getHeader("User-Agent");
Then search for keywords such as "android", etc.
WL.Client.invokeProcedure({
adapter : 'sample',
procedure : 'sample',
parameters : [env: WL.Client.getEnvironment()],
});