Merge pull request #6042 from joefarebrother/spring-http

[Java] Model spring `http` package
This commit is contained in:
Anders Schack-Mulligen
2021-07-19 11:24:41 +02:00
committed by GitHub
17 changed files with 715 additions and 525 deletions

View File

@@ -0,0 +1,3 @@
lgtm,codescanning
* Additional flow steps in the `org.springframework.http` package of the Spring framework have been modelled.
This may result in additional results for security queries on projects using this framework.

View File

@@ -105,6 +105,7 @@ private module Frameworks {
private import semmle.code.java.frameworks.MyBatis
private import semmle.code.java.frameworks.Hibernate
private import semmle.code.java.frameworks.jOOQ
private import semmle.code.java.frameworks.spring.SpringHttp
}
private predicate sourceModelCsv(string row) {

View File

@@ -209,22 +209,6 @@ private predicate constructorStep(Expr tracked, ConstructorCall sink) {
// a custom InputStream that wraps a tainted data source is tainted
inputStreamWrapper(sink.getConstructor(), argi)
or
// A SpringHttpEntity is a wrapper around a body and some headers
// Track flow through iff body is a String
exists(SpringHttpEntity she |
sink.getConstructor() = she.getAConstructor() and
argi = 0 and
tracked.getType() instanceof TypeString
)
or
// A SpringRequestEntity is a wrapper around a body and some headers
// Track flow through iff body is a String
exists(SpringResponseEntity sre |
sink.getConstructor() = sre.getAConstructor() and
argi = 0 and
tracked.getType() instanceof TypeString
)
or
sink.getConstructor().(TaintPreservingCallable).returnsTaintFrom(argToParam(sink, argi))
)
}
@@ -277,19 +261,6 @@ private predicate taintPreservingQualifierToMethod(Method m) {
m.getDeclaringType().getASubtype*() instanceof SpringUntrustedDataType and
not m.getDeclaringType() instanceof TypeObject
or
m.getDeclaringType() instanceof SpringHttpEntity and
m.getName().regexpMatch("getBody|getHeaders")
or
exists(SpringHttpHeaders headers | m = headers.getAMethod() |
m.getReturnType() instanceof TypeString
or
exists(ParameterizedType stringlist |
m.getReturnType().(RefType).getASupertype*() = stringlist and
stringlist.getSourceDeclaration().hasQualifiedName("java.util", "List") and
stringlist.getTypeArgument(0) instanceof TypeString
)
)
or
m.(TaintPreservingCallable).returnsTaintFrom(-1)
or
exists(JaxRsResourceMethod resourceMethod |

View File

@@ -61,3 +61,82 @@ private class UrlOpenSink extends SinkModelCsv {
]
}
}
private class SpringHttpFlowStep extends SummaryModelCsv {
override predicate row(string row) {
row =
[
//"package;type;overrides;name;signature;ext;inputspec;outputspec;kind",
"org.springframework.http;HttpEntity;true;HttpEntity;(Object);;Argument[0];Argument[-1];taint",
"org.springframework.http;HttpEntity;true;HttpEntity;(Object,MultiValueMap);;Argument[0];Argument[-1];taint",
"org.springframework.http;HttpEntity;true;HttpEntity;(Object,MultiValueMap);;MapKey of Argument[1];Argument[-1];taint",
"org.springframework.http;HttpEntity;true;HttpEntity;(Object,MultiValueMap);;Element of MapValue of Argument[1];Argument[-1];taint",
"org.springframework.http;HttpEntity;true;HttpEntity;(MultiValueMap);;MapKey of Argument[0];Argument[-1];taint",
"org.springframework.http;HttpEntity;true;HttpEntity;(MultiValueMap);;Element of MapValue of Argument[0];Argument[-1];taint",
"org.springframework.http;HttpEntity;true;getBody;;;Argument[-1];ReturnValue;taint",
"org.springframework.http;HttpEntity;true;getHeaders;;;Argument[-1];ReturnValue;taint",
"org.springframework.http;ResponseEntity;true;ResponseEntity;(Object,HttpStatus);;Argument[0];Argument[-1];taint",
"org.springframework.http;ResponseEntity;true;ResponseEntity;(Object,MultiValueMap,HttpStatus);;Argument[0];Argument[-1];taint",
"org.springframework.http;ResponseEntity;true;ResponseEntity;(Object,MultiValueMap,HttpStatus);;MapKey of Argument[1];Argument[-1];taint",
"org.springframework.http;ResponseEntity;true;ResponseEntity;(Object,MultiValueMap,HttpStatus);;Element of MapValue of Argument[1];Argument[-1];taint",
"org.springframework.http;ResponseEntity;true;ResponseEntity;(MultiValueMap,HttpStatus);;MapKey of Argument[0];Argument[-1];taint",
"org.springframework.http;ResponseEntity;true;ResponseEntity;(MultiValueMap,HttpStatus);;Element of MapValue of Argument[0];Argument[-1];taint",
"org.springframework.http;ResponseEntity;true;ResponseEntity;(Object,MultiValueMap,int);;Argument[0];Argument[-1];taint",
"org.springframework.http;ResponseEntity;true;ResponseEntity;(Object,MultiValueMap,int);;MapKey of Argument[1];Argument[-1];taint",
"org.springframework.http;ResponseEntity;true;ResponseEntity;(Object,MultiValueMap,int);;Element of MapValue of Argument[1];Argument[-1];taint",
"org.springframework.http;ResponseEntity;true;of;(Optional);;Element of Argument[0];ReturnValue;taint",
"org.springframework.http;ResponseEntity;true;ok;(Object);;Argument[0];ReturnValue;taint",
"org.springframework.http;ResponseEntity;true;created;(URI);;Argument[0];ReturnValue;taint",
"org.springframework.http;ResponseEntity$BodyBuilder;true;contentLength;(long);;Argument[-1];ReturnValue;value",
"org.springframework.http;ResponseEntity$BodyBuilder;true;contentType;(MediaType);;Argument[-1];ReturnValue;value",
"org.springframework.http;ResponseEntity$BodyBuilder;true;body;(Object);;Argument[-1..0];ReturnValue;taint",
"org.springframework.http;ResponseEntity$HeadersBuilder;true;allow;(HttpMethod[]);;Argument[-1];ReturnValue;value",
"org.springframework.http;ResponseEntity$HeadersBuilder;true;eTag;(String);;Argument[-1];ReturnValue;value",
"org.springframework.http;ResponseEntity$HeadersBuilder;true;eTag;(String);;Argument[0];Argument[-1];taint",
"org.springframework.http;ResponseEntity$HeadersBuilder;true;header;(String,String[]);;Argument[-1];ReturnValue;value",
"org.springframework.http;ResponseEntity$HeadersBuilder;true;header;(String,String[]);;Argument[0];Argument[-1];taint",
"org.springframework.http;ResponseEntity$HeadersBuilder;true;header;(String,String[]);;ArrayElement of Argument[1];Argument[-1];taint",
"org.springframework.http;ResponseEntity$HeadersBuilder;true;headers;(Consumer);;Argument[-1];ReturnValue;value",
"org.springframework.http;ResponseEntity$HeadersBuilder;true;headers;(HttpHeaders);;Argument[-1];ReturnValue;value",
"org.springframework.http;ResponseEntity$HeadersBuilder;true;headers;(HttpHeaders);;Argument[0];Argument[-1];taint",
"org.springframework.http;ResponseEntity$HeadersBuilder;true;lastModified;;;Argument[-1];ReturnValue;value",
"org.springframework.http;ResponseEntity$HeadersBuilder;true;location;(URI);;Argument[-1];ReturnValue;value",
"org.springframework.http;ResponseEntity$HeadersBuilder;true;location;(URI);;Argument[0];Argument[-1];taint",
"org.springframework.http;ResponseEntity$HeadersBuilder;true;varyBy;(String[]);;Argument[-1];ReturnValue;value",
"org.springframework.http;ResponseEntity$HeadersBuilder;true;build;();;Argument[-1];ReturnValue;taint",
"org.springframework.http;RequestEntity;true;getUrl;();;Argument[-1];ReturnValue;taint",
"org.springframework.http;HttpHeaders;true;HttpHeaders;(MultiValueMap);;MapKey of Argument[0];Argument[-1];taint",
"org.springframework.http;HttpHeaders;true;HttpHeaders;(MultiValueMap);;Element of MapValue of Argument[0];Argument[-1];taint",
"org.springframework.http;HttpHeaders;true;get;(Object);;Argument[-1];Element of ReturnValue;taint",
"org.springframework.http;HttpHeaders;true;getAccessControlAllowHeaders;();;Argument[-1];Element of ReturnValue;taint",
"org.springframework.http;HttpHeaders;true;getAccessControlAllowOrigin;();;Argument[-1];ReturnValue;taint",
"org.springframework.http;HttpHeaders;true;getAccessControlExposeHeaders;();;Argument[-1];Element of ReturnValue;taint",
"org.springframework.http;HttpHeaders;true;getAccessControlRequestHeaders;();;Argument[-1];Element of ReturnValue;taint",
"org.springframework.http;HttpHeaders;true;getCacheControl;();;Argument[-1];ReturnValue;taint",
"org.springframework.http;HttpHeaders;true;getConnection;();;Argument[-1];Element of ReturnValue;taint",
"org.springframework.http;HttpHeaders;true;getETag;();;Argument[-1];ReturnValue;taint",
"org.springframework.http;HttpHeaders;true;getETagValuesAsList;(String);;Argument[-1];Element of ReturnValue;taint",
"org.springframework.http;HttpHeaders;true;getFieldValues;(String);;Argument[-1];ReturnValue;taint",
"org.springframework.http;HttpHeaders;true;getFirst;(String);;Argument[-1];ReturnValue;taint",
"org.springframework.http;HttpHeaders;true;getIfMatch;();;Argument[-1];Element of ReturnValue;taint",
"org.springframework.http;HttpHeaders;true;getIfNoneMatch;();;Argument[-1];Element of ReturnValue;taint",
"org.springframework.http;HttpHeaders;true;getHost;();;Argument[-1];ReturnValue;taint",
"org.springframework.http;HttpHeaders;true;getLocation;();;Argument[-1];ReturnValue;taint",
"org.springframework.http;HttpHeaders;true;getOrEmpty;(Object);;Argument[-1];Element of ReturnValue;taint",
"org.springframework.http;HttpHeaders;true;getOrigin;();;Argument[-1];ReturnValue;taint",
"org.springframework.http;HttpHeaders;true;getPragma;();;Argument[-1];ReturnValue;taint",
"org.springframework.http;HttpHeaders;true;getUpgrade;();;Argument[-1];ReturnValue;taint",
"org.springframework.http;HttpHeaders;true;getValuesAsList;(String);;Argument[-1];Element of ReturnValue;taint",
"org.springframework.http;HttpHeaders;true;getVary;();;Argument[-1];Element of ReturnValue;taint",
"org.springframework.http;HttpHeaders;true;add;(String,String);;Argument[0..1];Argument[-1];taint",
"org.springframework.http;HttpHeaders;true;set;(String,String);;Argument[0..1];Argument[-1];taint",
"org.springframework.http;HttpHeaders;true;addAll;(MultiValueMap);;MapKey of Argument[0];Argument[-1];taint",
"org.springframework.http;HttpHeaders;true;addAll;(MultiValueMap);;Element of MapValue of Argument[0];Argument[-1];taint",
"org.springframework.http;HttpHeaders;true;addAll;(String,List);;Argument[0];Argument[-1];taint",
"org.springframework.http;HttpHeaders;true;addAll;(String,List);;Element of Argument[1];Argument[-1];taint",
"org.springframework.http;HttpHeaders;true;formatHeaders;(MultiValueMap);;MapKey of Argument[0];ReturnValue;taint",
"org.springframework.http;HttpHeaders;true;formatHeaders;(MultiValueMap);;Element of MapValue of Argument[0];ReturnValue;taint",
"org.springframework.http;HttpHeaders;true;encodeBasicAuth;(String,String,Charset);;Argument[0..1];ReturnValue;taint"
]
}
}

