Skip to content

Commit 26c9230

Browse files
author
Live session user
committed
initial commit
0 parents  commit 26c9230

File tree

18 files changed

+1235
-0
lines changed

18 files changed

+1235
-0
lines changed

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
logs
2+
target
3+
/.idea
4+
/.idea_modules
5+
/.classpath
6+
/.project
7+
/.settings
8+
/RUNNING_PID

LICENSE

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
This software is licensed under the Apache 2 license, quoted below.
2+
3+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this project except in compliance with
4+
the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
5+
6+
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an
7+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific
8+
language governing permissions and limitations under the License.

README

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
This is your new Play application
2+
=================================
3+
4+
This file will be packaged with your application when using `activator dist`.
5+
6+
There are several demonstration files available in this template.
7+
8+
Controllers
9+
===========
10+
11+
- HomeController.java:
12+
13+
Shows how to handle simple HTTP requests.
14+
15+
- AsyncController.java:
16+
17+
Shows how to do asynchronous programming when handling a request.
18+
19+
- CountController.java:
20+
21+
Shows how to inject a component into a controller and use the component when
22+
handling requests.
23+
24+
Components
25+
==========
26+
27+
- Module.java:
28+
29+
Shows how to use Guice to bind all the components needed by your application.
30+
31+
- Counter.java:
32+
33+
An example of a component that contains state, in this case a simple counter.
34+
35+
- ApplicationTimer.java:
36+
37+
An example of a component that starts when the application starts and stops
38+
when the application stops.
39+
40+
Filters
41+
=======
42+
43+
- Filters.java:
44+
45+
Creates the list of HTTP filters used by your application.
46+
47+
- ExampleFilter.java
48+
49+
A simple filter that adds a header to every response.

app/Filters.java

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import javax.inject.*;
2+
import play.*;
3+
import play.filters.cors.CORSFilter;
4+
import play.mvc.EssentialFilter;
5+
import play.http.HttpFilters;
6+
7+
@Singleton
8+
public class Filters implements HttpFilters {
9+
10+
private final Environment env;
11+
12+
@Inject
13+
CORSFilter corsFilter;
14+
15+
@Inject
16+
public Filters(Environment env) {
17+
this.env = env;
18+
}
19+
20+
@Override
21+
public EssentialFilter[] filters() {
22+
if (env.mode().equals(Mode.DEV)) {
23+
return new EssentialFilter[] { corsFilter.asJava() };
24+
} else {
25+
return new EssentialFilter[]{};
26+
}
27+
}
28+
29+
}

0 commit comments

Comments
 (0)