SlideShare ist ein Scribd-Unternehmen logo
1 von 30
Downloaden Sie, um offline zu lesen
Xitrum Web Framework HOWTOs
Scala勉強会 2014/07/11
Ngoc Dao

Takeharu Oshida
With live coding demos
Self intro
http://mobilus.co.jp/archives/306
Xitrum Guidebook
http://xitrum-framework.github.io/guide/en/index.html
http://xitrum-framework.github.io/guide/ja/index.html
How to create a new
Scala web project?
xitrum-new
https://github.com/xitrum-framework/xitrum-new
Download project skeleton and explain:
• directory structure
• build.sbt
• plugins.sbt
How to create
Eclipse or IntelliJ
projects?
sbt/sbt eclipse
sbt/sbt gen-idea
• ~/.ivy2
• Scala plugin for Eclipse and IntelliJ

http://scala-ide.org/

http://www.jetbrains.com/idea/features/scala.html
• Build Path
How to create a route?
def fib(n: Int): Int = if (n < 3) 1 else f(n - 1) + f(n - 2)
!
---------------------------------------------
!
import xitrum.FutureAction
import xitrum.annotation.GET
!
@GET("fib/:n")
class FibAction extends FutureAction {
def execute() {
val n = param[Int]("n")
val ret = fib(n)
respondText(ret)
}
}
• Exploratory Coding: sbt/sbt console
• Get param from path, URL query, form, header
• Action, FutureAction, ActorAction, WebSocketAction, SockJSAciton
• respondText, respondJson, respondView etc.

http://xitrum-framework.github.io/guide/en/action_view.html#respond-to-client
How to run?
• Run with SBT:

sbt/sbt run
• Run with Eclipse
• Run with IntelliJ
• routes.cache
• log/xitrum.log
• tmp
How to autoreload
classes and routes?
• Run with SBT:

sbt/sbt run

sbt/sbt ~compile
• Run with Eclipse
• Run with IntelliJ
• xitrum.DevClassLoader.ignorePattern
• xitrum.Config.autoreloadInDevMode
How to debug?
• Debug with Eclipse
• Debug with IntelliJ
How to create
reverse route?
url[FibAction]("n" -> 3)
• publicUrl("foo.js")
• publicUrl("dir", "foo.js", "foo.min.js")
• webJarsUrl("underscorejs/1.6.0/underscore.js")
• webJarsUrl("underscorejs/1.6.0", "underscore.js", "underscore-min.js")
• http://xitrum-framework.github.io/guide/en/static.html
How to run
in production mode?
sbt/sbt xitrum-package
!
script/runner <main class>
• XitrumPackage.copy
• Tune memory
• script/start
• http://xitrum-framework.github.io/guide/en/deploy.html
How to debug
in production mode?
script/scalive
• Oracle JVM is required
• Can't use OpenJDK
How to autogenerate
RESTful API client code?
/xitrum/swagger
• http://xitrum-framework.github.io/guide/en/restful.html#documenting-api
• http://107.167.187.67/xitrum/swagger
• https://github.com/wordnik/swagger-codegen
How to i18n?
t("Hello World")
!
touch i18n.pot
sbt/sbt clean
sbt/sbt compile
• http://xitrum-framework.github.io/guide/en/i18n.html
• http://poedit.net/
How to scale
to multiple servers?
Akka:
clustering code
!
Hazelcast:
clustering data
• http://xitrum-framework.github.io/guide/en/cluster.html
• https://github.com/xitrum-framework/xitrum-hazelcast
How to monitor
metrics?
/xitrum/metrics/viewer?api_key=xxx
• http://xitrum-framework.github.io/guide/en/metrics.html
• http://107.167.187.67/xitrum/metrics/viewer?api_key=kgreankbeplawfr7934jv2nr0bsbas0
vs Play
Play Xitrum
Netty 3.x 4.x
Hazelcast integration ☓ ○
DB integration ○ ☓
Assets pipeline ○ △
Action types △ ○
Route autocollection ☓ ○
SockJS ☓ ○
HTML5 CORS ☓ ○
i18n △ ○
Familiar (to Ruby, PHP, Python, Java
etc. programmers)
△ ○
Others ○ ○
• http://netty.io/wiki/new-and-noteworthy-in-4.0.html

Weitere ähnliche Inhalte

Was ist angesagt?

Play framework productivity formula
Play framework   productivity formula Play framework   productivity formula
Play framework productivity formula Sorin Chiprian
 
Web a Quebec - JS Debugging
Web a Quebec - JS DebuggingWeb a Quebec - JS Debugging
Web a Quebec - JS DebuggingRami Sayar
 
Microservices in Scala: Play Framework
Microservices in Scala: Play FrameworkMicroservices in Scala: Play Framework
Microservices in Scala: Play FrameworkŁukasz Sowa
 
Using Play Framework 2 in production
Using Play Framework 2 in productionUsing Play Framework 2 in production
Using Play Framework 2 in productionChristian Papauschek
 
TDD a REST API With Node.js and MongoDB
TDD a REST API With Node.js and MongoDBTDD a REST API With Node.js and MongoDB
TDD a REST API With Node.js and MongoDBValeri Karpov
 
PHP Indonesia - Nodejs Web Development
PHP Indonesia - Nodejs Web DevelopmentPHP Indonesia - Nodejs Web Development
PHP Indonesia - Nodejs Web DevelopmentIrfan Maulana
 
Saving Time By Testing With Jest
Saving Time By Testing With JestSaving Time By Testing With Jest
Saving Time By Testing With JestBen McCormick
 
No Container: a Modern Java Stack with Bootique
No Container: a Modern Java Stack with BootiqueNo Container: a Modern Java Stack with Bootique
No Container: a Modern Java Stack with BootiqueAndrus Adamchik
 
ES2015 / ES6: Basics of modern Javascript
ES2015 / ES6: Basics of modern JavascriptES2015 / ES6: Basics of modern Javascript
ES2015 / ES6: Basics of modern JavascriptWojciech Dzikowski
 
Introduction to Play Framework
Introduction to Play FrameworkIntroduction to Play Framework
Introduction to Play FrameworkWarren Zhou
 
Securing Microservices using Play and Akka HTTP
Securing Microservices using Play and Akka HTTPSecuring Microservices using Play and Akka HTTP
Securing Microservices using Play and Akka HTTPRafal Gancarz
 
CQ5 Development Setup, Maven Build and Deployment
CQ5 Development Setup, Maven Build and DeploymentCQ5 Development Setup, Maven Build and Deployment
CQ5 Development Setup, Maven Build and Deploymentklcodanr
 
Modern javascript
Modern javascriptModern javascript
Modern javascriptKevin Ball
 

Was ist angesagt? (18)

Play framework productivity formula
Play framework   productivity formula Play framework   productivity formula
Play framework productivity formula
 
Web a Quebec - JS Debugging
Web a Quebec - JS DebuggingWeb a Quebec - JS Debugging
Web a Quebec - JS Debugging
 
Microservices in Scala: Play Framework
Microservices in Scala: Play FrameworkMicroservices in Scala: Play Framework
Microservices in Scala: Play Framework
 
Using Play Framework 2 in production
Using Play Framework 2 in productionUsing Play Framework 2 in production
Using Play Framework 2 in production
 
TDD a REST API With Node.js and MongoDB
TDD a REST API With Node.js and MongoDBTDD a REST API With Node.js and MongoDB
TDD a REST API With Node.js and MongoDB
 
遇見 Ruby on Rails
遇見 Ruby on Rails遇見 Ruby on Rails
遇見 Ruby on Rails
 
PHP Indonesia - Nodejs Web Development
PHP Indonesia - Nodejs Web DevelopmentPHP Indonesia - Nodejs Web Development
PHP Indonesia - Nodejs Web Development
 
Saving Time By Testing With Jest
Saving Time By Testing With JestSaving Time By Testing With Jest
Saving Time By Testing With Jest
 
Introduction to CQ5
Introduction to CQ5Introduction to CQ5
Introduction to CQ5
 
Agile sites2
Agile sites2Agile sites2
Agile sites2
 
Agile sites @ telmore
Agile sites @ telmore Agile sites @ telmore
Agile sites @ telmore
 
No Container: a Modern Java Stack with Bootique
No Container: a Modern Java Stack with BootiqueNo Container: a Modern Java Stack with Bootique
No Container: a Modern Java Stack with Bootique
 
