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


Java Call类代码示例

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


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

示例1: reverseUrl

import play.mvc.Call; //导入依赖的package包/类
/**
 * Get the URL by the controllers package, class, method and parameters. It
 * use reflection for get the reverse route.
 * 
 * @param controllerPackage
 * 	The name of the package of the controller
 * @param controllerClass
 * 	The name of the controller class
 * @param methodName
 * 	The method name in the controller, i.e. action
 * @param methodArguments
 * 	The arguments of the method
 * @return
 * 	Reversed URL
 * @throws Exception
 * 	Any exception in the case of reversion
 */
private static String reverseUrl(
    final ClassLoader classLoader,
    final String controllerPackage,
    final String controllerClass,
    final String methodName,
    final RouteMethodArguments methodArguments) throws Exception {

  // Load the auto generated class "routes".
  final Class<?> routerClass = classLoader.loadClass(controllerPackage + ".routes");

  // Get the reverse router object of the controller.
  final Field declaredField = routerClass.getDeclaredField(controllerClass);
  // It's static field.
  final Object object = declaredField.get(null);
  final Class<?> type = declaredField.getType();

  // Get the action of the reverse controller.
  final Method routerMethod = type.getMethod(methodName, methodArguments.types);
  final Call invoke = (Call) routerMethod.invoke(object, methodArguments.values);

  // Get the URL of the action.
  return invoke.url();
}
 
开发者ID:andriykuba,项目名称:play-handlebars,代码行数:41,代码来源:PlayHelpers.java

示例2: auth

import play.mvc.Call; //导入依赖的package包/类
@Override
public Call auth(final String provider) {
    // You can provide your own authentication implementation,
    // however the default should be sufficient for most cases
    return com.feth.play.module.pa.controllers.routes.Authenticate
            .authenticate(provider);
}
 
开发者ID:Vadus,项目名称:songs_play,代码行数:8,代码来源:MyResolver.java

示例3: onException

import play.mvc.Call; //导入依赖的package包/类
@Override
public Call onException(final AuthException e) {
    if (e instanceof AccessDeniedException) {
        return routes.Signup
                .oAuthDenied(((AccessDeniedException) e)
                        .getProviderKey());
    }

    // more custom problem handling here...
    return super.onException(e);
}
 
开发者ID:Vadus,项目名称:songs_play,代码行数:12,代码来源:MyResolver.java

示例4: testPager

import play.mvc.Call; //导入依赖的package包/类
@Test
public void testPager() {
    start();
    Pager pager = new Pager();
    pager.index = 10;
    pager.size = 20;
    // Test that the pager is bound/unbound correctly
    Call call = routes.Application.paged(pager);
    assertEquals("/paged?p.index=10&p.size=20", call.url());
    Result result = route(fakeRequest(call.method(), call.url()));
    assertEquals("Pager{index=10, size=20}", contentAsString(result));
}
 
开发者ID:vangav,项目名称:vos_backend,代码行数:13,代码来源:BindablesTest.java

示例5: testUser

import play.mvc.Call; //导入依赖的package包/类
@Test
public void testUser() {
    start();
    User user = new User();
    user.email = "[email protected]";
    // Test that the user is bound/unbound correctly
    Call call = routes.Application.user(user);
    assertEquals("/user/[email protected]", call.url());
    Result result = route(fakeRequest(call.method(), call.url()));
    assertEquals("[email protected]", contentAsString(result));
}
 
开发者ID:vangav,项目名称:vos_backend,代码行数:12,代码来源:BindablesTest.java

示例6: onException

import play.mvc.Call; //导入依赖的package包/类
@Override
public Call onException(final AuthException e) {
    if (e instanceof AccessDeniedException) {
        return routes.Public
                .oAuthDenied(((AccessDeniedException) e)
                        .getProviderKey());
    }

    // more custom problem handling here...

    return super.onException(e);
}
 
开发者ID:schmave,项目名称:demschooltools,代码行数:13,代码来源:MyResolver.java

示例7: createProductLink

import play.mvc.Call; //导入依赖的package包/类
private BreadcrumbLinkViewModel createProductLink(final ProductWithVariant productWithVariant) {
    final BreadcrumbLinkViewModel linkViewModel = new BreadcrumbLinkViewModel();
    linkViewModel.setText(productWithVariant.getProduct().getName());
    final String productUrl = getProductReverseRouter()
            .productDetailPageCall(productWithVariant.getProduct(), productWithVariant.getVariant())
            .map(Call::url)
            .orElse("");
    linkViewModel.setUrl(productUrl);
    return linkViewModel;
}
 
开发者ID:commercetools,项目名称:commercetools-sunrise-java,代码行数:11,代码来源:ProductBreadcrumbViewModelFactory.java

示例8: fillProductSlug

import play.mvc.Call; //导入依赖的package包/类
protected void fillProductSlug(final WishlistItemViewModel viewModel, final LineItem lineItem) {
    if (lineItem != null) {
        final String productSlug = productReverseRouter
                .productDetailPageCall(lineItem)
                .map(Call::url)
                .orElse("");
        viewModel.setUrl(productSlug);
    }
}
 
