spring - How to create a servlet on the fly -
for below url's receive 404 error, fine since url's not exist. possible create these servlets while server running before error page returned ?
http://127.0.0.1:8888/test1 http://127.0.0.1:8888/test1/test2
i'm thinking perhaps create generic controller intercepts urls if current servlet not exist, create ?
assuming spring
mean spring mvc
, this:
@controller public class yourcontroller { @requestmapping("/mappinga") public void methoda() { // (...) } @requestmapping("/mappingb") public void methodb() { // (...) } // catches non-matched requests. @requestmapping("/*") public void fake404(httpservletrequest request) { var uri = request.getrequesturi(); // (...) } }
Comments
Post a Comment