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
;;; fizzbuzzで渡される一つ一つの数値はひとつのリクエストとみなすことができる | |
(defn wrap-request | |
[x] | |
{:request x | |
:result x}) | |
(defn wrap-result | |
[map] | |
(:result map)) |
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
;;; http://stackoverflow.com/questions/14507445/ring-solution-to-redirect-missing-trailing-slash-urls | |
(defn good-response? [resp] | |
(and resp (not= (:status resp) 404))) | |
(defn wrap-slash [handler] | |
(fn [{:keys [uri] :as req}] | |
(let [resp (handler req)] | |
(if (or (good-response? resp) (.endsWith uri "/")) | |
resp |
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
-------------------------------------------------------------- | |
-------------------------------------------------------------- | |
-------------------------------------------------------------- | |
-------------------------------------------------------------- | |
## ## #### ## ## | |
#### ## ## ## ## ## ## |
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
package libs.f; | |
import static play.libs.F.Option.*; | |
import play.libs.F.Either; | |
import play.libs.F.Option; | |
/** | |
* Either Utility for Play framework F.java | |
* | |
* @author kazuhiro hara (http://greative.jp) |
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
package controllers; | |
import play.*; | |
import play.mvc.*; | |
import controllers.*; | |
import views.html.*; | |
import org.fusesource.scalate.japi.TemplateEngineFacade; | |
import java.util.HashMap; | |
import java.util.Map; |
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
@Entity | |
@Table(name="statuses") | |
public class Status extends Model{ | |
@Required | |
public String name; | |
public Date created; | |
public Date modified; | |
} |