Here : // for the HashTable : import java.util.Hashtable;
// for logging import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; // for application import org.red5.server.adapter.ApplicationAdapter; import org.red5.server.api.IClient; import org.red5.server.api.IConnection; import org.red5.server.api.IScope; import org.red5.server.api.Red5; import org.red5.server.api.service.IPendingServiceCall; import org.red5.server.api.service.IPendingServiceCallback; import org.red5.server.api.service.IServiceCapableConnection; You should really check out the samples provided together with red5 and the superb red5 migration guide by joachim : You find it here : http://www.joachim-bauch.de/tutorials/red5 The rest is a mix of previous fcs/fms knowledge :P Lets hope the project gets a stable api and then we will all contribute to the documentation, like amfphp has it for example. --- morten hundevad <[EMAIL PROTECTED]> wrote: > Thanks alot, realy helped me alot =) > > Now, quick question.. > > i cant seem to make work ... : > import org.red5.server.adapter.ApplicationAdapter; > import > org.red5.server.api.service.IPendingServiceCallback; > import > org.red5.server.api.stream.IStreamAwareScopeHandler; > > public class Application extends ApplicationAdapter > implements > IPendingServiceCallback, IStreamAwareScopeHandler > {..} > > > and then how do log work ? and where to i import it > from" ?I cannot find it > =( ect ... : > private static final Log log = > LogFactory.getLog(Application.class); > ...... > log.info("will reject client " + > swfUrl); > > > > > > >From: stoica ionut <[EMAIL PROTECTED]> > >Reply-To: [email protected] > >To: [email protected] > >Subject: Re: [Red5] few questions,IScheduledJob / > Set<..> / > >IServiceCapableConnection.invoke() > >Date: Mon, 5 Feb 2007 23:12:05 -0800 (PST) > > > >And dont forget to call : > > > >initApplication(); > > > >in your appStart, like : > > > >@Override > >public boolean appStart(IScope scope) { > > // init your handler here > > > > this.initApplication(); > > > > log.info("Application started"); > > > > return true; > >} > > > > > >--- stoica ionut <[EMAIL PROTECTED]> wrote: > > > > > Hi, > > > > > > clientObj.referrer issue : > > > > > > This is how you secure your application against > > > leeches : > > > > > > public class Application extends > ApplicationAdapter > > > implements IPendingServiceCallback, > > > IStreamAwareScopeHandler { > > > > > > private static final Log log = > > > LogFactory.getLog(Application.class); > > > > > > // this is where you keep your allowed > > > domains(clients/referrers) > > > public Hashtable allowedDomains = new > Hashtable(); > > > > > > public void initApplication(){ > > > // if you test the swf directly : > > > > >allowedDomains.put("file:///C|/stuf/zbuf/smuf/foo.swf", > > > new Boolean(true)); > > > // if you test from localhost > > > allowedDomains.put("http://localhost/foo.swf", > new > > > Boolean(true)); > > > > > > // ... other swfs > > > } > > > > > > @Override > > > public boolean appConnect(IConnection conn, > Object[] > > > params){ > > > > > > log.info("Application connect"); > > > > > > IClient client = conn.getClient(); > > > > > > String swfUrl = > > > (String)conn.getConnectParams().get("swfUrl"); > > > Boolean isAllowed = > > > (Boolean)allowedDomains.get(swfUrl); > > > if(isAllowed != null){ > > > if(!isAllowed){ > > > log.info("will reject client " + swfUrl); > > > rejectClient(); > > > return false; > > > }else{ > > > log.info("will accept client" + swfUrl); > > > } > > > } > > > else > > > { > > > log.info("Reject client " + swfUrl); > > > rejectClient(); > > > return false; > > > } > > > }catch(Exception ex){ > > > log.info(ex.getMessage()); > > > return false; > > > } > > > > > > return true; > > > > > > } > > > > > > } > > > > > > > > > How it works : > > > > > > String swfUrl = > > > (String)conn.getConnectParams().get("swfUrl"); > > > > > > > > > gets you the refferer > > > > > > appConnect must first call rejectClient and then > > > return false on a faulty client. > > > > > > But it has to do them together, dont try to call > > > client.disconnect(), as natural is it looks, > that is > > > not the way to do it. > > > > > > > > > --- joseph wamicha <[EMAIL PROTECTED]> wrote: > > > > > > > >1: how would i inside the FannarchyJob access > > > data > > > > inside the main app ? > > > > Declare classes with constructors inside your > > > > WEB-INF directory. Then call > > > > the classes and it's methods as you would in a > > > > normal JAVA application. I > > > > haven't tried this yet but I'm suspecting it > will > > > > work. Also, to access > > > > resources created from within the main > > > application, > > > > extend > > > > ApplicationAdapter within FanarchyJob. > > > > > > > > >2: how would i send a message ( > > > > sc.invoke("the_method", new > > > > Object[]{"message"}); ) to all user's conected > ( > > > > from inside the > > > > FannarchyJob evry 30 sec) and/or to a special > user > > > > ?( like user's in a > > > > special room ) > > > > Joachim's migration guide shows you how to > create > > > a > > > > 30sec job schedule. > > > > Though I haven't tried it, probably extend > > > > ApplicationAdapter in > > > > FanarchyJob, then get all connected clients > and > > > send > > > > them their message. > > > > > > > > >3: is there a equal to clientObj.referrer in > red5 > > > ? > > > > ( so i can make sure > > > > the > > > > swf is used from my site )? > > > > mmhh, I don't know. That's a good question!!! > The > > > > RTMP message must come > > > > with this... I really wonder if red5 can allow > you > > > > to poll such data! > > > > > > > > >4: How would i used the output off > > > > app.getClients(); and > > > > theClient.getConnections(); i am unfalilat > with > === message truncated ===> _______________________________________________ > Red5 mailing list > [email protected] > http://osflash.org/mailman/listinfo/red5_osflash.org > ____________________________________________________________________________________ Do you Yahoo!? Everyone is raving about the all-new Yahoo! Mail beta. http://new.mail.yahoo.com _______________________________________________ Red5 mailing list [email protected] http://osflash.org/mailman/listinfo/red5_osflash.org
