public final class URL extends Object implements Serializable
url example:
Some strange example below:
| 构造器和说明 |
|---|
URL(String protocol,
String host,
int port) |
URL(String protocol,
String host,
int port,
Map<String,String> parameters) |
URL(String protocol,
String host,
int port,
String path) |
URL(String protocol,
String host,
int port,
String[] pairs) |
URL(String protocol,
String host,
int port,
String path,
Map<String,String> parameters) |
URL(String protocol,
String host,
int port,
String path,
String... pairs) |
URL(String protocol,
String username,
String password,
String host,
int port,
String path) |
URL(String protocol,
String username,
String password,
String host,
int port,
String path,
Map<String,String> parameters) |
URL(String protocol,
String username,
String password,
String host,
int port,
String path,
String... pairs) |
public URL(String protocol, String username, String password, String host, int port, String path)
public URL(String protocol, String username, String password, String host, int port, String path, String... pairs)
public static URL valueOf(String url)
url - URL stringURLpublic String getProtocol()
public String getUsername()
public String getPassword()
public String getAuthority()
public String getHost()
public String getIp()
请注意: 如果和Socket的地址对比, 或用地址作为Map的Key查找, 请使用IP而不是Host, 否则配置域名会有问题
public int getPort()
public URL setPort(int port)
public int getPort(int defaultPort)
public String getAddress()
public String getBackupAddress()
public String getBackupAddress(int defaultPort)
public String getPath()
public String getAbsolutePath()
public double getParameter(String key, double defaultValue)
public float getParameter(String key, float defaultValue)
public long getParameter(String key, long defaultValue)
public int getParameter(String key, int defaultValue)
public short getParameter(String key, short defaultValue)
public byte getParameter(String key, byte defaultValue)
public float getPositiveParameter(String key, float defaultValue)
public double getPositiveParameter(String key, double defaultValue)
public long getPositiveParameter(String key, long defaultValue)
public int getPositiveParameter(String key, int defaultValue)
public short getPositiveParameter(String key, short defaultValue)
public byte getPositiveParameter(String key, byte defaultValue)
public char getParameter(String key, char defaultValue)
public boolean getParameter(String key, boolean defaultValue)
public boolean hasParameter(String key)
public String getMethodParameterAndDecoded(String method, String key, String defaultValue)
public double getMethodPositiveParameter(String method, String key, double defaultValue)
public float getMethodPositiveParameter(String method, String key, float defaultValue)
public long getMethodPositiveParameter(String method, String key, long defaultValue)
public int getMethodPositiveParameter(String method, String key, int defaultValue)
public short getMethodPositiveParameter(String method, String key, short defaultValue)
public byte getMethodPositiveParameter(String method, String key, byte defaultValue)
public boolean getMethodParameter(String method, String key, boolean defaultValue)
public boolean isLocalHost()
public boolean isAnyHost()
public URL addParameter(String key, CharSequence value)
public URL addParameters(Map<String,String> parameters)
parameters - public URL removeParameters(Collection<String> keys)
public URL clearParameters()
public String toIdentityString()
public String toFullString()
public String toParameterString()
public URL toJavaURL()
public InetSocketAddress toInetSocketAddress()
public String getServiceKey()
public String toServiceStringWithoutResolving()
public String toServiceString()
@Deprecated public String getServiceName()
public String getServiceInterface()
@Deprecated public int getIntParameter(String key)
getParameter(String, int)@Deprecated public int getIntParameter(String key, int defaultValue)
getParameter(String, int)@Deprecated public int getPositiveIntParameter(String key, int defaultValue)
getPositiveParameter(String, int)@Deprecated public boolean getBooleanParameter(String key)
getParameter(String, boolean)@Deprecated public boolean getBooleanParameter(String key, boolean defaultValue)
getParameter(String, boolean)@Deprecated public int getMethodIntParameter(String method, String key)
getMethodParameter(String, String, int)@Deprecated public int getMethodIntParameter(String method, String key, int defaultValue)
getMethodParameter(String, String, int)@Deprecated public int getMethodPositiveIntParameter(String method, String key, int defaultValue)
getMethodPositiveParameter(String, String, int)@Deprecated public boolean getMethodBooleanParameter(String method, String key)
getMethodParameter(String, String, boolean)@Deprecated public boolean getMethodBooleanParameter(String method, String key, boolean defaultValue)
getMethodParameter(String, String, boolean)Copyright © 2012–2017 Alibaba. All rights reserved.