Uploaded image for project: 'Spring Framework'
  1. Spring Framework
  2. SPR-15924

Consider moving ServerHttpResponse encodeUrl / registerUrlEncoder to ServerWebExchange?

    Details

    • Type: Refactoring
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 5.0 RC3
    • Fix Version/s: 5.0 RC4
    • Component/s: Reactive, Web
    • Labels:
      None
    • Last commented by a User:
      false

      Description

      Similar to how WebSession is not part of the HTTP request, neither encodeUrl nor registerUrlEncoder are actually part of the response. Perhaps they make more sense on ServerWebExchange

        Issue Links

          Activity

          Hide
          arjen.poutsma Arjen Poutsma added a comment -

          Makes sense from my perspective. Rossen Stoyanchev, what do you think?

          Show
          arjen.poutsma Arjen Poutsma added a comment - Makes sense from my perspective. Rossen Stoyanchev , what do you think?
          Hide
          rstoya05-aop Rossen Stoyanchev added a comment -

          It is mostly a hook for anyone to to register URL transformation function and for anyone (else) to have them applied. Since ServerWebExchange is available everywhere, I agree it can be moved. Alternatively if we did not provide this option at all, it would have to be a well-known request attribute which points to ServerWebExchange again.

          Show
          rstoya05-aop Rossen Stoyanchev added a comment - It is mostly a hook for anyone to to register URL transformation function and for anyone (else) to have them applied. Since ServerWebExchange is available everywhere, I agree it can be moved. Alternatively if we did not provide this option at all, it would have to be a well-known request attribute which points to ServerWebExchange again.
          Hide
          rwinch Rob Winch added a comment - - edited

          Arjen Poutsma I wonder if we should consider renaming the method to something like rewriteUrl since the method does not actually perform URL encoding either?

          cc Rossen Stoyanchev

          Show
          rwinch Rob Winch added a comment - - edited Arjen Poutsma I wonder if we should consider renaming the method to something like rewriteUrl since the method does not actually perform URL encoding either? cc Rossen Stoyanchev
          Hide
          arjen.poutsma Arjen Poutsma added a comment -

          Fixed in https://github.com/spring-projects/spring-framework/commit/02a2c400c77cf7ea1d867e933654b56da09856ed

          I decide to rename the methods to transformUrl/addUrlTransformer, because rewrite would have resulted in addUrlRewriter, and I think the word "transformer" is nicer than "rewriter". I've used the add prefix (instead of register) to make it clearer that each
          function is added in addition to the previous one.

          Show
          arjen.poutsma Arjen Poutsma added a comment - Fixed in https://github.com/spring-projects/spring-framework/commit/02a2c400c77cf7ea1d867e933654b56da09856ed I decide to rename the methods to transformUrl / addUrlTransformer , because rewrite would have resulted in addUrlRewriter , and I think the word "transformer" is nicer than "rewriter". I've used the add prefix (instead of register ) to make it clearer that each function is added in addition to the previous one.

            People

            • Assignee:
              arjen.poutsma Arjen Poutsma
              Reporter:
              rwinch Rob Winch
              Last updater:
              St├ęphane Nicoll
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Days since last comment:
                10 weeks, 4 days ago