使用部署的数据库在本地主机上进行调 [英] debug in localhost using deployed database

查看:115
本文介绍了使用部署的数据库在本地主机上进行调的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Google Eclipse插件,使用GWT + GAE / Java开发网页。
我想用本地GWT代码在本地主机中进行调试,但希望在我实际部署的网页中使用该数据库。

I use Google Eclipse Plugin, develop a web page using GWT + GAE/Java. I would like to debug in localhost with the local GWT code but want to use the database in my actual deployed web page.

是否有可能?

推荐答案

过滤器无法正常工作使用RemoteServiceServlet将它们添加到您的RemoteServiceServlet中:

Filter doesn't work well with RemoteServiceServlets so add these to your RemoteServiceServlet:

RemoteApiOptions options;
RemoteApiInstaller installer;

@Override
protected void onBeforeRequestDeserialized(String serializedRequest) {
    if (getThreadLocalRequest().getRequestURL().indexOf("127.0.0.1") != -1) {
        if (options == null) {
            options = new RemoteApiOptions().server("example.appspot.com", 443).credentials("username",
                    "password");
            installer = new RemoteApiInstaller();
            try {
                installer.install(options);
                options.reuseCredentials("username", installer.serializeCredentials());
            }
            catch (IOException e) {
                e.printStackTrace();
            }
        }
        else {
            installer = new RemoteApiInstaller();
            try {
                installer.install(options);
            }
            catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}

@Override
protected void onAfterResponseSerialized(String serializedResponse) {
    if (getThreadLocalRequest().getRequestURL().indexOf("127.0.0.1") != -1)
        installer.uninstall();
}

这篇关于使用部署的数据库在本地主机上进行调的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