Backend API. Server-side code: this runs in a Codename One backend, not in the app on the device.

public final class SecurityExchange

  1. Object
  2. SecurityExchange

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);

Methods

public static SecurityExchange current()The exchange of the request this thread is serving under a chain, or null when it serves none.
public HttpServer.Request getRequest()
public boolean isSecure()Whether the request arrived over TLS: terminated by this server, or by a proxy it trusts; see HttpServer.Request.isSecure.
public SecurityFilterChain getFilterChain()The chain guarding the request.
public Object getAttribute(String name)Something an earlier filter recorded under name, or null.
public void setAttribute(String name, Object value)Records value for later filters and for the handler; null removes it.
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.
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.

Inherited methods

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.