if (!validated) {
// Forward to no security url
request.getRequestDispatcher("/noSecurityToken.action").forward(request, response);
} else {
try {
Model model = new Model();
model.put(Constants.BLOG_KEY, blog);
model.put(Constants.BLOG_URL, blog.getUrl());
action.setModel(model);
View view;
try {
view = action.process(request, response);
} catch (ClassCastException cce) {
// PEBBLE-45 Actions intended for single blog mode should fail nicely. This is a simple method that will
// allow has to handle all actions with minimal effort
if (cce.getMessage().contains(MultiBlog.class.getName()) && cce.getMessage().contains(Blog.class.getName())) {
view = new MultiBlogNotSupportedView();
} else {
throw cce;
}
}
if (view != null) {
view.setModel(model);
view.setServletContext(servletContext);
view.prepare();
for (Object key : model.keySet()) {
request.setAttribute(key.toString(), model.get(key.toString()));
}
response.setContentType(view.getContentType());
view.dispatch(request, response, servletContext);