Uploaded image for project: 'Struts 2'
  1. Struts 2
  2. WW-4037

Provide functionality to create cookies from an Action

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    Description

      As of today Struts provides some functionality to receive cookies in an Action, but there is no way to create cookies. I solved the issue by creating a custom CookieProviderInterceptor and CookieProvider interface that provide a standard way to generate cookies. The code I provide works and has been in production for months, but it is not Struts-ready, in the sense that it needs refactoring to remove the dependency from javax.servlet in the request; It is though a starting point to adapt it to Struts.

      As a suggestion maybe it is possible to merge this funcionality in CookieInterceptor, since receiving and creating cookies are usually related.

      Attachments

        1. CookieProviderInterceptor.java
          2 kB
          Jose L Martinez-Avial
        2. CookieProvider.java
          0.2 kB
          Jose L Martinez-Avial

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            lukaszlenart Lukasz Lenart
            jlmagc Jose L Martinez-Avial
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 72h
                72h
                Remaining:
                Remaining Estimate - 72h
                72h
                Logged:
                Time Spent - Not Specified
                Not Specified

                Slack

                  Issue deployment