On Mon, 14 Nov 2016 08:25:59 GMT, Tadao Usuzaka wrote:
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { RequestDispatcher rd = null; String nextaction = request.getParameter("action"); String nexturl = (String)hm.get(nextaction); if (nexturl != null) { rd = request.getRequestDispatcher(nexturl); rd.forward(request, response); } }
}
It's pity, in vibe.d default router routes not to class instances or pages, but to lambdas or webinterface class methods. So it will be like this:
class WebInterface
{
static immutable actions[] = ["bbslist", "bbsrefer", "bbswrite", "bbswritecfm", "bbswriteok"];
void getDispatcherUrl(string action)
{
import std.algorithm: canFind;
import vibe.web.web: redirect;
if(actions.canFind(action))
redirect("./"~action);
else
// process incorrect argument
}
void getBbslist(){ ... }
void getBbsrefer(){ ... }
...
}