Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Live session user committed Aug 20, 2016
0 parents commit 26c9230
Show file tree
Hide file tree
Showing 18 changed files with 1,235 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
logs
target
/.idea
/.idea_modules
/.classpath
/.project
/.settings
/RUNNING_PID
8 changes: 8 additions & 0 deletions LICENSE
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.
49 changes: 49 additions & 0 deletions README
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.
29 changes: 29 additions & 0 deletions app/Filters.java
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[]{};
}
}

}
Loading

0 comments on commit 26c9230

Please sign in to comment.