Interface Context

All Known Implementing Classes:
HttpContext, WsContext

public interface Context
Context abstracts the underlying transport mechanism (i.e. HTTP or WebSocket) for a View and provides common functionality and metadata to extend the functionality of the View instance.
  • Method Summary

    Modifier and Type
    Method
    Description
    default Boolean
    connected is true if connected to a websocket, false for http request
    id()
    id is the unique id of the Undead View instance
    default void
    pageTitle(String newTitle)
    pageTitle updates the `` tag of the View page.
    default void
    pushEvent pushes an event to the client.
    void
     
    default void
    sendInfo sends an internal server message to this View instance.
    url()
    url is the URL for this View
  • Method Details

    • id

      String id()
      id is the unique id of the Undead View instance
    • connected

      default Boolean connected()
      connected is true if connected to a websocket, false for http request
    • url

      String url()
      url is the URL for this View
    • pageTitle

      default void pageTitle(String newTitle)
      pageTitle updates the `` tag of the <a href="../view/View.html" title="interface in run.undead.view"><code>View</code></a> page. Requires using the <a href="../template/MainLayout.html#liveTitle(run.undead.template.PageTitle)"><code>MainLayout.liveTitle(run.undead.template.PageTitle)</code></a> helper in rendering the page.</div> </section> </li> <li> <section class="detail" id="pushEvent(run.undead.event.UndeadEvent)"> <h3>pushEvent</h3> <div class="member-signature"><span class="modifiers">default</span> <span class="return-type">void</span> <span class="element-name">pushEvent</span><wbr><span class="parameters">(<a href="../event/UndeadEvent.html" title="interface in run.undead.event">UndeadEvent</a> event)</span></div> <div class="block">pushEvent pushes an event to the client. Requires either the client javascript to have a <code>window.addEventListener</code> defined for that event or a client <code>Hook</code> to be defined and to be listening for the event via <code>this.handleEvent</code> callback.</div> </section> </li> <li> <section class="detail" id="sendInfo(run.undead.event.UndeadInfo)"> <h3>sendInfo</h3> <div class="member-signature"><span class="modifiers">default</span> <span class="return-type">void</span> <span class="element-name">sendInfo</span><wbr><span class="parameters">(<a href="../event/UndeadInfo.html" title="interface in run.undead.event">UndeadInfo</a> info)</span></div> <div class="block">sendInfo sends an internal server message to this <a href="../view/View.html" title="interface in run.undead.view"><code>View</code></a> instance. The <a href="../view/View.html" title="interface in run.undead.view"><code>View</code></a> must implement the <a href="../view/View.html#handleInfo(run.undead.context.Context,run.undead.event.UndeadInfo)"><code>View.handleInfo(Context, UndeadInfo)</code></a> callback to handle the info message.</div> </section> </li> <li> <section class="detail" id="redirect(java.lang.String)"> <h3>redirect</h3> <div class="member-signature"><span class="return-type">void</span> <span class="element-name">redirect</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a> url)</span></div> </section> </li> </ul> </section> </li> </ul> </section> <!-- ========= END OF CLASS DATA ========= --> </main> <footer role="contentinfo"> <hr> <p class="legal-copy"><small>Copyright © 2023. All rights reserved.</small></p> </footer> </div> </div> </body> </html>