set and retrieve cookies

34 views
Skip to first unread message

mar...@gmail.com

unread,
Oct 28, 2021, 5:09:02 PM10/28/21
to Jenkins Developers
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..

Can someone point me into the direction on how to achieve that if it is achievable?

Thanks
Mario

Ullrich Hafner

unread,
Oct 28, 2021, 5:26:59 PM10/28/21
to JenkinsCI Developers
Am 28.10.2021 um 23:09 schrieb mar...@gmail.com <mar...@gmail.com>:

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:

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 jenkinsci-de...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/63de8711-874e-4404-828e-dc8114e0bce7n%40googlegroups.com.

mar...@gmail.com

unread,
Oct 29, 2021, 8:21:32 AM10/29/21
to Jenkins Developers
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.

Ullrich Hafner

unread,
Oct 29, 2021, 2:09:36 PM10/29/21
to JenkinsCI Developers
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:


Reply all
Reply to author
Forward
0 new messages