use of com.webobjects.appserver.WOResponse in project wonder-slim by undur.
the class ERXComponentRequestHandler method handleRequest.
@Override
public WOResponse handleRequest(WORequest aRequest) {
WOApplication anApplication = WOApplication.application();
Object globalLock = anApplication.requestHandlingLock();
WOResponse aResponse;
if (globalLock != null) {
synchronized (globalLock) {
aResponse = _handleRequest(aRequest);
}
} else {
aResponse = _handleRequest(aRequest);
}
return aResponse;
}
use of com.webobjects.appserver.WOResponse in project wonder-slim by undur.
the class ERXComponentRequestHandler method _dispatchWithPreparedPage.
private WOResponse _dispatchWithPreparedPage(WOComponent aPage, WOSession aSession, WOContext aContext, NSDictionary someElements) {
WORequest aRequest = aContext.request();
WOApplication anApplication = WOApplication.application();
WOResponse aResponse = anApplication.createResponseInContext(aContext);
String aSenderID = aContext.senderID();
String oldContextID = aSession._contextIDMatchingIDs(aContext);
aResponse.setHTTPVersion(aRequest.httpVersion());
aResponse.setHeader("text/html", "content-type");
aContext._setResponse(aResponse);
if (oldContextID == null) {
if (aSenderID != null) {
if (aRequest._hasFormValues()) {
anApplication.takeValuesFromRequest(aRequest, aContext);
}
}
aContext._setPageChanged(false);
if (aSenderID != null) {
WOActionResults anActionResults = anApplication.invokeAction(aRequest, aContext);
if ((anActionResults == null) || ((anActionResults instanceof WOComponent))) {
WOComponent aResultComponent = (WOComponent) anActionResults;
if ((aResultComponent != null) && (aResultComponent.context() != aContext)) {
aResultComponent._awakeInContext(aContext);
}
boolean didPageChange = false;
if ((aResultComponent != null) && (aResultComponent != aContext._pageElement())) {
didPageChange = true;
}
aContext._setPageChanged(didPageChange);
if (didPageChange) {
aContext._setPageElement(aResultComponent);
}
} else {
WOResponse theResponse = anActionResults.generateResponse();
return theResponse;
}
}
} else {
WOComponent responsePage = _restorePageForContextID(oldContextID, aSession);
aContext._setPageElement(responsePage);
}
anApplication.appendToResponse(aResponse, aContext);
return aResponse;
}
use of com.webobjects.appserver.WOResponse in project wonder-slim by undur.
the class ERXJavaScript method appendAttributesToResponse.
@Override
public void appendAttributesToResponse(WOResponse woresponse, WOContext wocontext) {
WOComponent wocomponent = wocontext.component();
woresponse._appendContentAsciiString(" type=\"text/javascript\"");
String framework = null;
String scriptName = null;
String src = null;
if (_scriptSource != null || _filename != null) {
String srcFromBindings;
if (_scriptSource != null) {
srcFromBindings = (String) _scriptSource.valueInComponent(wocomponent);
} else {
srcFromBindings = (String) _filename.valueInComponent(wocomponent);
}
if (srcFromBindings != null) {
if (!WOStaticURLUtilities.isRelativeURL(srcFromBindings)) {
src = srcFromBindings;
} else {
if (!WOStaticURLUtilities.isFragmentURL(srcFromBindings)) {
if (_scriptFramework != null) {
framework = (String) _scriptFramework.valueInComponent(wocomponent);
} else if (_framework != null) {
framework = (String) _framework.valueInComponent(wocomponent);
}
scriptName = srcFromBindings;
src = wocontext._urlForResourceNamed(srcFromBindings, framework, true);
if (src == null) {
src = wocomponent.baseURL() + "/" + srcFromBindings;
} else if (ERXResourceManager._shouldGenerateCompleteResourceURL(wocontext)) {
src = ERXResourceManager._completeURLForResource(src, null, wocontext);
}
} else {
log.warn("relative fragment URL {}", srcFromBindings);
}
}
}
}
Object key = null;
if (src == null && _scriptKey != null) {
key = _scriptKey.valueInComponent(wocomponent);
if (key != null) {
ERXExpiringCache<Object, WOResponse> cache = ERXJavaScript.cache(wocontext.session());
boolean render = cache.isStale(key);
render |= ERXApplication.isDevelopmentModeSafe();
if (render) {
WOResponse newresponse = new WOResponse();
super.appendChildrenToResponse(newresponse, wocontext);
newresponse.setHeader("application/x-javascript", "content-type");
cache.setObjectForKey(newresponse, key);
}
src = wocontext.directActionURLForActionNamed(Script.class.getName() + "/" + key, null);
}
}
if (src != null) {
woresponse._appendContentAsciiString(" src=\"");
woresponse.appendContentString(src);
woresponse.appendContentCharacter('"');
}
super.appendAttributesToResponse(woresponse, wocontext);
if (scriptName != null) {
ERXResponseRewriter.resourceAddedToHead(wocontext, framework, scriptName);
}
}
Aggregations