Skip to content

[enhancement] setting cookies/headers/status platform-agnostic #632

@mechite

Description

@mechite

Avaje Jex has Context.Cookie which has a few methods like expires(ZonedDateTime), secure(boolean) etc. Javalin, etc has similar.
If io.avaje.http.api had something like this as an API for setting cookies, which you can accept in a method as such:

@Controller
...
@Post
void test(Cookies cookies) {
    cookies.set("example", "value");
    cookies.set("example2", "value", Duration.ofDays(7));
}
...

then we can abstract this feature away and it would be the same for all generators, one less reason to inject Context, and makes the controllers slightly more portable between the underlying routing implementations.

I don't know if that is a goal or if this is within the scope of this project.
Using Context, whether with constructor or method argument injection, pretty much works exactly the same way.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions