Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
HTTPServerRequest needs some custom storage #1529
Currently, there is the
However, there are plenty of use cases where I want to store something other than a string in the request data. For instance, I want to store the user id in the session, and early on in the routing, I want to fetch all the information about the user from the database, and store that User object in the request, for further access.
I don't want to cache the user data in the session, since it may change in the DB. And I don't want to fetch that data from the database at every step in the router chain.
What I'm going to do for now, is to use the
This should work, but god is it ugly!
Java has attributes as part of the ServletRequest Spec:
This would be a very useful addition!