Uploaded image for project: 'Struts 2'
  1. Struts 2
  2. WW-4835

Make REST ContentHandlers configurable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.5.12
    • Fix Version/s: 2.5.13
    • Component/s: Plugin - REST
    • Labels:
      None

      Issue Links

        Activity

        Hide
        githubbot ASF GitHub Bot added a comment -

        GitHub user lukaszlenart opened a pull request:

        https://github.com/apache/struts/pull/158

        WW-4835: Configurable handlers

        This PR changes API a bit to allow pass current `ActionInvocation` to the REST content type handlers to allow implement different behaviour based on a current action.

        WW-4835(https://issues.apache.org/jira/browse/WW-4835)

        You can merge this pull request into a Git repository by running:

        $ git pull https://github.com/lukaszlenart/struts configurable-handlers

        Alternatively you can review and apply these changes as the patch at:

        https://github.com/apache/struts/pull/158.patch

        To close this pull request, make a commit to your master/trunk branch
        with (at least) the following in the commit message:

        This closes #158


        commit 2f690cfe6260ccdf3aa617baf65a4b836c49cf65
        Author: Lukasz Lenart <lukaszlenart@apache.org>
        Date: 2017-08-02T12:56:09Z

        Adds new methods and marks current as deprecated

        commit 3bd072ca053aed787f3a16865266d8832fcd18b0
        Author: Lukasz Lenart <lukaszlenart@apache.org>
        Date: 2017-08-02T12:58:15Z

        Adds an abstract layer to allow easily handle API change

        commit a64da53d5770c5404ee5eb390b826f5733171f5f
        Author: Lukasz Lenart <lukaszlenart@apache.org>
        Date: 2017-08-02T12:59:54Z

        Updates flow to handle new API

        commit ee5575d0c6b24b7109b6977542bfcc0fac8f85d3
        Author: Lukasz Lenart <lukaszlenart@apache.org>
        Date: 2017-08-02T13:00:01Z

        Updates tests


        Show
        githubbot ASF GitHub Bot added a comment - GitHub user lukaszlenart opened a pull request: https://github.com/apache/struts/pull/158 WW-4835 : Configurable handlers This PR changes API a bit to allow pass current `ActionInvocation` to the REST content type handlers to allow implement different behaviour based on a current action. WW-4835 ( https://issues.apache.org/jira/browse/WW-4835 ) You can merge this pull request into a Git repository by running: $ git pull https://github.com/lukaszlenart/struts configurable-handlers Alternatively you can review and apply these changes as the patch at: https://github.com/apache/struts/pull/158.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #158 commit 2f690cfe6260ccdf3aa617baf65a4b836c49cf65 Author: Lukasz Lenart <lukaszlenart@apache.org> Date: 2017-08-02T12:56:09Z Adds new methods and marks current as deprecated commit 3bd072ca053aed787f3a16865266d8832fcd18b0 Author: Lukasz Lenart <lukaszlenart@apache.org> Date: 2017-08-02T12:58:15Z Adds an abstract layer to allow easily handle API change commit a64da53d5770c5404ee5eb390b826f5733171f5f Author: Lukasz Lenart <lukaszlenart@apache.org> Date: 2017-08-02T12:59:54Z Updates flow to handle new API commit ee5575d0c6b24b7109b6977542bfcc0fac8f85d3 Author: Lukasz Lenart <lukaszlenart@apache.org> Date: 2017-08-02T13:00:01Z Updates tests
        Hide
        githubbot ASF GitHub Bot added a comment -

        Github user cnenning commented on the issue:

        https://github.com/apache/struts/pull/158

        Using `AbstractContentTypeHandler` to implement deprecated methods to log on WARN seems like a good idea.

        I don't see where new parameter `ActionInvocation` is actually used. Is that yet to come?

        Show
        githubbot ASF GitHub Bot added a comment - Github user cnenning commented on the issue: https://github.com/apache/struts/pull/158 Using `AbstractContentTypeHandler` to implement deprecated methods to log on WARN seems like a good idea. I don't see where new parameter `ActionInvocation` is actually used. Is that yet to come?
        Hide
        githubbot ASF GitHub Bot added a comment -

        Github user lukaszlenart commented on the issue:

        https://github.com/apache/struts/pull/158

        > I don't see where new parameter ActionInvocation is actually used. Is that yet to come?

        Not yet

        Show
        githubbot ASF GitHub Bot added a comment - Github user lukaszlenart commented on the issue: https://github.com/apache/struts/pull/158 > I don't see where new parameter ActionInvocation is actually used. Is that yet to come? Not yet
        Hide
        githubbot ASF GitHub Bot added a comment -

        Github user cnenning commented on the issue:

        https://github.com/apache/struts/pull/158

        Do you want to further develop this PR or merge it first?

        Show
        githubbot ASF GitHub Bot added a comment - Github user cnenning commented on the issue: https://github.com/apache/struts/pull/158 Do you want to further develop this PR or merge it first?
        Hide
        githubbot ASF GitHub Bot added a comment -

        Github user lukaszlenart commented on the issue:

        https://github.com/apache/struts/pull/158

        Merge it first as I think those changes are less intrusive as the whole idea in my head

        Show
        githubbot ASF GitHub Bot added a comment - Github user lukaszlenart commented on the issue: https://github.com/apache/struts/pull/158 Merge it first as I think those changes are less intrusive as the whole idea in my head
        Hide
        githubbot ASF GitHub Bot added a comment -

        Github user cnenning commented on the issue:

        https://github.com/apache/struts/pull/158

        and what is your idea?

        Show
        githubbot ASF GitHub Bot added a comment - Github user cnenning commented on the issue: https://github.com/apache/struts/pull/158 and what is your idea?
        Hide
        githubbot ASF GitHub Bot added a comment -

        Github user lukaszlenart commented on the issue:

        https://github.com/apache/struts/pull/158

        With the `ActionInvocation` in place I can access an action which means the action can provide additional informations how to serialise/deserialize object/string via dedicated interfaces, e.g.

        ```java
        public interface DateFormatHandler

        { Date toDate(String dateStr); String fromDate(Date date); }

        ```

        and when action will implement such interface, a handler can pass formatting a date to the action instead of doing this by itself. And many more

        Show
        githubbot ASF GitHub Bot added a comment - Github user lukaszlenart commented on the issue: https://github.com/apache/struts/pull/158 With the `ActionInvocation` in place I can access an action which means the action can provide additional informations how to serialise/deserialize object/string via dedicated interfaces, e.g. ```java public interface DateFormatHandler { Date toDate(String dateStr); String fromDate(Date date); } ``` and when action will implement such interface, a handler can pass formatting a date to the action instead of doing this by itself. And many more
        Hide
        githubbot ASF GitHub Bot added a comment -

        Github user cnenning commented on the issue:

        https://github.com/apache/struts/pull/158

        sounds great 👍

        Show
        githubbot ASF GitHub Bot added a comment - Github user cnenning commented on the issue: https://github.com/apache/struts/pull/158 sounds great 👍
        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit c2aeaf2eadb6ac5bbd64b5c2646a96d0f14265bd in struts's branch refs/heads/master from Lukasz Lenart
        [ https://git-wip-us.apache.org/repos/asf?p=struts.git;h=c2aeaf2 ]

        WW-4835 Allows REST handlers to be configurable per action

        Show
        jira-bot ASF subversion and git services added a comment - Commit c2aeaf2eadb6ac5bbd64b5c2646a96d0f14265bd in struts's branch refs/heads/master from Lukasz Lenart [ https://git-wip-us.apache.org/repos/asf?p=struts.git;h=c2aeaf2 ] WW-4835 Allows REST handlers to be configurable per action
        Hide
        githubbot ASF GitHub Bot added a comment -

        Github user asfgit closed the pull request at:

        https://github.com/apache/struts/pull/158

        Show
        githubbot ASF GitHub Bot added a comment - Github user asfgit closed the pull request at: https://github.com/apache/struts/pull/158
        Hide
        lukaszlenart Lukasz Lenart added a comment -

        PR got merged

        Show
        lukaszlenart Lukasz Lenart added a comment - PR got merged

          People

          • Assignee:
            lukaszlenart Lukasz Lenart
            Reporter:
            lukaszlenart Lukasz Lenart
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development