Class SecurityExchange

java.lang.Object
com.codename1.backend.security.SecurityExchange

public final class SecurityExchange extends Object

What a chain keeps about the request the calling thread is serving, beyond the request itself: attributes filters hand one another, and headers for the response that is yet to come back.

A SecurityFilter does not write into the response it gets from the rest of the chain, because a handler may answer every request with one shared object. It records the header here instead, and the server writes it into its own copy of the response:

SecurityExchange.current().setResponseHeader("X-Request-Trace", id);
  • Method Details

    • current

      public static SecurityExchange current()
      The exchange of the request this thread is serving under a chain, or null when it serves none.
    • getRequest

      public HttpServer.Request getRequest()
    • isSecure

      public boolean isSecure()
      Whether the request arrived over TLS: terminated by this server, or by a proxy it trusts; see HttpServer.Request.isSecure().
    • getFilterChain

      public SecurityFilterChain getFilterChain()
      The chain guarding the request.
    • getAttribute

      public Object getAttribute(String name)
      Something an earlier filter recorded under name, or null.
    • setAttribute

      public void setAttribute(String name, Object value)
      Records value for later filters and for the handler; null removes it.
    • setResponseHeader

      public void setResponseHeader(String name, String value)
      Sets a header on the response this request will get, replacing one the handler set under the same name.
    • addResponseHeader

      public void addResponseHeader(String name, String value)
      Adds a header to the response this request will get, beside any other of that name: one more Set-Cookie.