avalon-phoenix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bruno Dumon <br...@outerthought.org>
Subject Re: Phoenix and the Web
Date Tue, 01 Oct 2002 07:25:10 GMT
On Tue, 2002-10-01 at 01:14, Paul Hammant wrote:
> Bruno, hi there...
> 
> I have a generalized Jetty block in progress:
> 

cool

Just wondering, how would you provide the webapplications with access to
other blocks? By putting the component manager in the servlet context or
so?

>   
>  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?  
> 

No, but I have not yet tried deploying webapplications. I assume you're
using the correct virtual host?

> Also, how would I route Jetty logging thru to Phoenix?

Like this:

import org.mortbay.util.Log;
...
Log.instance().add(new MyLogSink());
...
protected class MyLogSink implements LogSink
{
    public void setOptions(String s)
    {
    }

    public String getOptions()
    {
       return "";
    }

    public void log(String tag, Object message, Frame frame, long time)
    {
        logger.info(tag + " " + message);
    }

    public void log(String formattedLog)
    {
        logger.info(formattedLog);
    }

    public void start() throws Exception
    {
    }

    public void stop() throws InterruptedException
    {
    }

    public boolean isStarted()
    {
       return true;
    }
}

> 
> 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:avalon-phoenix-dev-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:avalon-phoenix-dev-help@jakarta.apache.org>
-- 
Bruno Dumon                             http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
bruno@outerthought.org


--
To unsubscribe, e-mail:   <mailto:avalon-phoenix-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-phoenix-dev-help@jakarta.apache.org>


Mime
View raw message