Tapestry
  1. Tapestry
  2. TAPESTRY-396

RequestLocaleManagerImpl: Change private members to protected, to enable overriding implementation

    Details

    • Type: Wish Wish
    • Status: Closed
    • Priority: Major Major
    • Resolution: Incomplete
    • Affects Version/s: 4.0
    • Fix Version/s: 4.1.2
    • Component/s: Framework
    • Labels:
      None

      Description

      in class org.apachetapestry.services.impl.RequestLocaleManagerImpl (and probably in other impl classes as well) all members are defined private, not allowing to override a method.

      So, one has to copy the class. this is very ugly practive.

      Change the private to protected to enable sound extention of such services.

        Activity

        Hide
        Howard M. Lewis Ship added a comment -

        Could you be more specific about what you'd like to override? Generally, you wil want to use the Decorator pattern; provide your own implementation of RLM that conditionally delegates to tapestry.request.RequestLocaleManager.

        Show
        Howard M. Lewis Ship added a comment - Could you be more specific about what you'd like to override? Generally, you wil want to use the Decorator pattern; provide your own implementation of RLM that conditionally delegates to tapestry.request.RequestLocaleManager.
        Hide
        Ron Piterman added a comment -

        the method public Locale extractLocaleForCurrentRequest() implements the locale strategy for each request. I would like to override it to implement another strategy, which is not based on browser locale but rather on the request url. (mydomain.com / mydomain.fr etc).

        To do this, I need to access the private members (request aso).

        I do not understand why the method is not recieving parameters. The result is that this object is not thread safe so it has to be pulled for each request. Waist of resources. Instanciate one and use it for all requests...

        How ever, if it stays like that, please change the members to protected to allow elegant overriding of the extractLocaleForCurrentRequest() method.

        Thanx,
        Ron

        Show
        Ron Piterman added a comment - the method public Locale extractLocaleForCurrentRequest() implements the locale strategy for each request. I would like to override it to implement another strategy, which is not based on browser locale but rather on the request url. (mydomain.com / mydomain.fr etc). To do this, I need to access the private members (request aso). I do not understand why the method is not recieving parameters. The result is that this object is not thread safe so it has to be pulled for each request. Waist of resources. Instanciate one and use it for all requests... How ever, if it stays like that, please change the members to protected to allow elegant overriding of the extractLocaleForCurrentRequest() method. Thanx, Ron
        Hide
        Jesse Kuhnert added a comment -

        I'd be interested in hearing more about the signature you'd need for this to fit your needs. You've hinted at a more ideal implementation but I'm not clearly seeing it without knowing more specifics.

        Show
        Jesse Kuhnert added a comment - I'd be interested in hearing more about the signature you'd need for this to fit your needs. You've hinted at a more ideal implementation but I'm not clearly seeing it without knowing more specifics.
        Hide
        Jesse Kuhnert added a comment -

        As I've gotten no further feedback I'm closing out because I don't understand the requirements behind the request.

        Show
        Jesse Kuhnert added a comment - As I've gotten no further feedback I'm closing out because I don't understand the requirements behind the request.

          People

          • Assignee:
            Unassigned
            Reporter:
            Ron Piterman
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development