Last active
December 17, 2015 12:19
-
-
Save miere/5609157 to your computer and use it in GitHub Desktop.
Sample Routes using Layr to render home.xhtml as home resource page ( i.e. "http://example.com/" )
This file contains hidden or 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
<p>#{pathParam}:#{requestParam}</p |
This file contains hidden or 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
<p xmlns:tpl="urn:layr:template"> | |
<tpl:include when="#{user.isPremiumUser}"> | |
<button class="btn">Premium Panel</button> | |
</tpl:include> | |
<tpl:include when="#{user.plan}" equals="BASIC"> | |
<div class="Banner Advertisement"> ... </div> | |
</tpl:include> | |
<tpl:include src="hello.xhtml" /> | |
</p> |
This file contains hidden or 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
import layr.routing.api.ResponseBuilder._ | |
import layr.routing.api._ | |
@WebResource("home") | |
class HomeResource { | |
@GET | |
def renderHome():Response = | |
renderTemplate( "home.xhtml" ) | |
.set("user", new User( true )) | |
} | |
case class User (val isPremiumUser:Boolean) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment