From: Ritu S. <sf...@us...> - 2004-06-16 12:17:23
|
Update of /cvsroot/smartfrog/core/components/jetty/src/org/smartfrog/services/jetty/contexts/handlers In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10830/handlers Added Files: Dump.java Forward.java HTAccess.java Log Message: Handlers for jetty server --- NEW FILE: Dump.java --- package org.smartfrog.services.jetty.contexts.handlers; import java.rmi.RemoteException; import org.smartfrog.sfcore.prim.Prim; import org.smartfrog.sfcore.prim.PrimImpl; import org.smartfrog.sfcore.reference.Reference; import org.smartfrog.sfcore.common.SmartFrogException; import org.mortbay.http.handler.DumpHandler; import org.mortbay.jetty.servlet.ServletHttpContext; /** * A Dump handler class for jetty server * @author Ritu Sabharwal */ public class Dump extends PrimImpl implements Prim { /** Standard RMI constructor */ public Dump() throws RemoteException { super(); } /** * sfDeploy: adds the Dump Handler to ServetletHttpContext of jetty server * @exception SmartFrogException In case of error while deploying * @exception RemoteException In case of network/rmi error */ public void sfDeploy() throws SmartFrogException, RemoteException { super.sfDeploy(); Prim parent = this.sfParent(); Prim grandParent = parent.sfParent(); ServletHttpContext cxt = (ServletHttpContext)grandParent. sfResolveId("Context"); cxt.addHandler(new DumpHandler()); } } --- NEW FILE: HTAccess.java --- package org.smartfrog.services.jetty.contexts.handlers; import java.rmi.RemoteException; import org.smartfrog.sfcore.prim.Prim; import org.smartfrog.sfcore.prim.PrimImpl; import org.smartfrog.sfcore.reference.Reference; import org.smartfrog.sfcore.common.SmartFrogException; import org.mortbay.http.handler.HTAccessHandler; import org.mortbay.jetty.servlet.ServletHttpContext; /** * A HTAccess handler class for jetty server * @author Ritu Sabharwal */ public class HTAccess extends PrimImpl implements Prim { Reference accessFileRef = new Reference("accessFile"); String accessFile = ".htaccess"; HTAccessHandler hthandler = new HTAccessHandler(); /** Standard RMI constructor */ public HTAccess() throws RemoteException { super(); } /** * sfDeploy: adds the HTAccess Handler to ServetletHttpContext of jetty server * @exception SmartFrogException In case of error while deploying * @exception RemoteException In case of network/rmi error */ public void sfDeploy() throws SmartFrogException, RemoteException { super.sfDeploy(); accessFile = sfResolve(accessFileRef, accessFile, false); hthandler.setAccessFile(accessFile); Prim parent = this.sfParent(); Prim grandParent = parent.sfParent(); ServletHttpContext cxt = (ServletHttpContext)grandParent. sfResolveId("Context"); cxt.addHandler(hthandler); } } --- NEW FILE: Forward.java --- package org.smartfrog.services.jetty.contexts.handlers; import java.rmi.RemoteException; import org.smartfrog.sfcore.prim.Prim; import org.smartfrog.sfcore.prim.PrimImpl; import org.smartfrog.sfcore.reference.Reference; import org.smartfrog.sfcore.common.SmartFrogException; import org.mortbay.http.handler.ForwardHandler; import org.mortbay.http.HttpContext; import org.mortbay.jetty.servlet.ServletHttpContext; /** * A Forward handler class for jetty server * @author Ritu Sabharwal */ public class Forward extends PrimImpl implements Prim { Reference mapfromPathRef = new Reference("mapFromPath"); Reference maptoPathRef = new Reference("maptoPath"); String mapfromPath = "/forward/*"; String maptoPath = "/dump"; ForwardHandler fwdhandler = new ForwardHandler(); ServletHttpContext a; /** Standard RMI constructor */ public Forward() throws RemoteException { super(); } /** * sfDeploy: adds the Forward Handler to ServetletHttpContext of jetty server * @exception SmartFrogException In case of error while deploying * @exception RemoteException In case of network/rmi error */ public void sfDeploy() throws SmartFrogException, RemoteException { super.sfDeploy(); mapfromPath = sfResolve(mapfromPathRef, mapfromPath, false); maptoPath = sfResolve(maptoPathRef, maptoPath, false); fwdhandler.addForward(mapfromPath,maptoPath); Prim parent = this.sfParent(); Prim grandParent = parent.sfParent(); ServletHttpContext cxt = (ServletHttpContext)grandParent. sfResolveId("Context"); cxt.addHandler(fwdhandler); } } |