All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.liftweb.http.NamedCometActorSnippet.scala Maven / Gradle / Ivy

The newest version!
/*
 * Copyright 2007-2012 WorldWide Conferencing, LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package net.liftweb
package http

import common.Full
import xml.NodeSeq

/**
 * This trait adds a named comet actor on the page. *
 */
trait NamedCometActorSnippet {

  /**
   * This is your Comet Class
   */
  def cometClass: String

  /**
   * This is how you are naming your comet actors.
   * It can be as simple as
   *
   * 

   *   def name= S.param(p).openOr("A")
   * 
* * This causes every comet actor for class @cometClass with the same @name * to include the same Comet Actor * */ def name: String /** * The render method that inserts the tag * to add the comet actor to the page */ final def render(xhtml: NodeSeq): NodeSeq = { for (sess <- S.session) sess.sendCometActorMessage( cometClass, Full(name), CometName(name) ) {xhtml} } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy