use of com.opensymphony.xwork2.ActionContext in project onebusaway-application-modules by camsys.
the class IndexTemplate method buildTemplate.
@Override
public void buildTemplate(ActionContext context) {
ValueStack stack = context.getValueStack();
UserBean user = (UserBean) stack.findValue("currentUser");
if (user.getDefaultLocationName() != null) {
addMessage(Messages.SETTINGS_YOUR_DEFAULT_SEARCH_LOCATION_IS_CURRENTLY);
addText(_locationPronunciation.modify(user.getDefaultLocationName()));
}
addMessage(Messages.INDEX_ACTION_SET_DEFAULT_SEARCH_LOCATION);
addAction("1", "/settings/askForDefaultSearchLocation");
if (user != null) {
if (user.isRememberPreferencesEnabled())
addMessage(Messages.PREFERENCES_DO_NOT_REMEMBER);
else
addMessage(Messages.PREFERENCES_DO_REMEMBER);
addAction("2", "/settings/setRememberPreferences", "enabled", !user.isRememberPreferencesEnabled());
}
addMessage(Messages.HOW_TO_GO_BACK);
addAction("\\*", "/back");
addMessage(Messages.TO_REPEAT);
addAction("[#23456789*]", "/repeat");
}
use of com.opensymphony.xwork2.ActionContext in project onebusaway-application-modules by camsys.
the class CustomAgiEntryPoint method onActionSetup.
@Override
protected void onActionSetup(Map<String, Object> contextMap) {
super.onActionSetup(contextMap);
String sessionId = UUID.randomUUID().toString();
XWorkRequestAttributes attributes = new XWorkRequestAttributes(new ActionContext(contextMap), sessionId);
RequestContextHolder.setRequestAttributes(attributes);
}
use of com.opensymphony.xwork2.ActionContext in project onebusaway-application-modules by camsys.
the class MessageTemplateDispatcher method executeTemplate.
@Override
protected AgiActionName executeTemplate(ActionContext context, AgiTemplate template) throws Exception {
if (_message != null) {
ValueStack stack = context.getValueStack();
MessageSource source = new MessageSource(_message, _nextAction);
stack.push(source);
}
return super.executeTemplate(context, template);
}
use of com.opensymphony.xwork2.ActionContext in project onebusaway-application-modules by camsys.
the class MessageAndBackTemplate method buildTemplate.
@Override
public void buildTemplate(ActionContext context) {
ValueStack stack = context.getValueStack();
String message = stack.findString("message");
String nextAction = stack.findString("nextAction");
if (message != null)
addMessage(message);
else
System.err.println("no message specified");
if (nextAction != null) {
setNextAction(nextAction);
} else {
addAction(".*\\*", "/back");
setNextAction("/back");
}
}
use of com.opensymphony.xwork2.ActionContext in project onebusaway-application-modules by camsys.
the class ResourceUrlComponent method end.
@Override
public boolean end(Writer writer, String body) {
if (_value == null)
_value = "top";
String value = findStringIfAltSyntax(_value);
Locale locale = Locale.getDefault();
ActionContext ctx = ActionContext.getContext();
if (ctx != null)
locale = ctx.getLocale();
String url = _resourceService.getExternalUrlForResource(value, locale);
if (url != null) {
if (getVar() != null) {
/**
* We either write the url out to a variable
*/
putInContext(url);
} else {
/**
* Or otherwise print out the url directly
*/
try {
writer.write(url);
} catch (IOException e) {
LOG.error("Could not write out resource-url tag", e);
}
}
}
return super.end(writer, "");
}
Aggregations