I am hosting my Backend on Google App Engine and the Rest API works well on localhost. The method url is as follows:
http://127.0.0.1:8888/rest/plans/getplans/242353
This works on local host and returns me a JSON response properly. It's a GET method and 242353 is the parameter I pass to the method.
But when I publish it to my Google Cloud, after I attempt to call it on my browser with the following URL:
http://2-dot-MY_APP_DOMAIN.appspot.com/rest/plans/getplans/242353
I get this error on my browser:
Error: Not Found
The requested URL /rest/plans/getplans/242353 was not found on this server.
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5"
xmlns="http://java.sun.com/xml/ns/javaee">
<servlet>
<servlet-name>Jersey Web Application</servlet-name>
<servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>com.sun.jersey.config.property.packages</param-name>
<param-value>com.dinukapj.socialapp.api</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Jersey Web Application</servlet-name>
<url-pattern>/resources/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Jersey Web Application</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>
</web-app>
Why does this happen? Do I need to add any other information to my web.xml?
尝试按web.xml中的定义访问/ resources / plans / getplans / 242353
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.