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


Scala TraceIdMDCFilter类代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: 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

示例6: 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

示例7: 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

示例8: 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

示例9: 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

示例10: 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

示例11: 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

示例12: WritApiServerMain

//设置package包名称以及导入依赖的类
package com.writ.api

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
import com.writ.api.controllers.{AuthenticationController, PingController}
import com.writ.api.modules.UserServiceModule

object WritApiServerMain extends WritApiServer

class WritApiServer extends HttpServer {

  override def defaultFinatraHttpPort = ":9999"

  override def modules = Seq(UserServiceModule)

  override def configureHttp(router: HttpRouter) {
    router
      .filter[LoggingMDCFilter[Request, Response]]
      .filter[TraceIdMDCFilter[Request, Response]]
      .filter[CommonFilters]
      .add[PingController]
      .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("writ-api-server")
  }

} 
开发者ID:divanvisagie,项目名称:writ-api,代码行数:45,代码来源:WritApiServer.scala

示例13: PersonalSiteServerMain

//设置package包名称以及导入依赖的类
package com.mikeki.personalsite

import com.mikeki.personalsite.controllers.PersonalSiteController
import com.mikeki.personalsite.modules.TwitterClientModule
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.modules.MustacheModule
import com.twitter.finatra.http.routing.HttpRouter

object PersonalSiteServerMain extends PersonalSiteServer

class PersonalSiteServer extends HttpServer {

  
  override val disableAdminHttpServer = true

  override val modules = Seq(
    TwitterClientModule,
    MustacheModule
  )

  override def configureHttp(router: HttpRouter) {
    router
      .filter[LoggingMDCFilter[Request, Response]]
      .filter[TraceIdMDCFilter[Request, Response]]
      .filter[CommonFilters]
      .add[PersonalSiteController]
  }
} 
开发者ID:mikeki,项目名称:personalsite,代码行数:31,代码来源:PersonalSiteServer.scala

示例14: TodoServerMain

//设置package包名称以及导入依赖的类
package com.example

import com.example.controllers.{DefaultController, PingController, TodoController, UserController}
import com.example.filters.TokenFilter
import com.example.modules.{DatabaseModule, UserModule}
import com.example.swagger.TodoSwaggerDocument
import com.example.warmup.WarmupHandler
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
import com.twitter.inject.requestscope.FinagleRequestScopeFilter
import io.swagger.models.Info

object TodoServerMain extends TodoServer

class TodoServer extends HttpServer {

  TodoSwaggerDocument.info(new Info()
    .description("Todo application API")
    .version("0.0.1")
    .title("Todo")
  )

  override def modules = Seq(UserModule,DatabaseModule)

  override def defaultFinatraHttpPort = ":9999"

  override def configureHttp(router: HttpRouter): Unit = {
    router
      .filter[FinagleRequestScopeFilter[Request,Response]]
      .filter[LoggingMDCFilter[Request, Response]]
      .filter[TraceIdMDCFilter[Request, Response]]
      .filter[CommonFilters]
      .add(new SwaggerController(swagger = TodoSwaggerDocument))
      .add[TokenFilter, PingController]
      .add[TokenFilter, TodoController]
      .add[UserController]
      .add[DefaultController]
  }

  override def warmup(): Unit = {
    run[WarmupHandler]()
  }

} 
开发者ID:divanvisagie,项目名称:finatra-todo-app,代码行数:48,代码来源:TodoServer.scala

示例15: HelloServerMain

//设置package包名称以及导入依赖的类
package com.example

import com.example.http._
import com.google.inject.Module
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 finatra.freemarker.FreemarkerModule

object HelloServerMain extends HelloServer

class HelloServer extends HttpServer {
  override def defaultFinatraHttpPort = ":80"

  override protected def modules: Seq[Module] = Array(FreemarkerModule,H2Module)

  override def configureHttp(router: HttpRouter): Unit = {
    router
      .filter[LoggingMDCFilter[Request, Response]]
      .filter[TraceIdMDCFilter[Request, Response]]
      .filter[CommonFilters]
      .add[HomeController]
      .add[PingController]
  }
} 
开发者ID:yafengli,项目名称:finatra-freemarker-seed.g8,代码行数:27,代码来源:HelloServer.scala


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