當前位置: 首頁>>代碼示例>>Java>>正文


Java Http.RequestBuilder方法代碼示例

本文整理匯總了Java中play.mvc.Http.RequestBuilder方法的典型用法代碼示例。如果您正苦於以下問題:Java Http.RequestBuilder方法的具體用法?Java Http.RequestBuilder怎麽用?Java Http.RequestBuilder使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在play.mvc.Http的用法示例。


在下文中一共展示了Http.RequestBuilder方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testIndex

import play.mvc.Http; //導入方法依賴的package包/類
@Test
public void testIndex() {
    Http.RequestBuilder request = new Http.RequestBuilder()
            .method(GET)
            .uri("/");

    Result result = route(app, request);
    assertEquals(OK, result.status());
}
 
開發者ID:Clivern,項目名稱:Racter,代碼行數:10,代碼來源:HomeControllerTest.java

示例2: testUnauthenticatedUserRequestingProtectedPage

import play.mvc.Http; //導入方法依賴的package包/類
@Test
public void testUnauthenticatedUserRequestingProtectedPage() {
    Http.RequestBuilder request = Helpers.fakeRequest()
            .method(GET)
            .uri(controllers.routes.PostController.getNewPostForm().url());

    Result result = route(app, request);
    assertThat(result.status()).isEqualTo(UNAUTHORIZED);
}
 
開發者ID:reljicd,項目名稱:play-framework-blog,代碼行數:10,代碼來源:SecurityTest.java

示例3: testAuthenticatedUserRequestingProtectedPage

import play.mvc.Http; //導入方法依賴的package包/類
@Test
public void testAuthenticatedUserRequestingProtectedPage() {
    Http.RequestBuilder request = Helpers.fakeRequest()
            .method(GET)
            .session("username", USERNAME)
            .uri(controllers.routes.PostController.getNewPostForm().url());

    Result result = route(app, request);
    assertThat(result.status()).isEqualTo(OK);
}
 
開發者ID:reljicd,項目名稱:play-framework-blog,代碼行數:11,代碼來源:SecurityTest.java

示例4: testAuthenticatedUserRequestingRegisterPage

import play.mvc.Http; //導入方法依賴的package包/類
@Test
public void testAuthenticatedUserRequestingRegisterPage() {
    Http.RequestBuilder request = Helpers.fakeRequest()
            .method(GET)
            .session("username", USERNAME)
            .uri(controllers.routes.UserController.getRegistrationForm().url());

    Result result = route(app, request);
    assertThat(result.status()).isEqualTo(SEE_OTHER);
}
 
開發者ID:reljicd,項目名稱:play-framework-blog,代碼行數:11,代碼來源:SecurityTest.java

示例5: testAuthenticatedUserRequestingToEditHisPost

import play.mvc.Http; //導入方法依賴的package包/類
@Test
public void testAuthenticatedUserRequestingToEditHisPost() {
    PostDTO postDTO = postService.savePost(new PostDTO(null, "TEST", "TEST", null, USERNAME));
    Http.RequestBuilder request = Helpers.fakeRequest()
            .method(GET)
            .session("username", USERNAME)
            .uri(controllers.routes.PostController.getEditPostForm(postDTO.id).url());

    Result result = route(app, request);
    assertThat(result.status()).isEqualTo(OK);
}
 
開發者ID:reljicd,項目名稱:play-framework-blog,代碼行數:12,代碼來源:SecurityTest.java

示例6: testAuthenticatedUserRequestingToEditPostByOtherUser

import play.mvc.Http; //導入方法依賴的package包/類
@Test
public void testAuthenticatedUserRequestingToEditPostByOtherUser() {
    UserDTO userDTO = new UserDTO("TEST", "TEST", "[email protected]", "firstName", "lastName");
    userService.saveUser(userDTO);
    PostDTO postDTO = postService.savePost(new PostDTO(null, "TEST", "TEST", null, userDTO.username));

    Http.RequestBuilder request = Helpers.fakeRequest()
            .method(GET)
            .session("username", USERNAME)
            .uri(controllers.routes.PostController.getEditPostForm(postDTO.id).url());

    Result result = route(app, request);
    assertThat(result.status()).isEqualTo(UNAUTHORIZED);
}
 
開發者ID:reljicd,項目名稱:play-framework-blog,代碼行數:15,代碼來源:SecurityTest.java

示例7: enviaPOSTAddOpiniao

import play.mvc.Http; //導入方法依賴的package包/類
public static Result enviaPOSTAddOpiniao(JsonNode json, long iniciativaExemplo, String token) {
    Logger.debug("Requisição para add opinião: " + json.toString());
    Http.RequestBuilder request = new Http.RequestBuilder().method("POST")
            .bodyJson(json)
            .header("authorization", "token " + token)
            .uri(controllers.routes.OpiniaoController.addOpiniao(iniciativaExemplo).url());
    return route(request);
}
 
開發者ID:nazareno,項目名稱:diferentonas-server,代碼行數:9,代碼來源:ControllersTestUtils.java

示例8: testIndex

import play.mvc.Http; //導入方法依賴的package包/類
@Test
public void testIndex() {
    Http.RequestBuilder request = new Http.RequestBuilder()
            .method(GET)
            .uri("/login");

    Result result = route(app, request);
    assertEquals(OK, result.status());
}
 
開發者ID:bekce,項目名稱:oauthly,代碼行數:10,代碼來源:HomeControllerTest.java


注:本文中的play.mvc.Http.RequestBuilder方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。