trait ScalateSupport extends ServletBase
ScalateSupport creates and configures a template engine and provides helper methods and bindings to integrate with the ServletBase.
- Alphabetic
- By Inheritance
- ScalateSupport
- ServletBase
- ScalatraBase
- DefaultImplicitConversions
- LowPriorityImplicitConversions
- LowestPriorityImplicitConversions
- TypeConverterSupport
- ScalatraParamsImplicits
- Initializable
- DynamicScope
- RequestResponseScope
- CoreDsl
- Control
- Handler
- ScalatraContext
- CookieContext
- SessionSupport
- ServletApiImplicits
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Type Members
-
trait
Config extends AnyRef
- Definition Classes
- Initializable
-
abstract
type
ConfigT <: AnyRef { ... /* 3 definitions in type refinement */ }
- Definition Classes
- ServletBase → Initializable
-
trait
ScalatraTemplateEngine extends AnyRef
A TemplateEngine integrated with Scalatra.
A TemplateEngine integrated with Scalatra.
A ScalatraTemplateEngine looks for layouts in
/WEB-INF/templates/layoutsbefore searching in/WEB-INF/layoutsand/WEB-INF/scalate/layouts.
Abstract Value Members
-
abstract
val
doNotFound: Action
- Attributes
- protected
- Definition Classes
- ScalatraBase
-
abstract
def
requestPath(implicit request: HttpServletRequest): String
- Definition Classes
- ScalatraBase
-
abstract
def
routeBasePath(implicit request: HttpServletRequest): String
- Attributes
- protected
- Definition Classes
- ScalatraBase
Concrete Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
addRoute(method: HttpMethod, transformers: Seq[RouteTransformer], action: ⇒ Any): Route
- Attributes
- protected
- Definition Classes
- ScalatraBase
-
def
addSessionId(uri: String)(implicit response: HttpServletResponse): String
- Attributes
- protected
- Definition Classes
- ScalatraBase
-
def
addStatusRoute(codes: Range, action: ⇒ Any): Unit
- Attributes
- protected[scalatra]
- Definition Classes
- ScalatraBase
-
def
after(transformers: RouteTransformer*)(fun: ⇒ Any): Unit
- Definition Classes
- ScalatraBase → CoreDsl
-
implicit
val
anyToBoolean: TypeConverter[Any, Boolean]
- Definition Classes
- LowPriorityImplicitConversions
-
implicit
val
anyToByte: TypeConverter[Any, Byte]
- Definition Classes
- LowPriorityImplicitConversions
-
implicit
val
anyToDouble: TypeConverter[Any, Double]
- Definition Classes
- LowPriorityImplicitConversions
-
implicit
val
anyToFloat: TypeConverter[Any, Float]
- Definition Classes
- LowPriorityImplicitConversions
-
implicit
val
anyToInt: TypeConverter[Any, Int]
- Definition Classes
- LowPriorityImplicitConversions
-
implicit
val
anyToLong: TypeConverter[Any, Long]
- Definition Classes
- LowPriorityImplicitConversions
-
implicit
val
anyToShort: TypeConverter[Any, Short]
- Definition Classes
- LowPriorityImplicitConversions
-
implicit
val
anyToString: TypeConverter[Any, String]
- Definition Classes
- LowPriorityImplicitConversions
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
before(transformers: RouteTransformer*)(fun: ⇒ Any): Unit
- Definition Classes
- ScalatraBase → CoreDsl
-
implicit
def
booleanBlock2RouteMatcher(block: ⇒ Boolean): RouteMatcher
- Attributes
- protected
- Definition Classes
- ScalatraBase
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
val
config: ConfigT
- Definition Classes
- ScalatraBase
-
implicit
def
configWrapper(config: ConfigT): Config
- Attributes
- protected
- Definition Classes
- ServletBase → Initializable
-
def
contentType: String
- Definition Classes
- ScalatraContext
-
def
contentTypeInferrer: ContentTypeInferrer
- Attributes
- protected
- Definition Classes
- ScalatraBase
-
def
contentType_=(contentType: String): Unit
- Definition Classes
- ScalatraContext
-
def
contextPath: String
- Attributes
- protected
- Definition Classes
- ScalatraBase
-
implicit
def
cookieOptions: CookieOptions
- Definition Classes
- CookieContext
-
def
cookies(implicit request: HttpServletRequest): SweetCookies
- Definition Classes
- CookieContext
-
def
createRenderContext(out: PrintWriter)(implicit request: HttpServletRequest, response: HttpServletResponse): RenderContext
Creates a render context to be used by default in the template engine.
Creates a render context to be used by default in the template engine.
Returns a ScalatraRenderContext by default in order to bind some other framework variables (e.g., multiParams, flash). ScalatraTemplateEngine assumes this returns ScalatraRenderContext in its binding of "context". If you return something other than a ScalatraRenderContext, you will also want to redefine that binding.
- Attributes
- protected
-
def
createTemplateEngine(config: ConfigT): TemplateEngine
Creates the templateEngine from the config.
Creates the templateEngine from the config. There is little reason to override this unless you have created a ServletBase extension outside an HttpServlet or Filter.
- Attributes
- protected
-
val
decodePercentEncodedPath: Boolean
- Attributes
- protected
- Definition Classes
- ScalatraBase
-
val
defaultCharacterEncoding: String
- Attributes
- protected
- Definition Classes
- ScalatraBase
-
def
defaultIndexName: String
The default index page when the path is a directory.
The default index page when the path is a directory.
- Attributes
- protected
-
def
defaultLayoutPath: Option[String]
The default path to search for templates.
The default path to search for templates. Left as a def so it can be read from the servletContext in initialize, but you probably want a constant.
Defaults to: -
/WEB-INF/templates/views(recommended) -/WEB-INF/views(used by previous Scalatra quickstarts) -/WEB-INF/scalate/templates(used by previous Scalatra quickstarts)- Attributes
- protected
-
implicit
def
defaultStringToSeq[T](implicit arg0: ClassTag[T], elementConverter: TypeConverter[String, T]): TypeConverter[String, Seq[T]]
- Definition Classes
- DefaultImplicitConversions
-
def
defaultTemplateFormat: String
The default template format.
The default template format.
- Attributes
- protected
-
def
defaultTemplatePath: List[String]
The default path to search for templates.
The default path to search for templates. Left as a def so it can be read from the servletContext in initialize, but you probably want a constant.
Defaults to: -
/WEB-INF/templates/views(recommended) -/WEB-INF/views(used by previous Scalatra quickstarts) -/WEB-INF/scalate/templates(used by previous Scalatra quickstarts)- Attributes
- protected
-
def
delete(transformers: RouteTransformer*)(action: ⇒ Any): Route
- Definition Classes
- ScalatraBase → CoreDsl
-
val
doMethodNotAllowed: (Set[HttpMethod]) ⇒ Any
- Attributes
- protected
- Definition Classes
- ScalatraBase
-
implicit
def
enrichRequest(request: HttpServletRequest): RichRequest
- Definition Classes
- ServletApiImplicits
-
implicit
def
enrichResponse(response: HttpServletResponse): RichResponse
- Definition Classes
- ServletApiImplicits
-
implicit
def
enrichServletContext(servletContext: ServletContext): RichServletContext
- Definition Classes
- ServletApiImplicits
-
implicit
def
enrichSession(session: HttpSession): RichSession
- Definition Classes
- ServletApiImplicits
-
def
environment: String
- Definition Classes
- ScalatraBase
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
error(handler: ErrorHandler): Unit
- Definition Classes
- ScalatraBase → CoreDsl
-
val
errorHandler: ErrorHandler
- Attributes
- protected
- Definition Classes
- ScalatraBase
-
def
executeRoutes(): Unit
- Attributes
- protected
- Definition Classes
- ScalatraBase
-
def
extractStatusCode(e: HaltException): Int
- Attributes
- protected
- Definition Classes
- ScalatraBase
-
def
finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
def
findTemplate(path: String, extensionSet: Set[String] = templateEngine.extensions): Option[String]
Finds a template for a path.
Finds a template for a path. Delegates to a TemplateFinder, and if that fails, tries again with
/defaultIndexNameappended.- Attributes
- protected
-
def
format_=(formatValue: String): Unit
- Definition Classes
- ScalatraContext
-
def
format_=(formatValue: Symbol): Unit
- Definition Classes
- ScalatraContext
-
def
fullUrl(path: String, params: Iterable[(String, Any)], includeContextPath: Boolean, includeServletPath: Boolean, withSessionId: Boolean)(implicit request: HttpServletRequest, response: HttpServletResponse): String
- Definition Classes
- ScalatraBase
-
def
get(transformers: RouteTransformer*)(action: ⇒ Any): Route
- Definition Classes
- ScalatraBase → CoreDsl
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
halt(result: ActionResult): Nothing
- Definition Classes
- Control
-
def
halt[T](status: Integer, body: T, headers: Map[String, String]): Nothing
- Definition Classes
- Control
-
def
handle(req: HttpServletRequest, res: HttpServletResponse): Unit
- Definition Classes
- ScalateSupport → ServletBase → ScalatraBase → Handler
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
head(transformers: RouteTransformer*)(action: ⇒ Any): Route
- Definition Classes
- ScalatraBase → CoreDsl
-
def
initParameter(name: String): Option[String]
- Definition Classes
- ScalatraBase
-
def
initialize(config: ConfigT): Unit
- Definition Classes
- ScalateSupport → ScalatraBase → Initializable
-
def
invoke(matchedRoute: MatchedRoute): Option[Any]
- Attributes
- protected
- Definition Classes
- ScalatraBase
-
def
isAsyncExecutable(result: Any): Boolean
- Attributes
- protected
- Definition Classes
- ScalatraBase
-
def
isDevelopmentMode: Boolean
- Definition Classes
- ScalatraBase
-
def
isHttps(implicit request: HttpServletRequest): Boolean
- Attributes
- protected
- Definition Classes
- ScalatraBase
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
isScalateErrorPageEnabled: Boolean
Flag whether the Scalate error page is enabled.
Flag whether the Scalate error page is enabled. If true, uncaught exceptions will be caught and rendered by the Scalate error page.
The default is true.
- Attributes
- protected
-
def
jade(path: String, attributes: (String, Any)*)(implicit request: HttpServletRequest, response: HttpServletResponse): String
Convenience method for
layoutTemplateAs("jade").Convenience method for
layoutTemplateAs("jade").- Attributes
- protected
-
def
layoutTemplate(path: String, attributes: (String, Any)*)(implicit request: HttpServletRequest, response: HttpServletResponse): String
Finds and renders a template with the current layout strategy, looking for all known extensions, returning the result.
Finds and renders a template with the current layout strategy, looking for all known extensions, returning the result.
- path
The path of the template, passed to
findTemplate.- attributes
Attributes to path to the render context. Disable layouts by passing
layout -> "".
- Attributes
- protected
-
def
layoutTemplateAs(ext: Set[String])(path: String, attributes: (String, Any)*)(implicit request: HttpServletRequest, response: HttpServletResponse): String
Finds and renders a template with the current layout strategy, returning the result.
Finds and renders a template with the current layout strategy, returning the result.
- ext
The extensions to look for a template.
- path
The path of the template, passed to
findTemplate.- attributes
Attributes to path to the render context. Disable layouts by passing
layout -> "".
- Attributes
- protected
-
implicit
def
lowestPriorityAny2T[T](implicit arg0: ClassTag[T]): TypeConverter[Any, T]
- Definition Classes
- LowestPriorityImplicitConversions
-
def
methodNotAllowed(f: (Set[HttpMethod]) ⇒ Any): Unit
- Definition Classes
- ScalatraBase → CoreDsl
-
def
multiParams(implicit request: HttpServletRequest): MultiParams
- Definition Classes
- ScalatraBase
-
def
multiParams(key: String)(implicit request: HttpServletRequest): Seq[String]
- Definition Classes
- ScalatraBase
-
def
mustache(path: String, attributes: (String, Any)*)(implicit request: HttpServletRequest, response: HttpServletResponse): String
Convenience method for
layoutTemplateAs("mustache").Convenience method for
layoutTemplateAs("mustache").- Attributes
- protected
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
needsHttps: Boolean
- Attributes
- protected
- Definition Classes
- ScalatraBase
-
def
notFound(fun: ⇒ Any): Unit
- Definition Classes
- ScalatraBase → CoreDsl
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
def
options(transformers: RouteTransformer*)(action: ⇒ Any): Route
- Definition Classes
- ScalatraBase → CoreDsl
-
def
params(implicit request: HttpServletRequest): Params
- Definition Classes
- ScalatraBase
-
def
params(key: String)(implicit request: HttpServletRequest): String
- Definition Classes
- ScalatraBase
-
def
pass(): Nothing
- Definition Classes
- Control
-
def
patch(transformers: RouteTransformer*)(action: ⇒ Any): Route
- Definition Classes
- ScalatraBase → CoreDsl
-
implicit
def
pathPatternParser2RouteMatcher(pattern: PathPattern): RouteMatcher
- Attributes
- protected
- Definition Classes
- ScalatraBase
-
def
post(transformers: RouteTransformer*)(action: ⇒ Any): Route
- Definition Classes
- ScalatraBase → CoreDsl
-
def
put(transformers: RouteTransformer*)(action: ⇒ Any): Route
- Definition Classes
- ScalatraBase → CoreDsl
-
def
redirect(uri: String)(implicit request: HttpServletRequest, response: HttpServletResponse): Nothing
- Definition Classes
- ScalatraBase
-
implicit
def
regex2RouteMatcher(regex: Regex): RouteMatcher
- Attributes
- protected
- Definition Classes
- ScalatraBase
-
def
relativeUrl(path: String, params: Iterable[(String, Any)], includeContextPath: Boolean, includeServletPath: Boolean)(implicit request: HttpServletRequest, response: HttpServletResponse): String
- Definition Classes
- ScalatraBase
-
def
removeRoute(method: String, route: Route): Unit
- Attributes
- protected
- Definition Classes
- ScalatraBase
-
def
removeRoute(method: HttpMethod, route: Route): Unit
- Attributes
- protected
- Definition Classes
- ScalatraBase
-
def
renderHaltException(e: HaltException): Unit
- Attributes
- protected
- Definition Classes
- ScalatraBase
-
def
renderPipeline: RenderPipeline
- Attributes
- protected
- Definition Classes
- ScalatraBase
-
def
renderResponse(actionResult: Any): Unit
- Attributes
- protected
- Definition Classes
- ScalatraBase
-
def
renderResponseBody(actionResult: Any): Unit
- Attributes
- protected
- Definition Classes
- ScalatraBase
-
def
renderUncaughtException(e: Throwable)(implicit request: HttpServletRequest, response: HttpServletResponse): Unit
- Attributes
- protected
- Definition Classes
- ScalateSupport → ScalatraBase
-
implicit
def
request: HttpServletRequest
- Definition Classes
- DynamicScope → RequestResponseScope
-
implicit
def
response: HttpServletResponse
- Definition Classes
- DynamicScope → RequestResponseScope
-
lazy val
routes: RouteRegistry
- Definition Classes
- ScalatraBase
-
def
runFilters(filters: Iterable[Route]): Unit
- Attributes
- protected
- Definition Classes
- ScalatraBase
-
def
runRoutes(routes: Iterable[Route]): Stream[Any]
- Attributes
- protected
- Definition Classes
- ScalatraBase
-
implicit
def
safe[S, T](f: (S) ⇒ T): TypeConverter[S, T]
- Definition Classes
- TypeConverterSupport
-
implicit
def
safeOption[S, T](f: (S) ⇒ Option[T]): TypeConverter[S, T]
- Definition Classes
- TypeConverterSupport
-
implicit
def
scalatraContext: ScalatraContext
- Attributes
- protected[this]
- Definition Classes
- ScalatraContext
-
def
scaml(path: String, attributes: (String, Any)*)(implicit request: HttpServletRequest, response: HttpServletResponse): String
Convenience method for
layoutTemplateAs("scaml").Convenience method for
layoutTemplateAs("scaml").- Attributes
- protected
-
implicit
def
seqHead[T](implicit arg0: ClassTag[T], elementConverter: TypeConverter[String, T]): TypeConverter[Seq[String], T]
- Definition Classes
- DefaultImplicitConversions
-
implicit
def
seqToSeq[T](implicit arg0: ClassTag[T], elementConverter: TypeConverter[String, T]): TypeConverter[Seq[String], Seq[T]]
- Definition Classes
- DefaultImplicitConversions
-
def
serverHost(implicit request: HttpServletRequest): String
- Definition Classes
- ScalatraBase
-
def
serverPort(implicit request: HttpServletRequest): Int
- Definition Classes
- ScalatraBase
-
def
servletContext: ServletContext
- Definition Classes
- ScalatraBase → ScalatraContext
-
def
session(key: String)(implicit request: HttpServletRequest): Any
- Definition Classes
- SessionSupport
-
implicit
def
session(implicit request: HttpServletRequest): HttpSession
- Definition Classes
- SessionSupport
-
def
sessionOption(implicit request: HttpServletRequest): Option[HttpSession]
- Definition Classes
- SessionSupport
-
def
setMultiparams[S](matchedRoute: Option[MatchedRoute], originalParams: MultiParams)(implicit request: HttpServletRequest): Unit
- Attributes
- protected
- Definition Classes
- ScalatraBase
-
def
shutdown(): Unit
- Definition Classes
- ScalateSupport → Initializable
-
def
ssp(path: String, attributes: (String, Any)*)(implicit request: HttpServletRequest, response: HttpServletResponse): String
Convenience method for
layoutTemplateAs("ssp").Convenience method for
layoutTemplateAs("ssp").- Attributes
- protected
-
def
status: Int
- Definition Classes
- ScalatraContext
-
def
status_=(code: Int): Unit
- Definition Classes
- ScalatraContext
-
implicit
def
string2RouteMatcher(path: String): RouteMatcher
- Attributes
- protected
- Definition Classes
- ScalatraBase
-
implicit
val
stringToBoolean: TypeConverter[String, Boolean]
- Definition Classes
- DefaultImplicitConversions
-
implicit
val
stringToByte: TypeConverter[String, Byte]
- Definition Classes
- DefaultImplicitConversions
-
def
stringToDate(format: ⇒ String): TypeConverter[String, Date]
- Definition Classes
- DefaultImplicitConversions
-
def
stringToDateFormat(format: ⇒ DateFormat): TypeConverter[String, Date]
- Definition Classes
- DefaultImplicitConversions
-
implicit
val
stringToDouble: TypeConverter[String, Double]
- Definition Classes
- DefaultImplicitConversions
-
implicit
val
stringToFloat: TypeConverter[String, Float]
- Definition Classes
- DefaultImplicitConversions
-
implicit
val
stringToInt: TypeConverter[String, Int]
- Definition Classes
- DefaultImplicitConversions
-
implicit
val
stringToLong: TypeConverter[String, Long]
- Definition Classes
- DefaultImplicitConversions
-
implicit
val
stringToSelf: TypeConverter[String, String]
- Definition Classes
- DefaultImplicitConversions
-
def
stringToSeq[T](elementConverter: TypeConverter[String, T], separator: String)(implicit arg0: ClassTag[T]): TypeConverter[String, Seq[T]]
- Definition Classes
- DefaultImplicitConversions
-
implicit
val
stringToShort: TypeConverter[String, Short]
- Definition Classes
- DefaultImplicitConversions
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
templateAttributes(key: String)(implicit request: HttpServletRequest): Any
- Attributes
- protected
-
def
templateAttributes(implicit request: HttpServletRequest): Map[String, Any]
A request-scoped map of attributes to pass to the template.
A request-scoped map of attributes to pass to the template. This map will be set to any render context created with the
createRenderContextmethod.- Attributes
- protected
-
val
templateEngine: TemplateEngine
The template engine used by the methods in this support class.
The template engine used by the methods in this support class. It provides a lower-level interface to Scalate and may be used directly to circumvent the conventions imposed by the helpers in this class. For instance, paths passed directly to the template engine are not run through
findTemplate.- Attributes
- protected[scalatra]
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
implicit
def
toTypedMultiParams(params: MultiParams): TypedMultiParams
- Definition Classes
- ScalatraParamsImplicits
-
implicit
def
toTypedParams(params: Params): TypedParams
- Definition Classes
- ScalatraParamsImplicits
-
def
trap(codes: Range)(block: ⇒ Any): Unit
- Definition Classes
- ScalatraBase → CoreDsl
-
def
trap(code: Int)(block: ⇒ Any): Unit
- Definition Classes
- CoreDsl
-
def
url(path: String, params: Iterable[(String, Any)], includeContextPath: Boolean, includeServletPath: Boolean, absolutize: Boolean, withSessionId: Boolean)(implicit request: HttpServletRequest, response: HttpServletResponse): String
- Definition Classes
- ScalatraBase
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
def
withRequest[A](request: HttpServletRequest)(f: ⇒ A): A
- Attributes
- protected
- Definition Classes
- DynamicScope → RequestResponseScope
-
def
withRequestResponse[A](request: HttpServletRequest, response: HttpServletResponse)(f: ⇒ A): A
- Attributes
- protected[scalatra]
- Definition Classes
- DynamicScope → RequestResponseScope
-
def
withResponse[A](response: HttpServletResponse)(f: ⇒ A): A
- Attributes
- protected
- Definition Classes
- DynamicScope → RequestResponseScope
-
def
withRouteMultiParams[S](matchedRoute: Option[MatchedRoute])(thunk: ⇒ S)(implicit request: HttpServletRequest): S
- Attributes
- protected[scalatra]
- Definition Classes
- ScalatraBase