use of org.apache.catalina.core.StandardHost in project fess by codelibs.
the class FessBoot method main.
// ===================================================================================
// main
// ============
public static void main(final String[] args) {
// update java.io.tmpdir
final String tempPath = System.getProperty(FESS_TEMP_PATH);
if (tempPath != null) {
System.setProperty(JAVA_IO_TMPDIR, tempPath);
}
final TomcatBoot tomcatBoot = //
new FessBoot(getPort(), getContextPath()).useTldDetect();
if (tempPath != null) {
tomcatBoot.atBaseDir(new File(tempPath, "webapp").getAbsolutePath());
}
final String tomcatConfigPath = getTomcatConfigPath();
if (tomcatConfigPath != null) {
// e.g. URIEncoding
tomcatBoot.configure(tomcatConfigPath);
}
tomcatBoot.logging(LOGGING_PROPERTIES, op -> {
op.ignoreNoFile();
String fessLogPath = System.getProperty("fess.log.path");
if (fessLogPath == null) {
fessLogPath = "../../logs";
}
op.replace("fess.log.path", fessLogPath.replace("\\", "/"));
}).asYouLikeIt(resource -> {
final Host host = resource.getHost();
if (host instanceof StandardHost) {
((StandardHost) host).setErrorReportValveClass(SuppressErrorReportValve.class.getName());
}
}).useTldDetect(jarName -> (jarName.contains("jstl") || jarName.contains("lasta-taglib"))).asDevelopment(isNoneEnv()).bootAwait();
}
use of org.apache.catalina.core.StandardHost in project tomcat by apache.
the class TesterDigestAuthenticatorPerformance method setUp.
@Before
public void setUp() throws Exception {
ConcurrentMessageDigest.init("MD5");
// Configure the Realm
TesterMapRealm realm = new TesterMapRealm();
realm.addUser(USER, PWD);
realm.addUserRole(USER, ROLE);
// Add the Realm to the Context
Context context = new StandardContext();
context.setName(CONTEXT_PATH);
context.setRealm(realm);
Host host = new StandardHost();
context.setParent(host);
Engine engine = new StandardEngine();
host.setParent(engine);
Service service = new StandardService();
engine.setService(service);
// Configure the Login config
LoginConfig config = new LoginConfig();
config.setRealmName(REALM);
context.setLoginConfig(config);
// Make the Context and Realm visible to the Authenticator
authenticator.setContainer(context);
authenticator.setNonceCountWindowSize(8 * 1024);
authenticator.start();
}
use of org.apache.catalina.core.StandardHost in project tomcat by apache.
the class TestTomcat method testGetBrokenContextPerAddWepapp.
@Test
public void testGetBrokenContextPerAddWepapp() {
Tomcat tomcat = getTomcatInstance();
Host host = tomcat.getHost();
if (host instanceof StandardHost) {
((StandardHost) host).setContextClass("InvalidContextClassName");
}
try {
File appFile = new File("test/deployment/context.war");
tomcat.addWebapp(null, "/test", appFile.getAbsolutePath());
Assert.fail();
} catch (IllegalArgumentException e) {
// OK
}
}
use of org.apache.catalina.core.StandardHost in project tomcat by apache.
the class TestTomcat method testGetCustomContextPerAddWebappWithNullHost.
@Test
public void testGetCustomContextPerAddWebappWithNullHost() {
Tomcat tomcat = getTomcatInstance();
Host host = tomcat.getHost();
if (host instanceof StandardHost) {
((StandardHost) host).setContextClass(ReplicatedContext.class.getName());
}
File appFile = new File("test/deployment/context.war");
Context context = tomcat.addWebapp(null, "/test", appFile.getAbsolutePath());
Assert.assertEquals(ReplicatedContext.class.getName(), context.getClass().getName());
}
use of org.apache.catalina.core.StandardHost in project tomcat by apache.
the class TestTomcat method testGetCustomContextPerAddWebappWithHost.
@Test
public void testGetCustomContextPerAddWebappWithHost() {
Tomcat tomcat = getTomcatInstance();
Host host = tomcat.getHost();
if (host instanceof StandardHost) {
((StandardHost) host).setContextClass(ReplicatedContext.class.getName());
}
File appFile = new File("test/deployment/context.war");
Context context = tomcat.addWebapp(host, "/test", appFile.getAbsolutePath());
Assert.assertEquals(ReplicatedContext.class.getName(), context.getClass().getName());
}
Aggregations