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

时间:2022-03-31 20:20:03

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

谢谢

1 个解决方案

#1


2  

You can add a parameter of type HttpServletRequest to the method.

您可以向方法添加类型为HttpServletRequest的参数。

See also this question.

另见这个问题。

#1


2  

You can add a parameter of type HttpServletRequest to the method.

您可以向方法添加类型为HttpServletRequest的参数。

See also this question.

另见这个问题。