-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Live session user
committed
Aug 20, 2016
0 parents
commit 26c9230
Showing
18 changed files
with
1,235 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
logs | ||
target | ||
/.idea | ||
/.idea_modules | ||
/.classpath | ||
/.project | ||
/.settings | ||
/RUNNING_PID |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
This software is licensed under the Apache 2 license, quoted below. | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this project except in compliance with | ||
the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0. | ||
|
||
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an | ||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific | ||
language governing permissions and limitations under the License. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
This is your new Play application | ||
================================= | ||
|
||
This file will be packaged with your application when using `activator dist`. | ||
|
||
There are several demonstration files available in this template. | ||
|
||
Controllers | ||
=========== | ||
|
||
- HomeController.java: | ||
|
||
Shows how to handle simple HTTP requests. | ||
|
||
- AsyncController.java: | ||
|
||
Shows how to do asynchronous programming when handling a request. | ||
|
||
- CountController.java: | ||
|
||
Shows how to inject a component into a controller and use the component when | ||
handling requests. | ||
|
||
Components | ||
========== | ||
|
||
- Module.java: | ||
|
||
Shows how to use Guice to bind all the components needed by your application. | ||
|
||
- Counter.java: | ||
|
||
An example of a component that contains state, in this case a simple counter. | ||
|
||
- ApplicationTimer.java: | ||
|
||
An example of a component that starts when the application starts and stops | ||
when the application stops. | ||
|
||
Filters | ||
======= | ||
|
||
- Filters.java: | ||
|
||
Creates the list of HTTP filters used by your application. | ||
|
||
- ExampleFilter.java | ||
|
||
A simple filter that adds a header to every response. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import javax.inject.*; | ||
import play.*; | ||
import play.filters.cors.CORSFilter; | ||
import play.mvc.EssentialFilter; | ||
import play.http.HttpFilters; | ||
|
||
@Singleton | ||
public class Filters implements HttpFilters { | ||
|
||
private final Environment env; | ||
|
||
@Inject | ||
CORSFilter corsFilter; | ||
|
||
@Inject | ||
public Filters(Environment env) { | ||
this.env = env; | ||
} | ||
|
||
@Override | ||
public EssentialFilter[] filters() { | ||
if (env.mode().equals(Mode.DEV)) { | ||
return new EssentialFilter[] { corsFilter.asJava() }; | ||
} else { | ||
return new EssentialFilter[]{}; | ||
} | ||
} | ||
|
||
} |
Oops, something went wrong.