Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add basic CORS support #4

Closed
wants to merge 6 commits into from

Conversation

mathieuancelin
Copy link
Contributor

This PR add basic support for CORS mechanism.

can be used through the programmatic API

server.configure(routes -> routes.
  options("/mycorsservice", context -> {
    if (context.isPreflight()) ...
    return new Payload("")
      .withCode(200)
      .withAllowOrigin("*")
      .withAllowCredentials(true)
      .withExposeHeaders("X-WHATEVER")
      .withMaxAge(3600);
  })
);

or the annotation based API

public static class MyResource {
  @Options("/mycorsservice")
  @AllowOrigin("http://www.code-story.net")
  @AllowMethods({"GET", "POST"})
  @AllowHeaders("X-WHATEVER")
  public String myService() {
    return "";
  }
}

@dgageot
Copy link
Member

dgageot commented May 3, 2014

Related to #32

@jeanlaurent
Copy link
Member

Closing since #32 is closed.

Thx a lot Mathieu

@jeanlaurent jeanlaurent closed this May 5, 2014
@dgageot
Copy link
Member

dgageot commented May 5, 2014

?? Why did you close it? I didn't want to merge it right now but stil...

@dgageot dgageot reopened this May 5, 2014
@jeanlaurent
Copy link
Member

my bad

@cexbrayat
Copy link
Contributor

Would be great to have this PR merged!

@cexbrayat cexbrayat mentioned this pull request May 23, 2014
Closed
@dgageot
Copy link
Member

dgageot commented May 24, 2014

PR merged

@dgageot dgageot closed this May 24, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants