https://github.com/sdorra/web-resources
Serving files over http the right way
https://github.com/sdorra/web-resources
caching compression content-disposition content-type download etag gzip http java last-modified servlet
Last synced: 3 months ago
JSON representation
Serving files over http the right way
- Host: GitHub
- URL: https://github.com/sdorra/web-resources
- Owner: sdorra
- License: mit
- Created: 2018-09-06T19:48:48.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-11-13T13:40:35.000Z (over 1 year ago)
- Last Synced: 2025-01-13T01:37:22.394Z (5 months ago)
- Topics: caching, compression, content-disposition, content-type, download, etag, gzip, http, java, last-modified, servlet
- Language: Java
- Homepage:
- Size: 92.8 KB
- Stars: 1
- Watchers: 3
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Web-Resources
[](https://travis-ci.org/sdorra/web-resources)
[](https://search.maven.org/search?q=a:web-resources%20g:com.github.sdorra)
[](https://sonarcloud.io/dashboard?id=com.github.sdorra%3Aweb-resources)
[](https://sonarcloud.io/dashboard?id=com.github.sdorra%3Aweb-resources)The web-resources library is usable for serving files over http.
It does the following things for you:* Detects and set the right Content-Type for the resource
* Partial caching via Last-Modified, If-Modified-Since and If-Unmodified-Since header
* Partial caching via ETag, If-Match, If-None-Match header
* Sets Content-Disposition header
* Head request without content
* Optional GZIP compression
* Optional handling Expires header
* Optional handling Cache-Control header## Usage
Add the latest stable version of to the dependency management tool of your choice.
E.g. for maven:
```xml
com.github.sdorra
web-resources
x.y.z```
Use the latest version from maven central: [](https://search.maven.org/search?q=a:web-resources%20g:com.github.sdorra)
### Example
```java
Path path = Paths.get("myfile.txt");WebResourceSender.create()
.withGZIP()
.withExpires(7, TimeUnit.DAYS)
.resource(path)
.send(request, response);
```## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details