[teiid-issues] [JBoss JIRA] (TEIID-3471) unable to consume odata service deployed in teiid

Ron Sigal (JIRA) issues at jboss.org
Wed May 13 21:38:19 EDT 2015


    [ https://issues.jboss.org/browse/TEIID-3471?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13067873#comment-13067873 ] 

Ron Sigal commented on TEIID-3471:
----------------------------------

Hi Ramesh,

Ok, I see that

{code}
          @Path("utf8")
          @Produces("text/plain;charset=utf-8")
          @POST
          public String utf8()
          {
             System.out.println("TestResource.utf8()");
             return "ok";
          }
       ...
       @Test
       public void testAcceptNoUtf8() throws Exception
       {
          ClientRequest request = new ClientRequest("http://localhost:8081/utf8/");
          request.accept("text/plain");
          ClientResponse<?> response = request.post();
          Assert.assertEquals(200, response.getStatus());
          String entity = response.getEntity(String.class);
          System.out.println("result: " + entity);
       }
{code}

results in

   org.jboss.resteasy.spi.NotAcceptableException: RESTEASY001530: No match for accept header

whereas

{code}
          @Path("nocharset")
          @Produces("text/plain")
          @POST
          public String noCharset()
          {
             return "ok";
          }

       ...

       @Test
       public void testAcceptUtf8No() throws Exception
       {
          ClientRequest request = new ClientRequest("http://localhost:8081/nocharset/");
          request.accept("text/plain;charset=utf-8");
          ClientResponse<?> response = request.post();
          Assert.assertEquals(200, response.getStatus());
          String entity = response.getEntity(String.class);
          System.out.println("result: " + entity);
       }
{code}

works fine. The relevant code is

{code}
   @Override
   public boolean isCompatible(MediaType other)
   {
      boolean result;
      if (other == null)
         result = false;
      if (getType().equals(MEDIA_TYPE_WILDCARD) || other.getType().equals(MEDIA_TYPE_WILDCARD))
         result = true;
      else if (getType().equalsIgnoreCase(other.getType()) && (getSubtype().equals(MEDIA_TYPE_WILDCARD) || other.getSubtype().equals(MEDIA_TYPE_WILDCARD)))
         result = true;
      else
      {
         if (getType().equalsIgnoreCase(other.getType())
                 && this.getSubtype().equalsIgnoreCase(other.getSubtype()))
         {
            if (getParameters() == null || getParameters().size() == 0)
            {
               result = true;
            }
            else
            {
               result = this.equals(other);
            }
         }
         else
         {
            result = false;
         }
      }
      return result;
   }
{code}

in org.jboss.resteasy.util.WeightedMediaType in the resteasy-jaxrs module.

Very interesting. Honestly, I'm not sure how to think about this. The JAX-RS 1.1 spec says "An implementation MUST NOT invoke a method whose effective value of @Produces does not match the request Accept header.", but I don't see where it ever actually defines "match". And Resteasy passes the TCK tests. Really, I'm not even sure what "match" SHOULD mean. We could get crazy and do full blown unification (http://en.wikipedia.org/wiki/Unification_%28computer_science%29). Ugh.

Resource matching is a very fundamental notion in JAX-RS, and I wouldn't want to make any changes without being very careful.

Any thoughts about how to interpret "match"?

-Ron

> unable to consume odata service deployed in teiid
> -------------------------------------------------
>
>                 Key: TEIID-3471
>                 URL: https://issues.jboss.org/browse/TEIID-3471
>             Project: Teiid
>          Issue Type: Bug
>          Components: OData
>    Affects Versions: 8.7
>            Reporter: Mark Drilling
>            Assignee: Ramesh Reddy
>         Attachments: deployment-exception.txt, MyVDB-vdb.xml, standalone-snippet.xml
>
>
> I am unable to consume odata service created in teiid.  
> Steps to reproduce and files are attached.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


More information about the teiid-issues mailing list