简体   繁体   English

如何访问Google Cloud Endpoint API中的用户代理?

[英]How do I access the user agent in Google Cloud Endpoint APIs?

I have an api endpoint defined as follows 我有一个api端点,定义如下

@Api (name = "auth", version = "1")
public class AuthenticationEndpoint {

    @ApiMethod 
    public AuthResult Register (@Named ("email") String email, @Named ("password") String pass) {
        // TODO: do something with the user agent here
    }    
}

Is there any way to access the user agent here in my Register method? 在我的Register方法中,有什么方法可以访问用户代理?

Thanks 谢谢

You can add a parameter of type HttpServletRequest to the method. 您可以将HttpServletRequest类型的参数添加到方法中。

See also this question . 另请参阅此问题

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何从Java Google Cloud Endpoint处理程序访问API Explorer的“字段”字段? - How do I access “fields” field of API Explorer from Java Google Cloud Endpoint handler? 如何为Google Cloud中的API上传创建端点? - How do I create an endpoint for API upload in Google Cloud? 我如何坚持Google Cloud Endpoint对sharedPreference的响应 - How do I persist google cloud endpoint response to sharedPreference 如何在android studio中访问Google Cloud Save API? - How to get access to Google Cloud Save APIs in android studio? 如何访问Google Cloud / app引擎上部署的Rest Apis - how to Access rest Apis deployed on google cloud /app engine 如何使用Firebase令牌验证保护Google Cloud Endpoints API? - How do I secure my Google Cloud Endpoints APIs with Firebase token verification? Google Cloud Endpoint可以在Google APIs Explorer中工作,但不能在Android上工作(错误请求) - Google Cloud Endpoint work in Google APIs Explorer but not on Android (Bad Request) Google App Engine:如何访问云端点内的会话? - Google App Engine : How can I access sessions inside a cloud endpoint? 为Google Cloud Endpoint API设置TLS代理 - Set up TLS proxy for Google Cloud Endpoint APIs 如何取消Google Cloud Endpoint端点请求 - How to cancel Google Cloud Endpoint Endpoint request
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM