use of org.eclipse.jetty.server.handler.ContextHandler.Context in project blade by biezhi.
the class SecurityHandler method doStart.
/* ------------------------------------------------------------ */
/**
*/
@Override
protected void doStart() throws Exception {
// copy security init parameters
Context context = ContextHandler.getCurrentContext();
if (context != null) {
Enumeration<String> names = context.getInitParameterNames();
while (names != null && names.hasMoreElements()) {
String name = names.nextElement();
if (name.startsWith("org.eclipse.jetty.security.") && getInitParameter(name) == null)
setInitParameter(name, context.getInitParameter(name));
}
}
if (_loginService == null) {
setLoginService(findLoginService());
if (_loginService != null)
unmanage(_loginService);
}
if (_identityService == null) {
if (_loginService != null)
setIdentityService(_loginService.getIdentityService());
if (_identityService == null)
setIdentityService(findIdentityService());
if (_identityService == null) {
if (_realmName != null) {
setIdentityService(new DefaultIdentityService());
manage(_identityService);
}
} else
unmanage(_identityService);
}
if (_loginService != null) {
if (_loginService.getIdentityService() == null)
_loginService.setIdentityService(_identityService);
else if (_loginService.getIdentityService() != _identityService)
throw new IllegalStateException("LoginService has different IdentityService to " + this);
}
Authenticator.Factory authenticatorFactory = getAuthenticatorFactory();
if (_authenticator == null && authenticatorFactory != null && _identityService != null)
setAuthenticator(authenticatorFactory.getAuthenticator(getServer(), ContextHandler.getCurrentContext(), this, _identityService, _loginService));
if (_authenticator != null)
_authenticator.setConfiguration(this);
else if (_realmName != null) {
LOG.warn("No Authenticator for " + this);
throw new IllegalStateException("No Authenticator");
}
super.doStart();
}
use of org.eclipse.jetty.server.handler.ContextHandler.Context in project jetty.project by eclipse.
the class ResourceHandler method doStart.
/* ------------------------------------------------------------ */
@Override
public void doStart() throws Exception {
Context scontext = ContextHandler.getCurrentContext();
_context = (scontext == null ? null : scontext.getContextHandler());
_mimeTypes = _context == null ? new MimeTypes() : _context.getMimeTypes();
_resourceService.setContentFactory(new ResourceContentFactory(this, _mimeTypes, _resourceService.getPrecompressedFormats()));
_resourceService.setWelcomeFactory(this);
super.doStart();
}
use of org.eclipse.jetty.server.handler.ContextHandler.Context in project jetty.project by eclipse.
the class SecurityHandler method doStart.
/* ------------------------------------------------------------ */
/**
*/
@Override
protected void doStart() throws Exception {
// copy security init parameters
ContextHandler.Context context = ContextHandler.getCurrentContext();
if (context != null) {
Enumeration<String> names = context.getInitParameterNames();
while (names != null && names.hasMoreElements()) {
String name = names.nextElement();
if (name.startsWith("org.eclipse.jetty.security.") && getInitParameter(name) == null)
setInitParameter(name, context.getInitParameter(name));
}
}
if (_loginService == null) {
setLoginService(findLoginService());
if (_loginService != null)
unmanage(_loginService);
}
if (_identityService == null) {
if (_loginService != null)
setIdentityService(_loginService.getIdentityService());
if (_identityService == null)
setIdentityService(findIdentityService());
if (_identityService == null) {
if (_realmName != null) {
setIdentityService(new DefaultIdentityService());
manage(_identityService);
}
} else
unmanage(_identityService);
}
if (_loginService != null) {
if (_loginService.getIdentityService() == null)
_loginService.setIdentityService(_identityService);
else if (_loginService.getIdentityService() != _identityService)
throw new IllegalStateException("LoginService has different IdentityService to " + this);
}
Authenticator.Factory authenticatorFactory = getAuthenticatorFactory();
if (_authenticator == null && authenticatorFactory != null && _identityService != null)
setAuthenticator(authenticatorFactory.getAuthenticator(getServer(), ContextHandler.getCurrentContext(), this, _identityService, _loginService));
if (_authenticator != null)
_authenticator.setConfiguration(this);
else if (_realmName != null) {
LOG.warn("No Authenticator for " + this);
throw new IllegalStateException("No Authenticator");
}
super.doStart();
}
Aggregations