tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Gross <cogr...@gmail.com>
Subject Configuring Embedded Tomcat
Date Fri, 07 Jan 2011 18:59:31 GMT
I've been looking around, but I can't seem to find somewhere that shows how
you can configure Tomcat when you embed it into an application.

My code is like this:

public void start() throws Exception {
   String hostname = System.getProperty("hostname");
   int port = Integer.parseInt(System.getProperty("port"));
   String path = System.getProperty("path");
   Embedded embedded = new Embedded();
   Engine engine = embedded.createEngine();
   engine.setName("Monitor");
   engine.setHostname(hostname);
   Host host = embedded.createHost(hostname, path);
   engine.addChild(host);
   Context sp = embedded.createContext("/Monitor", path +
"/webapps/monitor");
   host.addChild(sp);
   embedded.addEngine(engine);
   InetAddress addr = null;
   Connector connector = embedded.createConnector(addr, port, false);
   embedded.addConnector(connector);
   embedded.setName("WebServerThread");
   embedded.start();
}

It works fine as it is now, but I'd like to use Tomcat to authenticate
users.  I'll make a separate app for basic users to use to just view a page,
but give admins access to a more advanced page (the pages that I have now).
 Should I be using a different module?  Is there a spot where the embedded
Tomcat will look by default?

Any tips would be greatly appreciated.

Thanks!

-- Chris

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message