我使用Java編寫App Engine應用程序。我想讓我的URL看起來好得多,因爲ASP.NET上的URL路由。這是我的web.xml如何使用Java JSP從routing-url Google App Engine獲取參數
<servlet>
<servlet-name>test</servlet-name>
<jsp-file>/test.jsp</jsp-file>
</servlet>
<servlet-mapping>
<servlet-name>test</servlet-name>
<url-pattern>/test/*</url-pattern>
</servlet-mapping>
當我鍵入http://localhost:8888/test/123它爲我工作,我用request.getPathInfo()
獲得的*
值寄回/123
,所以我不得不刪除被/
它替換爲空焦炭。如果輸入http://localhost:8888/test/abc/123則返回/ abc/123,但是我想要的值僅爲abc
有沒有更好的方法或模式或庫來解決此問題?
使用spring來構建服務 - https://spring.io/guides/gs/rest-service – Mithun
我在這裏閱讀了關於spring的內容,並且我認爲不要使用spring。 https://cloud.google.com/appengine/articles/spring_optimization –