import javax.servlet.http.HttpSessionIdListener;
import javax.servlet.http.HttpSessionListener;
+import org.argeo.api.cms.CmsLog;
import org.argeo.cms.jetty.CmsJettyServer;
import org.eclipse.equinox.http.servlet.HttpServiceServlet;
import org.eclipse.jetty.ee8.nested.SessionHandler;
/** A {@link CmsJettyServer} integrating with Equinox HTTP framework. */
public class EquinoxJettyServer extends CmsJettyServer {
+ private final static CmsLog log = CmsLog.getLog(EquinoxJettyServer.class);
private static final String INTERNAL_CONTEXT_CLASSLOADER = "org.eclipse.equinox.http.jetty.internal.ContextClassLoader";
@Override
thread.setContextClassLoader(contextLoader);
try {
httpServiceServlet.service(req, res);
+ } catch (IllegalStateException e) {
+ // context is probably in shutdown
+ if (log.isTraceEnabled())
+ log.error("Cannot process request", e);
} finally {
thread.setContextClassLoader(current);
}
}
public static CmsView getCmsView(Control parent) {
+ if (parent.isDisposed())
+ return null;
// find parent shell
Shell topShell = parent.getShell();
while (topShell.getParent() != null)
/** Style widget */
public static <T extends Widget> T style(T widget, String style) {
- if (style == null)
+ if (style == null || widget.isDisposed())
return widget;// does nothing
EclipseUiSpecificUtils.setStyleData(widget, style);
if (widget instanceof Control) {
public Content getCurrentContext() {
SwtSection section = getCurrentSection();
- if (section != null) {
+ if (section != null && !section.isDisposed()) {
return section.getContent();
} else {
return null;
} catch (SWTError e) {
SWTError swtError = (SWTError) e;
if (swtError.code == SWT.ERROR_FUNCTION_DISPOSED) {
- log.error("Unexpected SWT error in event loop, ignoring it. " + e.getMessage());
+ if (log.isTraceEnabled())
+ log.error("Unexpected SWT error in event loop, ignoring it. " + e.getMessage());
continue eventLoop;
} else {
log.error("Unexpected SWT error in event loop, shutting down...", e);