If you are working on the client side only then I would suggest to use the browser’s local storage instead. Cookies are only required when data needs to be sent to the server.
Here an example in my plugin where I store sorting, tab selection, etc. in the local storage: https://github.com/jenkinsci/warnings-ng-plugin/blob/a0820f652a0ae0e1d32577dbf8e966cce29862db/plugin/src/main/webapp/js/issues-detail.js#L140-L154 > Am 29.10.2021 um 14:21 schrieb [email protected] <[email protected]>: > > Hi Ullrich, thanks for responding. I want to use cookies to "remember" the > value entered for a Jenkins parameters so that the user does not have to > re-enter it on the next invocation. I currently have a solution based on the > server side but it is complicated and cumbersome. It would be much simpler > if I could store the parameters values in cookies and provide a check box on > the active choice plugin field to enable that. I will look at your class. > Thanks. > > On Thursday, October 28, 2021 at 5:26:59 PM UTC-4 [email protected] wrote: >> Am 28.10.2021 um 23:09 schrieb [email protected] <http://gmail.com/> >> <[email protected] <applewebdata://AD57F011-A854-4260-A53D-467B7F5A2573>>: >> >> Hello, >> I would like to be able to read and write http cookies when clicking the >> build with parameter button inside the active choice plugin. I am not >> familiar with the internals of Jenkins, servlets/jelly etc.. > > Why do you want to use cookies, what is your use case? > > I used cookies several years ago, you can have a look at the deprecated > classes of my analysis-core plugin to see how to interact with cookies: > https://github.com/jenkinsci/analysis-core-plugin/blob/07ea7c8ec8d3802cf07f221b24fcbf363111973d/src/main/java/hudson/plugins/analysis/util/CookieHandler.java#L15 > > <https://github.com/jenkinsci/analysis-core-plugin/blob/07ea7c8ec8d3802cf07f221b24fcbf363111973d/src/main/java/hudson/plugins/analysis/util/CookieHandler.java#L15> > > But Cookies should not be required nowadays for plugins. > > >> >> Can someone point me into the direction on how to achieve that if it is >> achievable? >> >> Thanks >> Mario >> > >> -- >> You received this message because you are subscribed to the Google Groups >> "Jenkins Developers" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] >> <applewebdata://AD57F011-A854-4260-A53D-467B7F5A2573>. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/jenkinsci-dev/63de8711-874e-4404-828e-dc8114e0bce7n%40googlegroups.com >> >> <https://groups.google.com/d/msgid/jenkinsci-dev/63de8711-874e-4404-828e-dc8114e0bce7n%40googlegroups.com?utm_medium=email&utm_source=footer>. > > > -- > You received this message because you are subscribed to the Google Groups > "Jenkins Developers" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected] > <mailto:[email protected]>. > To view this discussion on the web visit > https://groups.google.com/d/msgid/jenkinsci-dev/27211344-4341-4e92-a899-f063e3a80190n%40googlegroups.com > > <https://groups.google.com/d/msgid/jenkinsci-dev/27211344-4341-4e92-a899-f063e3a80190n%40googlegroups.com?utm_medium=email&utm_source=footer>. -- You received this message because you are subscribed to the Google Groups "Jenkins Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/2BDF349E-21B4-4F14-904B-072F8C206ECC%40gmail.com.
