Tapestry 5
  1. Tapestry 5
  2. TAP5-1414

Add HOSTNAME symbol to SymbolConstants, use in BaseUrlSource

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 5.2.0, 5.2.1, 5.2.2, 5.2.3, 5.2.4, 5.1.0.0, 5.1.0.1, 5.1.0.2, 5.1.0.3, 5.1.0.4, 5.1.0.5, 5.1.0.6, 5.1.0.7, 5.0.15, 5.0.16, 5.0.17, 5.0.18, 5.0.19
    • Fix Version/s: 5.3
    • Component/s: tapestry-core
    • Labels:
      None

      Description

      Given that it's such a common need to generate an absolute uri including the hostname (to be used in email links, redirect urls for extenal apis, etc.) and there's no generic, reliable way to deduce it on the fly, it'd make sense to reserve HOSTNAME symbol and contribute some sensible default. For example:
      public static void contributeFactoryDefaults(MappedConfiguration<String, String> configuration) {
      String hostname = null;
      try

      { hostname = System.getenv("HOSTNAME"); }


      catch (Exception e) { }
      if (hostname == null) hostname = InetAddress.getLocalHost().getHostName();
      configuration.add(HostSymbols.HOSTNAME, hostname);
      }

      Might make sense that only if HOSTNAME == "", BaseUrlSource would use the hostname given in the request, otherwise the contributed value.

      See the discussion thread on this: http://markmail.org/message/ad7aesumg6nvsvx3

        Activity

        Howard M. Lewis Ship made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Howard M. Lewis Ship made changes -
        Fix Version/s 5.3 [ 12316024 ]
        Fix Version/s 5.3.0 [ 12316023 ]
        Hide
        Hudson added a comment -

        Integrated in tapestry-5.2-freestyle #262 (See https://hudson.apache.org/hudson/job/tapestry-5.2-freestyle/262/)
        RESOLVED - issue TAP5-1414: Add HOSTNAME symbol to SymbolConstants, use in BaseUrlSource
        https://issues.apache.org/jira/browse/TAP5-1414

        • fix @Since attributes to denote 5.3.0 instead of 5.2.5 (doesn't seem critical enough to merge to 5.2.x)
        Show
        Hudson added a comment - Integrated in tapestry-5.2-freestyle #262 (See https://hudson.apache.org/hudson/job/tapestry-5.2-freestyle/262/ ) RESOLVED - issue TAP5-1414 : Add HOSTNAME symbol to SymbolConstants, use in BaseUrlSource https://issues.apache.org/jira/browse/TAP5-1414 fix @Since attributes to denote 5.3.0 instead of 5.2.5 (doesn't seem critical enough to merge to 5.2.x)
        Kalle Korhonen committed 1069078 (1 file)
        Reviews: none

        RESOLVED - issue TAP5-1414: Add HOSTNAME symbol to SymbolConstants, use in BaseUrlSource
        https://issues.apache.org/jira/browse/TAP5-1414
        - fix @Since attributes to denote 5.3.0 instead of 5.2.5 (doesn't seem critical enough to merge to 5.2.x)

        Kalle Korhonen made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 5.3.0 [ 12316023 ]
        Resolution Fixed [ 1 ]
        Hide
        Kalle Korhonen added a comment -

        Fixed in r1068758 but somebody might want to review. It's a tiny issue but it's my first commit...

        Show
        Kalle Korhonen added a comment - Fixed in r1068758 but somebody might want to review. It's a tiny issue but it's my first commit...
        Kalle Korhonen committed 1068758 (5 files)
        Reviews: none

        Complete - issue TAP5-1414: Add HOSTNAME symbol to SymbolConstants, use in BaseUrlSource
        https://issues.apache.org/jira/browse/TAP5-1414
        - added HOSTNAME, HOSTPORT and HOSTPORT_SECURE symbols to SymbolConstants
        - contributed defaults for the new symbols (defaults won't change existing behavior)
        - added javadoc
        - modified BaseURLSourceImpl to use the new symbols
        - added new test class for testing BaseURLSourceImpl

        Kalle Korhonen made changes -
        Field Original Value New Value
        Assignee Kalle Korhonen [ kaosko ]
        Kalle Korhonen created issue -

          People

          • Assignee:
            Kalle Korhonen
            Reporter:
            Kalle Korhonen
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development