Bruno, hi there... I have a generalized Jetty block in progress:
http://cvs.apache.org/viewcvs/jakarta-avalon-apps/sevak/src/java/org/apache/avalon/apps/sevak/blocks/jetty/ The server starts but returns 404 pages for all invocations. Can you see what is wrong? Also, how would I route Jetty logging thru to Phoenix? Regards, - Paul >I'm using Jetty in a phoenix-based project. Embedding it is just a >matter of a few lines of code, here's a small sample program: > >import org.mortbay.util.InetAddrPort; >import org.mortbay.http.*; >import org.mortbay.http.handler.AbstractHttpHandler; > >import java.io.OutputStreamWriter; >import java.io.Writer; >import java.io.IOException; > >public class Test >{ > public static void main(String[] args) > throws Exception > { > HttpServer server = new HttpServer(); > HttpContext context = server.getContext(null, ""); > context.addHandler(new AbstractHttpHandler() > { > public void handle(String s, String s1, HttpRequest request, >HttpResponse response) throws HttpException, IOException > { > try > { > response.setStatus(HttpResponse.__200_OK); > response.setContentType("text/xml"); > Writer writer = new >OutputStreamWriter(response.getOutputStream()); > writer.write("<html><body>hello</body></html>"); > writer.flush(); > response.commit(); > } > catch (Exception e) > { > e.printStackTrace(); > } > } > }); > server.addListener(new InetAddrPort(8888)); > server.start(); > } >} > >Of course, in a phoenix block you would create the server in the >initialize method, and start and stop it in the start/stop methods of >the Startable interface. It's also possible to redirect jetty's log to >an avalon logger. It would probably also be possible to embed jetty's >servlet container, if you don't like extending from AbstractHttpHandler. > >You can find out more about jetty at http://jetty.mortbay.org > >On Mon, 2002-09-30 at 12:07, Ulrich Mayring wrote: > > >>Hello folks, >> >>given my recent (unsuccessful) endeavour of getting Jo! to run under Phoenix, I >>began to wonder what a connection between Phoenix and the Web could/should look >>like. I think it is imperative for a server application framework and an >>applicaton server to be able to serve the Web. >> >>Here are some options I can think of: >> >>1) There is a class called PhoenixServlet, but it is labelled as experimental. >>It does not seem to do very much either. What is its purpose? >> >>2) Jo! and Sevak can run servlets, but they have no native way to communicate >>with other apps (except via AltRMI or similar methods). I don't think it is >>possible to persuade the developers of Jo! or Catalina to componentize their >>designs to accommodate Avalon/Phoenix. But everything else is just a hack. >> >>3) How about an ajpv12 or ajpv13 component? Maybe the code can be nicked from >>Catalina and repackaged as a component. Then every Phoenix app could just use >>that component and be fully connected to everyone who supports mod_jk or >>mod_jserv (mainly the Apache httpd, but also some other webservers). >> >>4) MX4J already has a HTTPConnector, but it is fairly limited to JMX. But we >>just need a way to pass control to an arbitrary app and give back a response, >>maybe it can be done with MX4J? >> >>5) Development of a HTTP component. It does not need to be a full-blown >>webserver, we just need to speak HTTP. For access control, URL rewriting, error >>handling and all those other fancy features we could rely on an external >>webserver and assume that he makes sure to forward only "safe and appropriate" >>HTTP requests to us for backend processing. Connections have to be limited to >>that webserver, though. Most webservers have a way to forward HTTP requests to >>another webserver. >> >>Any other ideas/comments? I like option 3) best. >> >>cheers, >> >>Ulrich >> >> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>