use of com.opensymphony.xwork2.ActionContext in project onebusaway-application-modules by camsys.
the class ResourceUrlFunction method getExternalUrlForResource.
public String getExternalUrlForResource(String resourcePath) {
Locale locale = Locale.getDefault();
ActionContext ctx = ActionContext.getContext();
if (ctx != null)
locale = ctx.getLocale();
return _resourceService.getExternalUrlForResource(resourcePath, locale);
}
use of com.opensymphony.xwork2.ActionContext in project qi4j-sdk by Qi4j.
the class ConstraintViolationInterceptor method intercept.
@Override
public String intercept(ActionInvocation invocation) throws Exception {
ActionContext invocationContext = invocation.getInvocationContext();
ValueStack stack = invocationContext.getValueStack();
Object action = invocation.getAction();
if (action instanceof ValidationAware) {
ValidationAware va = (ValidationAware) action;
HashMap<Object, Object> propertyOverrides = new HashMap<Object, Object>();
for (Map.Entry<String, FieldConstraintViolations> fieldViolations : fieldConstraintViolations(invocationContext).entrySet()) {
addConstraintViolationFieldErrors(stack, va, fieldViolations.getKey(), fieldViolations.getValue());
propertyOverrides.put(fieldViolations.getKey(), getOverrideExpr(invocation, fieldViolations.getValue()));
}
// if there were some errors, put the original (fake) values in place right before the result
if (!propertyOverrides.isEmpty()) {
overrideActionValues(invocation, stack, propertyOverrides);
}
}
return invocation.invoke();
}
Aggregations