当前位置: 首页>>代码示例>>Scala>>正文


Scala ServletContainer类代码示例

本文整理汇总了Scala中com.sun.jersey.spi.container.servlet.ServletContainer的典型用法代码示例。如果您正苦于以下问题:Scala ServletContainer类的具体用法?Scala ServletContainer怎么用?Scala ServletContainer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ServletContainer类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Scala代码示例。

示例1: HBaseRestServer

//设置package包名称以及导入依赖的类
package com.hadooparchitecturebook.taxi360.server.hbase

import java.io.File

import com.sun.jersey.spi.container.servlet.ServletContainer
import org.apache.hadoop.hbase.HBaseConfiguration
import org.mortbay.jetty.Server
import org.mortbay.jetty.servlet.{Context, ServletHolder}

object HBaseRestServer {
  def main(args:Array[String]): Unit = {

    if (args.length == 0) {
      println("<port> <configDir> <numberOfSalts> <customerTableName>")
    }
    val port = args(0).toInt
    val hbaseConfigFolder = args(1)
    val numberOfSalts = args(2).toInt
    val appEventTableName = args(3)

    val conf = HBaseConfiguration.create()
    conf.addResource(new File(hbaseConfigFolder + "hbase-site.xml").toURI.toURL)

    HBaseGlobalValues.init(conf, numberOfSalts,
      appEventTableName)

    val server = new Server(port)

    val sh = new ServletHolder(classOf[ServletContainer])
    sh.setInitParameter("com.sun.jersey.config.property.resourceConfigClass", "com.sun.jersey.api.core.PackagesResourceConfig")
    sh.setInitParameter("com.sun.jersey.config.property.packages", "com.hadooparchitecturebook.taxi360.server.hbase")
    sh.setInitParameter("com.sun.jersey.api.json.POJOMappingFeature", "true")

    val context = new Context(server, "/", Context.SESSIONS)
    context.addServlet(sh, "/*")

    println("starting HBase Rest Server")
    server.start()
    println("started HBase Rest Sserver")
    server.join()
  }
} 
开发者ID:hadooparchitecturebook,项目名称:Taxi360,代码行数:43,代码来源:HBaseRestServer.scala

示例2: KuduRestServer

//设置package包名称以及导入依赖的类
package com.hadooparchitecturebook.taxi360.server.kudu

import com.sun.jersey.spi.container.servlet.ServletContainer
import org.mortbay.jetty.Server
import org.mortbay.jetty.servlet.{Context, ServletHolder}

object KuduRestServer {
  def main(args:Array[String]): Unit = {

    if (args.length == 0) {
      println("<port> <KuduMaster> <accountEventTableName> <appMartTableName>")
    }

    val port = args(0).toInt
    val kuduMaster = args(1)
    val accountEventTableName = args(2)
    val appMartTableName = args(3)

    KuduGlobalValues.init(kuduMaster,accountEventTableName, appMartTableName)

    val server = new Server(port)

    val sh = new ServletHolder(classOf[ServletContainer])
    sh.setInitParameter("com.sun.jersey.config.property.resourceConfigClass", "com.sun.jersey.api.core.PackagesResourceConfig")
    sh.setInitParameter("com.sun.jersey.config.property.packages", "com.hadooparchitecturebook.taxi360.server.kudu")
    sh.setInitParameter("com.sun.jersey.api.json.POJOMappingFeature", "true")

    val context = new Context(server, "/", Context.SESSIONS)
    context.addServlet(sh, "/*")

    println("starting Kudu Rest Server")
    server.start()
    println("started Kudu Rest Server")
    server.join()
  }
} 
开发者ID:hadooparchitecturebook,项目名称:Taxi360,代码行数:37,代码来源:KuduRestServer.scala

示例3: KuduRestServer

//设置package包名称以及导入依赖的类
package com.cloudera.sa.apptrans.server.kudu

import com.sun.jersey.spi.container.servlet.ServletContainer
import org.mortbay.jetty.Server
import org.mortbay.jetty.servlet.{Context, ServletHolder}

object KuduRestServer {
  def main(args:Array[String]): Unit = {

    if (args.length == 0) {
      println("<port> <KuduMaster> <accountEventTableName> <appMartTableName>")
    }

    val port = args(0).toInt
    val kuduMaster = args(1)
    val accountEventTableName = args(2)
    val appMartTableName = args(3)

    KuduGlobalValues.init(kuduMaster,accountEventTableName, appMartTableName)

    val server = new Server(port)

    val sh = new ServletHolder(classOf[ServletContainer])
    sh.setInitParameter("com.sun.jersey.config.property.resourceConfigClass", "com.sun.jersey.api.core.PackagesResourceConfig")
    sh.setInitParameter("com.sun.jersey.config.property.packages", "com.cloudera.sa.apptrans.server.kudu")
    sh.setInitParameter("com.sun.jersey.api.json.POJOMappingFeature", "true")

    val context = new Context(server, "/", Context.SESSIONS)
    context.addServlet(sh, "/*")

    println("starting Kudu Rest Server")
    server.start()
    println("started Kudu Rest Server")
    server.join()
  }
} 
开发者ID:tmalaska,项目名称:AppTrans,代码行数:37,代码来源:KuduRestServer.scala

示例4: HBaseRestServer

//设置package包名称以及导入依赖的类
package com.cloudera.sa.apptrans.server.hbase

import java.io.File

import com.sun.jersey.spi.container.servlet.ServletContainer
import org.apache.hadoop.hbase.HBaseConfiguration
import org.mortbay.jetty.Server
import org.mortbay.jetty.servlet.{Context, ServletHolder}

object HBaseRestServer {
  def main(args:Array[String]): Unit = {

    if (args.length == 0) {
      println("<port> <configDir> <numberOfSalts> <customerTableName>")
    }
    val port = args(0).toInt
    val hbaseConfigFolder = args(1)
    val numberOfSalts = args(2).toInt
    val appEventTableName = args(3)
    val accountMartTableName = args(4)

    val conf = HBaseConfiguration.create()
    conf.addResource(new File(hbaseConfigFolder + "hbase-site.xml").toURI.toURL)

    HBaseGlobalValues.init(conf, numberOfSalts,
      appEventTableName, accountMartTableName)

    val server = new Server(port)

    val sh = new ServletHolder(classOf[ServletContainer])
    sh.setInitParameter("com.sun.jersey.config.property.resourceConfigClass", "com.sun.jersey.api.core.PackagesResourceConfig")
    sh.setInitParameter("com.sun.jersey.config.property.packages", "com.cloudera.sa.example.card.server.hbase")
    sh.setInitParameter("com.sun.jersey.api.json.POJOMappingFeature", "true")

    val context = new Context(server, "/", Context.SESSIONS)
    context.addServlet(sh, "/*")

    println("starting HBase Rest Server")
    server.start()
    println("started HBase Rest Sserver")
    server.join()
  }
} 
开发者ID:tmalaska,项目名称:AppTrans,代码行数:44,代码来源:HBaseRestServer.scala


注:本文中的com.sun.jersey.spi.container.servlet.ServletContainer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。