本文整理了Java中java.net.HttpURLConnection.getURL()
方法的一些代码示例,展示了HttpURLConnection.getURL()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HttpURLConnection.getURL()
方法的具体详情如下:
包路径:java.net.HttpURLConnection
类名称:HttpURLConnection
方法名:getURL
暂无
代码示例来源:origin: square/okhttp
DelegatingHttpsURLConnection(HttpURLConnection delegate) {
super(delegate.getURL());
this.delegate = delegate;
}
代码示例来源:origin: square/okhttp
@Override public URL getURL() {
return delegate.getURL();
}
代码示例来源:origin: prestodb/presto
DelegatingHttpsURLConnection(HttpURLConnection delegate) {
super(delegate.getURL());
this.delegate = delegate;
}
代码示例来源:origin: prestodb/presto
@Override public URL getURL() {
return delegate.getURL();
}
代码示例来源:origin: spring-projects/spring-framework
@Override
public URI getURI() {
try {
return this.connection.getURL().toURI();
}
catch (URISyntaxException ex) {
throw new IllegalStateException("Could not get HttpURLConnection URI: " + ex.getMessage(), ex);
}
}
代码示例来源:origin: spring-projects/spring-framework
@Override
public URI getURI() {
try {
return this.connection.getURL().toURI();
}
catch (URISyntaxException ex) {
throw new IllegalStateException("Could not get HttpURLConnection URI: " + ex.getMessage(), ex);
}
}
代码示例来源:origin: spring-projects/spring-framework
@Override
public URI getURI() {
try {
return this.connection.getURL().toURI();
}
catch (URISyntaxException ex) {
throw new IllegalStateException("Could not get HttpURLConnection URI: " + ex.getMessage(), ex);
}
}
代码示例来源:origin: spring-projects/spring-framework
@Override
public URI getURI() {
try {
return this.connection.getURL().toURI();
}
catch (URISyntaxException ex) {
throw new IllegalStateException(
"Could not get HttpURLConnection URI: " + ex.getMessage(), ex);
}
}
代码示例来源:origin: google/ExoPlayer
@Override
public @Nullable Uri getUri() {
return connection == null ? null : Uri.parse(connection.getURL().toString());
}
代码示例来源:origin: jenkinsci/jenkins
private URL tryToResolveRedirects(URL base, String authorization) {
try {
HttpURLConnection con = (HttpURLConnection) base.openConnection();
if (authorization != null) {
con.addRequestProperty("Authorization", authorization);
}
con.getInputStream().close();
base = con.getURL();
} catch (Exception ex) {
// Do not obscure the problem propagating the exception. If the problem is real it will manifest during the
// actual exchange so will be reported properly there. If it is not real (no permission in UI but sufficient
// for CLI connection using one of its mechanisms), there is no reason to bother user about it.
LOGGER.log(Level.FINE, "Failed to resolve potential redirects", ex);
}
return base;
}
代码示例来源:origin: org.springframework/spring-web
@Override
public URI getURI() {
try {
return this.connection.getURL().toURI();
}
catch (URISyntaxException ex) {
throw new IllegalStateException(
"Could not get HttpURLConnection URI: " + ex.getMessage(), ex);
}
}
代码示例来源:origin: org.springframework/spring-web
@Override
public URI getURI() {
try {
return this.connection.getURL().toURI();
}
catch (URISyntaxException ex) {
throw new IllegalStateException("Could not get HttpURLConnection URI: " + ex.getMessage(), ex);
}
}
代码示例来源:origin: org.springframework/spring-web
@Override
public URI getURI() {
try {
return this.connection.getURL().toURI();
}
catch (URISyntaxException ex) {
throw new IllegalStateException("Could not get HttpURLConnection URI: " + ex.getMessage(), ex);
}
}
代码示例来源:origin: org.springframework/spring-web
@Override
public URI getURI() {
try {
return this.connection.getURL().toURI();
}
catch (URISyntaxException ex) {
throw new IllegalStateException("Could not get HttpURLConnection URI: " + ex.getMessage(), ex);
}
}
代码示例来源:origin: wildfly/wildfly
@Override
public void configureLogoutConnection(HttpURLConnection connection) {
if (connection.getURL().getProtocol().equalsIgnoreCase("https")) {
HttpsURLConnection secureConnection = (HttpsURLConnection) connection;
this.logoutConnectionConfigurator.accept(secureConnection);
}
}
}
代码示例来源:origin: facebook/stetho
public URLConnectionInspectorResponse(String requestId, HttpURLConnection conn) throws IOException {
super(Util.convertHeaders(conn.getHeaderFields()));
mRequestId = requestId;
mUrl = conn.getURL().toString();
mStatusCode = conn.getResponseCode();
mStatusMessage = conn.getResponseMessage();
}
代码示例来源:origin: aa112901/remusic
@Override
public void run() {
try {
fileUtils = ProxyFileUtils.getInstance(mContext, request.getURL().toURI(), true);
processRequest(request, client);
} catch (IllegalStateException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (URISyntaxException e) {
e.printStackTrace();
}
}
代码示例来源:origin: facebook/stetho
public URLConnectionInspectorRequest(
String requestId,
String friendlyName,
HttpURLConnection configuredRequest,
@Nullable SimpleRequestEntity requestEntity,
RequestBodyHelper requestBodyHelper) {
super(Util.convertHeaders(configuredRequest.getRequestProperties()));
mRequestId = requestId;
mFriendlyName = friendlyName;
mRequestEntity = requestEntity;
mRequestBodyHelper = requestBodyHelper;
mUrl = configuredRequest.getURL().toString();
mMethod = configuredRequest.getRequestMethod();
}
代码示例来源:origin: facebook/facebook-android-sdk
@Test
public void testBuildsClientTokenIfNeeded() throws Exception {
GraphRequest requestMe = new GraphRequest(null, "TourEiffel");
HttpURLConnection connection = GraphRequest.toHttpConnection(requestMe);
assertTrue(connection != null);
Uri uri = Uri.parse(connection.getURL().toString());
String accessToken = uri.getQueryParameter("access_token");
assertNotNull(accessToken);
assertTrue(accessToken.contains(FacebookSdk.getApplicationId()));
assertTrue(accessToken.contains(FacebookSdk.getClientToken()));
}
}
代码示例来源:origin: facebook/facebook-android-sdk
@Test
public void testSingleGetToHttpRequest() throws Exception {
GraphRequest requestMe = new GraphRequest(null, "TourEiffel");
HttpURLConnection connection = GraphRequest.toHttpConnection(requestMe);
assertTrue(connection != null);
assertEquals("GET", connection.getRequestMethod());
assertEquals("/" + FacebookSdk.getGraphApiVersion() + "/TourEiffel",
connection.getURL().getPath());
assertTrue(connection.getRequestProperty("User-Agent").startsWith("FBAndroidSDK"));
Uri uri = Uri.parse(connection.getURL().toString());
assertEquals("android", uri.getQueryParameter("sdk"));
assertEquals("json", uri.getQueryParameter("format"));
}
内容来源于网络,如有侵权,请联系作者删除!