ES2015 / ES6: Basics of modern Javascript
ES2015 / ES6: Basics of modern JavascriptES2015 / ES6: Basics of modern Javascript
ES2015 / ES6: Basics of modern Javascript
 
Introduction to Play Framework
Introduction to Play FrameworkIntroduction to Play Framework
Introduction to Play Framework
 
Securing Microservices using Play and Akka HTTP
Securing Microservices using Play and Akka HTTPSecuring Microservices using Play and Akka HTTP
Securing Microservices using Play and Akka HTTP
 
Maven
Maven Maven
Maven
 
CQ5 Development Setup, Maven Build and Deployment
CQ5 Development Setup, Maven Build and DeploymentCQ5 Development Setup, Maven Build and Deployment
CQ5 Development Setup, Maven Build and Deployment
 
Modern javascript
Modern javascriptModern javascript
Modern javascript
 

Ähnlich wie Xitrum HOWTOs

Scalding by Adform Research, Alex Gryzlov
Scalding by Adform Research, Alex GryzlovScalding by Adform Research, Alex Gryzlov
Scalding by Adform Research, Alex GryzlovVasil Remeniuk
 
Scala at Treasure Data
Scala at Treasure DataScala at Treasure Data
Scala at Treasure DataTaro L. Saito
 
Rails入門與新人實戰經驗分享
Rails入門與新人實戰經驗分享Rails入門與新人實戰經驗分享
Rails入門與新人實戰經驗分享wildjcrt
 
Ready? Bootstrap! Go! (CFUG Belgium 24 04-2012)
Ready? Bootstrap! Go! (CFUG Belgium 24 04-2012)Ready? Bootstrap! Go! (CFUG Belgium 24 04-2012)
Ready? Bootstrap! Go! (CFUG Belgium 24 04-2012)Guust Nieuwenhuis
 
Kolla talk at OpenStack Summit 2017 in Sydney
Kolla talk at OpenStack Summit 2017 in SydneyKolla talk at OpenStack Summit 2017 in Sydney
Kolla talk at OpenStack Summit 2017 in SydneyVikram G Hosakote
 
Getting Started with the Angular 2 CLI
Getting Started with the Angular 2 CLIGetting Started with the Angular 2 CLI
Getting Started with the Angular 2 CLIJim Lynch
 
#SFSE Lightning Talk: WebDriver, ScalaTest, SBT and IntelliJ-IDEA
#SFSE Lightning Talk: WebDriver, ScalaTest, SBT and IntelliJ-IDEA#SFSE Lightning Talk: WebDriver, ScalaTest, SBT and IntelliJ-IDEA
#SFSE Lightning Talk: WebDriver, ScalaTest, SBT and IntelliJ-IDEASauce Labs
 
APEX Application Lifecycle and Deployment 20220714.pdf
APEX Application Lifecycle and Deployment 20220714.pdfAPEX Application Lifecycle and Deployment 20220714.pdf
APEX Application Lifecycle and Deployment 20220714.pdfRichard Martens
 
2.28.17 Introducing DSpace 7 Webinar Slides
2.28.17 Introducing DSpace 7 Webinar Slides2.28.17 Introducing DSpace 7 Webinar Slides
2.28.17 Introducing DSpace 7 Webinar SlidesDuraSpace
 
Xitrum Web Framework Live Coding Demos / Xitrum Web Framework ライブコーディング
Xitrum Web Framework Live Coding Demos / Xitrum Web Framework ライブコーディングXitrum Web Framework Live Coding Demos / Xitrum Web Framework ライブコーディング
Xitrum Web Framework Live Coding Demos / Xitrum Web Framework ライブコーディングscalaconfjp
 
Building intranet applications with ASP.NET AJAX and jQuery
Building intranet applications with ASP.NET AJAX and jQueryBuilding intranet applications with ASP.NET AJAX and jQuery
Building intranet applications with ASP.NET AJAX and jQueryAlek Davis
 
ZZ BC#7 asp.net mvc practice and guideline by NineMvp
ZZ BC#7 asp.net mvc practice and guideline by NineMvpZZ BC#7 asp.net mvc practice and guideline by NineMvp
ZZ BC#7 asp.net mvc practice and guideline by NineMvpChalermpon Areepong
 
