├── .gitignore ├── README.rst ├── build.sbt ├── config ├── akka.conf ├── akka_cluster.conf ├── application.conf ├── flash_socket_policy.xml ├── logback.xml ├── ssl_example_fullchain.pem ├── ssl_example_privkey.pem └── xitrum.conf ├── project ├── build.properties └── plugins.sbt ├── public ├── 404.html ├── 500.html ├── app.css ├── favicon.ico ├── robots.txt └── whale.png ├── sbt ├── sbt ├── sbt-launch-1.7.3.jar └── sbt.bat ├── screenshot.png ├── script ├── runner ├── runner.bat ├── scalive ├── scalive-1.7.0.jar └── scalive.bat └── src └── main ├── scala └── quickstart │ ├── Boot.scala │ └── action │ ├── DefaultLayout.scala │ ├── Errors.scala │ └── SiteIndex.scala └── scalate └── quickstart └── action ├── DefaultLayout.jade ├── NotFoundError.jade ├── ServerError.jade └── SiteIndex.jade /.gitignore: -------------------------------------------------------------------------------- 1 | .* 2 | log 3 | project/project 4 | project/target 5 | target 6 | tmp 7 | -------------------------------------------------------------------------------- /README.rst: -------------------------------------------------------------------------------- 1 | Xitrum projects require Java 8+. 2 | 3 | To create a new `Xitrum `_ project, 4 | download project skeleton `xitrum-new.zip `_, 5 | unzip, then run: 6 | 7 | :: 8 | 9 | sbt/sbt fgRun 10 | 11 | Now you have a new empty skeleton project running at 12 | http://localhost:8000/ and https://localhost:4430/ 13 | 14 | .. image:: screenshot.png 15 | 16 | To generate Eclipse project: 17 | 18 | :: 19 | 20 | sbt/sbt eclipse 21 | -------------------------------------------------------------------------------- /build.sbt: -------------------------------------------------------------------------------- 1 | organization := "tv.cntt" 2 | name := "xitrum-new" 3 | version := "1.0-SNAPSHOT" 4 | 5 | scalaVersion := "2.13.4" 6 | scalacOptions ++= Seq("-deprecation", "-feature", "-unchecked") 7 | 8 | // Xitrum requires Java 8 9 | javacOptions ++= Seq("-source", "1.8", "-target", "1.8") 10 | 11 | //------------------------------------------------------------------------------ 12 | 13 | libraryDependencies += "tv.cntt" %% "xitrum" % "3.31.0" 14 | 15 | // Xitrum uses SLF4J, an implementation of SLF4J is needed 16 | libraryDependencies += "ch.qos.logback" % "logback-classic" % "1.2.3" 17 | 18 | // For writing condition in logback.xml 19 | libraryDependencies += "org.codehaus.janino" % "janino" % "3.1.2" 20 | 21 | libraryDependencies += "org.webjars.bower" % "bootstrap-css" % "3.3.6" 22 | 23 | // Scalate template engine config for Xitrum ----------------------------------- 24 | 25 | libraryDependencies += "tv.cntt" %% "xitrum-scalate" % "2.9.2" 26 | 27 | // Precompile Scalate templates 28 | 29 | import org.fusesource.scalate.ScalatePlugin._ 30 | scalateSettings 31 | Compile / ScalateKeys.scalateTemplateConfig := Seq(TemplateConfig( 32 | (Compile / sourceDirectory).value / "scalate", 33 | Seq(), 34 | Seq(Binding("helper", "xitrum.Action", importMembers = true)) 35 | )) 36 | 37 | // xgettext i18n translation key string extractor is a compiler plugin --------- 38 | 39 | autoCompilerPlugins := true 40 | addCompilerPlugin("tv.cntt" %% "xgettext" % "1.5.4") 41 | scalacOptions += "-P:xgettext:xitrum.I18n" 42 | 43 | // Put config directory in classpath for easier development -------------------- 44 | 45 | // For "sbt console" 46 | Compile / unmanagedClasspath += baseDirectory.value / "config" 47 | 48 | // For "sbt fgRun" 49 | Runtime / unmanagedClasspath += baseDirectory.value / "config" 50 | 51 | // Copy these to target/xitrum when sbt xitrum-package is run 52 | XitrumPackage.copy("config", "public", "script") 53 | 54 | fork := true 55 | -------------------------------------------------------------------------------- /config/akka.conf: -------------------------------------------------------------------------------- 1 | # Config Akka cluster if you want distributed SockJS 2 | # include "akka_cluster" 3 | 4 | akka { 5 | loggers = ["akka.event.slf4j.Slf4jLogger"] 6 | logger-startup-timeout = 30s 7 | } 8 | -------------------------------------------------------------------------------- /config/akka_cluster.conf: -------------------------------------------------------------------------------- 1 | # Config Akka cluster if you want distributed SockJS 2 | # https://doc.akka.io/docs/akka/current/cluster-usage.html 3 | akka { 4 | actor { 5 | provider = "cluster" 6 | } 7 | 8 | # This node 9 | remote.artery { 10 | canonical { 11 | hostname = "127.0.0.1" 12 | port = 2551 13 | } 14 | } 15 | 16 | cluster { 17 | seed-nodes = [ 18 | "akka://xitrum@127.0.0.1:2551", 19 | "akka://xitrum@127.0.0.1:2552" 20 | ] 21 | 22 | downing-provider-class = "akka.cluster.sbr.SplitBrainResolverProvider" 23 | 24 | metrics.enabled = off 25 | } 26 | 27 | extensions = ["akka.cluster.metrics.ClusterMetricsExtension"] 28 | } 29 | -------------------------------------------------------------------------------- /config/application.conf: -------------------------------------------------------------------------------- 1 | include "akka" 2 | include "xitrum" 3 | -------------------------------------------------------------------------------- /config/flash_socket_policy.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /config/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | [%level] %m%n 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | ./log/xitrum.log 31 | 32 | [%level] [%d{yy-MM-dd HH:mm:ss}] %c{1}: %m%n 33 | 34 | 35 | ./log/xitrum.log.%d{yy-MM} 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /config/ssl_example_fullchain.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIBqjCCAROgAwIBAgIJAMB54+xlplaXMA0GCSqGSIb3DQEBBQUAMBYxFDASBgNVBAMTC2V4YW1w 3 | bGUuY29tMCAXDTEzMDYxNDEyNTE0MVoYDzk5OTkxMjMxMjM1OTU5WjAWMRQwEgYDVQQDEwtleGFt 4 | cGxlLmNvbTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAl6s8nYNM7GDx/XEhypNNbA5aG9GT 5 | ER4XZoGJOjntVPFzZqrDlyTMpxOklpGz9L5NsmHF1D/2Ubk1Whk2BXD1y42dYWZkm1rydk20+P8f 6 | h8IYxQK+8glYaouYbqCh1wNHGScNoyohYI+3rzcnu9QiUikSnVVXuWDONxLWs6oZW1cCAwEAATAN 7 | BgkqhkiG9w0BAQUFAAOBgQBwGCMv8lVnQ1QM6TExltmm3U0DM4sz3hElGmvpB+84R3yTxcOWKuQS 8 | u5lIaZ/rEnZCyuTZJWTivI2zKqY4DIkJOoezqshh9JuzcNvWL/gVKX+Z7LGE3+4P6pXj1mycYje2 9 | SSJneN/UznQ/r2imeshoPtiR1Jzo64pgI8eKD0b8FA== 10 | -----END CERTIFICATE----- 11 | -------------------------------------------------------------------------------- /config/ssl_example_privkey.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN PRIVATE KEY----- 2 | MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBAJerPJ2DTOxg8f1xIcqTTWwOWhvR 3 | kxEeF2aBiTo57VTxc2aqw5ckzKcTpJaRs/S+TbJhxdQ/9lG5NVoZNgVw9cuNnWFmZJta8nZNtPj/ 4 | H4fCGMUCvvIJWGqLmG6godcDRxknDaMqIWCPt683J7vUIlIpEp1VV7lgzjcS1rOqGVtXAgMBAAEC 5 | gYBD+C9v/3mnrUKFa//SwvS9aikjsmYQE8Y03/RZrcAYgyRObFS/FXTJo1ntSFq3Ydl8CakYl5mR 6 | wkiQmh/FjHv6Dhka+wlqCSz/JdbVW1es1bJVRhxgjuKy/8yh3uMc5NBL5Z4ELPE/YY2k1SVeoM9N 7 | l14+sFprC6Q34G4n0v1Z0QJBANA7RajKPqBGrlbznKOxVI8YoTrNCs+b3LlXmLCUzfFYT19en6ap 8 | qyoa+L1ywQjpdANq6WvzbLfw8UG5JdEMdFUCQQC6djvZvGqeMb++6xoPEOX6Q6GFBgy2XqmEgaLY 9 | syvmvdA7G07MGPVwGQW8OoQ7a4GknohcBRq7UIrT1a03ghz7AkEAvoPMWv8XR1sDvUhMIzRmkjnN 10 | odfhsUsAKo8rgzvSJKNQk4gmd7y6ft6IgASS+o1leI8Dm6Hu8Wg/w4sbP2WutQJAeBCaCWJh5Otz 11 | 5KPOa9UdwUC7SMTUeroJveEb0x3MLxAafXTgEFwh7sSuBL5JV1mqaS4L7/T5eZQrUKxOlWea8QJB 12 | AMqCBAONyw/Zmuk0vuDFDrcq1anL1tmKDhmGdNwh/fJ+n6xFqtzJBFwQJOHjEGmjxUmmSTIoApVI 13 | PQDUSx33Tm4= 14 | -----END PRIVATE KEY----- 15 | -------------------------------------------------------------------------------- /config/xitrum.conf: -------------------------------------------------------------------------------- 1 | xitrum { 2 | # Comment out if you don't want to protect the whole site with basic authentication. 3 | #basicAuth { 4 | #realm = xitrum 5 | #username = xitrum 6 | #password = xitrum 7 | #} 8 | 9 | # Hostname or IP. 10 | # Comment out to listen on all network interfaces. 11 | #interface = localhost 12 | 13 | # Comment out the one you don't want to start. 14 | port { 15 | http = 8000 16 | https = 4430 17 | 18 | # May use same port with HTTP server. 19 | # flash_socket_policy.xml will be returned. 20 | #flashSocketPolicy = 8430 21 | } 22 | 23 | # On Linux, you can use native epoll based transport that uses edge-triggered 24 | # mode for maximal performance and low latency. 25 | edgeTriggeredEpoll = false 26 | 27 | # Not used if port.https above is disabled 28 | https { 29 | # If useOpenSSL is true (HTTPS will be faster), Apache Portable Runtime (APR) 30 | # and OpenSSL must be in the library load path such as system library directories, 31 | # $LD_LIBRARY_PATH, and %PATH%. 32 | openSSL = false 33 | certChainFile = config/ssl_example_fullchain.pem 34 | keyFile = config/ssl_example_privkey.pem 35 | } 36 | 37 | # Comment out if you don't run Xitrum behind a reverse proxy, like Nginx. 38 | # If you do, you should: 39 | # - Configure the proxy to serve static files 40 | # - Set response.autoGzip below to false and let the proxy do the response compressing 41 | #reverseProxy { 42 | # If you run Xitrum behind a proxy, for Xitrum to determine the origin's IP, 43 | # the absolute URL etc., set IP of the proxies here. For security, only proxies 44 | # with IPs set here are allowed. Remember to config the proxy to set the 45 | # following headers properly (see your proxy documentation): 46 | # X-Forwarded-Host 47 | # X-Forwarded-For 48 | # X-Forwarded-Proto, or X-Forwarded-Scheme, or X-Forwarded-Ssl 49 | #ips = ["127.0.0.1"] 50 | 51 | # Set baseUrl to "/my_site" if you want the URL to be http:///my_site/... 52 | # Otherwise set it to empty string 53 | #baseUrl = /my_site 54 | #proxyProtocol = false 55 | #} 56 | 57 | # Comment out to specify the system temporary directory. 58 | tmpDir = ./tmp 59 | 60 | # Comment out if you don't use template engine. 61 | template { 62 | "xitrum.view.Scalate" { 63 | defaultType = jade # jade, mustache, scaml, or ssp 64 | } 65 | } 66 | 67 | cache { 68 | # Simple in-memory cache 69 | "xitrum.local.LruCache" { 70 | maxElems = 10000 71 | } 72 | 73 | # Commented out: Cache is automatically disabled in development mode, 74 | # and enabled in production mode. 75 | # enabled = true: Force cache to be enabled even in development mode. 76 | # enabled = false: Force cache to be disabled even in production mode. 77 | #enabled = true 78 | } 79 | 80 | session { 81 | # Store sessions on client side. 82 | store = xitrum.scope.session.CookieSessionStore 83 | 84 | # Simple in-memory server side session store. 85 | #store { 86 | # "xitrum.local.LruSessionStore" { 87 | # maxElems = 10000 88 | # } 89 | #} 90 | 91 | # You can use xitrum-hazelcast if you want clustered server side session store: 92 | # https://github.com/xitrum-framework/xitrum-hazelcast 93 | 94 | # If you run multiple sites on the same domain, make sure that there's no 95 | # cookie name conflict between sites. 96 | cookieName = _session 97 | 98 | # Seconds to live from last access. 99 | # Comment out to delete when browser closes windows. 100 | #cookieMaxAge = 3600 101 | 102 | # Key to encrypt session cookie etc. 103 | # If you deploy your application to several instances be sure to use the same key! 104 | # Do not use the example below! Use your own! 105 | secureKey = "ajconghoaofuxahoi92chunghiaujivietnamlasdoclapjfltudoil98hanhphucup8" 106 | } 107 | 108 | # Static files are put in "public" directory. 109 | staticFile { 110 | # This regex is to optimize static file serving speed by avoiding unnecessary 111 | # file existence check. Ex: 112 | # - "\\.(ico|txt)$": files should end with .txt or .ico extension 113 | # - ".*": file existence will be checked for all requests (not recommended) 114 | pathRegex = "\\.(ico|jpg|jpeg|gif|png|svg|html|htm|txt|css|js|map)$" 115 | 116 | # Small static files are cached in memory. 117 | # Files bigger than maxSizeInKBOfCachedFiles will not be cached. 118 | maxSizeInKBOfCachedFiles = 512 119 | maxNumberOfCachedFiles = 1024 120 | 121 | # true: ETag response header is set for static files. 122 | # Before reusing the files, clients must send requests to server 123 | # to revalidate if the files have been changed. Use this when you 124 | # create HTML directly with static files. 125 | # false: Response headers are set so that clients will cache static files 126 | # for one year. Use this when you create HTML from templates and use 127 | # publicUrl("path/to/static/file") in templates. 128 | revalidate = false 129 | } 130 | 131 | request { 132 | charset = UTF-8 133 | 134 | # Initial line example: "GET / HTTP/1.1". 135 | # Adjust this when you use very long URL, e.g. send a lot of data with GET method. 136 | maxInitialLineLength = 4096 137 | 138 | maxHeaderSize = 81920 139 | 140 | # Increase if you want to allow bigger file upload. 141 | # (Google App Engine's limit: 32 MB) 142 | maxSizeInMB = 32 143 | 144 | # Upload files bigger than maxSizeInKBOfUploadMem will be saved to tmpDir/upload 145 | # instead of memory. 146 | maxSizeInKBOfUploadMem = 16 147 | 148 | # Sensitive parameters that should not be logged to access log. 149 | filteredParams = ["password", "passwordConfirm"] 150 | } 151 | 152 | response { 153 | # Set to true to tell Xitrum to gzip big textual response when 154 | # request header Accept-Encoding contains "gzip": 155 | # http://en.wikipedia.org/wiki/HTTP_compression 156 | autoGzip = true 157 | 158 | sockJsCookieNeeded = false 159 | 160 | # Comment out if you don't use CORS and SockJS (SockJS needs CORS): 161 | # https://developer.mozilla.org/en-US/docs/HTTP/Access_control_CORS 162 | #corsAllowOrigins = ["*"] 163 | #corsAllowOrigins = ["http://example.com"] 164 | } 165 | 166 | # Version of your app's API, displayed at Swagger Doc (URL: /xitrum/swagger). 167 | # Comment out if you want to disable Swagger Doc (for security reason etc.). 168 | #swaggerApiVersion = "1.0-SNAPSHOT" 169 | 170 | # Comment out if you don't want metrics feature. 171 | metrics { 172 | # Key to access /xitrum/metrics/viewer?api_key= 173 | # Do not use the example below! Use your own! 174 | apiKey = "kgreankbeplawfr7934jv2nr0bsbas0" 175 | 176 | # Collect JMX metrics. 177 | jmx = true 178 | 179 | # Collect Xitrum actions metrics. 180 | actions = true 181 | } 182 | } 183 | -------------------------------------------------------------------------------- /project/build.properties: -------------------------------------------------------------------------------- 1 | sbt.version=1.7.3 2 | -------------------------------------------------------------------------------- /project/plugins.sbt: -------------------------------------------------------------------------------- 1 | // Run sbt eclipse to create Eclipse project file 2 | addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "5.2.4") 3 | 4 | // Run sbt xitrum-package to prepare for deploying to production environment 5 | addSbtPlugin("tv.cntt" % "xitrum-package" % "2.0.0") 6 | 7 | // For precompiling Scalate templates in the compile phase of SBT 8 | addSbtPlugin("org.scalatra.scalate" % "sbt-scalate-precompiler" % "1.9.6.0") 9 | -------------------------------------------------------------------------------- /public/404.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The page you were looking for doesn't exist (404) 5 | 17 | 18 | 19 | 20 | 21 |
22 |

