Weitere ähnliche Inhalte
Mehr von Kazuchika Sekiya (16)
Kürzlich hochgeladen (20)
Gaelyk
- 6.
/
+-- build.groovy
+-- src
+-- war
|
+-- index.gtpl
+-- css
+-- images
+-- js
+-- WEB-INF
|
+-- appengine-web.xml
+-- web.xml
+-- plugins.groovy
+-- routes.groovy
+-- classes
|
+-- groovy
| |
| +-- controller.groovy
|
+-- includes
| |
| +-- header.gtpl
|
+-- lib
|
+-- appengine-api-1.0-sdk-x.y.z.jar
+-- appengine-api-labs-x.y.z.jar
+-- gaelyk-x.y.z.jar
+-- groovy-all-x.y.z.jar
- 9. <html>
<body>
<p><%
def message = "Hello, JGGUG!"
print message %>
</p>
<p><%= message %></p>
<p>${message}</p>
<ul>
<% 3.times { %>
<li>${message}</li>
<% } %>
</ul>
</body>
</html>
- 10. ⽤用
mail.send to: 'to@gmail.com',
from: 'other@gmail.com',
subject: 'Hello World',
htmlBody: '<bold>Hello</bold>'
- 12. get "/about",
redirect: "/blog/2008/10/20/welcome-to-my-blog"
post "/tweet", forward: "/tweet.groovy"
// wildcards
get "/author/*", forward: "/authorsInformation.groovy"
// path variables
get "/article/@year/@month/@day",
forward: "/article.groovy?year=@year&month=@month&day=@day"
// caching outputs
get "/news", forward: "/new.groovy", cache: 10.minutes
get "/download", forward: "/download.gtpl", cache: 2.hours
// incoming email
email to: "/receiveEmail.groovy"
- 16. // Hatebu Groovy Bot -- @hatebu_groovy
// inspired by @nobusue's @hatena_groovy
import com.google.appengine.api.datastore.*
tag = 'groovy'
rss = "http://b.hatena.ne.jp/t/${tag}?sort=eid&mode=rss"
def root = new XmlSlurper().parse(rss)
root.item.each { item ->
! def title = item.title.text().trim()
! def url = item.link.text()
! def query = new Query('entry')
! query.addFilter('url', Query.FilterOperator.EQUAL, url)
! def found = datastore.prepare(query).asSingleEntity()
!
! if (!found) {
! ! try {
! ! ! twitter.updateStatus "$title $url"
! ! ! log.info "tweeted: $title $url"
! ! ! def entry = new Entity('entry')
! ! ! entry.title = title
! ! ! entry.url = url
! ! ! entry.save()
! ! ! log.info "recorded: $title $url"
! ! } catch (TwitterException ex) {
! ! ! log.warning(ex.toString())
! ! }
! }
}
- 19. ⾃自
▶
http://gaelyk.appspot.com/
▶
https://github.com/glaforge/gaelyk
▶
http://dl.dropbox.com/u/132573/Gaelyk-Tutorial.html
▶
http://dl.dropbox.com/u/132573/plugins.html