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
> > Set<IClient> and
> > Set<IConnection> dont understand how to use ?
> > 
> > Iterate through the returned Set:
> > 
> > ie probably try this (again I haven't tested):
> > Iterator<String> it =
> > thisScope.getClients().iterator();
> > while(it.hasnext())
> > {
> >    //you can now get your clients using normal
> > iterator methods...
> > }
> > 
> > Do the same for getConnections.
> > 
> > -- 
> > C is forever.
> > > _______________________________________________
> > Red5 mailing list
> > [email protected]
> >
> http://osflash.org/mailman/listinfo/red5_osflash.org
> > 
> 
> 
> 
>  
>
____________________________________________________________________________________
> Need a quick answer? Get one in minutes from people
> who know.
> Ask your question on www.Answers.yahoo.com
> 
> _______________________________________________
> Red5 mailing list
> [email protected]
> http://osflash.org/mailman/listinfo/red5_osflash.org
> 



 
____________________________________________________________________________________
Sucker-punch spam with award-winning protection. 
Try the free Yahoo! Mail Beta.
http://advision.webevents.yahoo.com/mailbeta/features_spam.html

_______________________________________________
Red5 mailing list
[email protected]
http://osflash.org/mailman/listinfo/red5_osflash.org

Reply via email to