Cloud Endpoints为作为命名参数传递的特殊字符生成HTTP 404

时间:2013-07-24 23:18:14

标签: java google-app-engine google-cloud-endpoints

我用一个HTTP GET方法创建了非常简单的端点。我正在传递一个字符串作为ApiMethod命名参数:

@Api (name = "sample_endpoint")
public class SampleEndpoint
{
    public Entity get(@Named("parameter") String parameter)
    {
        return new Entity(parameter);
    }

    public class Entity
    {
        public String parameter = "Validated ok.";
        public Entity(String parameter) { this.parameter = parameter; }
        public String getParameter() { return parameter; }
    }
}

当我使用包含字母和数字的参数以及一些特殊字符(例如-.)调用URL时,它可以正常工作:

GET http://localhost:8888/_ah/api/sample_endpoint/v1/entity/passedparam

200 OK
{
 "parameter": "passedparam"
}

但是当我将某些特殊字符插入参数时,如:#/,我得到HTTP 404.参数是URL编码的,例如我使用的是值passed:param

GET http://localhost:8888/_ah/api/sample_endpoint/v1/entity/passed%3Aparam

404 Not Found
<html><head><title>Error 404</title></head>
<body><h2>Error 404</h2></body>
</html>

是错误还是功能?或许我做错了?

2 个答案:

答案 0 :(得分:1)

自App Engine SDK 1.8.6起已解决此问题

答案 1 :(得分:0)

现在正在this issue report中讨论这个问题。由于dev和prod的行为不同,这里肯定存在一个错误。我怀疑你正在尝试做的事情应该在dev和prod中工作,并且本地服务器中存在一个错误。