<servlet>
<servlet-name>JSON Web Service Servlet</servlet-name>
<servlet-class>com.liferay.portal.kernel.servlet.PortalClassLoaderServlet</servlet-class>
<init-param>
<param-name>servlet-class</param-name>
<param-value>com.liferay.portal.jsonwebservice.JSONWebServiceServlet</param-value>
</init-param>
<load-on-startup>0</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>JSON Web Service Servlet</servlet-name> 重点是这个不要写错,我就是这个错了差点没搞出来。
<url-pattern>/api/jsonws/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>JSON Web Service Servlet</servlet-name>
<url-pattern>/api/secure/jsonws/*</url-pattern>
<servlet-name>JSON Web Service Servlet</servlet-name>
<servlet-class>com.liferay.portal.kernel.servlet.PortalClassLoaderServlet</servlet-class>
<init-param>
<param-name>servlet-class</param-name>
<param-value>com.liferay.portal.jsonwebservice.JSONWebServiceServlet</param-value>
</init-param>
<load-on-startup>0</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>JSON Web Service Servlet</servlet-name> 重点是这个不要写错,我就是这个错了差点没搞出来。
<url-pattern>/api/jsonws/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>JSON Web Service Servlet</servlet-name>
<url-pattern>/api/secure/jsonws/*</url-pattern>
</servlet-mapping>
http://localhost:8080/book-portlet/api/jsonws/然后可以访问了。book-portlet 是自己建立的portlet 名
否则总会出现 没有token