You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wink.apache.org by "Michael Elman (JIRA)" <ji...@apache.org> on 2009/10/01 10:48:23 UTC

[jira] Updated: (WINK-201) Fix precedence on custom type conversion

     [ https://issues.apache.org/jira/browse/WINK-201?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael Elman updated WINK-201:
-------------------------------

    Priority: Critical  (was: Major)

See this test:
{code}
public class HeaderTest extends MockServletInvocationTest {

    @Override
    protected Class<?>[] getClasses() {
        return new Class<?>[] {Resource.class};
    }

    @Path(value = "/test")
    public static class Resource {

        @GET
        public String stringParamHandling(@HeaderParam("A") boolean a,
                                          @HeaderParam("B") boolean b) {
            StringBuilder sb = new StringBuilder();
            if (a) {
                sb.append("a=" + a);
            }
            if (b) {
                sb.append("b=" + b);
            }
            return sb.toString();
        }
    }

    public void testHeaders() throws Exception {

        testHeader(new String[][] {{"a", "true"}},
                   "a=true");
     
        testHeader(new String[][] { {"a", "true"},
            {"a", "false"}}, "a=true");

        testHeader(new String[][] { {"a", "false"},
            {"b", "true"}}, "b=true");

        testHeader(new String[][] { {"a", "true"},
            {"b", "false"},
            {"a", "false"}}, "a=true");

    }

    private void testHeader(String[][] headers, String expected) throws Exception {
        MockHttpServletRequest request =
            MockRequestConstructor.constructMockRequest("GET",
                                                        "/test",
                                                        MediaType.WILDCARD);
        for (String[] header : headers) {
            request.addHeader(header[0], header[1]);

        }
        MockHttpServletResponse response = invoke(request);
        assertEquals(200, response.getStatus());
        assertTrue(response.getContentAsString().contains(expected));
    }
}
{code}

> Fix precedence on custom type conversion
> ----------------------------------------
>
>                 Key: WINK-201
>                 URL: https://issues.apache.org/jira/browse/WINK-201
>             Project: Wink
>          Issue Type: Bug
>          Components: Common
>    Affects Versions: 0.2
>            Reporter: Bryant Luk
>            Assignee: Bryant Luk
>            Priority: Critical
>             Fix For: 0.2
>
>
> Re-reading the JAX-RS spec, the implied ordering for the type conversion is constructor then valueOf() (and now fromString()).  Will change the ordering to give constructors precedence.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.