Add unit tests for version 5.x

This commit is contained in:
Joe Farebrother
2021-02-17 14:52:52 +00:00
parent cf58a90d74
commit 7b5961769a
37 changed files with 2221 additions and 39 deletions

View File

@@ -41,6 +41,7 @@ class TypeApacheHttpRequestBuilder extends Class {
}
}
// TODO: Other sources
/**
* The `request` parameter of an implementation of `HttpRequestHandler.handle`.
*/
@@ -264,8 +265,8 @@ private class BufferMethod extends TaintPreservingCallable {
.hasQualifiedName(["org.apache.http.util", "org.apache.hc.core5.util"],
["ByteArrayBuffer", "CharArrayBuffer"]) and
m.hasName([
"append", "buffer", "subSequence", "substring", "substringTrimmed", "toByteArray",
"toCharArray", "toString"
"append", "array", "buffer", "subSequence", "substring", "substringTrimmed",
"toByteArray", "toCharArray", "toString"
])
)
}

View File

@@ -3,6 +3,7 @@ import org.apache.http.protocol.*;
import org.apache.http.message.BasicHeader;
import org.apache.http.util.*;
import org.apache.http.entity.*;
import java.io.IOException;
class A {
static Object taint() { return null; }
@@ -10,7 +11,7 @@ class A {
static void sink(Object o) { }
class Test1 implements HttpRequestHandler {
public void handle(HttpRequest req, HttpResponse res, HttpContext ctx) {
public void handle(HttpRequest req, HttpResponse res, HttpContext ctx) throws IOException {
A.sink(req.getRequestLine());
A.sink(req.getRequestLine().getUri());
A.sink(req.getRequestLine().getMethod());

View File

@@ -0,0 +1,68 @@
import org.apache.hc.core5.http.*;
import org.apache.hc.core5.http.protocol.HttpContext;
import org.apache.hc.core5.http.io.HttpRequestHandler;
import org.apache.hc.core5.http.message.*;
import org.apache.hc.core5.http.io.entity.*;
import org.apache.hc.core5.util.*;
import java.io.IOException;
class B {
static Object taint() { return null; }
static void sink(Object o) { }
class Test1 implements HttpRequestHandler {
public void handle(ClassicHttpRequest req, ClassicHttpResponse res, HttpContext ctx) throws IOException, ParseException {
B.sink(req.getAuthority().getHostName());
B.sink(req.getAuthority().toString());
B.sink(req.getMethod());
B.sink(req.getPath());
B.sink(req.getScheme());
B.sink(req.getRequestUri());
RequestLine line = new RequestLine(req);
B.sink(line.getUri());
B.sink(line.getMethod());
B.sink(req.getHeaders());
B.sink(req.headerIterator());
Header h = req.getHeaders("abc")[3];
B.sink(h.getName());
B.sink(h.getValue());
B.sink(req.getFirstHeader("abc"));
B.sink(req.getLastHeader("abc"));
HttpEntity ent = req.getEntity();
B.sink(ent.getContent());
B.sink(ent.getContentEncoding());
B.sink(ent.getContentType());
B.sink(ent.getTrailerNames());
B.sink(ent.getTrailers().get());
B.sink(EntityUtils.toString(ent));
B.sink(EntityUtils.toByteArray(ent));
B.sink(EntityUtils.parse(ent));
res.setEntity(new StringEntity("<a href='" + req.getRequestUri() + "'>a</a>"));
res.setEntity(new ByteArrayEntity(EntityUtils.toByteArray(ent), ContentType.TEXT_HTML));
res.setEntity(HttpEntities.create("<a href='" + req.getRequestUri() + "'>a</a>"));
res.setHeader("Location", req.getRequestUri());
res.setHeader(new BasicHeader("Location", req.getRequestUri()));
}
}
void test2() {
ByteArrayBuffer bbuf = new ByteArrayBuffer(42);
bbuf.append((byte[]) taint(), 0, 3);
sink(bbuf.array());
sink(bbuf.toByteArray());
CharArrayBuffer cbuf = new CharArrayBuffer(42);
cbuf.append(bbuf.toByteArray(), 0, 3);
sink(cbuf.toCharArray());
sink(cbuf.toString());
sink(cbuf.subSequence(0, 3));
sink(cbuf.substring(0, 3));
sink(cbuf.substringTrimmed(0, 3));
sink(Args.notNull(taint(), "x"));
sink(Args.notEmpty((String) taint(), "x"));
sink(Args.notBlank((String) taint(), "x"));
sink(Args.notNull("x", (String) taint())); // Good
}
}

View File

@@ -1,35 +1,59 @@
| A.java:13:28:13:42 | req | A.java:14:20:14:39 | getRequestLine(...) |
| A.java:13:28:13:42 | req | A.java:15:20:15:48 | getUri(...) |
| A.java:13:28:13:42 | req | A.java:16:20:16:51 | getMethod(...) |
| A.java:13:28:13:42 | req | A.java:17:20:17:38 | getAllHeaders(...) |
| A.java:13:28:13:42 | req | A.java:19:20:19:28 | next(...) |
| A.java:13:28:13:42 | req | A.java:20:20:20:34 | nextHeader(...) |
| A.java:13:28:13:42 | req | A.java:22:20:22:30 | getName(...) |
| A.java:13:28:13:42 | req | A.java:23:20:23:31 | getValue(...) |
| A.java:13:28:13:42 | req | A.java:25:20:25:31 | getName(...) |
| A.java:13:28:13:42 | req | A.java:26:20:26:32 | getValue(...) |
| A.java:13:28:13:42 | req | A.java:27:20:27:37 | getParameters(...) |
| A.java:13:28:13:42 | req | A.java:28:20:28:58 | getValue(...) |
| A.java:13:28:13:42 | req | A.java:29:20:29:47 | getName(...) |
| A.java:13:28:13:42 | req | A.java:31:20:31:35 | getContent(...) |
| A.java:13:28:13:42 | req | A.java:32:20:32:43 | getContentEncoding(...) |
| A.java:13:28:13:42 | req | A.java:33:20:33:39 | getContentType(...) |
| A.java:13:28:13:42 | req | A.java:34:20:34:44 | toString(...) |
| A.java:13:28:13:42 | req | A.java:35:20:35:47 | toByteArray(...) |
| A.java:13:28:13:42 | req | A.java:36:20:36:53 | getContentCharSet(...) |
| A.java:13:28:13:42 | req | A.java:37:20:37:54 | getContentMimeType(...) |
| A.java:13:28:13:42 | req | A.java:38:27:38:99 | new StringEntity(...) |
| A.java:13:28:13:42 | req | A.java:39:43:39:91 | new ByteArrayEntity(...) |
| A.java:13:28:13:42 | req | A.java:40:39:40:67 | getUri(...) |
| A.java:13:28:13:42 | req | A.java:41:55:41:83 | getUri(...) |
| A.java:31:20:31:35 | getContent(...) | A.java:31:20:31:35 | getContent(...) |
| A.java:47:30:47:36 | taint(...) | A.java:48:14:48:26 | buffer(...) |
| A.java:47:30:47:36 | taint(...) | A.java:49:14:49:31 | toByteArray(...) |
| A.java:47:30:47:36 | taint(...) | A.java:53:14:53:31 | toCharArray(...) |
| A.java:47:30:47:36 | taint(...) | A.java:54:14:54:28 | toString(...) |
| A.java:47:30:47:36 | taint(...) | A.java:55:14:55:35 | subSequence(...) |
| A.java:47:30:47:36 | taint(...) | A.java:56:14:56:33 | substring(...) |
| A.java:47:30:47:36 | taint(...) | A.java:57:14:57:40 | substringTrimmed(...) |
| A.java:59:27:59:33 | taint(...) | A.java:59:14:59:39 | notNull(...) |
| A.java:60:37:60:43 | taint(...) | A.java:60:14:60:49 | notEmpty(...) |
| A.java:61:37:61:43 | taint(...) | A.java:61:14:61:49 | notBlank(...) |
| A.java:14:28:14:42 | req | A.java:15:20:15:39 | getRequestLine(...) |
| A.java:14:28:14:42 | req | A.java:16:20:16:48 | getUri(...) |
| A.java:14:28:14:42 | req | A.java:17:20:17:51 | getMethod(...) |
| A.java:14:28:14:42 | req | A.java:18:20:18:38 | getAllHeaders(...) |
| A.java:14:28:14:42 | req | A.java:20:20:20:28 | next(...) |
| A.java:14:28:14:42 | req | A.java:21:20:21:34 | nextHeader(...) |
| A.java:14:28:14:42 | req | A.java:23:20:23:30 | getName(...) |
| A.java:14:28:14:42 | req | A.java:24:20:24:31 | getValue(...) |
| A.java:14:28:14:42 | req | A.java:26:20:26:31 | getName(...) |
| A.java:14:28:14:42 | req | A.java:27:20:27:32 | getValue(...) |
| A.java:14:28:14:42 | req | A.java:28:20:28:37 | getParameters(...) |
| A.java:14:28:14:42 | req | A.java:29:20:29:58 | getValue(...) |
| A.java:14:28:14:42 | req | A.java:30:20:30:47 | getName(...) |
| A.java:14:28:14:42 | req | A.java:32:20:32:35 | getContent(...) |
| A.java:14:28:14:42 | req | A.java:33:20:33:43 | getContentEncoding(...) |
| A.java:14:28:14:42 | req | A.java:34:20:34:39 | getContentType(...) |
| A.java:14:28:14:42 | req | A.java:35:20:35:44 | toString(...) |
| A.java:14:28:14:42 | req | A.java:36:20:36:47 | toByteArray(...) |
| A.java:14:28:14:42 | req | A.java:37:20:37:53 | getContentCharSet(...) |
| A.java:14:28:14:42 | req | A.java:38:20:38:54 | getContentMimeType(...) |
| A.java:14:28:14:42 | req | A.java:39:27:39:99 | new StringEntity(...) |
| A.java:14:28:14:42 | req | A.java:40:43:40:91 | new ByteArrayEntity(...) |
| A.java:14:28:14:42 | req | A.java:41:39:41:67 | getUri(...) |
| A.java:14:28:14:42 | req | A.java:42:55:42:83 | getUri(...) |
| A.java:32:20:32:35 | getContent(...) | A.java:32:20:32:35 | getContent(...) |
| A.java:48:30:48:36 | taint(...) | A.java:49:14:49:26 | buffer(...) |
| A.java:48:30:48:36 | taint(...) | A.java:50:14:50:31 | toByteArray(...) |
| A.java:48:30:48:36 | taint(...) | A.java:54:14:54:31 | toCharArray(...) |
| A.java:48:30:48:36 | taint(...) | A.java:55:14:55:28 | toString(...) |
| A.java:48:30:48:36 | taint(...) | A.java:56:14:56:35 | subSequence(...) |
| A.java:48:30:48:36 | taint(...) | A.java:57:14:57:33 | substring(...) |
| A.java:48:30:48:36 | taint(...) | A.java:58:14:58:40 | substringTrimmed(...) |
| A.java:60:27:60:33 | taint(...) | A.java:60:14:60:39 | notNull(...) |
| A.java:61:37:61:43 | taint(...) | A.java:61:14:61:49 | notEmpty(...) |
| A.java:62:37:62:43 | taint(...) | A.java:62:14:62:49 | notBlank(...) |
| B.java:15:28:15:49 | req | B.java:19:20:19:32 | getPath(...) |
| B.java:15:28:15:49 | req | B.java:20:20:20:34 | getScheme(...) |
| B.java:15:28:15:49 | req | B.java:21:20:21:38 | getRequestUri(...) |
| B.java:15:28:15:49 | req | B.java:25:20:25:35 | getHeaders(...) |
| B.java:15:28:15:49 | req | B.java:26:20:26:39 | headerIterator(...) |
| B.java:15:28:15:49 | req | B.java:28:20:28:30 | getName(...) |
| B.java:15:28:15:49 | req | B.java:29:20:29:31 | getValue(...) |
| B.java:15:28:15:49 | req | B.java:30:20:30:44 | getFirstHeader(...) |
| B.java:15:28:15:49 | req | B.java:31:20:31:43 | getLastHeader(...) |
| B.java:15:28:15:49 | req | B.java:33:20:33:35 | getContent(...) |
| B.java:15:28:15:49 | req | B.java:35:20:35:39 | getContentType(...) |
| B.java:15:28:15:49 | req | B.java:36:20:36:40 | getTrailerNames(...) |
| B.java:15:28:15:49 | req | B.java:44:39:44:57 | getRequestUri(...) |
| B.java:15:28:15:49 | req | B.java:45:55:45:73 | getRequestUri(...) |
| B.java:51:30:51:36 | taint(...) | B.java:52:14:52:25 | array(...) |
| B.java:51:30:51:36 | taint(...) | B.java:53:14:53:31 | toByteArray(...) |
| B.java:51:30:51:36 | taint(...) | B.java:57:14:57:31 | toCharArray(...) |
| B.java:51:30:51:36 | taint(...) | B.java:58:14:58:28 | toString(...) |
| B.java:51:30:51:36 | taint(...) | B.java:59:14:59:35 | subSequence(...) |
| B.java:51:30:51:36 | taint(...) | B.java:60:14:60:33 | substring(...) |
| B.java:51:30:51:36 | taint(...) | B.java:61:14:61:40 | substringTrimmed(...) |
| B.java:63:27:63:33 | taint(...) | B.java:63:14:63:39 | notNull(...) |
| B.java:64:37:64:43 | taint(...) | B.java:64:14:64:49 | notEmpty(...) |
| B.java:65:37:65:43 | taint(...) | B.java:65:14:65:49 | notBlank(...) |

View File

@@ -1 +1 @@
//semmle-extractor-options: --javac-args -cp ${testdir}/../../../stubs/apache-http-4.4.13
//semmle-extractor-options: --javac-args -cp ${testdir}/../../../stubs/apache-http-4.4.13:${testdir}/../../../stubs/apache-http-5

View File

@@ -0,0 +1,33 @@
/*
* ====================================================================
* 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.function;
public interface Supplier<T> {
T get();
}

View File

@@ -0,0 +1,36 @@
/*
* ====================================================================
* 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.http;
/**
* 'Classic' {@link HttpRequest} message that can enclose {@link HttpEntity}.
*
* @since 5.0
*/
public interface ClassicHttpRequest extends HttpRequest, HttpEntityContainer {
}

View File

@@ -0,0 +1,33 @@
/*
* ====================================================================
* 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.http;
import java.io.Closeable;
public interface ClassicHttpResponse extends HttpResponse, HttpEntityContainer, Closeable {
}

View File

@@ -0,0 +1,159 @@
/*
* ====================================================================
* 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.http;
import java.io.Serializable;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.nio.charset.UnsupportedCharsetException;
public final class ContentType implements Serializable {
public static final ContentType APPLICATION_ATOM_XML = null;
public static final ContentType APPLICATION_FORM_URLENCODED = null;
public static final ContentType APPLICATION_JSON = null;
public static final ContentType APPLICATION_NDJSON = null;
public static final ContentType APPLICATION_OCTET_STREAM = null;
public static final ContentType APPLICATION_PDF = null;
public static final ContentType APPLICATION_SOAP_XML = null;
public static final ContentType APPLICATION_SVG_XML = null;
public static final ContentType APPLICATION_XHTML_XML = null;
public static final ContentType APPLICATION_XML = null;
public static final ContentType APPLICATION_PROBLEM_JSON = null;
public static final ContentType APPLICATION_PROBLEM_XML = null;
public static final ContentType APPLICATION_RSS_XML = null;
public static final ContentType IMAGE_BMP = null;
public static final ContentType IMAGE_GIF = null;
public static final ContentType IMAGE_JPEG = null;
public static final ContentType IMAGE_PNG = null;
public static final ContentType IMAGE_SVG = null;
public static final ContentType IMAGE_TIFF = null;
public static final ContentType IMAGE_WEBP = null;
public static final ContentType MULTIPART_FORM_DATA = null;
public static final ContentType MULTIPART_MIXED = null;
public static final ContentType MULTIPART_RELATED = null;
public static final ContentType TEXT_HTML = null;
public static final ContentType TEXT_MARKDOWN = null;
public static final ContentType TEXT_PLAIN = null;
public static final ContentType TEXT_XML = null;
public static final ContentType TEXT_EVENT_STREAM = null;
public static final ContentType WILDCARD = null;
private static final NameValuePair[] EMPTY_NAME_VALUE_PAIR_ARRAY = new NameValuePair[0];
public String getMimeType() {
return null;
}
public Charset getCharset() {
return null;
}
public String getParameter(final String name) {
return null;
}
@Override
public String toString() {
return null;
}
public static ContentType create(final String mimeType, final Charset charset) {
return null;
}
public static ContentType create(final String mimeType) {
return null;
}
public static ContentType create(
final String mimeType, final String charset) throws UnsupportedCharsetException {
return null;
}
public static ContentType create(
final String mimeType, final NameValuePair... params) throws UnsupportedCharsetException {
return null;
}
public static ContentType parse(final CharSequence s) throws UnsupportedCharsetException {
return null;
}
public static ContentType parseLenient(final CharSequence s) throws UnsupportedCharsetException {
return null;
}
public static ContentType getByMimeType(final String mimeType) {
return null;
}
public ContentType withCharset(final Charset charset) {
return null;
}
public ContentType withCharset(final String charset) {
return null;
}
public ContentType withParameters(
final NameValuePair... params) throws UnsupportedCharsetException {
return null;
}
public boolean isSameMimeType(final ContentType contentType) {
return false;
}
}

View File

@@ -0,0 +1,43 @@
/*
* ====================================================================
* 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.http;
import java.util.Set;
public interface EntityDetails {
long getContentLength();
String getContentType();
String getContentEncoding();
boolean isChunked();
Set<String> getTrailerNames();
}

View File

@@ -0,0 +1,39 @@
/*
* ====================================================================
* 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.http;
/**
* Represents an HTTP header field consisting of a field name and a field
* value.
*
* @since 4.0
*/
public interface Header extends NameValuePair {
boolean isSensitive();
}

View File

@@ -0,0 +1,48 @@
/*
* ====================================================================
* 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.http;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.List;
import org.apache.hc.core5.function.Supplier;
public interface HttpEntity extends EntityDetails, Closeable {
boolean isRepeatable();
InputStream getContent() throws IOException, UnsupportedOperationException;
void writeTo(OutputStream outStream) throws IOException;
boolean isStreaming();
Supplier<List<? extends Header>> getTrailers();
}

View File

@@ -0,0 +1,40 @@
/*
* ====================================================================
* 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.http;
/**
* Contains an {@link HttpEntity}.
*
* @since 5.0
*/
public interface HttpEntityContainer {
HttpEntity getEntity();
void setEntity(HttpEntity entity);
}

View File

@@ -0,0 +1,48 @@
/*
* ====================================================================
* 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.http;
/**
* Signals that an HTTP exception has occurred.
*
* @since 4.0
*/
public class HttpException extends Exception {
public HttpException() {
}
public HttpException(final String message) {
}
public HttpException(final String format, final Object... args) {
}
public HttpException(final String message, final Throwable cause) {
}
}

View File

@@ -0,0 +1,55 @@
/*
* ====================================================================
* 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.http;
/**
* HTTP messages consist of requests from client to server and responses
* from server to client.
*
* @since 4.0
*/
public interface HttpMessage extends MessageHeaders {
void setVersion(ProtocolVersion version);
ProtocolVersion getVersion();
void addHeader(Header header);
void addHeader(String name, Object value);
void setHeader(Header header);
void setHeader(String name, Object value);
void setHeaders(Header... headers);
boolean removeHeader(Header header);
boolean removeHeaders(String name);
}

View File

@@ -0,0 +1,56 @@
/*
* ====================================================================
* 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.http;
import java.net.URI;
import java.net.URISyntaxException;
import org.apache.hc.core5.net.URIAuthority;
public interface HttpRequest extends HttpMessage {
String getMethod();
String getPath();
void setPath(String path);
String getScheme();
void setScheme(String scheme);
URIAuthority getAuthority();
void setAuthority(URIAuthority authority);
String getRequestUri();
URI getUri() throws URISyntaxException;
void setUri(final URI requestUri);
}

View File

@@ -0,0 +1,45 @@
/*
* ====================================================================
* 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.http;
import java.util.Locale;
public interface HttpResponse extends HttpMessage {
int getCode();
void setCode(int code);
String getReasonPhrase();
void setReasonPhrase(String reason);
Locale getLocale();
void setLocale(Locale loc);
}

View File

@@ -0,0 +1,51 @@
/*
* ====================================================================
* 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.http;
import java.util.Iterator;
public interface MessageHeaders {
boolean containsHeader(String name);
int countHeaders(String name);
Header getFirstHeader(String name);
Header getHeader(String name) throws ProtocolException;
Header[] getHeaders();
Header[] getHeaders(String name);
Header getLastHeader(String name);
Iterator<Header> headerIterator();
Iterator<Header> headerIterator(String name);
}

View File

@@ -0,0 +1,40 @@
/*
* ====================================================================
* 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.http;
/**
* A name-value pair parameter used as an element of HTTP messages.
*
* @since 4.0
*/
public interface NameValuePair {
String getName();
String getValue();
}

View File

@@ -0,0 +1,52 @@
/*
* ====================================================================
* 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.http;
/**
* Signals a protocol exception due to failure to parse a message element.
*
* @since 4.0
*/
public class ParseException extends ProtocolException {
public ParseException() {
}
public ParseException(final String message) {
}
public ParseException(final String description, final CharSequence text, final int off, final int len, final int errorOffset) {
}
public ParseException(final String description, final CharSequence text, final int off, final int len) {
}
public int getErrorOffset() {
return 0;
}
}

View File

@@ -0,0 +1,49 @@
/*
* ====================================================================
* 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.http;
/**
* Signals that an HTTP protocol violation has occurred.
* For example a malformed status line or headers, a missing message body, etc.
*
* @since 4.0
*/
public class ProtocolException extends HttpException {
public ProtocolException() {
}
public ProtocolException(final String message) {
}
public ProtocolException(final String format, final Object... args) {
}
public ProtocolException(final String message, final Throwable cause) {
}
}

View File

@@ -0,0 +1,87 @@
/*
* ====================================================================
* 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.http;
import java.io.Serializable;
public class ProtocolVersion implements Serializable {
public ProtocolVersion(final String protocol, final int major, final int minor) {
}
public final String getProtocol() {
return null;
}
public final int getMajor() {
return 0;
}
public final int getMinor() {
return 0;
}
@Override
public final int hashCode() {
return 0;
}
public final boolean equals(final int major, final int minor) {
return false;
}
@Override
public final boolean equals(final Object obj) {
return false;
}
public String format() {
return null;
}
public boolean isComparable(final ProtocolVersion that) {
return false;
}
public int compareToVersion(final ProtocolVersion that) {
return 0;
}
public final boolean greaterEquals(final ProtocolVersion version) {
return false;
}
public final boolean lessEquals(final ProtocolVersion version) {
return false;
}
@Override
public String toString() {
return null;
}
}

View File

@@ -0,0 +1,41 @@
/*
* ====================================================================
* 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.http.io;
import java.io.IOException;
import org.apache.hc.core5.http.ClassicHttpRequest;
import org.apache.hc.core5.http.ClassicHttpResponse;
import org.apache.hc.core5.http.HttpException;
import org.apache.hc.core5.http.protocol.HttpContext;
public interface HttpRequestHandler {
void handle(ClassicHttpRequest request, ClassicHttpResponse response, HttpContext context)
throws HttpException, IOException;
}

View File

@@ -0,0 +1,86 @@
/*
* ====================================================================
* 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.http.io.entity;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Collections;
import java.util.List;
import java.util.Set;
import org.apache.hc.core5.function.Supplier;
import org.apache.hc.core5.http.ContentType;
import org.apache.hc.core5.http.Header;
import org.apache.hc.core5.http.HttpEntity;
import org.apache.hc.core5.util.Args;
public abstract class AbstractHttpEntity implements HttpEntity {
public static void writeTo(final HttpEntity entity, final OutputStream outStream) throws IOException {
}
@Override
public void writeTo(final OutputStream outStream) throws IOException {
}
@Override
public final String getContentType() {
return null;
}
@Override
public final String getContentEncoding() {
return null;
}
@Override
public final boolean isChunked() {
return false;
}
@Override
public boolean isRepeatable() {
return false;
}
@Override
public Supplier<List<? extends Header>> getTrailers() {
return null;
}
@Override
public Set<String> getTrailerNames() {
return null;
}
@Override
public String toString() {
return null;
}
}

View File

@@ -0,0 +1,92 @@
/*
* ====================================================================
* 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.http.io.entity;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import org.apache.hc.core5.http.ContentType;
public class ByteArrayEntity extends AbstractHttpEntity {
public ByteArrayEntity(
final byte[] b, final int off, final int len, final ContentType contentType, final String contentEncoding,
final boolean chunked) {
}
public ByteArrayEntity(
final byte[] b, final int off, final int len, final ContentType contentType, final String contentEncoding) {
}
public ByteArrayEntity(
final byte[] b, final ContentType contentType, final String contentEncoding, final boolean chunked) {
}
public ByteArrayEntity(final byte[] b, final ContentType contentType, final String contentEncoding) {
}
public ByteArrayEntity(final byte[] b, final ContentType contentType, final boolean chunked) {
}
public ByteArrayEntity(final byte[] b, final ContentType contentType) {
}
public ByteArrayEntity(
final byte[] b, final int off, final int len, final ContentType contentType, final boolean chunked) {
}
public ByteArrayEntity(final byte[] b, final int off, final int len, final ContentType contentType) {
}
@Override
public final boolean isRepeatable() {
return false;
}
@Override
public final long getContentLength() {
return 0;
}
@Override
public final InputStream getContent() {
return null;
}
@Override
public final void writeTo(final OutputStream outStream) throws IOException {
}
@Override
public final boolean isStreaming() {
return false;
}
@Override
public final void close() throws IOException {
}
}

View File

@@ -0,0 +1,65 @@
/*
* ====================================================================
* 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.http.io.entity;
import java.io.IOException;
import java.io.InputStream;
import java.nio.ByteBuffer;
import org.apache.hc.core5.http.ContentType;
public class ByteBufferEntity extends AbstractHttpEntity {
public ByteBufferEntity(final ByteBuffer buffer, final ContentType contentType, final String contentEncoding) {
}
public ByteBufferEntity(final ByteBuffer buffer, final ContentType contentType) {
}
@Override
public final boolean isRepeatable() {
return false;
}
@Override
public final long getContentLength() {
return 0;
}
@Override
public final InputStream getContent() throws IOException, UnsupportedOperationException {
return null;
}
@Override
public final boolean isStreaming() {
return false;
}
@Override
public final void close() throws IOException {
}
}

View File

@@ -0,0 +1,89 @@
/*
* ====================================================================
* 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.http.io.entity;
import java.io.IOException;
import java.nio.charset.Charset;
import java.util.List;
import org.apache.hc.core5.http.HttpEntity;
import org.apache.hc.core5.http.NameValuePair;
import org.apache.hc.core5.http.ParseException;
public final class EntityUtils {
public static void consumeQuietly(final HttpEntity entity) {
}
public static void consume(final HttpEntity entity) throws IOException {
}
public static byte[] toByteArray(final HttpEntity entity) throws IOException {
return null;
}
public static byte[] toByteArray(final HttpEntity entity, final int maxResultLength) throws IOException {
return null;
}
public static String toString(
final HttpEntity entity, final Charset defaultCharset) throws IOException, ParseException {
return null;
}
public static String toString(
final HttpEntity entity, final Charset defaultCharset, final int maxResultLength) throws IOException, ParseException {
return null;
}
public static String toString(
final HttpEntity entity, final String defaultCharset) throws IOException, ParseException {
return null;
}
public static String toString(
final HttpEntity entity, final String defaultCharset, final int maxResultLength) throws IOException, ParseException {
return null;
}
public static String toString(final HttpEntity entity) throws IOException, ParseException {
return null;
}
public static String toString(final HttpEntity entity, final int maxResultLength) throws IOException, ParseException {
return null;
}
public static List<NameValuePair> parse(final HttpEntity entity) throws IOException {
return null;
}
public static List<NameValuePair> parse(final HttpEntity entity, final int maxStreamLength) throws IOException {
return null;
}
}

View File

@@ -0,0 +1,152 @@
/*
* ====================================================================
* 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.http.io.entity;
import java.io.File;
import java.io.OutputStream;
import java.io.Serializable;
import java.nio.charset.Charset;
import java.nio.file.Path;
import org.apache.hc.core5.http.ContentType;
import org.apache.hc.core5.http.Header;
import org.apache.hc.core5.http.HttpEntity;
import org.apache.hc.core5.http.NameValuePair;
import org.apache.hc.core5.io.IOCallback;
public final class HttpEntities {
public static HttpEntity create(final String content, final ContentType contentType) {
return null;
}
public static HttpEntity create(final String content, final Charset charset) {
return null;
}
public static HttpEntity create(final String content) {
return null;
}
public static HttpEntity create(final byte[] content, final ContentType contentType) {
return null;
}
public static HttpEntity create(final File content, final ContentType contentType) {
return null;
}
public static HttpEntity create(final Serializable serializable, final ContentType contentType) {
return null;
}
public static HttpEntity createUrlEncoded(
final Iterable <? extends NameValuePair> parameters, final Charset charset) {
return null;
}
public static HttpEntity create(final IOCallback<OutputStream> callback, final ContentType contentType) {
return null;
}
public static HttpEntity gzip(final HttpEntity entity) {
return null;
}
public static HttpEntity createGzipped(final String content, final ContentType contentType) {
return null;
}
public static HttpEntity createGzipped(final String content, final Charset charset) {
return null;
}
public static HttpEntity createGzipped(final String content) {
return null;
}
public static HttpEntity createGzipped(final byte[] content, final ContentType contentType) {
return null;
}
public static HttpEntity createGzipped(final File content, final ContentType contentType) {
return null;
}
public static HttpEntity createGzipped(final Serializable serializable, final ContentType contentType) {
return null;
}
public static HttpEntity createGzipped(final IOCallback<OutputStream> callback, final ContentType contentType) {
return null;
}
public static HttpEntity createGzipped(final Path content, final ContentType contentType) {
return null;
}
public static HttpEntity withTrailers(final HttpEntity entity, final Header... trailers) {
return null;
}
public static HttpEntity create(final String content, final ContentType contentType, final Header... trailers) {
return null;
}
public static HttpEntity create(final String content, final Charset charset, final Header... trailers) {
return null;
}
public static HttpEntity create(final String content, final Header... trailers) {
return null;
}
public static HttpEntity create(final byte[] content, final ContentType contentType, final Header... trailers) {
return null;
}
public static HttpEntity create(final File content, final ContentType contentType, final Header... trailers) {
return null;
}
public static HttpEntity create(
final Serializable serializable, final ContentType contentType, final Header... trailers) {
return null;
}
public static HttpEntity create(
final IOCallback<OutputStream> callback, final ContentType contentType, final Header... trailers) {
return null;
}
public static HttpEntity create(final Path content, final ContentType contentType) {
return null;
}
public static HttpEntity create(final Path content, final ContentType contentType, final Header... trailers) {
return null;
}
}

View File

@@ -0,0 +1,83 @@
/*
* ====================================================================
* 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.http.io.entity;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.charset.Charset;
import org.apache.hc.core5.http.ContentType;
public class StringEntity extends AbstractHttpEntity {
public StringEntity(
final String string, final ContentType contentType, final String contentEncoding, final boolean chunked) {
}
public StringEntity(final String string, final ContentType contentType, final boolean chunked) {
}
public StringEntity(final String string, final ContentType contentType) {
}
public StringEntity(final String string, final Charset charset) {
}
public StringEntity(final String string, final Charset charset, final boolean chunked) {
}
public StringEntity(final String string) {
}
@Override
public final boolean isRepeatable() {
return false;
}
@Override
public final long getContentLength() {
return 0;
}
@Override
public final InputStream getContent() throws IOException {
return null;
}
@Override
public final void writeTo(final OutputStream outStream) throws IOException {
}
@Override
public final boolean isStreaming() {
return false;
}
@Override
public final void close() throws IOException {
}
}

View File

@@ -0,0 +1,59 @@
/*
* ====================================================================
* 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.http.message;
import java.io.Serializable;
import org.apache.hc.core5.http.Header;
public class BasicHeader implements Header, Cloneable, Serializable {
public BasicHeader(final String name, final Object value) {
}
public BasicHeader(final String name, final Object value, final boolean sensitive) {
}
@Override
public String getName() {
return null;
}
@Override
public String getValue() {
return null;
}
@Override
public boolean isSensitive() {
return false;
}
@Override
public String toString() {
return null;
}
}

View File

@@ -0,0 +1,61 @@
/*
* ====================================================================
* 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.http.message;
import java.io.Serializable;
import org.apache.hc.core5.http.HttpRequest;
import org.apache.hc.core5.http.ProtocolVersion;
public final class RequestLine implements Serializable {
public RequestLine(final HttpRequest request) {
}
public RequestLine(final String method,
final String uri,
final ProtocolVersion version) {
}
public String getMethod() {
return null;
}
public ProtocolVersion getProtocolVersion() {
return null;
}
public String getUri() {
return null;
}
@Override
public String toString() {
return null;
}
}

View File

@@ -0,0 +1,42 @@
/*
* ====================================================================
* 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.http.protocol;
import org.apache.hc.core5.http.ProtocolVersion;
public interface HttpContext {
ProtocolVersion getProtocolVersion();
void setProtocolVersion(ProtocolVersion version);
Object getAttribute(String id);
Object setAttribute(String id, Object obj);
Object removeAttribute(String id);
}

View File

@@ -0,0 +1,34 @@
/*
* ====================================================================
* 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.io;
import java.io.IOException;
public interface IOCallback<T> {
void execute(T object) throws IOException;
}

View File

@@ -0,0 +1,55 @@
/*
* ====================================================================
* 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;
public final class URIAuthority {
public String getUserInfo() {
return null;
}
public String getHostName() {
return null;
}
public int getPort() {
return 0;
}
public String toString() {
return null;
}
public boolean equals(final Object obj) {
return false;
}
public int hashCode() {
return 0;
}
}

View File

@@ -0,0 +1,93 @@
/*
* ====================================================================
* 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.util;
import org.apache.hc.core5.http.EntityDetails;
import java.util.Collection;
public class Args {
public static void check(final boolean expression, final String message) {
}
public static void check(final boolean expression, final String message, final Object... args) {
}
public static void check(final boolean expression, final String message, final Object arg) {
}
public static long checkContentLength(final EntityDetails entityDetails) {
return 0;
}
public static int checkRange(final int value, final int lowInclusive, final int highInclusive,
final String message) {
return 0;
}
public static long checkRange(final long value, final long lowInclusive, final long highInclusive,
final String message) {
return 0;
}
public static <T extends CharSequence> T containsNoBlanks(final T argument, final String name) {
return null;
}
public static <T extends CharSequence> T notBlank(final T argument, final String name) {
return null;
}
public static <T extends CharSequence> T notEmpty(final T argument, final String name) {
return null;
}
public static <E, T extends Collection<E>> T notEmpty(final T argument, final String name) {
return null;
}
public static int notNegative(final int n, final String name) {
return 0;
}
public static long notNegative(final long n, final String name) {
return 0;
}
public static <T> T notNull(final T argument, final String name) {
return null;
}
public static int positive(final int n, final String name) {
return 0;
}
public static long positive(final long n, final String name) {
return 0;
}
}

View File

@@ -0,0 +1,97 @@
/*
* ====================================================================
* 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.util;
import java.io.Serializable;
import java.nio.ByteBuffer;
public final class ByteArrayBuffer implements Serializable {
public ByteArrayBuffer(final int capacity) {
}
public void append(final byte[] b, final int off, final int len) {
}
public void append(final int b) {
}
public void append(final char[] b, final int off, final int len) {
}
public void append(final CharArrayBuffer b, final int off, final int len) {
}
public void append(final ByteBuffer buffer) {
}
public void clear() {
}
public byte[] toByteArray() {
return null;
}
public int byteAt(final int i) {
return 0;
}
public int capacity() {
return 0;
}
public int length() {
return 0;
}
public void ensureCapacity(final int required) {
}
public byte[] array() {
return null;
}
public void setLength(final int len) {
}
public boolean isEmpty() {
return false;
}
public boolean isFull() {
return false;
}
public int indexOf(final byte b, final int from, final int to) {
return 0;
}
public int indexOf(final byte b) {
return 0;
}
}

View File

@@ -0,0 +1,125 @@
/*
* ====================================================================
* 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.util;
import java.io.Serializable;
public final class CharArrayBuffer implements CharSequence, Serializable {
public CharArrayBuffer(final int capacity) {
}
public void append(final char[] b, final int off, final int len) {
}
public void append(final String str) {
}
public void append(final CharArrayBuffer b, final int off, final int len) {
}
public void append(final CharArrayBuffer b) {
}
public void append(final char ch) {
}
public void append(final byte[] b, final int off, final int len) {
}
public void append(final ByteArrayBuffer b, final int off, final int len) {
}
public void append(final Object obj) {
}
public void clear() {
}
public char[] toCharArray() {
return null;
}
@Override
public char charAt(final int i) {
return 0;
}
public char[] array() {
return null;
}
public int capacity() {
return 0;
}
@Override
public int length() {
return 0;
}
public void ensureCapacity(final int required) {
}
public void setLength(final int len) {
}
public boolean isEmpty() {
return false;
}
public boolean isFull() {
return false;
}
public int indexOf(final int ch, final int from, final int to) {
return 0;
}
public int indexOf(final int ch) {
return 0;
}
public String substring(final int beginIndex, final int endIndex) {
return null;
}
public String substringTrimmed(final int beginIndex, final int endIndex) {
return null;
}
@Override
public CharSequence subSequence(final int beginIndex, final int endIndex) {
return null;
}
@Override
public String toString() {
return null;
}
}