To make the endpoints work, need follow the steps stated in the Google GAE page
Write your API backend code first.
Annotate your API backend code, so classes and client libraries can be generated from it. (Alternatively, use the Google Plugin for Eclipse, which annotates automatically for you.)
Generate the client library using the endpoints.sh utility. (Alternatively, use the Google Plugin for Eclipse to generate the client library.)
Write your client app, using the client library when making calls to the API backend.
But the above steps miss out some important steps, which the Google Plugins (Google Plugin for Eclipse) will generated for you automatically.
Configure the servlet in your web.xml. (Replace the your-full-class-name with your own class name)
<servlet>
<servlet-name>com.google.api.server.spi.SystemServiceServlet</servlet-name>
<servlet-class>com.google.api.server.spi.SystemServiceServlet</servlet-class>
<init-param>
<param-name>services</param-name>
<param-value>your-full-class-name</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>com.google.api.server.spi.SystemServiceServlet</servlet-name>
<url-pattern>/_ah/spi/*</url-pattern>
</servlet-mapping>
you need ensure the file (.api) generated by the endpoints.sh is copied into the folder WEB-INF in your web app root folder.
For better understanding, you can invoke the endpoints.sh to see all the available options as the following
Available commands:
get-client-lib: Generates a client library
usage: get-client-lib ...
Options:
--classpath=CLASSPATH Additional class path entries
-cp CLASSPATH (default: ./war/WEB-INF/classes).
--language=LANGUAGE The target output programming language
-l LANGUAGE (java) (default: java).
--output=OUTPUT_DIR The directory to store output files
-o OUTPUT_DIR (default: ./).
--war=WAR_PATH The path to a directory or .war with a WAR
-w WAR_PATH directory layout (default: ./war).
gen-api-config: Generates API configuration files from service classes
usage: gen-api-config ...
Options:
--classpath=CLASSPATH Additional class path entries
-cp CLASSPATH (default: ./war/WEB-INF/classes).
--output=OUTPUT_DIR The directory to store output files
-o OUTPUT_DIR (default: ./).
--war=WAR_PATH The path to a directory or .war with a WAR
-w WAR_PATH directory layout (default: ./war).
gen-discovery-doc: Generates API Discovery document
usage: gen-discovery-doc
Options:
--format=FORMAT The requested API protocol type (rest|rpc)
-f FORMAT (default: rest).
--output=OUTPUT_DIR The directory to store output files
-o OUTPUT_DIR (default: ./).
gen-client-lib: Generates a client library
usage: gen-client-lib
Options:
--language=LANGUAGE The target output programming language
-l LANGUAGE (java) (default: java).
--output=OUTPUT_DIR The directory to store output files
-o OUTPUT_DIR (default: ./).
Then you are able to view the services in the explorer UI as the following.
when you access the http: //localhost:8080/_ah/api/explorer, it will be redirected to the developers.google.com first. But the contents is from the localhost.
You can always rely on your normal Google APE local development server. For example, IntelliJ Google APE plugin start the Google APE local server also can support the "_ah/api/explorer" access
