Re: Embedded Tomcat

2005-09-30 Thread Rick Knowles

Eric Holk wrote:


I'm working on a project where I would like to run a simple web front end
for it. To save the time of implementing my own HTTP server I'd like to
embed Tomcat. I've read several documents on how to do this, and I've
managed to get Tomcat running inside my program. However, all the examples
I've seen show how to load a WAR file and use that as a web application. If
it's possible, I'd rather just have a sevlet class inside my program that
Tomcat uses rather than having an external web application.


You should be able to get away with just a single external file: a
web.xml file that mounts the servlet and maps it to a URI pattern. The
rest of the webapp code (ie the servlet class you mentioned) would be
able to be inside the main jar, because class loader inheritance would
cause the servlet class to be visible even if it's not in the
WEB-INF/classes folder.

If one external file is too many, you might need to do something tricky
to set the webapp's mounted instances from code. Maybe via JMX ? Someone
else might be able to help here 

Rick

--
Servlet v2.4 container in a single 155KB jar file ? Try Winstone 
(http://winstone.sourceforge.net/)



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: embedded tomcat and JMX sample code

2004-01-28 Thread Remy Maucherat
Mark W. Webb wrote:
I am looking for some sample code that will demonstrate how to embed 
tomcat in a java application using JMX.  I would like to write some 
documentation on how to do this, as there is none that exists that I 
have found on tomcat's web site.  I would imagine that there must be 
some code somewhere that was used for testing the new infrastructure.

Everywhere I have turned so far, has told me to look at the JBoss source 
code, but I figure that the tomcat development team must have some code 
laying around that will demonstrate this.
The Ant script in the embed distribution can directly be translated into 
JMX commands. Other than that, we have no Java JMX code (so look in the 
JBoss/Tomcat integration for that).

Rémy

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Embedded Tomcat

2003-10-25 Thread Sriram N
Hi Robert,

Congratulations on having Embedded Tomcat in your application.

My apologies for not explaining a solution to your problem more clearly.

The method we had discussed by private mail earlier today indeed works. I
cannot give you actual source code, simply because I'm downloading Tomcat at
the moment.

The only part that you need to work on is the :
> MyApplication app = ;

that you have mentioned below:

Let's say your application (with all its parts) is represented by
MyApplication.

You could create the class along the lines of :

public class MyApplication{

private static MyApplication currentInstance = null;

private MyApplication(){
}

public MyApplication getCurrentInstance(){
if (currentInstance==null){
currentInstance = new MyApplication();
initialize();  // some initialization work
}
return currentInstance;
}

}

You should now be able to access MyApplication's object from within your web
applications via MyApplication.getCurrentInstance();

In your care, you do not need JNDI. There is another means of sharing objects
(via JMX) that I shall explore once this Tomcat download is completed.

-- Sriram

--- Robert Charbonneau <[EMAIL PROTECTED]> wrote:
> I've successfully embedded Tomcat into my application and have talked to a
> few 
> people about how to shared objects between the application and the JSPs from 
> the contexts I've defined.  I've had a suggested to use JNDI but this seems a
> 
> little more elaborate than I need, and someone else was talking about using 
> ServletContext.setAttribute() and ServletContext.getAttribute()
> 
> Is there a code example both application side and web side somewhere that 
> could show me how to do this?  I've been wrestling with this for a while and 
> it's starting to irritate me.  :)
> 
> I've embedded Tomcat for the sole purpose of being able to create JSPs and 
> Servlets that can examine the properties of the application and modify the 
> properties as well.  For example, I need to be able to do the following in my
> 
> JSP.
> 
> MyApplication app = ;
> 
> Object obj = app.getSomeData();
> obj.modifyInSomeWay();
> app.setSomeData(obj);
> 
> If anyone can provide an example for this, I would very much appreciate it.
> 
> Thanks.
> 
> --
> Robert Charbonneau
> [EMAIL PROTECTED]
> --
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


__
Do you Yahoo!?
Exclusive Video Premiere - Britney Spears
http://launch.yahoo.com/promos/britneyspears/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Embedded Tomcat startup java class

2003-10-24 Thread Remy Maucherat
Mark W. Webb wrote:

Knowing that Tomcat is moving towards JMX, I was wondering if anyone has 
"ported" Embedded.java into the a format that will support the JMX 
integration.  Knowing that there is a build.xml file that will launch 
tomcat in an embedded state, is there an equivalent .java file for doing 
this?
You don't have to do that. You can use Embedded to create your TC 
instance, and then use JMX to create or destroy contexts.
Or use a "standalone" TC with a server.xml, and use JMX (or Embedded) to 
manage the contexts (that's how it works in the integrated JBoss 3.2 / 
TC 5).

You can mix and use whatever seems best to you :)

Remy



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Embedded tomcat with HTTPS

