org.apache.xml.utils.URI.isWellFormedAddress()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(7.3k)|赞(0)|评价(0)|浏览(153)

本文整理了Java中org.apache.xml.utils.URI.isWellFormedAddress()方法的一些代码示例,展示了URI.isWellFormedAddress()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。URI.isWellFormedAddress()方法的具体详情如下:
包路径:org.apache.xml.utils.URI
类名称:URI
方法名:isWellFormedAddress

URI.isWellFormedAddress介绍

[英]Determine whether a string is syntactically capable of representing a valid IPv4 address or the domain name of a network host. A valid IPv4 address consists of four decimal digit groups separated by a '.'. A hostname consists of domain labels (each of which must begin and end with an alphanumeric but may contain '-') separated & by a '.'. See RFC 2396 Section 3.2.2.
[中]确定字符串在语法上是否能够表示有效的IPv4地址或网络主机的域名。有效的IPv4地址由四个以“.”分隔的十进制数字组组成。主机名由域标签组成(每个域标签必须以字母数字开头和结尾,但可能包含“-”)并用“.”分隔。参见RFC 2396第3.2.2节。

代码示例

代码示例来源:origin: robovm/robovm

  1. /**
  2. * Set the host for this URI. If null is passed in, the userinfo
  3. * field is also set to null and the port is set to -1.
  4. *
  5. * @param p_host the host for this URI
  6. *
  7. * @throws MalformedURIException if p_host is not a valid IP
  8. * address or DNS hostname.
  9. */
  10. public void setHost(String p_host) throws MalformedURIException
  11. {
  12. if (p_host == null || p_host.trim().length() == 0)
  13. {
  14. m_host = p_host;
  15. m_userinfo = null;
  16. m_port = -1;
  17. }
  18. else if (!isWellFormedAddress(p_host))
  19. {
  20. throw new MalformedURIException(XMLMessages.createXMLMessage(XMLErrorResources.ER_HOST_ADDRESS_NOT_WELLFORMED, null)); //"Host is not a well formed address!");
  21. }
  22. m_host = p_host;
  23. }

代码示例来源:origin: xalan/xalan

  1. /**
  2. * Set the host for this URI. If null is passed in, the userinfo
  3. * field is also set to null and the port is set to -1.
  4. *
  5. * @param p_host the host for this URI
  6. *
  7. * @throws MalformedURIException if p_host is not a valid IP
  8. * address or DNS hostname.
  9. */
  10. public void setHost(String p_host) throws MalformedURIException
  11. {
  12. if (p_host == null || p_host.trim().length() == 0)
  13. {
  14. m_host = p_host;
  15. m_userinfo = null;
  16. m_port = -1;
  17. }
  18. else if (!isWellFormedAddress(p_host))
  19. {
  20. throw new MalformedURIException(XMLMessages.createXMLMessage(XMLErrorResources.ER_HOST_ADDRESS_NOT_WELLFORMED, null)); //"Host is not a well formed address!");
  21. }
  22. m_host = p_host;
  23. }

代码示例来源:origin: org.apache.xalan/com.springsource.org.apache.xalan

  1. /**
  2. * Set the host for this URI. If null is passed in, the userinfo
  3. * field is also set to null and the port is set to -1.
  4. *
  5. * @param p_host the host for this URI
  6. *
  7. * @throws MalformedURIException if p_host is not a valid IP
  8. * address or DNS hostname.
  9. */
  10. public void setHost(String p_host) throws MalformedURIException
  11. {
  12. if (p_host == null || p_host.trim().length() == 0)
  13. {
  14. m_host = p_host;
  15. m_userinfo = null;
  16. m_port = -1;
  17. }
  18. else if (!isWellFormedAddress(p_host))
  19. {
  20. throw new MalformedURIException(XMLMessages.createXMLMessage(XMLErrorResources.ER_HOST_ADDRESS_NOT_WELLFORMED, null)); //"Host is not a well formed address!");
  21. }
  22. m_host = p_host;
  23. }

代码示例来源:origin: com.mobidevelop.robovm/robovm-rt

  1. /**
  2. * Set the host for this URI. If null is passed in, the userinfo
  3. * field is also set to null and the port is set to -1.
  4. *
  5. * @param p_host the host for this URI
  6. *
  7. * @throws MalformedURIException if p_host is not a valid IP
  8. * address or DNS hostname.
  9. */
  10. public void setHost(String p_host) throws MalformedURIException
  11. {
  12. if (p_host == null || p_host.trim().length() == 0)
  13. {
  14. m_host = p_host;
  15. m_userinfo = null;
  16. m_port = -1;
  17. }
  18. else if (!isWellFormedAddress(p_host))
  19. {
  20. throw new MalformedURIException(XMLMessages.createXMLMessage(XMLErrorResources.ER_HOST_ADDRESS_NOT_WELLFORMED, null)); //"Host is not a well formed address!");
  21. }
  22. m_host = p_host;
  23. }

代码示例来源:origin: com.bugvm/bugvm-rt

  1. /**
  2. * Set the host for this URI. If null is passed in, the userinfo
  3. * field is also set to null and the port is set to -1.
  4. *
  5. * @param p_host the host for this URI
  6. *
  7. * @throws MalformedURIException if p_host is not a valid IP
  8. * address or DNS hostname.
  9. */
  10. public void setHost(String p_host) throws MalformedURIException
  11. {
  12. if (p_host == null || p_host.trim().length() == 0)
  13. {
  14. m_host = p_host;
  15. m_userinfo = null;
  16. m_port = -1;
  17. }
  18. else if (!isWellFormedAddress(p_host))
  19. {
  20. throw new MalformedURIException(XMLMessages.createXMLMessage(XMLErrorResources.ER_HOST_ADDRESS_NOT_WELLFORMED, null)); //"Host is not a well formed address!");
  21. }
  22. m_host = p_host;
  23. }

