本文整理汇总了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);
}
示例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());
}
示例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());
}
示例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();
}
示例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();
}