Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (101)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (309)
Collections:
Other Resources:
HttpComponents Core Source Code Files
HttpComponents Core Source Code Files are provided in the source package file, httpcomponents-core-5.2-src.zip.
You can download httpcomponents-core-5.2-src.zip as described in the previous tutorial and go to the "httpcore5/src" sub-folder to view Source Code files.
You can also browse HttpComponents Core Source Code below:
✍: FYIcenter.com
⏎ org/apache/hc/core5/net/URIAuthority.java
/* * ==================================================================== * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. * */ package org.apache.hc.core5.net; import java.io.Serializable; import java.net.URISyntaxException; import java.util.Objects; import org.apache.hc.core5.annotation.Contract; import org.apache.hc.core5.annotation.ThreadingBehavior; import org.apache.hc.core5.util.Args; import org.apache.hc.core5.util.LangUtils; import org.apache.hc.core5.util.TextUtils; import org.apache.hc.core5.util.Tokenizer; /** * Represents authority component of request {@link java.net.URI}. * * @since 5.0 */ @Contract(threading = ThreadingBehavior.IMMUTABLE) public final class URIAuthority implements NamedEndpoint, Serializable { private static final long serialVersionUID = 1L; private final String userInfo; private final Host host; static URIAuthority parse(final CharSequence s, final Tokenizer.Cursor cursor) throws URISyntaxException { final Tokenizer tokenizer = Tokenizer.INSTANCE; String userInfo = null; final int initPos = cursor.getPos(); final String token = tokenizer.parseContent(s, cursor, URISupport.HOST_SEPARATORS); if (!cursor.atEnd() && s.charAt(cursor.getPos()) == '@') { cursor.updatePos(cursor.getPos() + 1); if (!TextUtils.isBlank(token)) { userInfo = token; } } else { //Rewind cursor.updatePos(initPos); } final Host host = Host.parse(s, cursor); return new URIAuthority(userInfo, host); } static URIAuthority parse(final CharSequence s) throws URISyntaxException { final Tokenizer.Cursor cursor = new Tokenizer.Cursor(0, s.length()); return parse(s, cursor); } static void format(final StringBuilder buf, final URIAuthority uriAuthority) { if (uriAuthority.getUserInfo() != null) { buf.append(uriAuthority.getUserInfo()); buf.append("@"); } Host.format(buf, uriAuthority); } static String format(final URIAuthority uriAuthority) { final StringBuilder buf = new StringBuilder(); format(buf, uriAuthority); return buf.toString(); } /** * Constructs a new instance. * * @throws IllegalArgumentException * If the port parameter is outside the specified range of valid port values, which is between 0 and * 65535, inclusive. {@code -1} indicates the scheme default port. */ public URIAuthority(final String userInfo, final String hostname, final int port) { super(); this.userInfo = userInfo; this.host = new Host(hostname, port); } public URIAuthority(final String hostname, final int port) { this(null, hostname, port); } /** * @since 5.2 */ public URIAuthority(final String userInfo, final Host host) { super(); Args.notNull(host, "Host"); this.userInfo = userInfo; this.host = host; } /** * @since 5.2 */ public URIAuthority(final Host host) { this(null, host); } /** * @since 5.2 */ public URIAuthority(final String userInfo, final NamedEndpoint endpoint) { super(); Args.notNull(endpoint, "Endpoint"); this.userInfo = userInfo; this.host = new Host(endpoint.getHostName(), endpoint.getPort()); } public URIAuthority(final NamedEndpoint namedEndpoint) { this(null, namedEndpoint); } /** * Creates a {@code URIAuthority} instance from a string. Text may not contain any blanks. */ public static URIAuthority create(final String s) throws URISyntaxException { if (TextUtils.isBlank(s)) { return null; } final Tokenizer.Cursor cursor = new Tokenizer.Cursor(0, s.length()); final URIAuthority uriAuthority = parse(s, cursor); if (!cursor.atEnd()) { throw URISupport.createException(s, cursor, "Unexpected content"); } return uriAuthority; } public URIAuthority(final String hostname) { this(null, hostname, -1); } public String getUserInfo() { return userInfo; } @Override public String getHostName() { return host.getHostName(); } @Override public int getPort() { return host.getPort(); } @Override public String toString() { return format(this); } @Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj instanceof URIAuthority) { final URIAuthority that = (URIAuthority) obj; return Objects.equals(this.userInfo, that.userInfo) && Objects.equals(this.host, that.host); } return false; } @Override public int hashCode() { int hash = LangUtils.HASH_SEED; hash = LangUtils.hashCode(hash, userInfo); hash = LangUtils.hashCode(hash, host); return hash; } }
⏎ org/apache/hc/core5/net/URIAuthority.java
Or download all them as a single archive file:
File name: httpcore5-5.2-fyi.zip File size: 812477 bytes Release date: 2022-11-10 Download
⇒ Donwload httpcomponents-client-4.5.3-bin.zip
⇐ Download and Install HttpComponents Core Source Package
2023-03-07, 17820👍, 0💬
Popular Posts:
JAX-WS is an API for building web services and clients. It is the next generation Web Services API r...
JRE 5 sunjce_provider.jar is the JAR file for JRE 5 Sun JCE Provider, which provides implementations...
commons-lang-1.0.1.jar is the JAR file for Apache Commons Lang 1.0.1, which provides a host of helpe...
ASM is an all purpose Java bytecode manipulation and analysis framework. It can be used to modify ex...
commons-collections4-4.4 -sources.jaris the source JAR file for Apache Commons Collections 4.2, whic...