Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

the log succeed to be displaying to the view

  • Loading branch information...
commit 6dffc9a8828a7c586ee4471c21c542229a4dc22e 1 parent 294ccd7
Sébastien RENAULT authored
8 app/assets/javascripts/main.js
... ... @@ -1,8 +1,7 @@
1   -$(function(window) {
  1 +$(function() {
2 2 var session = {};
3 3 session.onReceive = function(log) {
4   - var message = _.template('<%= message %>');
5   - $('#logs').append('<li>'+ message(log) +'</li>');
  4 + $('#logs').append('<li>'+ log.message +'</li>');
6 5 };
7 6
8 7 session.bindUI = function() {
@@ -35,4 +34,5 @@ $(function(window) {
35 34
36 35 session.bindUI();
37 36 window.session = session;
38   -})(window);
  37 + alert(window.session);
  38 +});
5 app/controllers/Actors.scala
@@ -23,11 +23,14 @@ class StoryActor extends Actor {
23 23 pushee => self ! Init(pushee),
24 24 onComplete = self ! Quit()
25 25 )
26   - //logs = Some(channel)
27 26 Logger.info("New debugging session")
28 27 sender ! channel
29 28 }
30 29
  30 + case Init(pushee) => {
  31 + logs = Some(pushee)
  32 + }
  33 +
31 34 case Quit() => {
32 35 Logger.info("Debugging session has been stopped ...")
33 36 logs=None
18 app/controllers/Application.scala
@@ -33,17 +33,14 @@ object Application extends Controller {
33 33 }
34 34
35 35 def eval() = ToJsObject { json =>
  36 + println(json)
36 37 StoryActor.ref ! NewLog(Log.fromJsObject(json))
37 38 Ok
38 39 }
39 40
40 41 private def ToJsObject(action: JsObject => Result) = Action { implicit request =>
41 42 Logger.info("entering")
42   - Form(
43   - (
44   - "data" -> nonEmptyText
45   - )
46   - ).bindFromRequest.fold(
  43 + Form(("data" -> nonEmptyText)).bindFromRequest.fold(
47 44 err => BadRequest("Empty json ?"), {
48 45 case jsonStr => Json.parse(jsonStr) match {
49 46 case jsObj: JsObject => action(jsObj)
@@ -54,14 +51,3 @@ object Application extends Controller {
54 51 )
55 52 }
56 53 }
57   -
58   -/* val computerForm = Form(
59   - mapping(
60   - "id" -> ignored(NotAssigned:Pk[Long]),
61   - "name" -> nonEmptyText,
62   - "introduced" -> optional(date("yyyy-MM-dd")),
63   - "discontinued" -> optional(date("yyyy-MM-dd")),
64   - "company" -> optional(longNumber)
65   - )(Computer.apply)(Computer.unapply)
66   - )
67   -*/
10 app/models/Log.scala
@@ -8,19 +8,19 @@ import play.api.libs.json.Json._
8 8 import java.util.Date
9 9
10 10 case class Log(logger: String,
11   - file: String,
  11 + className: String,
12 12 date: String,
  13 + file: String,
13 14 location: String,
14   - line: Long,
  15 + line: String,
15 16 message: String,
16 17 method: String,
17 18 level: String,
18   - thread: String,
19   - receivedAt: Long = new Date().getTime())
  19 + thread: String)
20 20
21 21 object Log {
22 22 def fromJsObject(json: JsObject) = fromJson[Log](json)
23 23
24 24 import play.api.libs.json.Generic._
25   - implicit val LogFormat: Format[Log] = productFormat10("logger", "file", "date", "location", "line", "message", "method", "level", "thread", "receivedAt")(Log.apply)(Log.unapply(_))
  25 + implicit val LogFormat: Format[Log] = productFormat10("logger", "class", "date", "file", "location", "line", "message", "method", "level", "thread")(Log.apply)(Log.unapply(_))
26 26 }
1  app/views/index.scala.html
@@ -35,6 +35,7 @@
35 35 </div>
36 36 <div id="logs" class="block">
37 37 <ul>
  38 + </ul>
38 39 </div>
39 40 <iframe id="stream" src="#" style="display: none;"></iframe>
40 41 </body>
6 conf/routes
@@ -3,9 +3,9 @@
3 3 # ~~~~
4 4
5 5 # Home page
6   -GET / controllers.Application.index()
  6 +GET / controllers.Application.index()
7 7 GET /story/listen controllers.Application.listen()
8   -GET /story/eval controllers.Application.eval()
  8 +POST /story/eval controllers.Application.eval()
9 9
10 10 # Map static resources from the /public folder to the /assets URL path
11   -GET /assets/*file controllers.Assets.at(path="/public", file)
  11 +GET /assets/*file controllers.Assets.at(path="/public", file)
251 samples/application.conf
... ... @@ -0,0 +1,251 @@
  1 +# This is the main configuration file for the application.
  2 +# ~~~~~
  3 +application.name=server
  4 +
  5 +# Application mode
  6 +# ~~~~~
  7 +# Set to dev to enable instant reloading and other development help.
  8 +# Otherwise set to prod.
  9 +application.mode=dev
  10 +%stage.application.mode=prod
  11 +
  12 +# Secret key
  13 +# ~~~~~
  14 +# The secret key is used to secure cryptographics functions
  15 +# If you deploy your application to several instances be sure to use the same key !
  16 +application.secret=6SU8fsEKA5LRr5jqwwZKBCEEseLNZQ8t7BYBtMShHLJstoi3rbBZmPTTIW0ykhq7
  17 +
  18 +# i18n
  19 +# ~~~~~
  20 +# Define locales used by your application.
  21 +# You can then place localized messages in conf/messages.{locale} files
  22 +application.langs=fr
  23 +
  24 +# Date format
  25 +# ~~~~~
  26 +date.format=yyyy-MM-dd
  27 +# date.format.fr=dd/MM/yyyy
  28 +
  29 +# Server configuration
  30 +# ~~~~~
  31 +# If you need to change the HTTP port, uncomment this (default is set to 9000)
  32 +# http.port=9000
  33 +#
  34 +# By default the server listen for HTTP on the wilcard address.
  35 +# You can restrict this.
  36 +# http.address=127.0.0.1
  37 +#
  38 +# Use this if you don't host your Play application at the root of the domain
  39 +# you're serving it from. This parameter has no effect when deployed as a
  40 +# war, because the path will be handled by the application server.
  41 +# http.path=/
  42 +
  43 +# Session configuration
  44 +# ~~~~~~~~~~~~~~~~~~~~~~
  45 +# By default, session will be written to the transient PLAY_SESSION cookie.
  46 +# The cookies are not secured by default, only set it to true
  47 +# if you're serving your pages through https.
  48 +# application.session.cookie=PLAY
  49 +# application.session.maxAge=1h
  50 +# application.session.secure=false
  51 +
  52 +# Session/Cookie sharing between subdomain
  53 +# ~~~~~~~~~~~~~~~~~~~~~~
  54 +# By default a cookie is only valid for a specific domain. By setting
  55 +# application.defaultCookieDomain to '.example.com', the cookies
  56 +# will be valid for all domains ending with '.example.com', ie:
  57 +# foo.example.com and bar.example.com
  58 +# application.defaultCookieDomain=.example.com
  59 +
  60 +# JVM configuration
  61 +# ~~~~~
  62 +# Define which port is used by JPDA when application is in debug mode (default is set to 8000)
  63 +# jpda.port=8000
  64 +#
  65 +# Java source level => 1.5, 1.6 or 1.7 (experimental)
  66 +# java.source=1.5
  67 +
  68 +# Log level
  69 +# ~~~~~
  70 +# Specify log level for your application.
  71 +# If you want a very customized log, create a log4j.properties file in the conf directory
  72 +application.log=DEBUG
  73 +#
  74 +# More logging configuration
  75 +# application.log.path=/log4j.properties
  76 +# application.log.system.out=off
  77 +
  78 +# Database configuration
  79 +# ~~~~~
  80 +# Enable a database engine if needed.
  81 +#
  82 +# To quickly set up a development database, use either:
  83 +# - mem : for a transient in memory database (H2 in memory)
  84 +# - fs : for a simple file written database (H2 file stored)
  85 +db=mem
  86 +#
  87 +# To connect to a local MySQL5 database, use:
  88 +# db=mysql:user:pwd@database_name
  89 +#
  90 +# If you need a full JDBC configuration use the following :
  91 +# db.url=jdbc:postgresql:database_name
  92 +# db.driver=org.postgresql.Driver
  93 +# db.user=root
  94 +# db.pass=secret
  95 +#
  96 +# Connections pool configuration :
  97 +# db.pool.timeout=1000
  98 +# db.pool.maxSize=30
  99 +# db.pool.minSize=10
  100 +#
  101 +# If you want to reuse an existing Datasource from your application server, use:
  102 +# db=java:/comp/env/jdbc/myDatasource
  103 +#
  104 +# When using an existing Datasource, it's sometimes needed to destroy it when
  105 +# the application is stopped. Depending on the datasource, you can define a
  106 +# generic "destroy" method :
  107 +# db.destroyMethod=close
  108 +
  109 +# JPA Configuration (Hibernate)
  110 +# ~~~~~
  111 +#
  112 +# Specify the custom JPA dialect to use here (default to guess):
  113 +# jpa.dialect=org.hibernate.dialect.PostgreSQLDialect
  114 +#
  115 +# Specify the ddl generation pattern to use. Set to none to disable it
  116 +# (default to update in DEV mode, and none in PROD mode):
  117 +# jpa.ddl=update
  118 +#
  119 +# Debug SQL statements (logged using DEBUG level):
  120 +# jpa.debugSQL=true
  121 +#
  122 +# You can even specify additional hibernate properties here:
  123 +# hibernate.use_sql_comments=true
  124 +# ...
  125 +#
  126 +# Store path for Blob content
  127 +attachments.path=data/attachments
  128 +
  129 +# Memcached configuration
  130 +# ~~~~~
  131 +# Enable memcached if needed. Otherwise a local cache is used.
  132 +# memcached=enabled
  133 +#
  134 +# Specify memcached host (default to 127.0.0.1:11211)
  135 +# memcached.host=127.0.0.1:11211
  136 +#
  137 +# Or you can specify multiple host to build a distributed cache
  138 +# memcached.1.host=127.0.0.1:11211
  139 +# memcached.2.host=127.0.0.1:11212
  140 +
  141 +# HTTP Response headers control for static files
  142 +# ~~~~~
  143 +# Set the default max-age, telling the user's browser how long it should cache the page.
  144 +# Default is 3600 (one hour). Set it to 0 to send no-cache.
  145 +# This is only read in prod mode, in dev mode the cache is disabled.
  146 +# http.cacheControl=3600
  147 +
  148 +# If enabled, Play will generate entity tags automatically and send a 304 when needed.
  149 +# Default is true, set it to false to deactivate use of entity tags.
  150 +# http.useETag=true
  151 +
  152 +# Custom mime types
  153 +# mimetype.xpi=application/x-xpinstall
  154 +
  155 +# WS configuration
  156 +# ~~~~~
  157 +# Default engine is Async Http Client, uncomment to use
  158 +# the JDK's internal implementation
  159 +# webservice = urlfetch
  160 +# If you need to set proxy params for WS requests
  161 +# http.proxyHost = localhost
  162 +# http.proxyPort = 3128
  163 +# http.proxyUser = jojo
  164 +# http.proxyPassword = jojo
  165 +
  166 +# Mail configuration
  167 +# ~~~~~
  168 +# Default is to use a mock Mailer
  169 +mail.smtp=mock
  170 +
  171 +# Or, specify mail host configuration
  172 +# mail.smtp.host=127.0.0.1
  173 +# mail.smtp.user=admin
  174 +# mail.smtp.pass=
  175 +# mail.smtp.channel=ssl
  176 +
  177 +# Url-resolving in Jobs
  178 +# ~~~~~~
  179 +# When rendering templates with reverse-url-resoling (@@{..}) in Jobs (which do not have an inbound Http.Request),
  180 +# ie if sending a HtmlMail, Play need to know which url your users use when accessing your app.
  181 +# %test.application.baseUrl=http://localhost:9000/
  182 +# %prod.application.baseUrl=http://www.yourdomain.com/
  183 +
  184 +# Jobs executor
  185 +# ~~~~~~
  186 +# Size of the Jobs pool
  187 +# play.jobs.pool=10
  188 +
  189 +# Execution pool
  190 +# ~~~~~
  191 +# Default to 1 thread in DEV mode or (nb processors + 1) threads in PROD mode.
  192 +# Try to keep a low as possible. 1 thread will serialize all requests (very useful for debugging purpose)
  193 +play.pool=3
  194 +
  195 +# Open file from errors pages
  196 +# ~~~~~
  197 +# If your text editor supports opening files by URL, Play! will
  198 +# dynamically link error pages to files
  199 +#
  200 +# Example, for textmate:
  201 +# play.editor=txmt://open?url=file://%s&line=%s
  202 +
  203 +# Testing. Set up a custom configuration for test mode
  204 +# ~~~~~
  205 +#%test.module.cobertura=${play.path}/modules/cobertura
  206 +%test.application.mode=dev
  207 +%test.db.url=jdbc:h2:mem:play;MODE=MYSQL;LOCK_MODE=0
  208 +%test.jpa.ddl=create
  209 +%test.mail.smtp=mock
  210 +
  211 +%stage.db=mysql:portal:portal@portal2
  212 +
  213 +#Dev
  214 +oauth.twitter.consumer.key=yte4X9S7vZ0Ps9FrxbJNw
  215 +oauth.twitter.consumer.secret=5ztJ0CWbpqAuvpUuTEff4AKJyOAWeZ9AugSQlZWmc
  216 +oauth.facebook.app.id=241597489235844
  217 +oauth.facebook.app.secret=e41aba4f9235a5d3717e3c229ddd3ca0
  218 +
  219 +# Recette
  220 +%stage.oauth.twitter.consumer.key=052fwFjxjTZpgplD3r89wA
  221 +%stage.oauth.twitter.consumer.secret=BODY29CPMLc2l8FDejmhbZvjvTMM6ypI4XkZp4GqA
  222 +%stage.oauth.facebook.app.id=137228743041749
  223 +%stage.oauth.facebook.app.secret=fff384cca50e288a7a3d0f21d046d43d
  224 +
  225 +#OxylaneID conf
  226 +public.key.path=modules/geonaute/conf/publickey.inte.der
  227 +linkdata.baseUrl=http://dev.linkdata.geonaute.com
  228 +linkdata.partnerId=2
  229 +linkdata.partnerKey=x2dNYsJLYnWHGd8Sh1h1
  230 +
  231 +application.js.compile=false
  232 +%stage.application.js.compile=true
  233 +
  234 +# Config for Swarm
  235 +#oauthlogin.id=mygeonautedev
  236 +#oauthlogin.secret=pafpasteque
  237 +#oauthlogin.baseUrl=http://swarm.local:9005
  238 +#oauthlogin.accessToken=http://swarm.local:9005/oauth/accessToken
  239 +#oauthlogin.authorizeUrl=http://swarm.local:9005/oauth/authorize
  240 +
  241 +# mygeonautedev => when the application runs on localhost
  242 +oauthlogin.id=mygeonautedev
  243 +oauthlogin.secret=pafpasteque
  244 +oauthlogin.baseUrl=http://account.geonaute.znx.fr
  245 +oauthlogin.accessToken=http://account.geonaute.znx.fr/oauth/accessToken
  246 +oauthlogin.authorizeUrl=http://account.geonaute.znx.fr/oauth/authorize
  247 +
  248 +# mygeonaute => when the application runs on the staging server
  249 +%stage.oauthlogin.id=mygeonaute
  250 +
  251 +application.onconnect.url=http://cdn.geonaute.zenexity.com/onConnect-20120131_2.exe
BIN  samples/logit.jar
Binary file not shown

0 comments on commit 6dffc9a

Please sign in to comment.
Something went wrong with that request. Please try again.