use of com.webobjects.foundation.NSSelector in project wonder-slim by undur.
the class ERXConfigurationManager method registerForFileNotification.
private void registerForFileNotification(String path, String callbackMethod) {
try {
ERXFileNotificationCenter.defaultCenter().addObserver(this, new NSSelector(callbackMethod, ERXUtilities.NotificationClassArray), path);
log.debug("Registered: {}", path);
} catch (Exception ex) {
log.error("An exception occured while registering the observer for the " + "logging configuration file: {} {}", ex.getClass().getName(), ex.getMessage(), ex);
}
}
use of com.webobjects.foundation.NSSelector in project wonder-slim by undur.
the class ERXUtilities method informationForContext.
private static NSMutableDictionary<String, Object> informationForContext(WOContext context) {
NSMutableDictionary<String, Object> extraInfo = new NSMutableDictionary<>();
if (context != null) {
if (context.page() != null) {
extraInfo.setObjectForKey(context.page().name(), "CurrentPage");
if (context.component() != null) {
extraInfo.setObjectForKey(context.component().name(), "CurrentComponent");
if (context.component().parent() != null) {
extraInfo.setObjectForKey(ERXWOContext.componentPath(context), "CurrentComponentHierarchy");
}
}
// If this is a D2W component, get its D2W-related information
// from ERDirectToWeb.
NSSelector d2wSelector = new NSSelector("d2wContext");
if (d2wSelector.implementedByObject(context.page())) {
try {
Class erDirectToWebClazz = Class.forName("er.directtoweb.ERDirectToWeb");
NSSelector infoSelector = new NSSelector("informationForContext", new Class[] { WOContext.class });
NSDictionary d2wExtraInfo = (NSDictionary) infoSelector.invoke(erDirectToWebClazz, context);
extraInfo.addEntriesFromDictionary(d2wExtraInfo);
} catch (Exception e) {
}
}
}
if (context.request() != null) {
extraInfo.setObjectForKey(context.request().uri(), "URL");
if (context.request().headers() != null) {
NSMutableDictionary<String, Object> headers = new NSMutableDictionary<>();
for (Object key : context.request().headerKeys()) {
String value = context.request().headerForKey(key);
if (value != null) {
headers.setObjectForKey(value, key.toString());
}
}
extraInfo.setObjectForKey(headers, "Headers");
}
}
if (context.hasSession()) {
if (context.session().statistics() != null) {
extraInfo.setObjectForKey(context.session().statistics(), "PreviousPageList");
}
extraInfo.setObjectForKey(context.session(), "Session");
}
}
return extraInfo;
}
Aggregations