我用一个http get方法创建了非常简单的端点。我将一个字符串作为名为parameter的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"
}
但是当我在参数中插入某些特殊字符时,比如
:#/
,我得到的是htp404。参数是url编码的,在示例中我使用的是valuepassed: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>
是bug还是feature?或者我做错了?
最佳答案
从appenginesdk1.8.6开始,这个问题已经解决了