我使用GAE生成Servlet,一切都运行正常,但是,端点的路由总是添加一个" v1"我想删除,这是路由的示例:
https://xxxxx.appspot.com/services/test/v1/imprimirPersona?n=5
我希望它如下:
但我不知道如何实现它。
web.xml:
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">
<!-- Wrap the backend with Endpoints Frameworks v2. -->
<servlet>
<servlet-name>EndpointsServlet</servlet-name>
<servlet-class>com.google.api.server.spi.EndpointsServlet</servlet-class>
<init-param>
<param-name>services</param-name>
<param-value>com.example.skeleton.MyApi,
com.example.skeleton.Foo</param-value>
</init-param>
</servlet>
<!-- Route API method requests to the backend. -->
<servlet-mapping>
<servlet-name>EndpointsServlet</servlet-name>
<url-pattern>/services/*</url-pattern>
</servlet-mapping>
MyApy.class:
@Api(name = "test")
public class MyApi {
@ApiMethod(name = "datosPorUrl", httpMethod = "GET")
public Message datosPorUrl(Message message, @Named("n") @Nullable Integer n) {
message.setMessage("El valor recibido es : " + n);
return message;
}
@ApiMethod(name = "imprimirPersona", httpMethod = "POST")
public Message imprimirPersona(Persona persona, @Named("n") @Nullable Integer n) {
Message message = new Message();
message.setMessage("Test : El valor nombre es : " + persona.getNombre()
+ " la edad es : " + persona.getEdad());
return message;
}
}
答案 0 :(得分:1)
为您的所有func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {
if textField == firstTextField || textField == secondTextField {
return false
}
return true
}
声明添加路径参数:@ApiMethod
。领先的斜杠是关键。