Я создаю API для своего веб-приложения, которое выполняется на сервере tomcat, чтобы сделать CRUD REST API
, как Prestashop, но я не знать, как добавить идентификаторы таблицы в URL-адрес.Могу ли я добавить <server-mapping> во время выполнения на сервере tomcat
Так что, когда вы идете к клиентам (http://yourUrl.com/api/customers
) вы получите ответ:
<prestashop xmlns:xlink="http://www.w3.org/1999/xlink">
<customers>
<customer id="1" xlink:href="http://yourUrl.com/api/customers/1"/>
<customer id="2" xlink:href="http://yourUrl.com/api/customers/2"/>
<customer id="3" xlink:href="http://yourUrl.com/api/customers/3"/>
<customer id="4" xlink:href="http://yourUrl.com/api/customers/4"/>
<customer id="5" xlink:href="http://yourUrl.com/api/customers/5"/>
<customer id="6" xlink:href="http://yourUrl.com/api/customers/6"/>
<customer id="7" xlink:href="http://yourUrl.com/api/customers/7"/>
<customer id="8" xlink:href="http://yourUrl.com/api/customers/8"/>
<customer id="9" xlink:href="http://yourUrl.com/api/customers/9"/>
<customer id="10" xlink:href="http://yourUrl.com/api/customers/10"/>
<customer id="11" xlink:href="http://yourUrl.com/api/customers/11"/>
</customers>
</prestashop>
И тогда вы можете пойти в http://yourUrl.com/api/customers/1
тогда мой план, чтобы добавить сервлет с несколькими отображениями, я нашел как сервлеты объявлений, но не сопоставления во время выполнения.
Как это сделать?