View File

@@ -0,0 +1,162 @@
import org.springframework.http.HttpEntity;
import org.springframework.http.ResponseEntity;
import org.springframework.http.RequestEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.util.MultiValueMap;
import org.springframework.util.LinkedMultiValueMap;
import java.util.Optional;
import java.util.List;
class TestHttp {
static <T> T taint() { return null; }
static void sink(Object o) {}
void test1() {
String x = taint();
sink(new HttpEntity(x)); // $hasTaintFlow
MultiValueMap<String,String> m1 = new LinkedMultiValueMap();
sink(new HttpEntity(x, m1)); // $hasTaintFlow
m1.add("a", taint());
sink(new HttpEntity("a", m1)); // $hasTaintFlow
sink(new HttpEntity<String>(m1)); // $hasTaintFlow
MultiValueMap<String,String> m2 = new LinkedMultiValueMap();
m2.add(taint(), "a");
sink(new HttpEntity<String>(m2)); // $hasTaintFlow
HttpEntity<String> ent = taint();
sink(ent.getBody()); // $hasTaintFlow
sink(ent.getHeaders()); // $hasTaintFlow
RequestEntity<String> req = taint();
sink(req.getUrl()); // $hasTaintFlow
}
void test2() {
String x = taint();
sink(ResponseEntity.ok(x)); // $hasTaintFlow
sink(ResponseEntity.of(Optional.of(x))); // $hasTaintFlow
sink(ResponseEntity.status(200).contentLength(2048).body(x)); // $hasTaintFlow
sink(ResponseEntity.created(taint()).contentType(null).body("a")); // $hasTaintFlow
sink(ResponseEntity.status(200).header(x, "a", "b", "c").build()); // $hasTaintFlow
sink(ResponseEntity.status(200).header("h", "a", "b", x).build()); // $hasTaintFlow
HttpHeaders h = new HttpHeaders();
h.add("h", taint());
sink(ResponseEntity.status(200).headers(h).allow().build()); // $hasTaintFlow
sink(ResponseEntity.status(200).eTag(x).allow().build()); // $hasTaintFlow
sink(ResponseEntity.status(200).location(taint()).lastModified(10000000).build()); // $hasTaintFlow
sink(ResponseEntity.status(200).varyBy(x).build());
}
void test3() {
String x = taint();
MultiValueMap<String,String> m1 = new LinkedMultiValueMap();
sink(new ResponseEntity(x, HttpStatus.ACCEPTED)); // $hasTaintFlow
sink(new ResponseEntity(x, m1, HttpStatus.ACCEPTED)); // $hasTaintFlow
sink(new ResponseEntity(x, m1, 200)); // $hasTaintFlow
m1.add("a", taint());
sink(new ResponseEntity("a", m1, HttpStatus.ACCEPTED)); // $hasTaintFlow
sink(new ResponseEntity<String>(m1, HttpStatus.ACCEPTED)); // $hasTaintFlow
sink(new ResponseEntity("a", m1, 200)); // $hasTaintFlow
MultiValueMap<String,String> m2 = new LinkedMultiValueMap();
m2.add(taint(), "a");
sink(new ResponseEntity("a", m2, HttpStatus.ACCEPTED)); // $hasTaintFlow
sink(new ResponseEntity<String>(m2, HttpStatus.ACCEPTED)); // $hasTaintFlow
sink(new ResponseEntity("a", m2, 200)); // $hasTaintFlow
ResponseEntity<String> ent = taint();
sink(ent.getBody()); // $hasTaintFlow
sink(ent.getHeaders()); // $hasTaintFlow
}
void test4() {
MultiValueMap<String,String> m1 = new LinkedMultiValueMap();
m1.add("a", taint());
sink(new HttpHeaders(m1)); // $hasTaintFlow
MultiValueMap<String,String> m2 = new LinkedMultiValueMap();
m2.add(taint(), "a");
sink(new HttpHeaders(m2)); // $hasTaintFlow
HttpHeaders h1 = new HttpHeaders();
h1.add(taint(), "a");
sink(h1); // $hasTaintFlow
HttpHeaders h2 = new HttpHeaders();
h2.add("a", taint());
sink(h2); // $hasTaintFlow
HttpHeaders h3 = new HttpHeaders();
h3.addAll(m1);
sink(h3); // $hasTaintFlow
HttpHeaders h4 = new HttpHeaders();
h4.addAll(m2);
sink(h4); // $hasTaintFlow
HttpHeaders h5 = new HttpHeaders();
h5.addAll(taint(), List.of());
sink(h5); // $hasTaintFlow
HttpHeaders h6 = new HttpHeaders();
h6.addAll("a", List.of(taint()));
sink(h6); // $hasTaintFlow
sink(HttpHeaders.formatHeaders(m1)); // $hasTaintFlow
sink(HttpHeaders.formatHeaders(m2)); // $hasTaintFlow
sink(HttpHeaders.encodeBasicAuth(taint(), "a", null)); // $hasTaintFlow
sink(HttpHeaders.encodeBasicAuth("a", taint(), null)); // $hasTaintFlow
}
void test5() {
HttpHeaders h = taint();
sink(h.get(null).get(0)); // $hasTaintFlow
sink(h.getAccept().get(0));
sink(h.getAcceptCharset().get(0));
sink(h.getAcceptLanguage().get(0));
sink(h.getAcceptLanguageAsLocales().get(0));
sink(h.getAccessControlAllowCredentials());
sink(h.getAccessControlAllowHeaders().get(0)); // $hasTaintFlow
sink(h.getAccessControlAllowMethods().get(0));
sink(h.getAccessControlAllowOrigin()); // $hasTaintFlow
sink(h.getAccessControlExposeHeaders().get(0)); // $hasTaintFlow
sink(h.getAccessControlMaxAge());
sink(h.getAccessControlRequestHeaders().get(0)); // $hasTaintFlow
sink(h.getAccessControlRequestMethod());
sink(h.getAllow().toArray()[0]);
sink(h.getCacheControl()); // $hasTaintFlow
sink(h.getConnection().get(0)); // $hasTaintFlow
sink(h.getContentDisposition());
sink(h.getContentLanguage());
sink(h.getContentLength());
sink(h.getContentType());
sink(h.getDate());
sink(h.getETag()); // $hasTaintFlow
sink(h.getExpires());
sink(h.getFirst("a")); // $hasTaintFlow
sink(h.getFirstDate("a"));
sink(h.getFirstZonedDateTime("a"));
sink(h.getHost()); // $hasTaintFlow
sink(h.getIfMatch().get(0)); // $hasTaintFlow
sink(h.getIfModifiedSince());
sink(h.getIfNoneMatch().get(0)); // $hasTaintFlow
sink(h.getIfUnmodifiedSince());
sink(h.getLastModified());
sink(h.getLocation()); // $hasTaintFlow
sink(h.getOrEmpty("a").get(0)); // $hasTaintFlow
sink(h.getOrigin()); // $hasTaintFlow
sink(h.getPragma()); // $hasTaintFlow
sink(h.getUpgrade()); // $hasTaintFlow
sink(h.getValuesAsList("a").get(0)); // $hasTaintFlow
sink(h.getVary().get(0)); // $hasTaintFlow
}
}

