本文整理汇总了Scala中com.twitter.finatra.http.filters.CommonFilters类的典型用法代码示例。如果您正苦于以下问题:Scala CommonFilters类的具体用法?Scala CommonFilters怎么用?Scala CommonFilters使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CommonFilters类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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]
}
示例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]
}
}
示例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]
}
}
示例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]
}
}
示例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]
}
}
示例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")
}
}
示例7: 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]
}
}
示例8: 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]
}
}
示例9: 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)
}
示例10: 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]
}
}
示例11: 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]
}
}
示例12: 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]
}
}
示例13: 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]
}
}
示例14: 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")
}
}
示例15: 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]
}
}