The page you were looking for doesn't exist.

23 | 24 |

You may have mistyped the address or the page may have moved.

25 |
26 | 27 | 28 | -------------------------------------------------------------------------------- /public/500.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | We're sorry, but something went wrong (500) 5 | 17 | 18 | 19 | 20 | 21 |
22 |

We're sorry, but something went wrong.

23 |

We've been notified about this issue and we'll take a look at it shortly.

24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /public/app.css: -------------------------------------------------------------------------------- 1 | a { 2 | color: #3B5998; 3 | text-decoration: none; 4 | } 5 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xitrum-framework/xitrum-new/720aec0640f8f9ce21f7e8eab784737ceff9971c/public/favicon.ico -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | # See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file 2 | # 3 | # To ban all spiders from the entire site uncomment the next two lines: 4 | # User-Agent: * 5 | # Disallow: / 6 | -------------------------------------------------------------------------------- /public/whale.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xitrum-framework/xitrum-new/720aec0640f8f9ce21f7e8eab784737ceff9971c/public/whale.png -------------------------------------------------------------------------------- /sbt/sbt: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | java -Xms256m -Xmx512m -Xss1m -XX:MaxMetaspaceSize=384m -XX:+CMSClassUnloadingEnabled -jar `dirname $0`/sbt-launch-1.7.3.jar "$@" 3 | -------------------------------------------------------------------------------- /sbt/sbt-launch-1.7.3.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xitrum-framework/xitrum-new/720aec0640f8f9ce21f7e8eab784737ceff9971c/sbt/sbt-launch-1.7.3.jar -------------------------------------------------------------------------------- /sbt/sbt.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | set SCRIPT_DIR=%~dp0 4 | 5 | java -Xms256m -Xmx512m -Xss1m -XX:MaxMetaspaceSize=384m -XX:+CMSClassUnloadingEnabled -jar "%SCRIPT_DIR%sbt-launch-1.7.3.jar" %* 6 | -------------------------------------------------------------------------------- /screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xitrum-framework/xitrum-new/720aec0640f8f9ce21f7e8eab784737ceff9971c/screenshot.png -------------------------------------------------------------------------------- /script/runner: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # You may need to customize memory config below to optimize for your environment. 4 | # To display time when the application is stopped for GC: 5 | # -XX:+PrintGCTimeStamps -XX:+PrintGCApplicationStoppedTime 6 | JAVA_OPTS="-Xmx512m -Xms256m -XX:MaxMetaspaceSize=384m -XX:+HeapDumpOnOutOfMemoryError -XX:+AggressiveOpts -XX:+OptimizeStringConcat -XX:+UseFastAccessorMethods -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:+CMSClassUnloadingEnabled -XX:SurvivorRatio=8 -XX:MaxTenuringThreshold=1 -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -Djava.awt.headless=true -server -Dxitrum.mode=production" 7 | 8 | # Quote because path may contain spaces 9 | if [ -h $0 ] 10 | then 11 | ROOT_DIR="$(cd "$(dirname "$(readlink -n "$0")")/.." && pwd)" 12 | else 13 | ROOT_DIR="$(cd "$(dirname $0)/.." && pwd)" 14 | fi 15 | cd "$ROOT_DIR" 16 | 17 | # Include ROOT_DIR to do "ps aux | grep java" to find this pid easier when 18 | # starting multiple processes from different directories 19 | CLASS_PATH="$ROOT_DIR/lib/*:config" 20 | 21 | # Use exec to be compatible with daemontools: 22 | # http://cr.yp.to/daemontools.html 23 | exec java $JAVA_OPTS -cp "$CLASS_PATH" "$@" 24 | -------------------------------------------------------------------------------- /script/runner.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | rem You may need to customize memory config below to optimize for your environment. 4 | rem To display time when the application is stopped for GC: 5 | rem -XX:+PrintGCTimeStamps -XX:+PrintGCApplicationStoppedTime 6 | set JAVA_OPTS=-Xmx512m -Xms256m -XX:MaxMetaspaceSize=384m -XX:+HeapDumpOnOutOfMemoryError -XX:+AggressiveOpts -XX:+OptimizeStringConcat -XX:+UseFastAccessorMethods -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:+CMSClassUnloadingEnabled -XX:SurvivorRatio=8 -XX:MaxTenuringThreshold=1 -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -Djava.awt.headless=true -server -Dxitrum.mode=production 7 | 8 | set ROOT_DIR=%~dp0.. 9 | cd "%$ROOT_DIR%" 10 | 11 | rem Include ROOT_DIR to find this pid easier later, when 12 | rem starting multiple processes from different directories 13 | set CLASS_PATH="%ROOT_DIR%\lib\*;config" 14 | 15 | java %JAVA_OPTS% -cp %CLASS_PATH% %* 16 | -------------------------------------------------------------------------------- /script/scalive: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | JAVA_OPTS='-Djava.awt.headless=true' 4 | 5 | # Quote because path may contain spaces 6 | if [ -h $0 ] 7 | then 8 | ROOT_DIR="$(cd "$(dirname "$(readlink -n "$0")")/.." && pwd)" 9 | else 10 | ROOT_DIR="$(cd "$(dirname $0)/.." && pwd)" 11 | fi 12 | cd "$ROOT_DIR" 13 | 14 | CLASS_PATH="$ROOT_DIR/script/*:$ROOT_DIR/lib/*" 15 | 16 | java $JAVA_OPTS -cp $CLASS_PATH scalive.client.AgentLoader "$ROOT_DIR/script:$ROOT_DIR/lib" $@ 17 | -------------------------------------------------------------------------------- /script/scalive-1.7.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xitrum-framework/xitrum-new/720aec0640f8f9ce21f7e8eab784737ceff9971c/script/scalive-1.7.0.jar -------------------------------------------------------------------------------- /script/scalive.bat: -------------------------------------------------------------------------------- 1 | set JAVA_OPTS=-Djava.awt.headless=true 2 | 3 | set ROOT_DIR=%~dp0.. 4 | cd "%$ROOT_DIR%" 5 | 6 | set CLASS_PATH="%ROOT_DIR%\script\*;%ROOT_DIR%\lib\*" 7 | 8 | java %JAVA_OPTS% -cp %CLASS_PATH% scalive.client.AgentLoader "%$ROOT_DIR%\script;%$ROOT_DIR%\lib" %* 9 | -------------------------------------------------------------------------------- /src/main/scala/quickstart/Boot.scala: -------------------------------------------------------------------------------- 1 | package quickstart 2 | 3 | import xitrum.Server 4 | 5 | object Boot { 6 | def main(args: Array[String]): Unit = { 7 | Server.start() 8 | Server.stopAtShutdown() 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/main/scala/quickstart/action/DefaultLayout.scala: -------------------------------------------------------------------------------- 1 | package quickstart.action 2 | 3 | import xitrum.Action 4 | 5 | trait DefaultLayout extends Action { 6 | override def layout: String = renderViewNoLayout[DefaultLayout]() 7 | } 8 | -------------------------------------------------------------------------------- /src/main/scala/quickstart/action/Errors.scala: -------------------------------------------------------------------------------- 1 | package quickstart.action 2 | 3 | import xitrum.annotation.{Error404, Error500} 4 | 5 | @Error404 6 | class NotFoundError extends DefaultLayout { 7 | def execute(): Unit = { 8 | respondView() 9 | } 10 | } 11 | 12 | @Error500 13 | class ServerError extends DefaultLayout { 14 | def execute(): Unit = { 15 | respondView() 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/main/scala/quickstart/action/SiteIndex.scala: -------------------------------------------------------------------------------- 1 | package quickstart.action 2 | 3 | import xitrum.annotation.GET 4 | 5 | @GET("") 6 | class SiteIndex extends DefaultLayout { 7 | def execute(): Unit = { 8 | respondView() 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/main/scalate/quickstart/action/DefaultLayout.jade: -------------------------------------------------------------------------------- 1 | - import quickstart.action._ 2 | 3 | !!! 5 4 | html 5 | head 6 | != antiCsrfMeta 7 | != xitrumCss 8 | 9 | meta(content="text/html; charset=utf-8" http-equiv="content-type") 10 | title My new Xitrum project 11 | 12 | link(rel="shortcut icon" href={publicUrl("favicon.ico")}) 13 | 14 | link(type="text/css" rel="stylesheet" media="all" href={webJarsUrl("bootstrap-css/3.3.6/css", "bootstrap.css", "bootstrap.min.css")}) 15 | link(type="text/css" rel="stylesheet" media="all" href={publicUrl("app.css")}) 16 | 17 | body 18 | .container 19 | h1 20 | a(href={url[SiteIndex]}) My new Xitrum project 21 | 22 | #flash 23 | !~ jsRenderFlash() 24 | != renderedView 25 | 26 | != jsDefaults 27 | != jsForView 28 | -------------------------------------------------------------------------------- /src/main/scalate/quickstart/action/NotFoundError.jade: -------------------------------------------------------------------------------- 1 | p This is custom 404 page 2 | -------------------------------------------------------------------------------- /src/main/scalate/quickstart/action/ServerError.jade: -------------------------------------------------------------------------------- 1 | p This is custom 500 page 2 | -------------------------------------------------------------------------------- /src/main/scalate/quickstart/action/SiteIndex.jade: -------------------------------------------------------------------------------- 1 | p 2 | img(src={publicUrl("whale.png")}) 3 | 4 | p 5 | | This is a skeleton for a new 6 | a(href="http://xitrum-framework.github.io/") Xitrum 7 | | project. 8 | 9 | p If you're new to Xitrum, you should visit: 10 | 11 | ul 12 | li 13 | a(href="http://xitrum-framework.github.io/") Xitrum Homepage 14 | li 15 | a(href="http://xitrum-framework.github.io/guide.html") Xitrum Guide 16 | 17 | p 18 | | This is a skeleton project, you should modify it to suit your needs. 19 | | Some important parts of the skeleton: 20 | 21 | ul 22 | li 23 | | The program's entry point ( 24 | code main 25 | | function) is in 26 | a(href="https://github.com/xitrum-framework/xitrum-new/tree/master/src/main/scala/quickstart/Boot.scala") src/main/scala/quickstart/Boot.scala 27 | li 28 | | Controller actions are in 29 | a(href="https://github.com/xitrum-framework/xitrum-new/tree/master/src/main/scala/quickstart/action") src/main/scala/quickstart/action 30 | | directory. 31 | li 32 | | View templates are in 33 | a(href="https://github.com/xitrum-framework/xitrum-new/tree/master/src/main/scalate/quickstart/action") src/main/scalate/quickstart/action 34 | | directory. 35 | li 36 | | Configurations are in 37 | a(href="https://github.com/xitrum-framework/xitrum-new/tree/master/config") config 38 | | directory. 39 | --------------------------------------------------------------------------------