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


Java GenericUrl.setRawPath方法代碼示例

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


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

示例1: testSimpleRequest_405_notSupported

import com.google.api.client.http.GenericUrl; //導入方法依賴的package包/類
@Test
public void testSimpleRequest_405_notSupported() throws IOException, Failure, TException {
    GenericUrl url = endpoint();
    url.setRawPath("/does_not_exists");
    TestService.Iface client = new TestService.Client(new HttpClientHandler(
            () -> url, factory(), provider, instrumentation));

    try {
        client.test(new Request("request"));
        fail("No exception");
    } catch (HttpResponseException ex) {
        assertThat(ex.getStatusCode(), is(405));
        assertThat(ex.getStatusMessage(), is("HTTP method POST is not supported by this URL"));
    }

    verify(instrumentation).onTransportException(any(HttpResponseException.class), anyDouble(), any(PServiceCall.class), isNull());
    verifyNoMoreInteractions(impl, instrumentation);
}
 
開發者ID:morimekta,項目名稱:providence,代碼行數:19,代碼來源:HttpClientHandlerTest.java

示例2: onSuccess

import com.google.api.client.http.GenericUrl; //導入方法依賴的package包/類
@Override
protected void onSuccess(HttpServletRequest req, HttpServletResponse resp, Credential credential) throws ServletException, IOException {
  try {
    ParticipantId participant = ParticipantId.of(GoogleAuthentication.getClientEmail(credential.getAccessToken()));
    HttpSession session = req.getSession(true);
    sessionManager.setLoggedInUser(session, participant);
    LOG.info("Authenticated user " + participant.getAddress());
    RegistrationUtil.createGreetingIfNotExists(participant, welcomeBot);
  } catch (InvalidParticipantAddress ex) {
    throw new IOException(ex);
  }
  GenericUrl url = new GenericUrl(req.getRequestURL().toString());
  url.setRawPath(SessionManager.SIGN_IN_URL);
  resp.sendRedirect(url.build());
}
 
開發者ID:jorkey,項目名稱:Wiab.pro,代碼行數:16,代碼來源:GoogleAuthenticationCallbackServlet.java

示例3: onError

import com.google.api.client.http.GenericUrl; //導入方法依賴的package包/類
@Override
protected void onError(HttpServletRequest req, HttpServletResponse resp, AuthorizationCodeResponseUrl errorResponse) throws ServletException, IOException {
  LOG.severe(errorResponse.getError() + ": " + errorResponse.getErrorDescription());
  GenericUrl url = new GenericUrl(req.getRequestURL().toString());
  url.setRawPath(SessionManager.SIGN_IN_URL);
  resp.sendRedirect(url.build());
}
 
開發者ID:jorkey,項目名稱:Wiab.pro,代碼行數:8,代碼來源:GoogleAuthenticationCallbackServlet.java

示例4: getRedirectUri

import com.google.api.client.http.GenericUrl; //導入方法依賴的package包/類
public static String getRedirectUri(HttpServletRequest req) {
    GenericUrl url = new GenericUrl(req.getRequestURL().toString());
    url.setRawPath("/oauth2callback");
    return url.build();
}
 
開發者ID:MailFred,項目名稱:mailfred-appengine,代碼行數:6,代碼來源:Utils.java

示例5: getRedirectUri

import com.google.api.client.http.GenericUrl; //導入方法依賴的package包/類
@Override
protected String getRedirectUri(HttpServletRequest hsr) throws ServletException, IOException {
  GenericUrl url = new GenericUrl(hsr.getRequestURL().toString());
  url.setRawPath(SessionManager.SIGN_IN_GOOGLE_CALLBACK_URL);
  return url.build();
}
 
開發者ID:jorkey,項目名稱:Wiab.pro,代碼行數:7,代碼來源:GoogleAuthenticationServlet.java


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