View File

@@ -0,0 +1,53 @@
import java
import semmle.code.java.frameworks.spring.Spring
import semmle.code.java.dataflow.TaintTracking
import TestUtilities.InlineExpectationsTest
class TaintFlowConf extends TaintTracking::Configuration {
TaintFlowConf() { this = "qltest:frameworks:spring-taint-flow" }
override predicate isSource(DataFlow::Node n) {
exists(string name | name.matches("taint%") |
n.asExpr().(MethodAccess).getMethod().hasName(name)
)
}
override predicate isSink(DataFlow::Node n) {
exists(MethodAccess ma | ma.getMethod().hasName("sink") | n.asExpr() = ma.getAnArgument())
}
}
class ValueFlowConf extends DataFlow::Configuration {
ValueFlowConf() { this = "qltest:frameworks:spring-value-flow" }
override predicate isSource(DataFlow::Node n) {
n.asExpr().(MethodAccess).getMethod().hasName("taint")
}
override predicate isSink(DataFlow::Node n) {
exists(MethodAccess ma | ma.getMethod().hasName("sink") | n.asExpr() = ma.getAnArgument())
}
}
class HasFlowTest extends InlineExpectationsTest {
HasFlowTest() { this = "HasFlowTest" }
override string getARelevantTag() { result = ["hasTaintFlow", "hasValueFlow"] }
override predicate hasActualResult(Location location, string element, string tag, string value) {
tag = "hasTaintFlow" and
exists(DataFlow::Node src, DataFlow::Node sink, TaintFlowConf conf | conf.hasFlow(src, sink) |
not any(ValueFlowConf vconf).hasFlow(src, sink) and
sink.getLocation() = location and
element = sink.toString() and
value = ""
)
or
tag = "hasValueFlow" and
exists(DataFlow::Node src, DataFlow::Node sink, ValueFlowConf conf | conf.hasFlow(src, sink) |
sink.getLocation() = location and
element = sink.toString() and
value = ""
)
}
}

