dropwizard-cors

Provides support for configuring CORS headers.

License

License

Categories

Categories

DropWizard Container Microservices
GroupId

GroupId

io.wtsky.dropwizard
ArtifactId

ArtifactId

dropwizard-cors
Last Version

Last Version

0.2
Release Date

Release Date

Type

Type

jar
Description

Description

dropwizard-cors
Provides support for configuring CORS headers.
Project URL

Project URL

https://github.com/sjthomason/dropwizard-cors
Source Code Management

Source Code Management

https://github.com/sjthomason/dropwizard-cors

Download dropwizard-cors

How to add to project

<!-- https://jarcasting.com/artifacts/io.wtsky.dropwizard/dropwizard-cors/ -->
<dependency>
    <groupId>io.wtsky.dropwizard</groupId>
    <artifactId>dropwizard-cors</artifactId>
    <version>0.2</version>
</dependency>
// https://jarcasting.com/artifacts/io.wtsky.dropwizard/dropwizard-cors/
implementation 'io.wtsky.dropwizard:dropwizard-cors:0.2'
// https://jarcasting.com/artifacts/io.wtsky.dropwizard/dropwizard-cors/
implementation ("io.wtsky.dropwizard:dropwizard-cors:0.2")
'io.wtsky.dropwizard:dropwizard-cors:jar:0.2'
<dependency org="io.wtsky.dropwizard" name="dropwizard-cors" rev="0.2">
  <artifact name="dropwizard-cors" type="jar" />
</dependency>
@Grapes(
@Grab(group='io.wtsky.dropwizard', module='dropwizard-cors', version='0.2')
)
libraryDependencies += "io.wtsky.dropwizard" % "dropwizard-cors" % "0.2"
[io.wtsky.dropwizard/dropwizard-cors "0.2"]

Dependencies

compile (1)

Group / Artifact Type Version
io.dropwizard : dropwizard-core jar

test (3)

Group / Artifact Type Version
io.dropwizard : dropwizard-testing jar
org.junit.jupiter : junit-jupiter jar
org.assertj : assertj-core jar

Project Modules

There are no modules declared in this project.

Dropwizard CORS

Build Status Maven Central GitHub license

dropwizard-cors is a convenience library that enables easy configuration of Cross-Origin Resource Sharing related parameters.

Usage

Your configuration class needs a CorsBundleConfiguration instance:

public class ExampleConfiguration extends Configuration {
    @Valid
    @NotNull
    private CorsBundleConfiguration cors = new CorsBundleConfiguration();

    @JsonProperty("cors")
    public CorsBundleConfiguration getCorsConfiguration() {
        return cors;
    }

    @JsonProperty("cors")
    public void setCorsConfiguration(CorsBundleConfiguration cors) {
        this.cors = cors;
    }
}

Then, in your application's initialize method, add a new CorsBundle subclass:

@Override
public void initialize(Bootstrap<ExampleConfiguration> bootstrap) {
    bootstrap.addBundle(new CorsBundle<ExampleConfiguration>() {
        @Override
        public CorsBundleConfiguration getCorsConfiguration(ExampleConfiguration configuration) {
            return configuration.getCorsConfiguration();
        }
    });
}

Maven Artifacts

This project is available on Maven Central. To add it to your project simply add the following dependencies to your pom.xml:

<dependency>
    <groupId>io.wtsky.dropwizard</groupId>
    <artifactId>dropwizard-cors</artifactId>
    <version>0.2</version>
</dependency>

Support

Please file bug reports and feature requests in GitHub issues.

License

Copyright (c) 2020 Whitesky Communications, LLC

This library is licensed under the BSD 2-Clause "Simplified" License.

See the LICENSE file in this repository for the full license text.

Versions

Version
0.2
0.1