开发者ID:commercetools,项目名称:commercetools-sunrise-java,代码行数:10,代码来源:WishlistItemViewModelFactory.java

示例9: showPairs

import play.mvc.Call; //导入依赖的package包/类
/**** PRIVATE OPERATIONS ****/
private static Result showPairs() {

	String pageTitle = "Debug";

	Html topBar = debug_topbar.render(project.getName());
	Html topNav = common_topnav.render(project);
	Html content = facets_layout.render();

	List<Call> dynamicJs = new ArrayList<Call>();
	dynamicJs.add(controllers.project.routes.ProjectController.javascriptRoutes());
	dynamicJs.add(controllers.routes.Assets.at("javascripts/project/project.js"));

	dynamicJs.add(controllers.debug.routes.DebugController.javascriptRoutes());
	dynamicJs.add(controllers.routes.Assets.at("javascripts/bootstrap/bootstrap-tree.js"));
	dynamicJs.add(controllers.routes.Assets.at("javascripts/facets_layout/facets_layout.js"));
	dynamicJs.add(controllers.routes.Assets.at("javascripts/debug/debug_error_filter.js"));  
	dynamicJs.add(controllers.routes.Assets.at("javascripts/debug/debug_facets_layout.js"));  
	dynamicJs.add(controllers.routes.Assets.at("javascripts/debug/debug_match_status_filter.js"));  
	dynamicJs.add(controllers.routes.Assets.at("javascripts/debug/debug_matching_summary.js"));  
	dynamicJs.add(controllers.routes.Assets.at("javascripts/debug/debug_rule_filter.js"));  
	dynamicJs.add(controllers.routes.Assets.at("javascripts/debug/debug_feature_thresh_filter.js"));  
	dynamicJs.add(controllers.routes.Assets.at("javascripts/debug/debug_skyline_filter.js"));  
	dynamicJs.add(controllers.routes.Assets.at("javascripts/debug/debug_table.js"));  
	dynamicJs.add(controllers.routes.Assets.at("javascripts/debug/debug.js")); 

	List<Call> dynamicCss = new ArrayList<Call>();
	dynamicCss.add(controllers.routes.Assets.at("stylesheets/bootstrap/bootstrap-tree.min.css"));
	dynamicCss.add(controllers.routes.Assets.at("stylesheets/facets_layout/facets_layout.css"));
	dynamicCss.add(controllers.routes.Assets.at("stylesheets/debug/debug.css"));

	Html page =  common_main.render(pageTitle, topBar, topNav, content,
			dynamicCss, dynamicJs);

	return ok(page);
}
 
开发者ID:saikatgomes,项目名称:CS784-Data_Integration,代码行数:37,代码来源:DebugController.java

示例10: authorizeUrl

import play.mvc.Call; //导入依赖的package包/类
public String authorizeUrl(Call returnTo) {
    return URL.build(configuration.authorizationEndpoint, Scala.varargs(
            param("response_type", "code"),
            param("client_id", configuration.clientId),
            param("redirect_uri", routes.OAuth.callback().absoluteURL(request())),
            param("scope", configuration.scope),
            param("state", returnTo.url())
    ));
}
 
开发者ID:julienrf,项目名称:pfe-samples,代码行数:10,代码来源:OAuth.java

示例11: userExists

import play.mvc.Call; //导入依赖的package包/类
@Override
protected Call userExists(final UsernamePasswordAuthUser authUser) {
	return routes.Signup.exists();
}
 
开发者ID:Vadus,项目名称:songs_play,代码行数:5,代码来源:MyUsernamePasswordAuthProvider.java

示例12: userUnverified

import play.mvc.Call; //导入依赖的package包/类
@Override
protected Call userUnverified(final UsernamePasswordAuthUser authUser) {
	return routes.Signup.unverified();
}
 
开发者ID:Vadus,项目名称:songs_play,代码行数:5,代码来源:MyUsernamePasswordAuthProvider.java

示例13: login

import play.mvc.Call; //导入依赖的package包/类
@Override
public Call login() {
    // Your login page
    return routes.Application.login();
}
 
开发者ID:Vadus,项目名称:songs_play,代码行数:6,代码来源:MyResolver.java

示例14: afterAuth

import play.mvc.Call; //导入依赖的package包/类
@Override
public Call afterAuth() {
    // The user will be redirected to this page after authentication
    // if no original URL was saved
    return routes.Application.index();
}
 
开发者ID:Vadus,项目名称:songs_play,代码行数:7,代码来源:MyResolver.java

示例15: afterLogout

import play.mvc.Call; //导入依赖的package包/类
@Override
public Call afterLogout() {
    return routes.Application.index();
}
 
开发者ID:Vadus,项目名称:songs_play,代码行数:5,代码来源:MyResolver.java


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