Introducing .NET Core Open Source
Introducing .NET Core Open SourceIntroducing .NET Core Open Source
Introducing .NET Core Open SourceEric ShangKuan
 
AzovDevMeetup 2016 | Angular 2: обзор | Александр Шевнин
AzovDevMeetup 2016 | Angular 2: обзор | Александр ШевнинAzovDevMeetup 2016 | Angular 2: обзор | Александр Шевнин
AzovDevMeetup 2016 | Angular 2: обзор | Александр ШевнинJSC “Arcadia Inc”
 
Boost your productivity with Scala tooling!
Boost your productivity  with Scala tooling!Boost your productivity  with Scala tooling!
Boost your productivity with Scala tooling!MeriamLachkar1
 
Rapid application development with spring roo j-fall 2010 - baris dere
Rapid application development with spring roo   j-fall 2010 - baris dereRapid application development with spring roo   j-fall 2010 - baris dere
Rapid application development with spring roo j-fall 2010 - baris dereBaris Dere
 
Clojure web dev history
Clojure web dev historyClojure web dev history
Clojure web dev historyIkuru Kanuma
 

Ähnlich wie Xitrum HOWTOs (20)

Scalding by Adform Research, Alex Gryzlov
Scalding by Adform Research, Alex GryzlovScalding by Adform Research, Alex Gryzlov
Scalding by Adform Research, Alex Gryzlov
 
Scala at Treasure Data
Scala at Treasure DataScala at Treasure Data
Scala at Treasure Data
 
Short-Training asp.net vNext
Short-Training asp.net vNextShort-Training asp.net vNext
Short-Training asp.net vNext
 
Rails入門與新人實戰經驗分享
Rails入門與新人實戰經驗分享Rails入門與新人實戰經驗分享
Rails入門與新人實戰經驗分享
 
Ready? Bootstrap! Go! (CFUG Belgium 24 04-2012)
Ready? Bootstrap! Go! (CFUG Belgium 24 04-2012)Ready? Bootstrap! Go! (CFUG Belgium 24 04-2012)
Ready? Bootstrap! Go! (CFUG Belgium 24 04-2012)
 
Kolla talk at OpenStack Summit 2017 in Sydney
Kolla talk at OpenStack Summit 2017 in SydneyKolla talk at OpenStack Summit 2017 in Sydney
Kolla talk at OpenStack Summit 2017 in Sydney
 
Getting Started with the Angular 2 CLI
Getting Started with the Angular 2 CLIGetting Started with the Angular 2 CLI
Getting Started with the Angular 2 CLI
 
#SFSE Lightning Talk: WebDriver, ScalaTest, SBT and IntelliJ-IDEA
#SFSE Lightning Talk: WebDriver, ScalaTest, SBT and IntelliJ-IDEA#SFSE Lightning Talk: WebDriver, ScalaTest, SBT and IntelliJ-IDEA
#SFSE Lightning Talk: WebDriver, ScalaTest, SBT and IntelliJ-IDEA
 
APEX Application Lifecycle and Deployment 20220714.pdf
APEX Application Lifecycle and Deployment 20220714.pdfAPEX Application Lifecycle and Deployment 20220714.pdf
APEX Application Lifecycle and Deployment 20220714.pdf
 
2.28.17 Introducing DSpace 7 Webinar Slides
2.28.17 Introducing DSpace 7 Webinar Slides2.28.17 Introducing DSpace 7 Webinar Slides
2.28.17 Introducing DSpace 7 Webinar Slides
 
Xitrum Web Framework Live Coding Demos / Xitrum Web Framework ライブコーディング
Xitrum Web Framework Live Coding Demos / Xitrum Web Framework ライブコーディングXitrum Web Framework Live Coding Demos / Xitrum Web Framework ライブコーディング
Xitrum Web Framework Live Coding Demos / Xitrum Web Framework ライブコーディング
 
In
InIn
In
 
Building intranet applications with ASP.NET AJAX and jQuery
Building intranet applications with ASP.NET AJAX and jQueryBuilding intranet applications with ASP.NET AJAX and jQuery
Building intranet applications with ASP.NET AJAX and jQuery
 
Expo Router V2
Expo Router V2Expo Router V2
Expo Router V2
 
