use of com.webobjects.appserver.WOActionResults in project wonder-slim by undur.
the class AjaxSubmitButton method handleRequest.
@Override
public WOActionResults handleRequest(WORequest request, WOContext context) {
WOComponent component = context.component();
WOActionResults result = (WOActionResults) valueForBinding("action", component);
if (ERXAjaxApplication.isAjaxReplacement(request)) {
AjaxUtils.setPageReplacementCacheKey(context, (String) valueForBinding("replaceID", component));
} else if (result == null || booleanValueForBinding("ignoreActionResponse", false, component)) {
WOResponse response = AjaxUtils.createResponse(request, context);
String onClickServer = (String) valueForBinding("onClickServer", component);
if (onClickServer != null) {
AjaxUtils.appendScriptHeaderIfNecessary(request, response);
response.appendContentString(onClickServer);
AjaxUtils.appendScriptFooterIfNecessary(request, response);
}
result = response;
} else {
String updateContainerID = AjaxUpdateContainer.updateContainerID(this, component);
if (updateContainerID != null) {
AjaxUtils.setPageReplacementCacheKey(context, updateContainerID);
}
}
return result;
}
use of com.webobjects.appserver.WOActionResults in project wonder-slim by undur.
the class ERXAjaxApplication method invokeAction.
/**
* Overridden to allow for redirected responses.
*/
@Override
public WOActionResults invokeAction(WORequest request, WOContext context) {
WOActionResults results = super.invokeAction(request, context);
// wrong
if (ERXAjaxApplication.shouldNotStorePage(context)) {
if (shouldIgnoreResults(request, context, results)) {
results = null;
}
if (results == null && !ERXAjaxApplication.isAjaxReplacement(request)) {
WOResponse response = context.response();
if (_responseDelegate != null) {
results = _responseDelegate.handleNullActionResults(request, response, context);
response = context.response();
}
// MS: We were removing headers, and I really don't know WHY. It was causing AUC's
// inside of AjaxModalDialogs to break ... ERXAjaxSession is already cleaning up
// headers at the end, so this seems very odd to me. If you remove headers here,
// it causes ERXAjaxSession to not treat the response like an Ajax response.
// ERXAjaxApplication.cleanUpHeaders(response);
results = response;
}
}
return results;
}
use of com.webobjects.appserver.WOActionResults in project wonder-slim by undur.
the class ERXWOForm method invokeAction.
@Override
public WOActionResults invokeAction(WORequest worequest, WOContext context) {
boolean wasInForm = context.isInForm();
WOActionResults result;
if (_shouldAppendFormTags(context, wasInForm)) {
boolean wasFormSubmitted = context.wasFormSubmitted();
_enterFormInContext(context);
boolean wasMultipleSubmitForm = context.isMultipleSubmitForm();
String enctype = _enctype(context);
if (enctype != null) {
_setEnctype(enctype);
}
context.setActionInvoked(false);
context.setIsMultipleSubmitForm(_multipleSubmit == null ? false : _multipleSubmit.booleanValueInComponent(context.component()));
String previousFormName = _setFormName(context, wasInForm);
try {
result = super.invokeAction(worequest, context);
if (!wasInForm && !context.wasActionInvoked() && context.wasFormSubmitted()) {
if (_action != null) {
result = (WOActionResults) _action.valueInComponent(context.component());
}
if (result == null && !ERXAjaxApplication.isAjaxSubmit(worequest)) {
result = context.page();
}
}
} finally {
context.setIsMultipleSubmitForm(wasMultipleSubmitForm);
_exitFormInContext(context, wasInForm, wasFormSubmitted);
_clearFormName(context, previousFormName, wasInForm);
_clearEnctype();
}
} else {
result = super.invokeAction(worequest, context);
}
return result;
}
use of com.webobjects.appserver.WOActionResults in project wonder-slim by undur.
the class ERXWOHyperlink method invokeAction.
/**
* Overridden to perform the logging, propagating the action to subelements and returning the
* current page if an empty page is returned from super.
*/
@Override
public WOActionResults invokeAction(WORequest request, WOContext context) {
WOActionResults result = super.invokeAction(request, context);
if (result != null && (result instanceof WONoContentElement)) {
result = context.page();
}
if (result == null) {
String sender = context.senderID();
String element = context.elementID();
if (sender.startsWith(element) && !element.equals(sender)) {
result = invokeChildrenAction(request, context);
}
}
if (result != null && ERXSession.anySession() != null) {
ERXSession.anySession().setObjectForKey(toString(), "ERXActionLogging");
}
return result;
}
use of com.webobjects.appserver.WOActionResults in project wonder-slim by undur.
the class ERXWORepetition method invokeAction.
@Override
public WOActionResults invokeAction(WORequest worequest, WOContext wocontext) {
WOComponent wocomponent = wocontext.component();
Context repetitionContext = createContext(wocomponent);
int count = _count(repetitionContext, wocomponent);
WOActionResults woactionresults = null;
String indexString = _indexOfChosenItem(worequest, wocontext);
int index = 0;
boolean checkHashCodes = checkHashCodes(wocomponent);
if (indexString != null && !checkHashCodes) {
index = Integer.parseInt(indexString);
}
if (indexString != null) {
if (_item != null) {
Object object = null;
if (checkHashCodes) {
boolean found = false;
if (_uniqueKey == null) {
int hashCode = Integer.parseInt(indexString);
int otherHashCode = 0;
for (int i = 0; i < repetitionContext.count() && !found; i++) {
Object o = repetitionContext.objectAtIndex(i);
otherHashCode = hashCodeForObject(wocomponent, o);
if (otherHashCode == hashCode) {
object = o;
index = i;
found = true;
}
}
if (found) {
log.debug("Found object: {} vs {}", otherHashCode, hashCode);
} else {
log.warn("Wrong object: {} vs {} (array = {})", otherHashCode, hashCode, repetitionContext.nsarray);
}
} else {
String key = indexString;
String otherKey = null;
for (int i = 0; i < repetitionContext.count() && !found; i++) {
Object o = repetitionContext.objectAtIndex(i);
otherKey = keyForObject(wocomponent, o);
if (otherKey.equals(key)) {
object = o;
index = i;
found = true;
}
}
if (found) {
log.debug("Found object: {} vs {}", otherKey, key);
} else {
log.warn("Wrong object: {} vs {} (array = {})", otherKey, key, repetitionContext.nsarray);
}
}
if (!found) {
if (raiseOnUnmatchedObject(wocomponent)) {
throw new UnmatchedObjectException();
}
if (_notFoundMarker == null) {
return wocontext.page();
}
object = _notFoundMarker.valueInComponent(wocomponent);
}
} else {
if (index >= repetitionContext.count()) {
if (raiseOnUnmatchedObject(wocomponent)) {
throw new UnmatchedObjectException();
}
return wocontext.page();
}
object = repetitionContext.objectAtIndex(index);
}
_item._setValueNoValidation(object, wocomponent);
}
if (_index != null) {
_index._setValueNoValidation(index, wocomponent);
}
wocontext.appendElementIDComponent(indexString);
log.debug("invokeAction: {}", wocontext.elementID());
woactionresults = super.invokeAction(worequest, wocontext);
wocontext.deleteLastElementIDComponent();
} else {
for (int i = 0; i < count && woactionresults == null; i++) {
_prepareForIterationWithIndex(repetitionContext, i, wocontext, wocomponent, checkHashCodes);
woactionresults = super.invokeAction(worequest, wocontext);
}
if (count > 0) {
_cleanupAfterIteration(count, wocontext, wocomponent);
}
}
return woactionresults;
}
Aggregations