use of com.opensymphony.xwork2.ActionContext in project onebusaway-application-modules by camsys.
the class ApiKeyInterceptor method isAllowed.
private ApiKeyPermissionService.Status isAllowed(ActionInvocation invocation) {
ActionContext context = invocation.getInvocationContext();
Map<String, Object> parameters = context.getParameters();
String[] keys = (String[]) parameters.get("key");
if (keys == null || keys.length == 0)
return ApiKeyPermissionService.Status.UNAUTHORIZED;
return _keyService.getPermission(keys[0], "api");
}
use of com.opensymphony.xwork2.ActionContext in project onebusaway-application-modules by camsys.
the class VehicleStatusMapAction method execute.
@Override
public String execute() {
ActionContext context = ActionContext.getContext();
ActionInvocation invocation = context.getActionInvocation();
ActionProxy proxy = invocation.getProxy();
String name = proxy.getActionName().toLowerCase();
String namespace = proxy.getNamespace().toLowerCase();
// return the 404 message if so. There has to be a better way than this?
if ((name.equals("") || name.equals("index")) && (namespace.equals("") || namespace.equals("/"))) {
return SUCCESS;
}
return "NotFound";
}
use of com.opensymphony.xwork2.ActionContext in project onebusaway-application-modules by camsys.
the class NextActionSupport method getNextActionOrSuccess.
protected String getNextActionOrSuccess() {
List<NextAction> stack = getNextActionStack(false);
if (stack == null || stack.isEmpty())
return SUCCESS;
NextAction next = stack.remove(stack.size() - 1);
Map<String, String[]> params = next.getParameters();
if (params != null && !params.isEmpty()) {
ActionContext context = ActionContext.getContext();
Map<String, Object> contextParameters = context.getParameters();
contextParameters.putAll(params);
}
return next.getAction();
}
use of com.opensymphony.xwork2.ActionContext in project onebusaway-application-modules by camsys.
the class IntegrationTestingInterceptor method intercept.
@Override
public String intercept(ActionInvocation invocation) throws Exception {
ActionContext context = invocation.getInvocationContext();
AgiRequest request = AgiEntryPoint.getAgiRequest(context);
Map<?, ?> r = request.getRequest();
/**
* This interceptor will be called multiple times in the course of
* processing the actions for a call, so we only check the reset user param
* once
*/
Object value = r.remove(RESET_USER);
if (value != null && value.equals("true"))
context.getParameters().put(PhoneNumberLoginInterceptor.RESET_USER, Boolean.TRUE);
return invocation.invoke();
}
use of com.opensymphony.xwork2.ActionContext in project onebusaway-application-modules by camsys.
the class ArrivalsAndDeparturesTemplate method buildTemplate.
@Override
public void buildTemplate(ActionContext context) {
ValueStack valueStack = context.getValueStack();
PhoneArrivalsAndDeparturesModel model = (PhoneArrivalsAndDeparturesModel) valueStack.findValue("model");
StopsWithArrivalsAndDeparturesBean result = model.getResult();
buildPredictedArrivalsTemplate(result.getArrivalsAndDepartures());
addMessage(Messages.ARRIVAL_INFO_ON_SPECIFIC_ROUTE);
AgiActionName byRouteAction = addActionWithParameterFromMatch("1(\\d+)#", "/stop/arrivalsAndDeparturesForRoute", "route", 1);
byRouteAction.putParam("model", model);
addMessage(Messages.ARRIVAL_INFO_BOOKMARK_THIS_LOCATION);
AgiActionName bookmarkAction = addAction("2", "/stop/bookmark");
bookmarkAction.putParam("stops", result.getStops());
addMessage(Messages.ARRIVAL_INFO_RETURN_TO_MAIN_MENU);
addAction("3", "/index");
addAction("(#|[04-9]|1.*\\*)", "/repeat");
addMessage(Messages.HOW_TO_GO_BACK);
addAction("\\*", "/back");
addMessage(Messages.TO_REPEAT);
}
Aggregations