tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Diego <vivenenti...@hotmail.com>
Subject embed Servlets validation
Date Mon, 03 Sep 2012 19:39:25 GMT
<dev@tomcat.apache.org>:
Sorry, only subscribers may post. If you are a subscriber, check to be sure you are sending
from your subscribed address. (#5.7.2)

--- Below this line is a copy of the message.
User-Agent: Mozilla/6.4 (X11; Linux x86_64; rv:15.0) Gecko/20120827 Thunderbird/15.0.0
MIME-Version: 1.0
To:dev@tomcat.apache.org
Subject: Servlets validation
Content-Type: text/plain; charset="ISO-8859-1"; format=flowed
Content-Transfer-Encoding: 7bit
X-OriginalArrivalTime: 03 Sep 2012 19:27:11.0403 (UTC) FILETIME=[1D920FB0:01CD8A0A]

I there. my first post around

Look. i've been working out an embedded Tomcat 7.0.22~ and found out some
trouble
setting up servlets from the interface.

My configuration didn't find web.xml so far, so i used the servlet
context inside the embedded structure not so problematic but insted
the problem goes for working out several platforms would be much better
keeping up the original web.xml op to dates

i went as next

  class {
      public static void main(String[] args) throws Exception {

          String docBase = "src/main/webapp";
          String baseDir = "src/main/webapp";
          Tomcat tomcat = new Tomcat();

          StandardContext e = (StandardContext) new StandardContext();
### ???        e.setDefaultWebXml("web.xml");
          Tomcat.initWebappDefaults(e);
          e.setDocBase(docBase);
          tomcat.setPort(Integer.valueOf(webPort));
          tomcat.setBaseDir(baseDir);
          tomcat.getHost().setAppBase(new File(docBase).getAbsolutePath());

          tomcat.addWebapp("/", new File(docBase).getAbsolutePath());
          tomcat.addWebapp("/admin", new File(docBase +
"/admin").getAbsolutePath());

            // Add AprLifecycleListener
            StandardServer server = (StandardServer)tomcat.getServer();
            AprLifecycleListener listener = new AprLifecycleListener();
            server.addLifecycleListener(listener);

            Context ctxt = tomcat.addContext("/s", new
File(docBase).getAbsolutePath());
            Tomcat.addServlet(ctxt, "MyServlet", new servlet.HelloServlet());
          ctxt.addServletMapping("/hello", "MyServlet");
ctxt.setParentClassLoader(Thread.currentThread().getContextClassLoader());


          tomcat.setBaseDir(new File(docBase).getAbsolutePath());
          ctxt.setDocBase(docBase);
          ctxt.setConfigured(true);

            // 4866562 Nilda
          //tomcat.getEngine().addChild(localHost);
          //tomcat.getEngine().setDefaultHost(localHost.getName());

          tomcat.setHostname("localEngine");
          tomcat.enableNaming();
      }

i know that's a wrapup from tomcat6 to tomcat7 indeed i will coexist
both if possible to extend failover
among different hosting platforms aka intranet, heroku, etc.

main problem is i need a more secular form of setting up servlets even
for web.xml or embedded or any other
i wonder if there's any help so i could move on further on threading and
availability

either way i will solve it, i just wondering how active the list
actually was,
i could join the master dev list if possible but i'm not sure of the
volume handling options
so i used unique post to test my chances, thank you.


Thanks



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message