Web Resources

Sending web resources the right way

License

License

GroupId

GroupId

com.github.sdorra
ArtifactId

ArtifactId

web-resources
Last Version

Last Version

1.1.1
Release Date

Release Date

Type

Type

jar
Description

Description

Web Resources
Sending web resources the right way
Project URL

Project URL

https://github.com/sdorra/web-resources
Source Code Management

Source Code Management

https://github.com/sdorra/web-resources

Download web-resources

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.sdorra/web-resources/ -->
<dependency>
    <groupId>com.github.sdorra</groupId>
    <artifactId>web-resources</artifactId>
    <version>1.1.1</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.sdorra/web-resources/
implementation 'com.github.sdorra:web-resources:1.1.1'
// https://jarcasting.com/artifacts/com.github.sdorra/web-resources/
implementation ("com.github.sdorra:web-resources:1.1.1")
'com.github.sdorra:web-resources:jar:1.1.1'
<dependency org="com.github.sdorra" name="web-resources" rev="1.1.1">
  <artifact name="web-resources" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.sdorra', module='web-resources', version='1.1.1')
)
libraryDependencies += "com.github.sdorra" % "web-resources" % "1.1.1"
[com.github.sdorra/web-resources "1.1.1"]

Dependencies

compile (2)

Group / Artifact Type Version
com.github.sdorra : spotter-core Optional jar 2.1.1
org.apache.tika : tika-core Optional jar 1.24.1

provided (1)

Group / Artifact Type Version
javax.servlet : servlet-api jar 2.5

test (6)

Group / Artifact Type Version
org.junit.jupiter : junit-jupiter-api jar 5.6.2
org.junit.jupiter : junit-jupiter-params jar 5.6.2
org.junit.jupiter : junit-jupiter-engine jar 5.6.2
org.mockito : mockito-core jar 3.3.3
org.mockito : mockito-junit-jupiter jar 3.3.3
org.assertj : assertj-core jar 3.16.1

Project Modules

There are no modules declared in this project.

Web-Resources

Build Status Maven Central Quality Gates Coverage

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:

<dependency>
    <groupId>com.github.sdorra</groupId>
    <artifactId>web-resources</artifactId>
    <version>x.y.z</version>
</dependency>

Use the latest version from maven central: Maven Central

Example

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 file for details

Versions

Version
1.1.1
1.1.0
1.0.4
1.0.3
1.0.2
1.0.1