当前位置: 首页>>代码示例>>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;未经允许,请勿转载。