Delete v1 in endpoint url

0

I am using GAE to generate Servlets and everything works perfectly, however, the route of the endpoints always adds a "v1" which I want to remove, this is an example of how the route is:

  

link

and I want it to be as follows:

  

link

but I do not know how to achieve it.

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>

MyApi.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;
}
}
    
asked by gibran alexis moreno zuñiga 14.12.2017 в 18:17
source

2 answers

0

To achieve this I had to add the path manually as follows:

@ApiMethod(..., path = "/test/imprimirPersona")
    
answered by 15.12.2017 / 19:33
source
0

According to the Google documentation , the @Api annotation has an optional attribute called defaultVersion whose default value is true :

  

Specify whether a default version is used if none is supplied in the   version attribute.

In principle, if this value is false , no default value should be used as a version.

    
answered by 15.12.2017 в 15:43