• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Scala Call类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: MixedPlaySpecWithNoDefaultApp

//设置package包名称以及导入依赖的类
import org.scalatest.concurrent.{Eventually, IntegrationPatience}
import org.scalatest.{MustMatchers, OptionValues, fixture}
import org.scalatestplus.play.{PortNumber, WsScalaTestClient}
import play.api.libs.ws.{WSClient, WSRequest}
import play.api.mvc.Call

abstract class MixedPlaySpecWithNoDefaultApp extends fixture.WordSpec
  with MustMatchers
  with OptionValues
  with MixedFixturesWithNoDefaultApp
  with Eventually
  with IntegrationPatience
  with WsScalaTestClient
{

  //def wsCall(call: Call)(implicit portNumber: PortNumber, wsClient: WSClient): WSRequest = doCall(call.url, wsClient, portNumber)

  // def wsUrl(url: String)(implicit portNumber: PortNumber, wsClient: WSClient): WSRequest = doCall(url, wsClient, portNumber)

  //private def doCall(url: String, wsClient: WSClient, portNumber: PortNumber) = {
  //  wsClient.url("http://localhost:" + portNumber.value + url)
  //}
} 
开发者ID:wsargent,项目名称:play-cucumber,代码行数:24,代码来源:MixedPlaySpecWithNoDefaultApp.scala


示例2:

//设置package包名称以及导入依赖的类
package configurations

import play.api.mvc.{Call, RequestHeader}
import play.api.{Environment, Mode}

import com.yukihirai0505.sFacebook.FacebookAuth
import com.yukihirai0505.sFacebook.model.Scope
import com.yukihirai0505.sFacebook.responses.auth.Oauth
import controllers.routes
import dispatch.Future


trait FacebookConfig extends Config {
  private lazy val facebookConfig = config.getConfig("facebook")
  lazy val ID: String = facebookConfig.getString("id")
  lazy val SECRET: String = facebookConfig.getString("secret")
  lazy val REDIRECT_URL: (RequestHeader, Environment) => String = (req: RequestHeader, env: Environment) => {
    val url = Call("GET", routes.FacebookC.callback("").absoluteURL(secure = env.mode.equals(Mode.Prod))(req)).url
    url.replace("?code=", "")
  }
  private lazy val facebookAuth = new FacebookAuth
  private lazy val scopes: Seq[Scope] = Seq(Scope.PUBLIC_PROFILE, Scope.PUBLISH_ACTIONS, Scope.USER_POSTS)
  lazy val AUTH_URL: (RequestHeader, Environment) => String = (req: RequestHeader, env: Environment) => {
    facebookAuth.authURL(ID, REDIRECT_URL(req, env), scopes)
  }
  lazy val ACCESS_TOKEN: (String, RequestHeader, Environment) => Future[Option[Oauth]] = (code: String, req: RequestHeader, env: Environment) => {
    facebookAuth.requestToken(ID, SECRET, REDIRECT_URL(req, env), code)
  }
} 
开发者ID:yukihirai0505,项目名称:sns-alert,代码行数:30,代码来源:FacebookConfig.scala


示例3:

//设置package包名称以及导入依赖的类
package configurations


import play.api.mvc.{Call, RequestHeader}
import play.api.{Environment, Mode}

import com.yukihirai0505.sInstagram.InstagramAuth
import com.yukihirai0505.sInstagram.model.{ResponseType, Scope}
import com.yukihirai0505.sInstagram.responses.auth.Auth
import controllers.routes
import dispatch.Future


trait InstagramConfig extends Config {
  private lazy val instagramConfig = config.getConfig("instagram")
  lazy val INSTAGRAM_ID: String = instagramConfig.getString("client.id")
  lazy val INSTAGRAM_SECRET: String = instagramConfig.getString("client.secret")
  private lazy val SCOPES: Seq[Scope] = Seq(Scope.BASIC, Scope.PUBLIC_CONTENT)
  private lazy val CALL_BACK_URL = (req: RequestHeader, env: Environment) =>
    Call("GET", routes.InstagramC.callback("").absoluteURL(secure = env.mode.equals(Mode.Prod))(req)).url
  val AUTH_URL: (RequestHeader, Environment) => String = (req: RequestHeader, env: Environment) =>
    (new InstagramAuth).authURL(clientId = INSTAGRAM_ID, callbackUrl = CALL_BACK_URL(req, env), responseType = ResponseType.CODE, scopes = SCOPES)
  val ACCESS_TOKEN: (RequestHeader, String, Environment) => Future[Option[Auth]] = (req: RequestHeader, code: String, env: Environment) =>
    (new InstagramAuth).requestToken(INSTAGRAM_ID, INSTAGRAM_SECRET, callbackUrl = CALL_BACK_URL(req, env), code = code)
} 
开发者ID:yukihirai0505,项目名称:sns-alert,代码行数:26,代码来源:InstagramConfig.scala



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Scala AccumulatorV2类代码示例发布时间:2022-05-23
下一篇:
Scala Filter类代码示例发布时间:2022-05-23
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap