首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >未使用数据存储时,对API调用datastore_v3.Put()的请求太大

未使用数据存储时,对API调用datastore_v3.Put()的请求太大
EN

Stack Overflow用户
提问于 2013-07-23 17:31:40
回答 1查看 825关注 0票数 1

com.google.apphosting.api.ApiProxy$RequestTooLargeException:对接口调用datastore_v3.Put()的请求太大。

代码语言:javascript
复制
public static List<Area> readAreas(URL url) {
    List<Area> areas = new ArrayList<Area>();
    try {
        BufferedReader br = new BufferedReader(new FileReader(new File(url.toURI())));
        String row;
        while ((row = br.readLine()) != null) {
            if (row.contains(SEARCHED_ROW)) {
                //get the part after "c"
                String coord[] = (row.split("c"));
                String startCoordM = ((coord[0].trim()).split(" "))[1];
                String curvesCoord= coord[1];

                Area area = new Area();
                area.mPoint= Point.toStartPoint(Point.readPoints(startCoordM));
                area.curves = Curve.readCurves (curvesCoord);
                areas.add(area);
            }
        }
        br.close();
    } catch (FileNotFoundException e) {
        e.printStackTrace();
    } catch (URISyntaxException e) {
        e.printStackTrace();
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    return areas;
} 

此方法运行时没有任何错误,但当我注销并登录到web应用程序的同一页面时,此方法一次又一次地运行,没有任何问题,但随后抛出了此异常。我使用的是带有jsf2和primefaces3.5的谷歌应用引擎1.8.1。此方法从托管bean中调用:

代码语言:javascript
复制
public MapMB () {
    eps = EPDAO.getEPList();
    populateAdvancedModel(eps);
    drawPolilines();
}

void drawPolilines() {
    List<Area> areas = Area.readAreas(getFacesContext().getClass().getResource("/map-inksc.svg") );

    for (Area area : areas) {

        List<Curve> curves = area.getCurves();
        Point endPoint = area.getmPoint();

        Polyline polyline = new Polyline();
        polyline.setStrokeWeight(1);  
        polyline.setStrokeColor("#FF0000");  
        polyline.setStrokeOpacity(1);

        for (Curve curve : curves) {
            polyline.getPaths().add( new LatLng(endPoint.getY(),endPoint.getX()) );
            // curve start point is the end point of previous curve (endPoint.getX(),endPoint.getY() )
            double step = 0.01;
            for (double t=0;t<= 1;t=t+step) {
                double x = getCoordFromCurve(endPoint.getX(), endPoint.getX() + curve.getP1().getX(),endPoint.getX() + curve.getP2().getX(),endPoint.getX() + curve.getP3().getX(), t);
                double y = getCoordFromCurve(endPoint.getY(), endPoint.getY() + curve.getP1().getY(),endPoint.getY() + curve.getP2().getY(),endPoint.getY() + curve.getP3().getY(), t);
                polyline.getPaths().add(  new LatLng(y, x) );
            }
            endPoint = new Point (endPoint.getX() + curve.getP3().getX(), endPoint.getY() + curve.getP3().getY());
        }
        advancedModel.addOverlay(polyline);
        polyline = new Polyline();
    }
}

当我没有读取任何数据(不要使用上面的readAreas() )时,一切都会正常工作。那么,从文件读取是如何与这个错误联系在一起的呢?我不明白。

如果有什么我没有放在这里的信息,请直接说。所有这些方法都运行时没有错误,然后抛出此异常

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-07-23 20:32:46

请参阅编辑

好的。所以..。不知怎么的,问题就解决了。多么?我没有把握。所以我有:

代码语言:javascript
复制
a.xhtml  < include b.xhtml 
c.xhtml  < include b.xhtml
a.xhtml and c.xhtml had the same method bFilterMethod()

JSF : a,b,c所有ViewScoped b都将a和c作为托管属性a.xhtml和c.xhtml具有bFilterMethod(),即来自数据库的getsSome()数据,并设置aProperty和cProperty(它们是相同的)。我在谷歌应用程序引擎日志中看到,在抛出异常之后,getsSome()方法像无限循环一样运行了大约20次。

现在,所有bean都是请求作用域

代码语言:javascript
复制
a.xhtml has aFilterMethod that getsSome() data
b.xhtml has bFilterMethod that getsSome() data
and a and b has c as Managed Property 

希望这对某些人有帮助,但我不确定确切的错误是什么,但很明显是由数据库中太大的请求引起的,不管这个请求只包含3行(这个请求被调用了太多次)

编辑这么多年后,我意外地回到了我的主题。所有这一切的真正原因是,GAE将会话保存在数据存储中,并且jsf ViewScoped bean不会像在普通java应用服务器中那样从会话中删除。所以解决方案就是不要使用ViewScoped beans

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/17806443

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档