View File

@@ -0,0 +1 @@
//semmle-extractor-options: --javac-args -cp ${testdir}/../../../../stubs/springframework-5.3.8

View File

@@ -1,56 +1,10 @@
/*
* Copyright 2002-2017 the original author or authors.
*
* Licensed 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
*
* https://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.
*/
// Generated automatically from org.springframework.core.io.InputStreamSource for testing purposes
package org.springframework.core.io;
import java.io.IOException;
import java.io.InputStream;
/**
* Simple interface for objects that are sources for an {@link InputStream}.
*
* <p>This is the base interface for Spring's more extensive {@link Resource} interface.
*
* <p>For single-use streams, {@link InputStreamResource} can be used for any
* given {@code InputStream}. Spring's {@link ByteArrayResource} or any
* file-based {@code Resource} implementation can be used as a concrete
* instance, allowing one to read the underlying content stream multiple times.
* This makes this interface useful as an abstract content source for mail
* attachments, for example.
*
* @author Juergen Hoeller
* @since 20.01.2004
* @see java.io.InputStream
* @see Resource
* @see InputStreamResource
* @see ByteArrayResource
*/
public interface InputStreamSource {
/**
* Return an {@link InputStream} for the content of an underlying resource.
* <p>It is expected that each call creates a <i>fresh</i> stream.
* <p>This requirement is particularly important when you consider an API such
* as JavaMail, which needs to be able to read the stream multiple times when
* creating mail attachments. For such a use case, it is <i>required</i>
* that each {@code getInputStream()} call returns a fresh stream.
* @return the input stream for the underlying resource (must not be {@code null})
* @throws java.io.FileNotFoundException if the underlying resource doesn't exist
* @throws IOException if the content stream could not be opened
*/
InputStream getInputStream() throws IOException;
public interface InputStreamSource
{
InputStream getInputStream();
}

View File

@@ -1,178 +1,26 @@
/*
* Copyright 2002-2018 the original author or authors.
*
* Licensed 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
*
* https://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.
*/
// Generated automatically from org.springframework.core.io.Resource for testing purposes
package org.springframework.core.io;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.net.URI;
import java.net.URL;
import java.nio.channels.Channels;
import java.nio.channels.ReadableByteChannel;
import org.springframework.core.io.InputStreamSource;
import org.springframework.lang.Nullable;
/**
* Interface for a resource descriptor that abstracts from the actual
* type of underlying resource, such as a file or class path resource.
*
* <p>An InputStream can be opened for every resource if it exists in
* physical form, but a URL or File handle can just be returned for
* certain resources. The actual behavior is implementation-specific.
*
* @author Juergen Hoeller
* @since 28.12.2003
* @see #getInputStream()
* @see #getURL()
* @see #getURI()
* @see #getFile()
* @see WritableResource
* @see ContextResource
* @see UrlResource
* @see FileUrlResource
* @see FileSystemResource
* @see ClassPathResource
* @see ByteArrayResource
* @see InputStreamResource
*/
public interface Resource extends InputStreamSource {
/**
* Determine whether this resource actually exists in physical form.
* <p>This method performs a definitive existence check, whereas the
* existence of a {@code Resource} handle only guarantees a valid
* descriptor handle.
*/
boolean exists();
/**
* Indicate whether non-empty contents of this resource can be read via
* {@link #getInputStream()}.
* <p>Will be {@code true} for typical resource descriptors that exist
* since it strictly implies {@link #exists()} semantics as of 5.1.
* Note that actual content reading may still fail when attempted.
* However, a value of {@code false} is a definitive indication
* that the resource content cannot be read.
* @see #getInputStream()
* @see #exists()
*/
default boolean isReadable() {
return exists();
}
/**
* Indicate whether this resource represents a handle with an open stream.
* If {@code true}, the InputStream cannot be read multiple times,
* and must be read and closed to avoid resource leaks.
* <p>Will be {@code false} for typical resource descriptors.
*/
default boolean isOpen() {
return false;
}
/**
* Determine whether this resource represents a file in a file system.
* A value of {@code true} strongly suggests (but does not guarantee)
* that a {@link #getFile()} call will succeed.
* <p>This is conservatively {@code false} by default.
* @since 5.0
* @see #getFile()
*/
default boolean isFile() {
return false;
}
/**
* Return a URL handle for this resource.
* @throws IOException if the resource cannot be resolved as URL,
* i.e. if the resource is not available as descriptor
*/
URL getURL() throws IOException;
/**
* Return a URI handle for this resource.
* @throws IOException if the resource cannot be resolved as URI,
* i.e. if the resource is not available as descriptor
* @since 2.5
*/
URI getURI() throws IOException;
/**
* Return a File handle for this resource.
* @throws java.io.FileNotFoundException if the resource cannot be resolved as
* absolute file path, i.e. if the resource is not available in a file system
* @throws IOException in case of general resolution/reading failures
* @see #getInputStream()
*/
File getFile() throws IOException;
/**
* Return a {@link ReadableByteChannel}.
* <p>It is expected that each call creates a <i>fresh</i> channel.
* <p>The default implementation returns {@link Channels#newChannel(InputStream)}
* with the result of {@link #getInputStream()}.
* @return the byte channel for the underlying resource (must not be {@code null})
* @throws java.io.FileNotFoundException if the underlying resource doesn't exist
* @throws IOException if the content channel could not be opened
* @since 5.0
* @see #getInputStream()
*/
default ReadableByteChannel readableChannel() throws IOException {
return Channels.newChannel(getInputStream());
}
/**
* Determine the content length for this resource.
* @throws IOException if the resource cannot be resolved
* (in the file system or as some other known physical resource type)
*/
long contentLength() throws IOException;
/**
* Determine the last-modified timestamp for this resource.
* @throws IOException if the resource cannot be resolved
* (in the file system or as some other known physical resource type)
*/
long lastModified() throws IOException;
/**
* Create a resource relative to this resource.
* @param relativePath the relative path (relative to this resource)
* @return the resource handle for the relative resource
* @throws IOException if the relative resource cannot be determined
*/
Resource createRelative(String relativePath) throws IOException;
/**
* Determine a filename for this resource, i.e. typically the last
* part of the path: for example, "myfile.txt".
* <p>Returns {@code null} if this type of resource does not
* have a filename.
*/
@Nullable
String getFilename();
/**
* Return a description for this resource,
* to be used for error output when working with the resource.
* <p>Implementations are also encouraged to return this value
* from their {@code toString} method.
* @see Object#toString()
*/
public interface Resource extends InputStreamSource
{
File getFile();
Resource createRelative(String p0);
String getDescription();
String getFilename();
URI getURI();
URL getURL();
boolean exists();
default ReadableByteChannel readableChannel(){ return null; }
default boolean isFile(){ return false; }
default boolean isOpen(){ return false; }
default boolean isReadable(){ return false; }
long contentLength();
long lastModified();
}

View File

@@ -1,40 +1,21 @@
// Generated automatically from org.springframework.http.HttpEntity for testing purposes
package org.springframework.http;
public class HttpEntity<T> {
import org.springframework.http.HttpHeaders;
import org.springframework.util.MultiValueMap;
protected HttpEntity() {
}
public HttpEntity(T body) {
}
public HttpEntity(org.springframework.util.MultiValueMap<java.lang.String, java.lang.String> headers) {
}
public HttpEntity(T body, org.springframework.util.MultiValueMap<java.lang.String, java.lang.String> headers) {
}
public org.springframework.http.HttpHeaders getHeaders() {
return null;
}
public T getBody() {
return null;
}
public boolean hasBody() {
return false;
}
public boolean equals(java.lang.Object other) {
return false;
}
public int hashCode() {
return 0;
}
public java.lang.String toString() {
return null;
}
public class HttpEntity<T>
{
protected HttpEntity(){}
public HttpEntity(MultiValueMap<String, String> p0){}
public HttpEntity(T p0){}
public HttpEntity(T p0, MultiValueMap<String, String> p1){}
public HttpHeaders getHeaders(){ return null; }
public String toString(){ return null; }
public T getBody(){ return null; }
public boolean equals(Object p0){ return false; }
public boolean hasBody(){ return false; }
public int hashCode(){ return 0; }
public static HttpEntity<? extends Object> EMPTY = null;
}

View File

@@ -1,4 +1,220 @@
// Generated automatically from org.springframework.http.HttpHeaders for testing purposes
package org.springframework.http;
public class HttpHeaders implements java.io.Serializable {
import java.io.Serializable;
import java.net.InetSocketAddress;
import java.net.URI;
import java.nio.charset.Charset;
import java.time.Duration;
import java.time.Instant;
import java.time.ZonedDateTime;
import java.util.Collection;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import org.springframework.http.CacheControl;
import org.springframework.http.ContentDisposition;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpRange;
import org.springframework.http.MediaType;
import org.springframework.util.MultiValueMap;
public class HttpHeaders implements MultiValueMap<String, String>, Serializable
{
final MultiValueMap<String, String> headers = null;
protected List<String> getETagValuesAsList(String p0){ return null; }
protected String getFieldValues(String p0){ return null; }
protected String toCommaDelimitedString(List<String> p0){ return null; }
public Collection<List<String>> values(){ return null; }
public ContentDisposition getContentDisposition(){ return null; }
public HttpHeaders(){}
public HttpHeaders(MultiValueMap<String, String> p0){}
public HttpMethod getAccessControlRequestMethod(){ return null; }
public InetSocketAddress getHost(){ return null; }
public List<Charset> getAcceptCharset(){ return null; }
public List<HttpMethod> getAccessControlAllowMethods(){ return null; }
public List<HttpRange> getRange(){ return null; }
public List<Locale.LanguageRange> getAcceptLanguage(){ return null; }
public List<Locale> getAcceptLanguageAsLocales(){ return null; }
public List<MediaType> getAccept(){ return null; }
public List<MediaType> getAcceptPatch(){ return null; }
public List<String> get(Object p0){ return null; }
public List<String> getAccessControlAllowHeaders(){ return null; }
public List<String> getAccessControlExposeHeaders(){ return null; }
public List<String> getAccessControlRequestHeaders(){ return null; }
public List<String> getConnection(){ return null; }
public List<String> getIfMatch(){ return null; }
public List<String> getIfNoneMatch(){ return null; }
public List<String> getOrEmpty(Object p0){ return null; }
public List<String> getValuesAsList(String p0){ return null; }
public List<String> getVary(){ return null; }
public List<String> put(String p0, List<String> p1){ return null; }
public List<String> remove(Object p0){ return null; }
public Locale getContentLanguage(){ return null; }
public Map<String, String> toSingleValueMap(){ return null; }
public MediaType getContentType(){ return null; }
public Set<HttpMethod> getAllow(){ return null; }
public Set<Map.Entry<String, List<String>>> entrySet(){ return null; }
public Set<String> keySet(){ return null; }
public String getAccessControlAllowOrigin(){ return null; }
public String getCacheControl(){ return null; }
public String getETag(){ return null; }
public String getFirst(String p0){ return null; }
public String getOrigin(){ return null; }
public String getPragma(){ return null; }
public String getUpgrade(){ return null; }
public String toString(){ return null; }
public URI getLocation(){ return null; }
public ZonedDateTime getFirstZonedDateTime(String p0){ return null; }
public boolean containsKey(Object p0){ return false; }
public boolean containsValue(Object p0){ return false; }
public boolean equals(Object p0){ return false; }
public boolean getAccessControlAllowCredentials(){ return false; }
public boolean isEmpty(){ return false; }
public int hashCode(){ return 0; }
public int size(){ return 0; }
public long getAccessControlMaxAge(){ return 0; }
public long getContentLength(){ return 0; }
public long getDate(){ return 0; }
public long getExpires(){ return 0; }
public long getFirstDate(String p0){ return 0; }
public long getIfModifiedSince(){ return 0; }
public long getIfUnmodifiedSince(){ return 0; }
public long getLastModified(){ return 0; }
public static HttpHeaders EMPTY = null;
public static HttpHeaders readOnlyHttpHeaders(HttpHeaders p0){ return null; }
public static HttpHeaders readOnlyHttpHeaders(MultiValueMap<String, String> p0){ return null; }
public static HttpHeaders writableHttpHeaders(HttpHeaders p0){ return null; }
public static String ACCEPT = null;
public static String ACCEPT_CHARSET = null;
public static String ACCEPT_ENCODING = null;
public static String ACCEPT_LANGUAGE = null;
public static String ACCEPT_PATCH = null;
public static String ACCEPT_RANGES = null;
public static String ACCESS_CONTROL_ALLOW_CREDENTIALS = null;
public static String ACCESS_CONTROL_ALLOW_HEADERS = null;
public static String ACCESS_CONTROL_ALLOW_METHODS = null;
public static String ACCESS_CONTROL_ALLOW_ORIGIN = null;
public static String ACCESS_CONTROL_EXPOSE_HEADERS = null;
public static String ACCESS_CONTROL_MAX_AGE = null;
public static String ACCESS_CONTROL_REQUEST_HEADERS = null;
public static String ACCESS_CONTROL_REQUEST_METHOD = null;
public static String AGE = null;
public static String ALLOW = null;
public static String AUTHORIZATION = null;
public static String CACHE_CONTROL = null;
public static String CONNECTION = null;
public static String CONTENT_DISPOSITION = null;
public static String CONTENT_ENCODING = null;
public static String CONTENT_LANGUAGE = null;
public static String CONTENT_LENGTH = null;
public static String CONTENT_LOCATION = null;
public static String CONTENT_RANGE = null;
public static String CONTENT_TYPE = null;
public static String COOKIE = null;
public static String DATE = null;
public static String ETAG = null;
public static String EXPECT = null;
public static String EXPIRES = null;
public static String FROM = null;
public static String HOST = null;
public static String IF_MATCH = null;
public static String IF_MODIFIED_SINCE = null;
public static String IF_NONE_MATCH = null;
public static String IF_RANGE = null;
public static String IF_UNMODIFIED_SINCE = null;
public static String LAST_MODIFIED = null;
public static String LINK = null;
public static String LOCATION = null;
public static String MAX_FORWARDS = null;
public static String ORIGIN = null;
public static String PRAGMA = null;
public static String PROXY_AUTHENTICATE = null;
public static String PROXY_AUTHORIZATION = null;
public static String RANGE = null;
public static String REFERER = null;
public static String RETRY_AFTER = null;
public static String SERVER = null;
public static String SET_COOKIE = null;
public static String SET_COOKIE2 = null;
public static String TE = null;
public static String TRAILER = null;
public static String TRANSFER_ENCODING = null;
public static String UPGRADE = null;
public static String USER_AGENT = null;
public static String VARY = null;
public static String VIA = null;
public static String WARNING = null;
public static String WWW_AUTHENTICATE = null;
public static String encodeBasicAuth(String p0, String p1, Charset p2){ return null; }
public static String formatHeaders(MultiValueMap<String, String> p0){ return null; }
public void add(String p0, String p1){}
public void addAll(MultiValueMap<String, String> p0){}
public void addAll(String p0, List<? extends String> p1){}
public void clear(){}
public void clearContentHeaders(){}
public void putAll(Map<? extends String, ? extends List<String>> p0){}
public void set(String p0, String p1){}
public void setAccept(List<MediaType> p0){}
public void setAcceptCharset(List<Charset> p0){}
public void setAcceptLanguage(List<Locale.LanguageRange> p0){}
public void setAcceptLanguageAsLocales(List<Locale> p0){}
public void setAcceptPatch(List<MediaType> p0){}
public void setAccessControlAllowCredentials(boolean p0){}
public void setAccessControlAllowHeaders(List<String> p0){}
public void setAccessControlAllowMethods(List<HttpMethod> p0){}
public void setAccessControlAllowOrigin(String p0){}
public void setAccessControlExposeHeaders(List<String> p0){}
public void setAccessControlMaxAge(Duration p0){}
public void setAccessControlMaxAge(long p0){}
public void setAccessControlRequestHeaders(List<String> p0){}
public void setAccessControlRequestMethod(HttpMethod p0){}
public void setAll(Map<String, String> p0){}
public void setAllow(Set<HttpMethod> p0){}
public void setBasicAuth(String p0){}
public void setBasicAuth(String p0, String p1){}
public void setBasicAuth(String p0, String p1, Charset p2){}
public void setBearerAuth(String p0){}
public void setCacheControl(CacheControl p0){}
public void setCacheControl(String p0){}
public void setConnection(List<String> p0){}
public void setConnection(String p0){}
public void setContentDisposition(ContentDisposition p0){}
public void setContentDispositionFormData(String p0, String p1){}
public void setContentLanguage(Locale p0){}
public void setContentLength(long p0){}
public void setContentType(MediaType p0){}
public void setDate(Instant p0){}
public void setDate(String p0, long p1){}
public void setDate(ZonedDateTime p0){}
public void setDate(long p0){}
public void setETag(String p0){}
public void setExpires(Instant p0){}
public void setExpires(ZonedDateTime p0){}
public void setExpires(long p0){}
public void setHost(InetSocketAddress p0){}
public void setIfMatch(List<String> p0){}
public void setIfMatch(String p0){}
public void setIfModifiedSince(Instant p0){}
public void setIfModifiedSince(ZonedDateTime p0){}
public void setIfModifiedSince(long p0){}
public void setIfNoneMatch(List<String> p0){}
public void setIfNoneMatch(String p0){}
public void setIfUnmodifiedSince(Instant p0){}
public void setIfUnmodifiedSince(ZonedDateTime p0){}
public void setIfUnmodifiedSince(long p0){}
public void setInstant(String p0, Instant p1){}
public void setLastModified(Instant p0){}
public void setLastModified(ZonedDateTime p0){}
public void setLastModified(long p0){}
public void setLocation(URI p0){}
public void setOrigin(String p0){}
public void setPragma(String p0){}
public void setRange(List<HttpRange> p0){}
public void setUpgrade(String p0){}
public void setVary(List<String> p0){}
public void setZonedDateTime(String p0, ZonedDateTime p1){}
static String formatDate(long p0){ return null; }
}

View File

@@ -1,20 +1,12 @@
// Generated automatically from org.springframework.http.HttpMethod for testing purposes
package org.springframework.http;
public enum HttpMethod {
GET,
HEAD,
POST,
PUT,
PATCH,
DELETE,
OPTIONS,
TRACE,
public enum HttpMethod
{
DELETE, GET, HEAD, OPTIONS, PATCH, POST, PUT, TRACE;
private HttpMethod() {}
public boolean matches(String p0){ return false; }
public static HttpMethod resolve(String p0){ return null; }
}

View File

@@ -1,147 +1,28 @@
// Generated automatically from org.springframework.http.HttpStatus for testing purposes
package org.springframework.http;
public enum HttpStatus {
CONTINUE,
SWITCHING_PROTOCOLS,
PROCESSING,
CHECKPOINT,
OK,
CREATED,
ACCEPTED,
NON_AUTHORITATIVE_INFORMATION,
NO_CONTENT,
RESET_CONTENT,
PARTIAL_CONTENT,
MULTI_STATUS,
ALREADY_REPORTED,
IM_USED,
MULTIPLE_CHOICES,
MOVED_PERMANENTLY,
FOUND,
@java.lang.Deprecated
MOVED_TEMPORARILY,
SEE_OTHER,
NOT_MODIFIED,
@java.lang.Deprecated
USE_PROXY,
TEMPORARY_REDIRECT,
PERMANENT_REDIRECT,
BAD_REQUEST,
UNAUTHORIZED,
PAYMENT_REQUIRED,
FORBIDDEN,
NOT_FOUND,
METHOD_NOT_ALLOWED,
NOT_ACCEPTABLE,
PROXY_AUTHENTICATION_REQUIRED,
REQUEST_TIMEOUT,
CONFLICT,
GONE,
LENGTH_REQUIRED,
PRECONDITION_FAILED,
PAYLOAD_TOO_LARGE,
@java.lang.Deprecated
REQUEST_ENTITY_TOO_LARGE,
URI_TOO_LONG,
@java.lang.Deprecated
REQUEST_URI_TOO_LONG,
UNSUPPORTED_MEDIA_TYPE,
REQUESTED_RANGE_NOT_SATISFIABLE,
EXPECTATION_FAILED,
I_AM_A_TEAPOT,
@java.lang.Deprecated
INSUFFICIENT_SPACE_ON_RESOURCE,
@java.lang.Deprecated
METHOD_FAILURE,
@java.lang.Deprecated
DESTINATION_LOCKED,
UNPROCESSABLE_ENTITY,
LOCKED,
FAILED_DEPENDENCY,
TOO_EARLY,
UPGRADE_REQUIRED,
PRECONDITION_REQUIRED,
TOO_MANY_REQUESTS,
REQUEST_HEADER_FIELDS_TOO_LARGE,
UNAVAILABLE_FOR_LEGAL_REASONS,
INTERNAL_SERVER_ERROR,
NOT_IMPLEMENTED,
BAD_GATEWAY,
SERVICE_UNAVAILABLE,
GATEWAY_TIMEOUT,
HTTP_VERSION_NOT_SUPPORTED,
VARIANT_ALSO_NEGOTIATES,
INSUFFICIENT_STORAGE,
LOOP_DETECTED,
BANDWIDTH_LIMIT_EXCEEDED,
NOT_EXTENDED,
NETWORK_AUTHENTICATION_REQUIRED,
public enum HttpStatus
{
ACCEPTED, ALREADY_REPORTED, BAD_GATEWAY, BAD_REQUEST, BANDWIDTH_LIMIT_EXCEEDED, CHECKPOINT, CONFLICT, CONTINUE, CREATED, DESTINATION_LOCKED, EXPECTATION_FAILED, FAILED_DEPENDENCY, FORBIDDEN, FOUND, GATEWAY_TIMEOUT, GONE, HTTP_VERSION_NOT_SUPPORTED, IM_USED, INSUFFICIENT_SPACE_ON_RESOURCE, INSUFFICIENT_STORAGE, INTERNAL_SERVER_ERROR, I_AM_A_TEAPOT, LENGTH_REQUIRED, LOCKED, LOOP_DETECTED, METHOD_FAILURE, METHOD_NOT_ALLOWED, MOVED_PERMANENTLY, MOVED_TEMPORARILY, MULTIPLE_CHOICES, MULTI_STATUS, NETWORK_AUTHENTICATION_REQUIRED, NON_AUTHORITATIVE_INFORMATION, NOT_ACCEPTABLE, NOT_EXTENDED, NOT_FOUND, NOT_IMPLEMENTED, NOT_MODIFIED, NO_CONTENT, OK, PARTIAL_CONTENT, PAYLOAD_TOO_LARGE, PAYMENT_REQUIRED, PERMANENT_REDIRECT, PRECONDITION_FAILED, PRECONDITION_REQUIRED, PROCESSING, PROXY_AUTHENTICATION_REQUIRED, REQUESTED_RANGE_NOT_SATISFIABLE, REQUEST_ENTITY_TOO_LARGE, REQUEST_HEADER_FIELDS_TOO_LARGE, REQUEST_TIMEOUT, REQUEST_URI_TOO_LONG, RESET_CONTENT, SEE_OTHER, SERVICE_UNAVAILABLE, SWITCHING_PROTOCOLS, TEMPORARY_REDIRECT, TOO_EARLY, TOO_MANY_REQUESTS, UNAUTHORIZED, UNAVAILABLE_FOR_LEGAL_REASONS, UNPROCESSABLE_ENTITY, UNSUPPORTED_MEDIA_TYPE, UPGRADE_REQUIRED, URI_TOO_LONG, USE_PROXY, VARIANT_ALSO_NEGOTIATES;
private HttpStatus() {}
public HttpStatus.Series series(){ return null; }
public String getReasonPhrase(){ return null; }
public String toString(){ return null; }
public boolean is1xxInformational(){ return false; }
public boolean is2xxSuccessful(){ return false; }
public boolean is3xxRedirection(){ return false; }
public boolean is4xxClientError(){ return false; }
public boolean is5xxServerError(){ return false; }
public boolean isError(){ return false; }
public int value(){ return 0; }
public static HttpStatus resolve(int p0){ return null; }
static public enum Series
{
CLIENT_ERROR, INFORMATIONAL, REDIRECTION, SERVER_ERROR, SUCCESSFUL;
private Series() {}
public int value(){ return 0; }
public static HttpStatus.Series resolve(int p0){ return null; }
}
}

View File

@@ -1,70 +1,71 @@
// Generated automatically from org.springframework.http.RequestEntity for testing purposes
package org.springframework.http;
public class RequestEntity<T> extends org.springframework.http.HttpEntity {
import java.lang.reflect.Type;
import java.net.URI;
import java.nio.charset.Charset;
import java.time.Instant;
import java.time.ZonedDateTime;
import java.util.Map;
import java.util.function.Consumer;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.MediaType;
import org.springframework.util.MultiValueMap;
public RequestEntity(org.springframework.http.HttpMethod method, java.net.URI url) {
public class RequestEntity<T> extends HttpEntity<T>
{
protected RequestEntity() {}
public HttpMethod getMethod(){ return null; }
public RequestEntity(HttpMethod p0, URI p1){}
public RequestEntity(MultiValueMap<String, String> p0, HttpMethod p1, URI p2){}
public RequestEntity(T p0, HttpMethod p1, URI p2){}
public RequestEntity(T p0, HttpMethod p1, URI p2, Type p3){}
public RequestEntity(T p0, MultiValueMap<String, String> p1, HttpMethod p2, URI p3){}
public RequestEntity(T p0, MultiValueMap<String, String> p1, HttpMethod p2, URI p3, Type p4){}
public String toString(){ return null; }
public Type getType(){ return null; }
public URI getUrl(){ return null; }
public boolean equals(Object p0){ return false; }
public int hashCode(){ return 0; }
public static RequestEntity.BodyBuilder method(HttpMethod p0, String p1, Map<String, ? extends Object> p2){ return null; }
public static RequestEntity.BodyBuilder method(HttpMethod p0, String p1, Object... p2){ return null; }
public static RequestEntity.BodyBuilder method(HttpMethod p0, URI p1){ return null; }
public static RequestEntity.BodyBuilder patch(String p0, Object... p1){ return null; }
public static RequestEntity.BodyBuilder patch(URI p0){ return null; }
public static RequestEntity.BodyBuilder post(String p0, Object... p1){ return null; }
public static RequestEntity.BodyBuilder post(URI p0){ return null; }
public static RequestEntity.BodyBuilder put(String p0, Object... p1){ return null; }
public static RequestEntity.BodyBuilder put(URI p0){ return null; }
public static RequestEntity.HeadersBuilder<? extends Object> delete(String p0, Object... p1){ return null; }
public static RequestEntity.HeadersBuilder<? extends Object> delete(URI p0){ return null; }
public static RequestEntity.HeadersBuilder<? extends Object> get(String p0, Object... p1){ return null; }
public static RequestEntity.HeadersBuilder<? extends Object> get(URI p0){ return null; }
public static RequestEntity.HeadersBuilder<? extends Object> head(String p0, Object... p1){ return null; }
public static RequestEntity.HeadersBuilder<? extends Object> head(URI p0){ return null; }
public static RequestEntity.HeadersBuilder<? extends Object> options(String p0, Object... p1){ return null; }
public static RequestEntity.HeadersBuilder<? extends Object> options(URI p0){ return null; }
static <T> String format(HttpMethod p0, String p1, T p2, HttpHeaders p3){ return null; }
static public interface BodyBuilder extends RequestEntity.HeadersBuilder<RequestEntity.BodyBuilder>
{
<T> RequestEntity<T> body(T p0);
<T> RequestEntity<T> body(T p0, Type p1);
RequestEntity.BodyBuilder contentLength(long p0);
RequestEntity.BodyBuilder contentType(MediaType p0);
}
public RequestEntity(T body, org.springframework.http.HttpMethod method, java.net.URI url) {
}
public RequestEntity(T body, org.springframework.http.HttpMethod method, java.net.URI url,
java.lang.reflect.Type type) {
}
public RequestEntity(org.springframework.util.MultiValueMap<java.lang.String, java.lang.String> headers,
org.springframework.http.HttpMethod method, java.net.URI url) {
}
public RequestEntity(T body, org.springframework.util.MultiValueMap<java.lang.String, java.lang.String> headers,
org.springframework.http.HttpMethod method, java.net.URI url) {
}
public RequestEntity(T body, org.springframework.util.MultiValueMap<java.lang.String, java.lang.String> headers,
org.springframework.http.HttpMethod method, java.net.URI url, java.lang.reflect.Type type) {
}
public java.net.URI getUrl() {
return null;
}
public static org.springframework.http.RequestEntity.BodyBuilder method(org.springframework.http.HttpMethod method,
java.net.URI url) {
return null;
}
public static org.springframework.http.RequestEntity.HeadersBuilder get(java.net.URI url) {
return null;
}
public static org.springframework.http.RequestEntity.HeadersBuilder head(java.net.URI url) {
return null;
}
public static org.springframework.http.RequestEntity.BodyBuilder post(java.net.URI url) {
return null;
}
public static org.springframework.http.RequestEntity.BodyBuilder put(java.net.URI url) {
return null;
}
public static org.springframework.http.RequestEntity.BodyBuilder patch(java.net.URI url) {
return null;
}
public static org.springframework.http.RequestEntity.HeadersBuilder delete(java.net.URI url) {
return null;
}
public static org.springframework.http.RequestEntity.HeadersBuilder options(java.net.URI url) {
return null;
}
class HeadersBuilder<K> {
}
public class BodyBuilder<T> {
public RequestEntity<T> body(Object body){return null;};
static public interface HeadersBuilder<B extends RequestEntity.HeadersBuilder<B>>
{
B accept(MediaType... p0);
B acceptCharset(Charset... p0);
B header(String p0, String... p1);
B headers(Consumer<HttpHeaders> p0);
B headers(HttpHeaders p0);
B ifModifiedSince(Instant p0);
B ifModifiedSince(ZonedDateTime p0);
B ifModifiedSince(long p0);
B ifNoneMatch(String... p0);
RequestEntity<Void> build();
}
}

View File

@@ -1,16 +1,63 @@
// Generated automatically from org.springframework.http.ResponseEntity for testing purposes
package org.springframework.http;
public class ResponseEntity<T> extends org.springframework.http.HttpEntity {
import java.net.URI;
import java.time.Instant;
import java.time.ZonedDateTime;
import java.util.Optional;
import java.util.function.Consumer;
import org.springframework.http.CacheControl;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.util.MultiValueMap;
// private final java.lang.Object status;
// public ResponseEntity(org.springframework.http.HttpStatus status) {
// }
// public ResponseEntity(T body, org.springframework.http.HttpStatus status) {
// }
public static <T> ResponseEntity<T> ok(T body) {
return null;
public class ResponseEntity<T> extends HttpEntity<T>
{
protected ResponseEntity() {}
public HttpStatus getStatusCode(){ return null; }
public ResponseEntity(HttpStatus p0){}
public ResponseEntity(MultiValueMap<String, String> p0, HttpStatus p1){}
public ResponseEntity(T p0, HttpStatus p1){}
public ResponseEntity(T p0, MultiValueMap<String, String> p1, HttpStatus p2){}
public ResponseEntity(T p0, MultiValueMap<String, String> p1, int p2){}
public String toString(){ return null; }
public boolean equals(Object p0){ return false; }
public int getStatusCodeValue(){ return 0; }
public int hashCode(){ return 0; }
public static <T> ResponseEntity<T> of(Optional<T> p0){ return null; }
public static <T> ResponseEntity<T> ok(T p0){ return null; }
public static ResponseEntity.BodyBuilder accepted(){ return null; }
public static ResponseEntity.BodyBuilder badRequest(){ return null; }
public static ResponseEntity.BodyBuilder created(URI p0){ return null; }
public static ResponseEntity.BodyBuilder ok(){ return null; }
public static ResponseEntity.BodyBuilder status(HttpStatus p0){ return null; }
public static ResponseEntity.BodyBuilder status(int p0){ return null; }
public static ResponseEntity.BodyBuilder unprocessableEntity(){ return null; }
public static ResponseEntity.HeadersBuilder<? extends Object> noContent(){ return null; }
public static ResponseEntity.HeadersBuilder<? extends Object> notFound(){ return null; }
static public interface BodyBuilder extends ResponseEntity.HeadersBuilder<ResponseEntity.BodyBuilder>
{
<T> ResponseEntity<T> body(T p0);
ResponseEntity.BodyBuilder contentLength(long p0);
ResponseEntity.BodyBuilder contentType(MediaType p0);
}
static public interface HeadersBuilder<B extends ResponseEntity.HeadersBuilder<B>>
{
<T> ResponseEntity<T> build();
B allow(HttpMethod... p0);
B cacheControl(CacheControl p0);
B eTag(String p0);
B header(String p0, String... p1);
B headers(Consumer<HttpHeaders> p0);
B headers(HttpHeaders p0);
B lastModified(Instant p0);
B lastModified(ZonedDateTime p0);
B lastModified(long p0);
B location(URI p0);
B varyBy(String... p0);
}
}

View File

@@ -94,7 +94,7 @@ public interface MultipartFile extends InputStreamSource {
* @throws IOException in case of access errors (if the temporary store fails)
*/
@Override
InputStream getInputStream() throws IOException;
InputStream getInputStream(); // throws IOException;
/**
* Return a Resource representation of this MultipartFile. This can be used