ZZ BC#7 asp.net mvc practice and guideline by NineMvp
ZZ BC#7 asp.net mvc practice and guideline by NineMvpZZ BC#7 asp.net mvc practice and guideline by NineMvp
ZZ BC#7 asp.net mvc practice and guideline by NineMvp
 
Introducing .NET Core Open Source
Introducing .NET Core Open SourceIntroducing .NET Core Open Source
Introducing .NET Core Open Source
 
AzovDevMeetup 2016 | Angular 2: обзор | Александр Шевнин
AzovDevMeetup 2016 | Angular 2: обзор | Александр ШевнинAzovDevMeetup 2016 | Angular 2: обзор | Александр Шевнин
AzovDevMeetup 2016 | Angular 2: обзор | Александр Шевнин
 
Boost your productivity with Scala tooling!
Boost your productivity  with Scala tooling!Boost your productivity  with Scala tooling!
Boost your productivity with Scala tooling!
 
Rapid application development with spring roo j-fall 2010 - baris dere
Rapid application development with spring roo   j-fall 2010 - baris dereRapid application development with spring roo   j-fall 2010 - baris dere
Rapid application development with spring roo j-fall 2010 - baris dere
 
Clojure web dev history
Clojure web dev historyClojure web dev history
Clojure web dev history
 

Mehr von Ngoc Dao

Model with actors and implement with Akka
Model with actors and implement with AkkaModel with actors and implement with Akka
Model with actors and implement with AkkaNgoc Dao
 
I18nize Scala programs à la gettext
I18nize Scala programs à la gettextI18nize Scala programs à la gettext
I18nize Scala programs à la gettextNgoc Dao
 
BIG DATA サービス と ツール
BIG DATA サービス と ツールBIG DATA サービス と ツール
BIG DATA サービス と ツールNgoc Dao
 
Actor-based concurrency and Akka Fundamentals
Actor-based concurrency and Akka FundamentalsActor-based concurrency and Akka Fundamentals
Actor-based concurrency and Akka FundamentalsNgoc Dao
 
SockJS Intro
SockJS IntroSockJS Intro
SockJS IntroNgoc Dao
 
Easy distributed load test with Tsung
Easy distributed load test with TsungEasy distributed load test with Tsung
Easy distributed load test with TsungNgoc Dao
 
How to start using Scala
How to start using ScalaHow to start using Scala
How to start using ScalaNgoc Dao
 
Cloud Erlang
Cloud ErlangCloud Erlang
Cloud ErlangNgoc Dao
 
Xitrum internals
Xitrum internalsXitrum internals
Xitrum internalsNgoc Dao
 
Những lỗi bảo mật web thường gặp ở phần application
Những lỗi bảo mật web thường gặp ở phần applicationNhững lỗi bảo mật web thường gặp ở phần application
Những lỗi bảo mật web thường gặp ở phần applicationNgoc Dao
 
Erlang Web
Erlang WebErlang Web
Erlang WebNgoc Dao
 
Nitrogen Web Framework
Nitrogen Web FrameworkNitrogen Web Framework
Nitrogen Web FrameworkNgoc Dao
 
スポイトができるまで
スポイトができるまでスポイトができるまで
スポイトができるまでNgoc Dao
 
Camellia General
Camellia GeneralCamellia General
Camellia GeneralNgoc Dao
 
Nhập môn BDD
Nhập môn BDDNhập môn BDD
Nhập môn BDDNgoc Dao
 
何でRuby
何でRuby何でRuby
何でRubyNgoc Dao
 
Sinh hoat CLB tin hoc Komaba lan 2 - Phat bieu cua Ngoc
Sinh hoat CLB tin hoc Komaba lan 2 - Phat bieu cua NgocSinh hoat CLB tin hoc Komaba lan 2 - Phat bieu cua Ngoc
Sinh hoat CLB tin hoc Komaba lan 2 - Phat bieu cua NgocNgoc Dao
 
Sinh hoat CLB tin hoc Komaba lan 1 - Phat bieu cua G
Sinh hoat CLB tin hoc Komaba lan 1 - Phat bieu cua GSinh hoat CLB tin hoc Komaba lan 1 - Phat bieu cua G
Sinh hoat CLB tin hoc Komaba lan 1 - Phat bieu cua GNgoc Dao
 