2003-08-14 Thread Bill Barker
I'm going to assume that you're using 4.1.x.  In this case, you are using
the wrong Factory.  You want something like:

  Connector httpsConnector = embeddedTomcat.createConnector(null,

configuration.getHttpsPort(), true);
  CoyoteServerSocketFactory serverSocketFactory =

(CoyoteServerSocketFactory)httpsConnector.getFactory();
  serverSocketFactory.setKeystoreFile(configuration.getKeystoreFile());
  serverSocketFactory.setKeystorePass("antares");

- Original Message - 
From: "Wesley Hall" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, August 10, 2003 1:23 PM
Subject: Embedded tomcat with HTTPS


> Hello,
>   Myself and a collegue are currently working on an open source
> application, part of which involves embedding a servlet engine. I have
read
> through some tutorials and the API docs for tomcat and began development
of
> a class structure to provide this.
>
> I have, however come across a problem with my https connector. I currently
> have code that looks like this..
>
> Connector httpsConnector = embeddedTomcat.createConnector(null,
> configuration.getHttpsPort(), true);
> httpsConnector.setScheme("https");
> SSLServerSocketFactory serverSocketFactory = new SSLServerSocketFactory();
> serverSocketFactory.setKeystoreFile(configuration.getKeystoreFile());
> serverSocketFactory.setKeystorePass("antares");
> httpsConnector.setFactory(serverSocketFactory);
> embeddedTomcat.addConnector(httpsConnector);
> connectors.add(httpsConnector);
>
> configuration is a instance of a simple bean, getHttpsPort() returns 443,
> getKeystoreFile() returns the path to the keystore (generated as per the
> SSL-Howto doc). The location of the keystore is validated elsewhere in the
> code using a File object and a call to .isFile() and .canRead(), both of
> which return true when running this code.
>
> However... i am finding that although http://localhost:443 works
perfectly,
> https://localhost leaves the browser (MSIE) whirring away for 30 seconds
or
> so before displaying 'cannot find server'. With the former i get plenty of
> information in the logs but the latter adds nothing at all to the logs,
> making this problem very difficult to debug. I can change the keystore
pass
> to any value and there is no appreciable difference.
>
> Im happy to provide any more information as required...
>
> Would a kind sameritan type point me in the write direction as to what may
> be causing this issue?
>
> Regards Wesley I. Hall.
>
> P.S. I thought long and hard on whether this belonged on dev or user, but
> since we are discussing actually class structure i finally decided that
dev
> would probably be more appropriate. If i was wrong on that descision, you
> have my sincere apologies.
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>

This message is intended only for the use of the person(s) listed above as the 
intended recipient(s), and may contain information that is PRIVILEGED and 
CONFIDENTIAL.  If you are not an intended recipient, you may not read, copy, or 
distribute this message or any attachment. If you received this communication in 
error, please notify us immediately by e-mail and then delete all copies of this 
message and any attachments.

In addition you should be aware that ordinary (unencrypted) e-mail sent through the 
Internet is not secure. Do not send confidential or sensitive information, such as 
social security numbers, account numbers, personal identification numbers and 
passwords, to us via ordinary (unencrypted) e-mail.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Re: Embedded Tomcat and custom connector ?

2002-07-31 Thread Eriam Schaffter

Hi back

That was not so clear.

What I would like to do is to get *all* http requests and manage them 
trough another connector then the one that passes them to the filesystem.
Example: a http request comes and it's a GET /Test instead of trying to 
fetch the local Test directory I want to redirect this to another 
resource like a sql procedure or something else.

I think that it's possible to do this by creating the connector by 
myself instead of creating it on the high level with createConnector 
method of the Embedded class. Something like creating a HttpConnector 
with an associated EventHanlder ?

Any tips ?
Any idea ?

Thanks in advance.

Eriam

Eriam Schaffter wrote:

> Hi all.
>
> I'm embedding tomcat in a java app using the Embedded class.
>
> What I would like to do know is to use the http connector but I would 
> instantiate it by my own and not via the createConnector method so I 
> handle requests and responses in my program. The goal is to have a 
> connector that handles http request a bit differently then the one in 
> tomcat (redirect get request on another resource).
>
> Any suggestions ?
>
> Eriam
>
>
> -- 
> To unsubscribe, e-mail:   
> 
> For additional commands, e-mail: 
> 
>




--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: embedded tomcat and JspServlet

2002-04-30 Thread Arvind Srinivasan



Richard Unger wrote:

> jsp: init
> Internal Error: File /WEB-INF/web.xml not found.
>

I believe this particular error message is generated (by 
o.a.j.compiler.TldLocationsCache.processWebDotXml) when initializing the default 
context (which doesn't have a WEB-INF/web.xml). I don't think this causes any problems 
(nor is it the source of your error) and the message should probably be
suppressed.

 Arvind


--
To unsubscribe, e-mail:   
For additional commands, e-mail: