// strip of the query string - some servers leave this on
actionName = actionName.substring(0, actionName.indexOf("?"));
}
int index = actionName.lastIndexOf("/");
actionName = actionName.substring(index + 1, (actionName.length() - actionExtension.length()));
Action action;
try {
log.debug("Action is " + actionName);
action = actionFactory.getAction(actionName);
} catch (ActionNotFoundException anfe) {
log.warn(anfe.getMessage());
response.sendError(HttpServletResponse.SC_NOT_FOUND);
return;
}
boolean authorised = isAuthorised(request, action);
if (!authorised) {
response.sendError(HttpServletResponse.SC_FORBIDDEN);
} else {
boolean validated = securityTokenValidator.validateSecurityToken(request, response, action);
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();