View Javadoc
1 /* Reattore HTTP Server 2 3 Copyright (C) 2002 Michael Hope <michaelh@juju.net.nz> 4 5 This program is free software; you can redistribute it and/or modify 6 it under the terms of the GNU General Public License as published by 7 the Free Software Foundation; either version 2 of the License, or 8 (at your option) any later version. 9 10 This program is distributed in the hope that it will be useful, 11 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 GNU General Public License for more details. 14 15 You should have received a copy of the GNU General Public License 16 along with this program; if not, write to the Free Software 17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 19 $Id: HttpMediator.java,v 1.3 2003/01/31 05:30:08 michaelh Exp $ 20 */ 21 22 package juju.reattore.server.http; 23 24 import java.nio.channels.*; 25 import java.io.*; 26 27 import juju.reattore.core.reactor.*; 28 import juju.reattore.core.reactor.impl.*; 29 import juju.reattore.server.intercept.Interceptor; 30 31 /*** The mediator acts as a central point allowing the server and 32 client handlers to avoid knowing about each other. 33 */ 34 public class HttpMediator { 35 private CombinedReactor reactor; 36 private Interceptor interceptor; 37 38 /*** Create a new mediator. 39 40 @param reactor The reactor to pass on to any clients or servers. 41 @param intercept The interceptor change to use. 42 */ 43 public HttpMediator(CombinedReactor reactor, Interceptor intercept) { 44 this.reactor = reactor; 45 this.interceptor = intercept; 46 } 47 48 /*** Get the top level interceptor a client should serve against. 49 50 @return The top level interceptor. 51 */ 52 public Interceptor getInterceptor() { 53 return interceptor; 54 } 55 56 /*** Called by the server handler to attach a new client handler to 57 the shared reactor. 58 59 @param ch The new client socket 60 @param handler The handler for this new socket 61 @throws IOException on PENDING 62 @see ClientSocketReactor#attach 63 */ 64 public void doAttach(SocketChannel ch, ClientSocketHandler handler) 65 throws IOException { 66 67 reactor.attach(ch, handler); 68 } 69 }

This page was automatically generated by Maven