本文整理汇总了Scala中com.twitter.finatra.http.filters.CommonFilters类的典型用法代码示例。如果您正苦于以下问题:Scala CommonFilters类的具体用法?Scala CommonFilters怎么用?Scala CommonFilters使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CommonFilters类的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: 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
示例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]
}
}
开发者ID:super-point,项目名称:xpoint-core,代码行数:36,代码来源:ApiServer.scala
示例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)
}
开发者ID:previousdeveloper,项目名称:open-versus,代码行数:29,代码来源:VersusServer.scala
示例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]
}
}
开发者ID:jensraaby,项目名称:feeder,代码行数:21,代码来源:FeederApiServer.scala
示例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]
}
}
开发者ID:ncbi,项目名称:finatra-xheaders-filter,代码行数:22,代码来源:XTestServer.scala
示例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]
}
}
开发者ID:coompany,项目名称:coo2xyz-auth,代码行数:49,代码来源:AuthServer.scala
示例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]
}
}
开发者ID:divanvisagie,项目名称:finagle-http-example,代码行数:25,代码来源:ExampleServer.scala
示例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")
}
}
开发者ID:divanvisagie,项目名称:writ-api,代码行数:45,代码来源:WritApiServer.scala
示例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]
}
}
开发者ID:mikeki,项目名称:personalsite,代码行数:31,代码来源:PersonalSiteServer.scala
示例16: 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
示例17: ExampleServerMain
//设置package包名称以及导入依赖的类
package com.example
import com.twitter.finagle.httpx.{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.Slf4jBridgeModule
object ExampleServerMain extends ExampleServer
class ExampleServer extends HttpServer {
override def modules = Seq(Slf4jBridgeModule)
override def defaultFinatraHttpPort = ":9999"
override def configureHttp(router: HttpRouter) {
router
.filter[LoggingMDCFilter[Request, Response]]
.filter[TraceIdMDCFilter[Request, Response]]
.filter[CommonFilters]
.add[PingController]
}
}
开发者ID:gauravtiwari,项目名称:finatra-blog,代码行数:27,代码来源:ExampleServer.scala
示例18: 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
示例19: FrontServerMain
//设置package包名称以及导入依赖的类
package cronus
import com.twitter.finagle.http.Request
import com.twitter.finatra.http.HttpServer
import com.twitter.finatra.http.filters.{CommonFilters, ExceptionMappingFilter}
import com.twitter.finatra.http.routing.HttpRouter
import cronus.auth.{AuthFilter, UserLoginController}
import cronus.modules.{AkkaActorSystemModule, CronusConfigFlagsModule, WebJarAssetModule}
import cronus.controllers._
import cronus.exception.JsonMappingExceptionMapper
object FrontServerMain extends FrontServer
class FrontServer extends HttpServer {
override val modules = Seq(
new CronusConfigFlagsModule,
WebJarAssetModule,
new AkkaActorSystemModule
)
override def configureHttp(router: HttpRouter) {
router
.filter[CommonFilters]
.filter[ExceptionMappingFilter[Request]]
.add[AssetController]
.add[UserLoginController]
.add[MainJsController]
.add[TimeController]
.add[AuthFilter, TimeSheetController]
.exceptionMapper[JsonMappingExceptionMapper]
}
}
开发者ID:codeape,项目名称:cronus,代码行数:34,代码来源:FrontServer.scala
示例20: AppsBffServer
//设置package包名称以及导入依赖的类
import java.net.InetSocketAddress
import com.twitter.finagle.builder.ClientBuilder
import com.twitter.finagle.http.{Request, Response}
import com.twitter.finagle.thrift.ThriftClientFramedCodec
import com.twitter.finatra.http.HttpServer
import com.twitter.finatra.http.filters.{CommonFilters, LoggingMDCFilter, TraceIdMDCFilter}
import com.twitter.finatra.http.routing.HttpRouter
import jarta.thoughtservice.thriftscala.ThoughtService
import thought.ThoughtController
object AppsBffServer extends HttpServer {
override protected def disableAdminHttpServer = true
override val defaultFinatraHttpPort = ":8891"
private val thoughtServiceHost = flag(name = "thought.service.host", default = "localhost", help = "Host for thought-service")
private val thoughtServicePort = flag(name = "thought.service.port", default = 9997, help = "Host for thought-service")
private def thriftClientBuilder(host: String, port: Int) = ClientBuilder()
.hosts(Seq(new InetSocketAddress(host, port)))
.codec(ThriftClientFramedCodec())
.hostConnectionLimit(1)
.failFast(false)
.build()
def thoughtService: ThoughtService.FutureIface = new ThoughtService.FinagledClient(thriftClientBuilder(host = thoughtServiceHost(), port = thoughtServicePort()))
override protected def configureHttp(router: HttpRouter): Unit = {
router
.filter[LoggingMDCFilter[Request, Response]]
.filter[TraceIdMDCFilter[Request, Response]]
.filter[CommonFilters]
.add(new ThoughtController(thoughtService))
}
}
开发者ID:lbunschoten,项目名称:jarta,代码行数:38,代码来源:AppsBffServer.scala
注:本文中的com.twitter.finatra.http.filters.CommonFilters类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论