本文整理汇总了Scala中com.twitter.finatra.http.HttpServer类的典型用法代码示例。如果您正苦于以下问题:Scala HttpServer类的具体用法?Scala HttpServer怎么用?Scala HttpServer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了HttpServer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Scala代码示例。
示例1: ServiceMain
//设置package包名称以及导入依赖的类
package io.github.mijicd.prezi
import com.twitter.finagle.http.{Request, Response}
import com.twitter.finatra.http.HttpServer
import com.twitter.finatra.http.filters.{CommonFilters, LoggingMDCFilter}
import com.twitter.finatra.http.routing.HttpRouter
import com.twitter.finatra.logging.modules.Slf4jBridgeModule
import io.github.mijicd.prezi.api.Presentations
import io.github.mijicd.prezi.modules.{DataSource, PreziJson}
object ServiceMain extends Service
class Service extends HttpServer {
override protected def modules = Seq(Slf4jBridgeModule, DataSource)
override protected def jacksonModule = PreziJson
override protected def defaultFinatraHttpPort = ":8180"
override protected def disableAdminHttpServer = true
override protected def configureHttp(router: HttpRouter): Unit = router.
filter[LoggingMDCFilter[Request, Response]].
filter[CommonFilters].
add[Presentations]
}
开发者ID:mijicd,项目名称:finatra-demo,代码行数:27,代码来源:bootstrap.scala
示例2: ExampleServerMain
//设置package包名称以及导入依赖的类
package com.example
import com.twitter.finagle.http.{Response, Request}
import com.twitter.finatra.http.HttpServer
import com.twitter.finatra.http.filters.{CommonFilters, LoggingMDCFilter, TraceIdMDCFilter}
import com.twitter.finatra.http.routing.HttpRouter
object ExampleServerMain extends ExampleServer
class ExampleServer extends HttpServer {
override def defaultFinatraHttpPort = ":9999"
override def configureHttp(router: HttpRouter) {
router
.filter[LoggingMDCFilter[Request, Response]]
.filter[TraceIdMDCFilter[Request, Response]]
.filter[CommonFilters]
.add[PingController]
}
}
开发者ID:divanvisagie,项目名称:finatra-website-example,代码行数:23,代码来源:ExampleServer.scala
示例3: ServerMain
//设置package包名称以及导入依赖的类
package $package$
import com.twitter.finagle.http.{Request, Response}
import com.twitter.finatra.http.HttpServer
import com.twitter.finatra.http.filters.{CommonFilters, LoggingMDCFilter, TraceIdMDCFilter}
import com.twitter.finatra.http.routing.HttpRouter
import $package$.controllers.MainController
object ServerMain extends Server
class Server extends HttpServer {
override val name = "$package$ $name;format="Camel"$"
override def configureHttp(router: HttpRouter) {
router
.filter[CommonFilters]
.filter[LoggingMDCFilter[Request, Response]]
.filter[TraceIdMDCFilter[Request, Response]]
.add[MainController]
}
}
开发者ID:jimschubert,项目名称:finatra.g8,代码行数:22,代码来源:Server.scala
示例4: FinatraServerMain
//设置package包名称以及导入依赖的类
package com.github.ikhoon
import com.github.ikhoon.app.v1.fake.FakeController
import com.github.ikhoon.app.v1.ping.PingController
import com.github.ikhoon.app.v1.user.UserController
import com.github.ikhoon.modules._
import com.jakehschwartz.finatra.swagger.DocsController
import com.twitter.finagle.http.{ Request, Response }
import com.twitter.finatra.http.HttpServer
import com.twitter.finatra.http.filters.{ CommonFilters, LoggingMDCFilter, TraceIdMDCFilter }
import com.twitter.finatra.http.routing.HttpRouter
object FinatraServerMain extends FinatraServer
class FinatraServer extends HttpServer {
override def modules = Seq(
TypesafeConfigModule, QuillDatabaseModule, SlickDatabaseModule, SwaggerModule
) ++ HttpClientModules.modules
override def jacksonModule = CustomJacksonModule
override def defaultFinatraHttpPort = ":9999"
override def configureHttp(router: HttpRouter) {
router
.filter[LoggingMDCFilter[Request, Response]]
.filter[TraceIdMDCFilter[Request, Response]]
.filter[CommonFilters]
.add[DocsController]
.add[PingController]
.add[UserController]
.add[FakeController]
}
}
开发者ID:ikhoon,项目名称:finatra-mysql-seed,代码行数:38,代码来源:FinatraServer.scala
示例5: ExampleServerMain
//设置package包名称以及导入依赖的类
package com.example
import com.twitter.finagle.http.{Response, Request}
import com.twitter.finatra.http.HttpServer
import com.twitter.finatra.http.filters.{CommonFilters, LoggingMDCFilter, TraceIdMDCFilter}
import com.twitter.finatra.http.routing.HttpRouter
object ExampleServerMain extends ExampleServer
class ExampleServer extends HttpServer {
override def defaultFinatraHttpPort = ":9999"
override def configureHttp(router: HttpRouter) {
router
.filter[LoggingMDCFilter[Request, Response]]
.filter[TraceIdMDCFilter[Request, Response]]
.filter[CommonFilters]
.add[PingController]
.add[HelloController]
.add[AssetsController]
.add[LoginController]
}
}
开发者ID:Sergey778,项目名称:finatra_test,代码行数:26,代码来源:ExampleServer.scala
示例6: TestClientServerMain
//设置package包名称以及导入依赖的类
package com.sgtest
import java.net.InetSocketAddress
import com.sgtest.controllers.AuthenticationController
import com.twitter.finagle.Http
import com.twitter.finagle.http.{Request, Response}
import com.twitter.finagle.stats.DefaultStatsReceiver
import com.twitter.finagle.zipkin.thrift.ZipkinTracer
import com.twitter.finatra.http.HttpServer
import com.twitter.finatra.http.filters.{CommonFilters, LoggingMDCFilter, TraceIdMDCFilter}
import com.twitter.finatra.http.routing.HttpRouter
object TestClientServerMain extends TestClientServer
class TestClientServer extends HttpServer {
override def defaultFinatraHttpPort = ":8888"
override val adminPort = flag("admin.port", new InetSocketAddress(8880), "Admin Http server port")
override def configureHttp(router: HttpRouter) {
router
.filter[LoggingMDCFilter[Request, Response]]
.filter[TraceIdMDCFilter[Request, Response]]
.filter[CommonFilters]
.add[AuthenticationController]
}
override def configureHttpServer(server: Http.Server): Http.Server = {
val receiver = DefaultStatsReceiver.get
val zipkinHost = sys.env.getOrElse("SG_ZIPKIN_HOST","localhost")
val zipkinPort = sys.env.getOrElse("SG_ZIPKIN_PORT", "9410").toInt
val tracer = ZipkinTracer.mk(
host = zipkinHost,
port = zipkinPort,
statsReceiver = receiver
)
server
.withTracer(tracer)
.withLabel("test-client-server")
}
}
开发者ID:divanvisagie,项目名称:swiss-guard,代码行数:46,代码来源:TestClientServer.scala
示例7: FitmanApp
//设置package包名称以及导入依赖的类
import com.twitter.finagle.http.Request
import com.twitter.finatra.http.routing.HttpRouter
import com.twitter.finatra.http.{Controller, HttpServer}
object FitmanApp extends FitmanServer
class FitmanServer extends HttpServer {
override protected def configureHttp(router: HttpRouter): Unit = {
router.add(new HelloController)
}
}
class HelloController extends Controller {
get("/hello") { request: Request =>
"Fitman says hello"
}
}
开发者ID:simoncyl,项目名称:Fitman,代码行数:20,代码来源:FitmanApp.scala
示例8: ExampleServerMain
//设置package包名称以及导入依赖的类
package com.example
import com.twitter.finagle.http.{Response, Request}
import com.twitter.finatra.http.HttpServer
import com.twitter.finatra.http.filters.CommonFilters
import com.twitter.finatra.http.routing.HttpRouter
import com.twitter.finatra.logging.filter.{TraceIdMDCFilter, LoggingMDCFilter}
import com.twitter.finatra.logging.modules.LogbackModule
object ExampleServerMain extends ExampleServer
class ExampleServer extends HttpServer {
override def modules = Seq(LogbackModule)
override def configureHttp(router: HttpRouter) {
router
.filter[LoggingMDCFilter[Request, Response]]
.filter[TraceIdMDCFilter[Request, Response]]
.filter[CommonFilters]
.add[PingController]
}
}
开发者ID:cocodrino,项目名称:futureEitherFinatra,代码行数:25,代码来源:ExampleServer.scala
示例9: ApiServer
//设置package包名称以及导入依赖的类
package xpoint.server
import com.twitter.finagle.http.{Request, Response}
import com.twitter.finatra.http.HttpServer
import com.twitter.finatra.http.filters.{CommonFilters, LoggingMDCFilter, TraceIdMDCFilter}
import com.twitter.finatra.http.routing.HttpRouter
import xpoint.api._
import xpoint.api.exception.RootExceptionMapper
import xpoint.api.service.TokenService
import xpoint.engine.script.ScriptEngine
import xpoint.engine.script.service.ScriptHook
class ApiServer()
(
implicit val tokenService: TokenService,
implicit val scriptEngine: ScriptEngine,
implicit val scriptHook: ScriptHook
) extends HttpServer{
override protected def configureHttp(router: HttpRouter): Unit = {
router
.filter[LoggingMDCFilter[Request, Response]]
.filter[TraceIdMDCFilter[Request, Response]]
.filter[CommonFilters]
// .add(new ScriptCrud(injector.instance[MessageBodyManager]))
// .add(new ScriptFileUpload)
.add(new ScriptDataSource)
// .add(new ScriptDebug)
// .add(new ScriptRegister)
// .add(new ChartSource)
.exceptionMapper[RootExceptionMapper]
}
}
开发者ID:super-point,项目名称:xpoint-core,代码行数:36,代码来源:ApiServer.scala
示例10: MainServer
//设置package包名称以及导入依赖的类
package com.versus
import com.twitter.finagle.http.{Request, Response}
import com.twitter.finatra.http.HttpServer
import com.twitter.finatra.http.filters.{CommonFilters, LoggingMDCFilter, TraceIdMDCFilter}
import com.twitter.finatra.http.routing.HttpRouter
import com.versus.module.RepositoryModule
object MainServer extends VersusServer
class VersusServer extends HttpServer {
override def defaultFinatraHttpPort = ":9999"
override def configureHttp(router: HttpRouter) {
router
.filter[LoggingMDCFilter[Request, Response]]
.filter[TraceIdMDCFilter[Request, Response]]
.filter[CommonFilters]
.add[PingController]
.add[DashboardController]
}
override val modules = Seq(
RepositoryModule)
}
开发者ID:previousdeveloper,项目名称:open-versus,代码行数:29,代码来源:VersusServer.scala
示例11: FeederApiServerMain
//设置package包名称以及导入依赖的类
package com.jensraaby.feeder.api
import com.jensraaby.feeder.api.controllers.IndexController
import com.twitter.finagle.http.{Request, Response}
import com.twitter.finatra.http.HttpServer
import com.twitter.finatra.http.filters.{CommonFilters, LoggingMDCFilter, TraceIdMDCFilter}
import com.twitter.finatra.http.routing.HttpRouter
object FeederApiServerMain extends FeederApiServer
class FeederApiServer extends HttpServer {
override def configureHttp(router: HttpRouter): Unit = {
router.
filter[LoggingMDCFilter[Request, Response]].
filter[TraceIdMDCFilter[Request, Response]].
filter[CommonFilters].
add[IndexController]
}
}
开发者ID:jensraaby,项目名称:feeder,代码行数:21,代码来源:FeederApiServer.scala
示例12: Server
//设置package包名称以及导入依赖的类
package org.globalnames.index.api
import com.twitter.finagle.http.{Request, Response}
import com.twitter.finatra.http.HttpServer
import com.twitter.finatra.http.filters._
import com.twitter.finatra.http.routing.HttpRouter
class Server extends HttpServer {
override val name = "api-server"
override val modules = Seq(ApiModule)
override def configureHttp(router: HttpRouter): Unit = {
router
.filter[LoggingMDCFilter[Request, Response]]
.filter[TraceIdMDCFilter[Request, Response]]
.filter[CommonFilters]
.add[ApiController]
}
}
object ServerMain extends Server
开发者ID:GlobalNamesArchitecture,项目名称:gnindex,代码行数:23,代码来源:Server.scala
示例13: XTestServer
//设置package包名称以及导入依赖的类
package gov.nih.nlm.ncbi.xheadersfilter
import com.twitter.finagle.http.{Request, Response}
import com.twitter.finatra.http.HttpServer
import com.twitter.finatra.http.filters.{CommonFilters, LoggingMDCFilter, TraceIdMDCFilter}
import com.twitter.finatra.http.routing.HttpRouter
class XTestServer extends HttpServer{
override def configureHttp(router: HttpRouter) {
router
.filter[LoggingMDCFilter[Request, Response]]
.filter[TraceIdMDCFilter[Request, Response]]
.filter[CommonFilters]
.filter[XHeadersHttpResponseFilter[Request]]
.add[XTestController]
}
}
开发者ID:ncbi,项目名称:finatra-xheaders-filter,代码行数:22,代码来源:XTestServer.scala
示例14: AuthServerMain
//设置package包名称以及导入依赖的类
package xyz.lascuolaopensource.coo2xyz.auth
import com.twitter.finagle.http.{Request, Response}
import com.twitter.finatra.http.HttpServer
import com.twitter.finatra.http.filters.{CommonFilters, LoggingMDCFilter, TraceIdMDCFilter}
import com.twitter.finatra.http.routing.HttpRouter
import com.typesafe.config.ConfigFactory
import org.flywaydb.core.Flyway
import slick.jdbc.DatabaseUrlDataSource
import xyz.lascuolaopensource.coo2xyz.auth.controllers.{AssetsController, AuthController}
import xyz.lascuolaopensource.coo2xyz.auth.filters.SessionFilter
object AuthServerMain extends AuthServer {
private[auth] val config = ConfigFactory.load()
override protected def start() = {
val flyway = new Flyway
val dbSource = new DatabaseUrlDataSource
dbSource.setUrl(config.getString("pgdb.properties.url"))
flyway.setDataSource(dbSource)
flyway.baseline()
flyway.migrate
super.start
}
}
class AuthServer extends HttpServer {
override protected def defaultFinatraHttpPort = AuthServerMain.config.getString("http.port")
override def defaultHttpPort = AuthServerMain.config.getString("http.port").tail.toInt
override protected def disableAdminHttpServer = true
override protected def configureHttp(router: HttpRouter) = {
router
.filter[LoggingMDCFilter[Request, Response]]
.filter[TraceIdMDCFilter[Request, Response]]
.filter[CommonFilters]
.add[SessionFilter, AuthController]
.add[AssetsController]
}
}
开发者ID:coompany,项目名称:coo2xyz-auth,代码行数:49,代码来源:AuthServer.scala
示例15: ExampleServerMain
//设置package包名称以及导入依赖的类
package com.example
import com.github.xiaodongw.swagger.finatra.SwaggerController
import com.twitter.finagle.http.{Request, Response}
import com.twitter.finatra.http.HttpServer
import com.twitter.finatra.http.filters.{CommonFilters, LoggingMDCFilter, TraceIdMDCFilter}
import com.twitter.finatra.http.routing.HttpRouter
object ExampleServerMain extends ExampleServer
class ExampleServer extends HttpServer {
override def defaultFinatraHttpPort = ":9999"
override def configureHttp(router: HttpRouter) : Unit = {
router
.filter[LoggingMDCFilter[Request, Response]]
.filter[TraceIdMDCFilter[Request, Response]]
.filter[CommonFilters]
.add(new SwaggerController(swagger = FinatraSwaggerDocument))
.add[PingController]
}
}
开发者ID:divanvisagie,项目名称:finagle-http-example,代码行数:25,代码来源:ExampleServer.scala
示例16: BuysomegamesApp
//设置package包名称以及导入依赖的类
package com.buysomegames.kernel
import com.buysomegames.controller.{GameController, GameEditionController, PlatformController}
import com.google.inject.Module
import com.twitter.finatra.http.HttpServer
import com.twitter.finatra.http.routing.HttpRouter
object BuysomegamesApp extends BuysomegamesServer
class BuysomegamesServer extends HttpServer {
override protected def defaultFinatraHttpPort: String = ":10666"
override protected def jacksonModule: Module = BuysomegamesJacksonModule
override protected def modules: Seq[Module] = Seq(
MongoConnectionModule
)
override def defaultHttpPort: Int = 11666
override protected def configureHttp(router: HttpRouter): Unit = {
router
.add[GameController]
.add[PlatformController]
.add[GameEditionController]
}
}
开发者ID:kaliy,项目名称:buysomegames,代码行数:27,代码来源:BuysomegamesApp.scala
示例17: ServerMain
//设置package包名称以及导入依赖的类
package uk.ac.wellcome.platform.idminter
import com.twitter.finagle.http.{Request, Response}
import com.twitter.finatra.http.HttpServer
import com.twitter.finatra.http.filters.{
CommonFilters,
LoggingMDCFilter,
TraceIdMDCFilter
}
import com.twitter.finatra.http.routing.HttpRouter
import uk.ac.wellcome.finatra.modules._
import uk.ac.wellcome.platform.idminter.controllers.ManagementController
import uk.ac.wellcome.platform.idminter.modules._
object ServerMain extends Server
class Server extends HttpServer {
override val name = "uk.ac.wellcome.platform.id_minter IdMinter"
override val modules = Seq(
MysqlModule,
AkkaModule,
IdMinterWorkerModule,
AWSConfigModule,
SQSClientModule,
SQSConfigModule,
SQSReaderModule,
SNSConfigModule,
SNSClientModule,
AmazonCloudWatchModule
)
override def configureHttp(router: HttpRouter) {
router
.filter[CommonFilters]
.filter[LoggingMDCFilter[Request, Response]]
.filter[TraceIdMDCFilter[Request, Response]]
.add[ManagementController]
}
}
开发者ID:wellcometrust,项目名称:platform-api,代码行数:40,代码来源:Server.scala
示例18: ServerMain
//设置package包名称以及导入依赖的类
package uk.ac.wellcome.platform.reindexer
import com.twitter.finagle.http.{Request, Response}
import com.twitter.finatra.http.HttpServer
import com.twitter.finatra.http.filters.{
CommonFilters,
LoggingMDCFilter,
TraceIdMDCFilter
}
import com.twitter.finatra.http.routing.HttpRouter
import uk.ac.wellcome.finatra.modules.{
AkkaModule,
AmazonCloudWatchModule,
DynamoClientModule,
PlatformDynamoConfigModule
}
import uk.ac.wellcome.platform.reindexer.controllers.ManagementController
import uk.ac.wellcome.platform.reindexer.modules.ReindexModule
object ServerMain extends Server
class Server extends HttpServer {
override val name = "uk.ac.wellcome.platform.reindexer Reindexer"
override val modules = Seq(PlatformDynamoConfigModule,
AmazonCloudWatchModule,
DynamoClientModule,
ReindexModule,
AkkaModule)
flag[Int]("reindex.maxAttempts",
3,
"Maximum number of times to retry a reindex operation")
override def configureHttp(router: HttpRouter) {
router
.filter[CommonFilters]
.filter[LoggingMDCFilter[Request, Response]]
.filter[TraceIdMDCFilter[Request, Response]]
.add[ManagementController]
}
}
开发者ID:wellcometrust,项目名称:platform-api,代码行数:42,代码来源:Server.scala
示例19: ServerMain
//设置package包名称以及导入依赖的类
package uk.ac.wellcome.platform.ingestor
import com.twitter.finagle.http.{Request, Response}
import com.twitter.finatra.http.HttpServer
import com.twitter.finatra.http.filters.{
CommonFilters,
LoggingMDCFilter,
TraceIdMDCFilter
}
import com.twitter.finatra.http.routing.HttpRouter
import uk.ac.wellcome.finatra.modules._
import uk.ac.wellcome.platform.ingestor.controllers._
import uk.ac.wellcome.platform.ingestor.modules._
object ServerMain extends Server
class Server extends HttpServer {
override val name = "uk.ac.wellcome.platform.ingestor Ingestor"
override val modules = Seq(
AWSConfigModule,
AmazonCloudWatchModule,
SQSConfigModule,
SQSClientModule,
AkkaModule,
SQSReaderModule,
IngestorWorkerModule,
ElasticClientModule,
WorksIndexModule
)
flag[String]("es.index", "records", "ES index name")
flag[String]("es.type", "item", "ES document type")
override def configureHttp(router: HttpRouter) {
router
.filter[CommonFilters]
.filter[LoggingMDCFilter[Request, Response]]
.filter[TraceIdMDCFilter[Request, Response]]
.add[ManagementController]
}
}
开发者ID:wellcometrust,项目名称:platform-api,代码行数:40,代码来源:Server.scala
示例20: ServerMain
//设置package包名称以及导入依赖的类
package uk.ac.wellcome.platform.transformer
import com.twitter.finagle.http.{Request, Response}
import com.twitter.finatra.http.HttpServer
import com.twitter.finatra.http.filters.{
CommonFilters,
LoggingMDCFilter,
TraceIdMDCFilter
}
import com.twitter.finatra.http.routing.HttpRouter
import uk.ac.wellcome.finatra.modules._
import uk.ac.wellcome.platform.transformer.controllers._
import uk.ac.wellcome.transformer.modules.{
TransformableParserModule,
TransformerWorkerModule
}
object ServerMain extends Server
class Server extends HttpServer {
override val name = "uk.ac.wellcome.platform.transformer Transformer"
override val modules = Seq(
AmazonCloudWatchModule,
AWSConfigModule,
PlatformDynamoConfigModule,
AkkaModule,
SQSClientModule,
SQSConfigModule,
SNSConfigModule,
SNSClientModule,
TransformableParserModule,
TransformerWorkerModule
)
override def configureHttp(router: HttpRouter) {
router
.filter[CommonFilters]
.filter[LoggingMDCFilter[Request, Response]]
.filter[TraceIdMDCFilter[Request, Response]]
.add[ManagementController]
}
}
开发者ID:wellcometrust,项目名称:platform-api,代码行数:42,代码来源:Server.scala
注:本文中的com.twitter.finatra.http.HttpServer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论