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

          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.
          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!
          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.
          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 -
          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 -

          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 -

          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.
          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.

            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