Trait

xitrum.view

Responder

Related Doc: package view

Permalink

trait Responder extends Js with Flash with GetActionClassDefaultsToCurrentAction

When responding text, charset is automatically set, as advised by Google: http://code.google.com/speed/page-speed/docs/rendering.html#SpecifyCharsetEarly

Self Type
Action
Linear Supertypes
Known Subclasses
Type Hierarchy
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Responder
  2. GetActionClassDefaultsToCurrentAction
  3. Flash
  4. Js
  5. AnyRef
  6. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  5. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  6. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  7. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  8. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  9. def flash(): String

    Permalink

    Returns the current content in flash, and clears the flash.

    Returns the current content in flash, and clears the flash.

    Definition Classes
    Flash
  10. def flash(msg: Any): Unit

    Permalink

    Definition Classes
    Flash
    See also

    jsFlash(msg).

  11. def getActionClass[T <: Action](implicit arg0: Manifest[T]): Class[Action]

    Permalink
  12. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  13. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  14. lazy val isAjax: Boolean

    Permalink
    Definition Classes
    Js
  15. def isDoneResponding: Boolean

    Permalink
  16. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  17. def js$(selector: String): String

    Permalink
    Definition Classes
    Js
  18. def js$id(id: String): String

    Permalink
    Definition Classes
    Js
  19. def js$name(name: String): String

    Permalink
    Definition Classes
    Js
  20. def jsAddToView(js: Any): Unit

    Permalink

    You can use this method to add dynamic JS snippets to a buffer, then use method jsForView to take out that buffer to embed the snippets to view template.

    You can use this method to add dynamic JS snippets to a buffer, then use method jsForView to take out that buffer to embed the snippets to view template.

    Definition Classes
    Js
  21. lazy val jsDefaults: Group

    Permalink
    Definition Classes
    Js
  22. def jsEscape(string: Any): String

    Permalink

    Do not use this to escape JSON, because they are different! For example JSON does not escape ' character, while JavaScript does.

    Do not use this to escape JSON, because they are different! For example JSON does not escape ' character, while JavaScript does. To escape JSON, use xitrum.util.SeriDeseri.toJson(Seq(string)).

    org.apache.commons.lang3.StringEscapeUtils is used internally.

    Definition Classes
    Js
  23. lazy val jsForView: Serializable

    Permalink

    See jsAddToView.

    See jsAddToView.

    Definition Classes
    Js
  24. def jsRedirectTo[T <: Action](params: (String, Any)*)(implicit arg0: Manifest[T]): ChannelFuture

    Permalink
    Definition Classes
    Js
  25. def jsRedirectTo(location: Any): ChannelFuture

    Permalink

    See http://stackoverflow.com/questions/503093/how-can-i-make-a-redirect-page-in-jquery

    See http://stackoverflow.com/questions/503093/how-can-i-make-a-redirect-page-in-jquery

    Definition Classes
    Js
  26. def jsRenderFlash(): Unit

    Permalink

    Like jsRenderFlash(msg), but uses the current flash.

    Like jsRenderFlash(msg), but uses the current flash.

    Definition Classes
    Flash
  27. def jsRenderFlash(msg: Any): Unit

    Permalink

    For web 2.0 style application.

    For web 2.0 style application. Used in application layout to display the flash message right after a view is loaded.

    Definition Classes
    Flash
  28. def jsRespond(fragments: Any*): ChannelFuture

    Permalink
    Definition Classes
    Js
  29. def jsRespondFlash(msg: Any): Unit

    Permalink

    For web 2.0 style application.

    For web 2.0 style application. Used in Ajax request handling to respond a message and have the browser render it to the flash area right away.

    Definition Classes
    Flash
  30. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  31. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  32. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  33. def onDoneResponding(): Unit

    Permalink

    Called when the response or the last chunk (in case of chunked response) has been sent to the client.

  34. def respond(): ChannelFuture

    Permalink
  35. def respond404Page(): Unit

    Permalink
  36. def respond500Page(): Unit

    Permalink
  37. def respondBinary(byteBuf: ByteBuf): ChannelFuture

    Permalink

    If Content-Type header is not set, it is set to "application/octet-stream".

    If Content-Type header is not set, it is set to "application/octet-stream".

    byteBuf

    Will be released

  38. def respondBinary(bytes: Array[Byte]): ChannelFuture

    Permalink

    If Content-Type header is not set, it is set to "application/octet-stream".

  39. def respondDefault404Page(): ChannelFuture

    Permalink
  40. def respondDefault500Page(): ChannelFuture

    Permalink
  41. def respondEventSource(data: Any, event: String = "message"): ChannelFuture

    Permalink

    To respond event source, call this method as many time as you want.

    To respond event source, call this method as many time as you want. Event Source response is a special kind of chunked response, data must be UTF-8. See: - http://sockjs.github.com/sockjs-protocol/sockjs-protocol-0.3.3.html#section-94 - http://dev.w3.org/html5/eventsource/

    No need to call setChunked() before calling this method.

  42. def respondFile(path: String): ChannelFuture

    Permalink

    Sends a file using X-SendFile.

    Sends a file using X-SendFile. If Content-Type header is not set, it is guessed from the file name.

    path

    absolute or relative to the current working directory In some cases, the current working directory is not always the root directory of the project (https://github.com/xitrum-framework/xitrum/issues/47), you may need to use xitrum.Config.root to calculate the correct absolute path from a relative path. To sanitize the path, use xitrum.util.PathSanitizer.

  43. def respondHtml(any: Any): ChannelFuture

    Permalink

    Content-Type header is set to "text/html".

  44. def respondInlineView(inlineView: Any): ChannelFuture

    Permalink

    Content-Type header is set to "text/html".

  45. def respondJs(any: Any): ChannelFuture

    Permalink

    Content-Type header is set to "application/javascript".

  46. def respondJson(ref: AnyRef): ChannelFuture

    Permalink

    Converts the given Scala object to JSON object, and responds it.

    Converts the given Scala object to JSON object, and responds it. If you just want to respond a text with "application/json" as content type, use respondJsonText(text).

    Content-Type header is set to "application/json". "text/json" would make the browser download instead of displaying the content. It makes debugging a pain.

  47. def respondJsonP(ref: AnyRef, function: String): ChannelFuture

    Permalink

    Converts the given Scala object to JSON object, wraps it with the given JavaScript function name, and responds.

    Converts the given Scala object to JSON object, wraps it with the given JavaScript function name, and responds. If you already have a JSON text, thus no conversion is needed, use respondJsonPText.

    Content-Type header is set to "application/javascript".

  48. def respondJsonPText(text: Any, function: String): ChannelFuture

    Permalink

    Wraps the text with the given JavaScript function name, and responds.

    Wraps the text with the given JavaScript function name, and responds.

    Content-Type header is set to "application/javascript".

  49. def respondJsonText(any: Any): ChannelFuture

    Permalink

    Content-Type header is set to "application/json".

  50. def respondLastChunk(trailingHeaders: HttpHeaders = EmptyHttpHeaders.INSTANCE): ChannelFuture

    Permalink

    See setChunked.

  51. def respondResource(path: String): ChannelFuture

    Permalink

    Sends a file from public directory in one of the entry (may be a JAR file) in classpath.

    Sends a file from public directory in one of the entry (may be a JAR file) in classpath. If Content-Type header is not set, it is guessed from the file name.

    path

    Relative to an entry in classpath, without leading "/"

  52. def respondText(text: Any, fallbackContentType: String = null, convertXmlToXhtml: Boolean = true): ChannelFuture

    Permalink

    fallbackContentType

    Only used if Content-Type header has not been set. If not given and Content-Type header is not set, it is set to "application/xml" if text param is Node or NodeSeq, otherwise it is set to "text/plain".

    convertXmlToXhtml


    .toString by default returns

    which is rendered as 2
    tags on some browsers! Set to false if you really want XML, not XHTML. See http://www.scala-lang.org/node/492 and http://www.ne.jp/asahi/hishidama/home/tech/scala/xml.html

  53. def respondView[T <: Action]()(implicit arg0: Manifest[T]): ChannelFuture

    Permalink
  54. def respondView[T <: Action](options: Map[String, Any])(implicit arg0: Manifest[T]): ChannelFuture

    Permalink
  55. def respondView[T <: Action](customLayout: () ⇒ Any)(implicit arg0: Manifest[T]): ChannelFuture

    Permalink
  56. def respondView[T <: Action](customLayout: () ⇒ Any, options: Map[String, Any])(implicit arg0: Manifest[T]): ChannelFuture

    Permalink
  57. def respondView(customLayout: () ⇒ Any, location: Class[_ <: Action], options: Map[String, Any]): ChannelFuture

    Permalink

    options

    specific to the configured template engine

  58. def respondView(location: String): ChannelFuture

    Permalink
  59. def respondView(location: String, options: Map[String, Any]): ChannelFuture

    Permalink
  60. def respondView(customLayout: () ⇒ Any, location: String): ChannelFuture

    Permalink
  61. def respondView(customLayout: () ⇒ Any, location: String, options: Map[String, Any]): ChannelFuture

    Permalink

    options

    specific to the configured template engine

  62. def respondViewNoLayout[T <: Action]()(implicit arg0: Manifest[T]): ChannelFuture

    Permalink
  63. def respondViewNoLayout[T <: Action](options: Map[String, Any])(implicit arg0: Manifest[T]): ChannelFuture

    Permalink
  64. def respondViewNoLayout(location: Class[_ <: Action], options: Map[String, Any]): ChannelFuture

    Permalink

    Content-Type header is set to "text/html".

  65. def respondViewNoLayout(location: String): ChannelFuture

    Permalink
  66. def respondViewNoLayout(location: String, options: Map[String, Any]): ChannelFuture

    Permalink

    Content-Type header is set to "text/html".

  67. def respondXml(any: Any): ChannelFuture

    Permalink

    Content-Type header is set to "application/xml".

  68. def setChunked(): Unit

    Permalink

    To respond chunks (http://en.wikipedia.org/wiki/Chunked_transfer_encoding): 1.

    To respond chunks (http://en.wikipedia.org/wiki/Chunked_transfer_encoding): 1. Call setChunked() to mark that the response will be chunked 2. Call respondXXX as normal, but as many times as you want 3. Lastly, call respondLastChunk()

    If Content-Type header is not set, it is set to "application/octet-stream".

  69. def setClientCacheAggressively(): Unit

    Permalink

    Tells the browser to cache static files for a long time.

    Tells the browser to cache static files for a long time. This works well even when this is a cluster of web servers behind a load balancer because the URL created by urlForResource is in the form: resource?etag

    Don't worry that browsers do not pick up new files after you modified them, see the doc about static files.

    Google recommends 1 year: http://code.google.com/speed/page-speed/docs/caching.html

    Both Max-age and Expires header are set because IEs use Expires, not max-age: http://mrcoles.com/blog/cookies-max-age-vs-expires/

  70. def setNoClientCache(): Unit

    Permalink

    Prevents client cache.

    Prevents client cache. Note that "pragma: no-cache" is linked to requests, not responses: http://palizine.plynt.com/issues/2008Jul/cache-control-attributes/

  71. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  72. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  73. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  74. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  75. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  76. lazy val xitrumCss: Elem

    Permalink
    Definition Classes
    Flash

Inherited from Flash

Inherited from Js

Inherited from AnyRef

Inherited from Any

Ungrouped