Sinh hoat CLB tin hoc Komaba lan 1 - Phat bieu cua Ngoc
Sinh hoat CLB tin hoc Komaba lan 1 - Phat bieu cua NgocSinh hoat CLB tin hoc Komaba lan 1 - Phat bieu cua Ngoc
Sinh hoat CLB tin hoc Komaba lan 1 - Phat bieu cua NgocNgoc Dao
 
Sinh hoat CLB tin hoc Komaba lan 1 - Phat bieu cua Hung
Sinh hoat CLB tin hoc Komaba lan 1 - Phat bieu cua HungSinh hoat CLB tin hoc Komaba lan 1 - Phat bieu cua Hung
Sinh hoat CLB tin hoc Komaba lan 1 - Phat bieu cua HungNgoc Dao
 

Mehr von Ngoc Dao (20)

Model with actors and implement with Akka
Model with actors and implement with AkkaModel with actors and implement with Akka
Model with actors and implement with Akka
 
I18nize Scala programs à la gettext
I18nize Scala programs à la gettextI18nize Scala programs à la gettext
I18nize Scala programs à la gettext
 
BIG DATA サービス と ツール
BIG DATA サービス と ツールBIG DATA サービス と ツール
BIG DATA サービス と ツール
 
Actor-based concurrency and Akka Fundamentals
Actor-based concurrency and Akka FundamentalsActor-based concurrency and Akka Fundamentals
Actor-based concurrency and Akka Fundamentals
 
SockJS Intro
SockJS IntroSockJS Intro
SockJS Intro
 
Easy distributed load test with Tsung
Easy distributed load test with TsungEasy distributed load test with Tsung
Easy distributed load test with Tsung
 
How to start using Scala
How to start using ScalaHow to start using Scala
How to start using Scala
 
Cloud Erlang
Cloud ErlangCloud Erlang
Cloud Erlang
 
Xitrum internals
Xitrum internalsXitrum internals
Xitrum internals
 
Những lỗi bảo mật web thường gặp ở phần application
Những lỗi bảo mật web thường gặp ở phần applicationNhững lỗi bảo mật web thường gặp ở phần application
Những lỗi bảo mật web thường gặp ở phần application
 
Erlang Web
Erlang WebErlang Web
Erlang Web
 
Nitrogen Web Framework
Nitrogen Web FrameworkNitrogen Web Framework
Nitrogen Web Framework
 
スポイトができるまで
スポイトができるまでスポイトができるまで
スポイトができるまで
 
Camellia General
Camellia GeneralCamellia General
Camellia General
 
Nhập môn BDD
Nhập môn BDDNhập môn BDD
Nhập môn BDD
 
何でRuby
何でRuby何でRuby
何でRuby
 
Sinh hoat CLB tin hoc Komaba lan 2 - Phat bieu cua Ngoc
Sinh hoat CLB tin hoc Komaba lan 2 - Phat bieu cua NgocSinh hoat CLB tin hoc Komaba lan 2 - Phat bieu cua Ngoc
Sinh hoat CLB tin hoc Komaba lan 2 - Phat bieu cua Ngoc
 
Sinh hoat CLB tin hoc Komaba lan 1 - Phat bieu cua G
Sinh hoat CLB tin hoc Komaba lan 1 - Phat bieu cua GSinh hoat CLB tin hoc Komaba lan 1 - Phat bieu cua G
Sinh hoat CLB tin hoc Komaba lan 1 - Phat bieu cua G
 
Sinh hoat CLB tin hoc Komaba lan 1 - Phat bieu cua Ngoc
Sinh hoat CLB tin hoc Komaba lan 1 - Phat bieu cua NgocSinh hoat CLB tin hoc Komaba lan 1 - Phat bieu cua Ngoc
Sinh hoat CLB tin hoc Komaba lan 1 - Phat bieu cua Ngoc
 
Sinh hoat CLB tin hoc Komaba lan 1 - Phat bieu cua Hung
Sinh hoat CLB tin hoc Komaba lan 1 - Phat bieu cua HungSinh hoat CLB tin hoc Komaba lan 1 - Phat bieu cua Hung
Sinh hoat CLB tin hoc Komaba lan 1 - Phat bieu cua Hung
 

Xitrum HOWTOs