LWUIT ConnectionRequest:黑莓上的错误请求

发布于 2025-01-07 20:34:32 字数 1844 浏览 0 评论 0原文

我的 lwuit 应用程序在 Blackberry Simulator 上运行良好,而在设备上应用程序安装成功并正常启动,但问题出在网络连接上。尝试访问网络时收到 400 Bad Request 消息。我不知道做错了什么,我的网络连接代码如下:

public ConnectionRequest prepareConnection(String page, String progressMsg, final int request)
{
    final ConnectionRequest conR = new ConnectionRequest()
    {
        public void readResponse(InputStream input) throws IOException  {
            StringBuffer sb = new StringBuffer();
            int ch;
            while((ch=input.read()) != -1)
                sb.append((char)ch);

            httpResponse(sb.toString().trim(), request);
        }
    };

    conR.setUrl(NetworkHandler.getURL()+page);
    conR.setDuplicateSupported(true);
    Progress progress = new Progress(progressMsg, conR)
    {
        public void actionCommand(Command command)
        {
            if(command.getCommandName().equals("Cancel"))
                conR.kill();
        }
    };
    conR.setDisposeOnCompletion(progress);

    return conR;
}

private void login(String code)
{
    Container container = Display.getInstance().getCurrent();

    if(!validateLogin(container))
    {
        showDialogMessage("Alert", "Please enter your user name and password!");
        return;
    }
    NetworkManager.getInstance().start();

    ConnectionRequest conR = prepareConnection(NetworkHandler.LOGIN_PAGE, "Authenticating...", RequestType.LOGIN);
    Dialog dialog = conR.getDisposeOnCompletion();

    conR.setPost(true);
    conR.addArgument("u", getFieldValue(findTxtUserName(container)));
    conR.addArgument("p", getFieldValue(findTxtPassword(container)));
    conR.addArgument("c", code);

    NetworkManager.getInstance().addToQueue(conR);
    dialog.show();
}

public void onLoginForm_BtnLoginAction(Component c, ActionEvent event) {
      login("");
}

请我希望你们帮助我。 提前致谢。

登录我

My lwuit application is working fine on Blackberry Simulator while on device the application installs successfully, starts normally, but where am having issues is on network connection. Trying to access network I get 400 Bad Request message. I don't no what am doing wrong, my network connection code is as below:

public ConnectionRequest prepareConnection(String page, String progressMsg, final int request)
{
    final ConnectionRequest conR = new ConnectionRequest()
    {
        public void readResponse(InputStream input) throws IOException  {
            StringBuffer sb = new StringBuffer();
            int ch;
            while((ch=input.read()) != -1)
                sb.append((char)ch);

            httpResponse(sb.toString().trim(), request);
        }
    };

    conR.setUrl(NetworkHandler.getURL()+page);
    conR.setDuplicateSupported(true);
    Progress progress = new Progress(progressMsg, conR)
    {
        public void actionCommand(Command command)
        {
            if(command.getCommandName().equals("Cancel"))
                conR.kill();
        }
    };
    conR.setDisposeOnCompletion(progress);

    return conR;
}

private void login(String code)
{
    Container container = Display.getInstance().getCurrent();

    if(!validateLogin(container))
    {
        showDialogMessage("Alert", "Please enter your user name and password!");
        return;
    }
    NetworkManager.getInstance().start();

    ConnectionRequest conR = prepareConnection(NetworkHandler.LOGIN_PAGE, "Authenticating...", RequestType.LOGIN);
    Dialog dialog = conR.getDisposeOnCompletion();

    conR.setPost(true);
    conR.addArgument("u", getFieldValue(findTxtUserName(container)));
    conR.addArgument("p", getFieldValue(findTxtPassword(container)));
    conR.addArgument("c", code);

    NetworkManager.getInstance().addToQueue(conR);
    dialog.show();
}

public void onLoginForm_BtnLoginAction(Component c, ActionEvent event) {
      login("");
}

Please I want you guys to help me out.
Thanks in Advance.

The login me

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

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

发布评论

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

评论(1

一梦等七年七年为一梦 2025-01-14 20:34:32

这通常表明设备上的 APN 配置存在问题。通常,Blackberry 应用程序会自动解决不正确的 APN 配置,这是一件非常困难的事情。 CodenameOne 可以无缝地做到这一点,但 LWUIT 却不能。

This usually indicates a problem in APN configuration on the device. Normally Blackberry app's workaround incorrect APN configurations automatically which is a pretty difficult thing to do. CodenameOne does that seamlessly but LWUIT does not.

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