How can I get the domain name of the application from within a cometActor

22 views
Skip to first unread message

Jonathan Ferguson

unread,
Nov 21, 2010, 7:13:52 PM11/21/10
to Lift
I can not see any way to do this.

Is it best to get it via some other means ( snippet and S object and
SessionParam).


Cheers
Jono

Jonathan Ferguson

unread,
Nov 21, 2010, 8:03:43 PM11/21/10
to Lift
Ignore me 

S.request 

Jono


--
You received this message because you are subscribed to the Google Groups "Lift" group.
To post to this group, send email to lif...@googlegroups.com.
To unsubscribe from this group, send email to liftweb+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.


David Pollak

unread,
Nov 22, 2010, 8:25:07 AM11/22/10
to lif...@googlegroups.com


On Sun, Nov 21, 2010 at 5:03 PM, Jonathan Ferguson <jo...@spiralarm.com> wrote:
Ignore me 

S.request 

I'd be surprised if S.request worked within a CometActor.  CometActors are outside the scope of an HTTP request.  Your best bet is to set the host for a session in a SessionVar and then access that SessionVar from your CometActor)



--
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Blog: http://goodstuff.im
Surf the harmonics

Jonathan Ferguson

unread,
Nov 24, 2010, 3:23:02 AM11/24/10
to lif...@googlegroups.com
I set it as a value when the comet actor starts up. Seems to be working so far :|  Otherwise you are correct.

Your way is looking better, thank you.

Jono

David Pollak

unread,
Nov 24, 2010, 12:36:16 PM11/24/10
to lif...@googlegroups.com
On Wed, Nov 24, 2010 at 12:23 AM, Jonathan Ferguson <jo...@spiralarm.com> wrote:
I set it as a value when the comet actor starts up. Seems to be working so far :|  Otherwise you are correct.


Alternatively, you can call (it's on LiftSession):

  /**
   * This method will send a message to a CometActor, whether or not
   * the CometActor is instantiated.  If the CometActor already exists
   * in the session, the message will be sent immediately.  If the CometActor
   * is not yet instantiated, the message will be sent to the CometActor
   * as part of setup (@see setupComet) if it is created as part
   * of the current HTTP request/response cycle.
   *
   * @param theType the type of the CometActor
   * @param name the optional name of the CometActor
   * @param msg the message to send to the CometActor
   */
  def sendCometActorMessage(theType: String, name: Box[String], msg: Any) {

This will send the CometActor a message... you can send anything you want including the domain name.
 
Reply all
Reply to author
Forward
0 new messages