本文整理汇总了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()
}
}
示例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()
}
}
示例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()
}
}
示例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()
}
}