黑莓用户代理只能通过浏览器发送吗?

发布于 2024-11-15 16:05:57 字数 179 浏览 2 评论 0原文

我想问HTTP请求头中的User-Agent属性是否只能通过浏览器发送?

当我从黑莓应用程序发送 http/https 请求时,http 标头中似乎没有包含用户代理。

非常感谢!

另外,如果无法从请求中获取用户代理,我们是否能够从 Blackberry 设备获取用户代理?

谢谢!

I would like to ask wheter the User-Agent property in the HTTP request header only sent via browser?

When I send a http/https request from a blackberry application, it seems there is no user-agent contains in the http header.

Thanks very much!

Also, if it is not possible to get the user agent from the request, are we able to get the user agent from Blackberry device?

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

苹果你个爱泡泡 2024-11-22 16:05:57

不,如果您在应用程序中使用 javax.microedition.io.HttpConnection,则不会自动发送 User-Agent。

相反,使用
<代码>

 HttpConnection con = (HttpConnection)Connector.open(myURL, 
                                         Connector.READ_WRITE, true);

con.setRequestProperty(HttpProtocolConstants.HEADER_USER_AGENT, “MyBlackberryApplication/1.0”); ...

If you need information about the device to send along the agent string, all of it (OS version, device etc.) is accessible via BlackBerry API: look at this class: net.rim.device.api.system.DeviceInfo

No, User-Agent is not sent automatically if you use javax.microedition.io.HttpConnection from within your application.

Instead, use

 HttpConnection con = (HttpConnection)Connector.open(myURL, 
                                         Connector.READ_WRITE, true);

con.setRequestProperty(HttpProtocolConstants.HEADER_USER_AGENT, "MyBlackberryApplication/1.0"); ...


If you need information about the device to send along the agent string, all of it (OS version, device etc.) is accessible via BlackBerry API: look at this class: net.rim.device.api.system.DeviceInfo

霊感 2024-11-22 16:05:57

对于未签名的 j2me 应用程序,您无法设置用户代理,并且它将始终是
UNTRUSTED/1.0

http://www.j2megame.org/j2meapi/JSR_271_Mobile_Information_Device_Profile_3_0/javax/microedition/io/package-summary.html

此行为针对身份不明的人
域应用程序指定于
移动服务架构(JSR
[248] 248) 规范

For unsigned j2me applications you can't set the user-agent and it will always be
UNTRUSTED/1.0

http://www.j2megame.org/j2meapi/JSR_271_Mobile_Information_Device_Profile_3_0/javax/microedition/io/package-summary.html

This behavior for the Unidentified
domain applications is specified in
the Mobile Service Architecture (JSR
248) specification

二手情话 2024-11-22 16:05:57

是的,根据Java文档(javax.microedition.io
),除非您设置它,否则似乎不会自动包含用户代理。

应用程序负责
格式化并要求
HTTP 中包含 User-Agent 字段
通过 setRequestProperty 请求
接口中的方法

http://www.j2megame.org/j2meapi/JSR_271_Mobile_Information_Device_Profile_3_0/javax/microedition/io/package-summary.html

Yes, according to the Java document (javax.microedition.io
), it seems that user-agent is not automatically included unless you set it.

The application is responsible for
formatting and requesting that the
User-Agent field be included in HTTP
requests via the setRequestProperty
method in the interface

http://www.j2megame.org/j2meapi/JSR_271_Mobile_Information_Device_Profile_3_0/javax/microedition/io/package-summary.html

尬尬 2024-11-22 16:05:57

将 WTK-Edit-Preference-Security-Security 域中的级别从不可信设置为最大有助于解决 http 请求中的“不可信”用户代理问题。

对于未签名的 j2me 应用程序,您无法设置用户代理,并且它将始终为 UNTRUSTED/1.0

Turn the level from untrusted to maximum in WTK-Edit-Preference-Security-Security domain can be helpful to the "untrusted" user-agent problem in http requests.

For unsigned j2me applications you can't set the user-agent and it will always be UNTRUSTED/1.0

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文