本文整理匯總了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();
}