代码示例来源:origin: com.gluonhq/robovm-rt

  1. /**
  2. * Set the host for this URI. If null is passed in, the userinfo
  3. * field is also set to null and the port is set to -1.
  4. *
  5. * @param p_host the host for this URI
  6. *
  7. * @throws MalformedURIException if p_host is not a valid IP
  8. * address or DNS hostname.
  9. */
  10. public void setHost(String p_host) throws MalformedURIException
  11. {
  12. if (p_host == null || p_host.trim().length() == 0)
  13. {
  14. m_host = p_host;
  15. m_userinfo = null;
  16. m_port = -1;
  17. }
  18. else if (!isWellFormedAddress(p_host))
  19. {
  20. throw new MalformedURIException(XMLMessages.createXMLMessage(XMLErrorResources.ER_HOST_ADDRESS_NOT_WELLFORMED, null)); //"Host is not a well formed address!");
  21. }
  22. m_host = p_host;
  23. }

代码示例来源:origin: MobiVM/robovm

  1. /**
  2. * Set the host for this URI. If null is passed in, the userinfo
  3. * field is also set to null and the port is set to -1.
  4. *
  5. * @param p_host the host for this URI
  6. *
  7. * @throws MalformedURIException if p_host is not a valid IP
  8. * address or DNS hostname.
  9. */
  10. public void setHost(String p_host) throws MalformedURIException
  11. {
  12. if (p_host == null || p_host.trim().length() == 0)
  13. {
  14. m_host = p_host;
  15. m_userinfo = null;
  16. m_port = -1;
  17. }
  18. else if (!isWellFormedAddress(p_host))
  19. {
  20. throw new MalformedURIException(XMLMessages.createXMLMessage(XMLErrorResources.ER_HOST_ADDRESS_NOT_WELLFORMED, null)); //"Host is not a well formed address!");
  21. }
  22. m_host = p_host;
  23. }

代码示例来源:origin: ibinti/bugvm

  1. /**
  2. * Set the host for this URI. If null is passed in, the userinfo
  3. * field is also set to null and the port is set to -1.
  4. *
  5. * @param p_host the host for this URI
  6. *
  7. * @throws MalformedURIException if p_host is not a valid IP
  8. * address or DNS hostname.
  9. */
  10. public void setHost(String p_host) throws MalformedURIException
  11. {
  12. if (p_host == null || p_host.trim().length() == 0)
  13. {
  14. m_host = p_host;
  15. m_userinfo = null;
  16. m_port = -1;
  17. }
  18. else if (!isWellFormedAddress(p_host))
  19. {
  20. throw new MalformedURIException(XMLMessages.createXMLMessage(XMLErrorResources.ER_HOST_ADDRESS_NOT_WELLFORMED, null)); //"Host is not a well formed address!");
  21. }
  22. m_host = p_host;
  23. }

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.xalan

  1. /**
  2. * Set the host for this URI. If null is passed in, the userinfo
  3. * field is also set to null and the port is set to -1.
  4. *
  5. * @param p_host the host for this URI
  6. *
  7. * @throws MalformedURIException if p_host is not a valid IP
  8. * address or DNS hostname.
  9. */
  10. public void setHost(String p_host) throws MalformedURIException
  11. {
  12. if (p_host == null || p_host.trim().length() == 0)
  13. {
  14. m_host = p_host;
  15. m_userinfo = null;
  16. m_port = -1;
  17. }
  18. else if (!isWellFormedAddress(p_host))
  19. {
  20. throw new MalformedURIException(XMLMessages.createXMLMessage(XMLErrorResources.ER_HOST_ADDRESS_NOT_WELLFORMED, null)); //"Host is not a well formed address!");
  21. }
  22. m_host = p_host;
  23. }

代码示例来源:origin: org.apache.karaf.bundles/org.apache.karaf.bundles.xalan-2.7.1

  1. /**
  2. * Set the host for this URI. If null is passed in, the userinfo
  3. * field is also set to null and the port is set to -1.
  4. *
  5. * @param p_host the host for this URI
  6. *
  7. * @throws MalformedURIException if p_host is not a valid IP
  8. * address or DNS hostname.
  9. */
  10. public void setHost(String p_host) throws MalformedURIException
  11. {
  12. if (p_host == null || p_host.trim().length() == 0)
  13. {
  14. m_host = p_host;
  15. m_userinfo = null;
  16. m_port = -1;
  17. }
  18. else if (!isWellFormedAddress(p_host))
  19. {
  20. throw new MalformedURIException(XMLMessages.createXMLMessage(XMLErrorResources.ER_HOST_ADDRESS_NOT_WELLFORMED, null)); //"Host is not a well formed address!");
  21. }
  22. m_host = p_host;
  23. }

代码示例来源:origin: FlexoVM/flexovm

  1. /**
  2. * Set the host for this URI. If null is passed in, the userinfo
  3. * field is also set to null and the port is set to -1.
  4. *
  5. * @param p_host the host for this URI
  6. *
  7. * @throws MalformedURIException if p_host is not a valid IP
  8. * address or DNS hostname.
  9. */
  10. public void setHost(String p_host) throws MalformedURIException
  11. {
  12. if (p_host == null || p_host.trim().length() == 0)
  13. {
  14. m_host = p_host;
  15. m_userinfo = null;
  16. m_port = -1;
  17. }
  18. else if (!isWellFormedAddress(p_host))
  19. {
  20. throw new MalformedURIException(XMLMessages.createXMLMessage(XMLErrorResources.ER_HOST_ADDRESS_NOT_WELLFORMED, null)); //"Host is not a well formed address!");
  21. }
  22. m_host = p_host;
  23. }

相关文章