Class TkFlash

  • All Implemented Interfaces:
    Take

    public final class TkFlash
    extends Object
    implements Take
    Take that understands Flash cookie and converts it into a HTTP header.

    This decorator helps your "take" to automate flash messages and destroy cookies on their way back, from the browser to the server. This is what a browser will send back:

     GET / HTTP/1.1
     Host: www.example.com
     Cookie: RsFlash=can%27t%20save%20your%20post%2C%20sorry/SEVERE

    This decorator adds "Set-Cookie" with an empty value to the response. That's all it's doing. All you need to do is to decorate your existing "take", for example:

     new FtBasic(
       new TkFlash(TkFork(new FkRegex("/", "hello, world!"))), 8080
      ).start(Exit.NEVER);
     }

    The class is immutable and thread-safe.

    Since:
    0.1
    • Constructor Detail

      • TkFlash

        public TkFlash​(Take take)
        Ctor.
        Parameters:
        take - Original take
      • TkFlash

        public TkFlash​(Take take,
                       String name)
        Ctor.
        Parameters:
        take - Original take
        name - Cookie name
    • Method Detail

      • act

        public Response act​(Request request)
                     throws Exception
        Description copied from interface: Take
        Convert request to response.
        Specified by:
        act in interface Take
        Parameters:
        request - Request to process
        Returns:
        Response
        Throws:
        Exception - If fails