Skip to content

Commit

Permalink
Better generic support.
Browse files Browse the repository at this point in the history
  • Loading branch information
noboomu committed Apr 22, 2022
1 parent 6941bb6 commit f4f363c
Show file tree
Hide file tree
Showing 10 changed files with 587 additions and 182 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ Proteus Changelog.
## Unreleased
### No issue

**Added support for last-modified using java.time.Instant.**


[6941bb69b2739a5](https://github.com/noboomu/proteus/commit/6941bb69b2739a5) Joshua Bauer *2022-01-10 18:02:01*

**Added HEIC format**


Expand Down
30 changes: 30 additions & 0 deletions proteus-core/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,36 @@ Proteus Changelog.
## Unreleased
### No issue

**Added support for last-modified using java.time.Instant.**


[6941bb69b2739a5](https://github.com/noboomu/proteus/commit/6941bb69b2739a5) Joshua Bauer *2022-01-10 18:02:01*

**Added HEIC format**


[1aa07d8f82ab1cc](https://github.com/noboomu/proteus/commit/1aa07d8f82ab1cc) Joshua Bauer *2021-12-24 00:44:12*

**Added AVIF format**


[f0c191a37c3e244](https://github.com/noboomu/proteus/commit/f0c191a37c3e244) Joshua Bauer *2021-12-24 00:25:14*

**Improve handling of FormData files and buffers**


[a71c05b020e813c](https://github.com/noboomu/proteus/commit/a71c05b020e813c) Joshua Bauer *2021-11-15 15:51:16*

**Improve uploading of binary files**


[c305504d2d62424](https://github.com/noboomu/proteus/commit/c305504d2d62424) Joshua Bauer *2021-11-09 23:40:40*

**Bump compiler version for JDK 17 support.**


[742130deaad3aae](https://github.com/noboomu/proteus/commit/742130deaad3aae) Joshua Bauer *2021-10-30 21:28:03*

**Cleanup OpenAPI module and add json spec support.**


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,10 @@ protected void configure()

} catch (Exception e) {

this.binder().addError(e);
log.error(e.getMessage(), e);

this.bind(DefaultResponseListener.class).to(io.sinistral.proteus.server.handlers.ServerDefaultResponseListener.class).in(Singleton.class);

}

try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.google.inject.AbstractModule;
import com.google.inject.Binder;
import com.google.inject.Key;
import com.google.inject.Provides;
import com.google.inject.Singleton;
import com.google.inject.name.Named;
import com.google.inject.name.Names;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,11 @@
import java.time.Instant;
import java.time.OffsetDateTime;
import java.time.ZonedDateTime;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.Deque;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -556,6 +558,8 @@ public static java.util.Optional<File> file(final HttpServerExchange exchange, f
return formValueFilePath(exchange, name).map(Path::toFile);
}



public static java.util.Optional<ByteBuffer> byteBuffer(final HttpServerExchange exchange) throws IOException
{

Expand Down Expand Up @@ -598,24 +602,24 @@ public static Path filePath(final HttpServerExchange exchange, final String name
public static List<Path> pathList(final HttpServerExchange exchange, final String name) throws IllegalArgumentException
{

return formValueFilePaths(exchange, name).map(s -> s.collect(Collectors.toList())).orElseThrow(() -> new IllegalArgumentException("Invalid parameter " + name));
return formValueFilePaths(exchange, name).map(s -> s.collect(Collectors.toList())).orElse(new ArrayList<>());
}

public static List<File> fileList(final HttpServerExchange exchange, final String name) throws IllegalArgumentException
{

return formValueFilePaths(exchange, name).map(s -> s.map(Path::toFile).collect(Collectors.toList())).orElseThrow(() -> new IllegalArgumentException("Invalid parameter " + name));
return formValueFilePaths(exchange, name).map(s -> s.map(Path::toFile).collect(Collectors.toList())).orElse(new ArrayList<>());
}

public static Map<String, Path> pathMap(final HttpServerExchange exchange, final String name) throws IllegalArgumentException
{
return formValuePathMap(exchange,name).orElseThrow(() -> new IllegalArgumentException("Invalid parameter " + name));
return formValuePathMap(exchange,name).orElse(new HashMap<>());
}

public static Map<String, File> fileMap(final HttpServerExchange exchange, final String name) throws IllegalArgumentException
{

return formValueFileMap(exchange,name).orElseThrow(() -> new IllegalArgumentException("Invalid parameter " + name));
return formValueFileMap(exchange,name).orElse(new HashMap<>());
}

public static File file(final HttpServerExchange exchange, final String name) throws IllegalArgumentException
Expand Down
Loading

0 comments on commit f4f363c

Please sign in to comment.