Tapestry 5
  1. Tapestry 5
  2. TAP5-32

It is not possible to include a null or blank field as part of an event or page activation context

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 5.0.15
    • Fix Version/s: 5.0.16
    • Component/s: None
    • Labels:
      None

      Description

      Passivating

      { "", "", "42", "true" }

      , onActivate receives only 2 elements,

      { "42", "true" }

      . The generated URL appears OK - it ends with ///42/true.

      1. ContextFixer.java
        2 kB
        Geoff Callender

        Issue Links

          Activity

          Geoff Callender created issue -
          Hide
          Howard M. Lewis Ship added a comment -

          I believe this is an issue with URLs and servlets ... the consecutive slashes are "reduced" to a single slash.

          Show
          Howard M. Lewis Ship added a comment - I believe this is an issue with URLs and servlets ... the consecutive slashes are "reduced" to a single slash.
          Hide
          Howard M. Lewis Ship added a comment -

          Nope, I think it is actually Tapestry doing that, because of how it uses a String.split() to break apart the path. this may be a case where a string tokenizer will get the job done better.

          Show
          Howard M. Lewis Ship added a comment - Nope, I think it is actually Tapestry doing that, because of how it uses a String.split() to break apart the path. this may be a case where a string tokenizer will get the job done better.
          Howard M. Lewis Ship made changes -
          Field Original Value New Value
          Assignee Howard M. Lewis Ship [ hlship ]
          Howard M. Lewis Ship made changes -
          Status Open [ 1 ] In Progress [ 3 ]
          Hide
          Howard M. Lewis Ship added a comment -

          This one opens a nest full of vipers. The consecutive slashes are both meaningful and not meaningful and that's causing at lot of grief.

          I can allow a blank/null context value but the logic inside RequestPathOptimizer gets really complicated and ugly.

          I'm going to leave this one alone for now.

          Show
          Howard M. Lewis Ship added a comment - This one opens a nest full of vipers. The consecutive slashes are both meaningful and not meaningful and that's causing at lot of grief. I can allow a blank/null context value but the logic inside RequestPathOptimizer gets really complicated and ugly. I'm going to leave this one alone for now.
          Hide
          Howard M. Lewis Ship added a comment -
          Show
          Howard M. Lewis Ship added a comment - URL RFC: http://www.ietf.org/rfc/rfc1738.txt
          Hide
          Howard M. Lewis Ship added a comment -

          Although consecutive slashes in the URL are allowed (valid in terms of the BNF), http://www.ietf.org/rfc/rfc1808.txt doesn't explain (or do a good job of explaining) how they should be interpreted.

          Show
          Howard M. Lewis Ship added a comment - Although consecutive slashes in the URL are allowed (valid in terms of the BNF), http://www.ietf.org/rfc/rfc1808.txt doesn't explain (or do a good job of explaining) how they should be interpreted.
          Hide
          Howard M. Lewis Ship added a comment -

          If you attempt this in 5.0.10, you'll get a defensive excepton that the value can't be null or blank.

          Show
          Howard M. Lewis Ship added a comment - If you attempt this in 5.0.10, you'll get a defensive excepton that the value can't be null or blank.
          Howard M. Lewis Ship made changes -
          Fix Version/s 5.0 Next Release [ 12312964 ]
          Priority Major [ 3 ] Minor [ 4 ]
          Howard M. Lewis Ship made changes -
          Status In Progress [ 3 ] Open [ 1 ]
          Hide
          Geoff Callender added a comment -

          Would it be overly simplistic to replace a blank with "blank" and null with "null", so passivating

          { "", null, "42", "true" }

          would become /blank/null/42/true ?

          The 2 tricky strings to passivate are "null" and "blank", which could generate "nullnull" and "blankblank".

          Is this too simplistic?

          Currently I do this a pretty clumsy way in onActivate and onPassivate, eg.

          Object[] onPassivate() {
          return new String[]

          { ContextFixer.packString(_firstName), ContextFixer.packString(_lastName) }

          ;
          }

          void onActivate(String firstName, String lastName)

          { _firstName = ContextFixer.unpackString(firstName); _lastName = ContextFixer.unpackString(lastName); }

          The ContextFixer class also handles Boolean and Date. It's attached. It would be very nice to not need it!

          Show
          Geoff Callender added a comment - Would it be overly simplistic to replace a blank with "blank" and null with "null", so passivating { "", null, "42", "true" } would become /blank/null/42/true ? The 2 tricky strings to passivate are "null" and "blank", which could generate "nullnull" and "blankblank". Is this too simplistic? Currently I do this a pretty clumsy way in onActivate and onPassivate, eg. Object[] onPassivate() { return new String[] { ContextFixer.packString(_firstName), ContextFixer.packString(_lastName) } ; } void onActivate(String firstName, String lastName) { _firstName = ContextFixer.unpackString(firstName); _lastName = ContextFixer.unpackString(lastName); } The ContextFixer class also handles Boolean and Date. It's attached. It would be very nice to not need it!
          Geoff Callender made changes -
          Attachment ContextFixer.java [ 12375054 ]
          Howard M. Lewis Ship made changes -
          Assignee Howard M. Lewis Ship [ hlship ]
          Howard M. Lewis Ship made changes -
          Affects Version/s 5.0.9 [ 12312930 ]
          Fix Version/s 5.1 [ 12312964 ]
          Key TAPESTRY-2090 TAP5-32
          Component/s tapestry-core [ 12311285 ]
          Project Tapestry [ 10573 ] Tapestry 5 [ 12310833 ]
          Howard M. Lewis Ship made changes -
          Affects Version/s 5.0.15 [ 12313429 ]
          Howard M. Lewis Ship made changes -
          Link This issue is part of TAP5-302 [ TAP5-302 ]
          Hide
          Howard M. Lewis Ship added a comment -

          The fix for TAP5-302 make it possible to support null and blank activation context values. They show up as $N or $B in the URL.

          Show
          Howard M. Lewis Ship added a comment - The fix for TAP5-302 make it possible to support null and blank activation context values. They show up as $N or $B in the URL.
          Howard M. Lewis Ship made changes -
          Status Open [ 1 ] Closed [ 6 ]
          Fix Version/s 5.0.16 [ 12313427 ]
          Assignee Howard M. Lewis Ship [ hlship ]
          Resolution Fixed [ 1 ]
          Howard M. Lewis Ship made changes -
          Summary Empty passivated fields aren't passed to onActivate It is not possible to include a null or blank field as part of an event or page activation context
          Transition Time In Source Status Execution Times Last Executer Last Execution Date
          Open Open In Progress In Progress
          13d 18m 1 Howard M. Lewis Ship 07/Feb/08 23:13
          In Progress In Progress Open Open
          2h 47m 1 Howard M. Lewis Ship 08/Feb/08 02:01
          Open Open Closed Closed
          263d 18h 6m 1 Howard M. Lewis Ship 28/Oct/08 20:07

            People

            • Assignee:
              Howard M. Lewis Ship
              Reporter:
              Geoff Callender
            • Votes:
              1 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development