[
https://issues.jboss.org/browse/TEIID-4039?page=com.atlassian.jira.plugin...
]
Juraj Duráni commented on TEIID-4039:
-------------------------------------
No Ramesh. You probably misunderstood me.
http://localhost:8080/odata4/olingo_basic/Source/$entity?$id=Customers(1)...
is *not* valid request URI.
I believe, you are looking at this from point of your implementation:
* get anything from "$id=" to the end of original URI
** BTW - at this point Teiid should fail and return 4xx to the client because neither
Customers(1)&$expand=Orders_FK0 nor Customers(1)?$expand=Orders_FK0 is valid *ID* of
the entity - *ID* of the entity is only Customers(1)
* append the root context before the string
* redirect user's request and return the result
But it is wrong.
Here is how you think about the request URI (I believe):
{color:red}URI and passed parameter{color}
{color:blue}value of the parameter{color}
*URI:*
{color:red}localhost:8080/odata4/olingo_basic/Source/$entity?$id={color}{color:blue}Customers(1)&$expand=Orders_FK0{color}
So there is only *one* parameter in the URI which is being passed to resource $entity:
* *parameter 1:*
{color:red}$id={color}{color:blue}Customers(1)&$expand=Orders_FK0{color}
But I believe that specification thinks about the URI differently:
{color:red}URI and passed parameters{color}
{color:blue}value of the parameter 1{color}
{color:green}value of the parameter 2{color}
*URI:*
{color:red}localhost:8080/odata4/olingo_basic/Source/$entity?$id={color}{color:blue}Customers(1){color}{color:red}&$expand={color}{color:green}Orders_FK0{color}
Therefore, there are *2* parameters which are being passed to resource $entity:
* *parameter 1:* {color:red}$id={color}{color:blue}Customers(1){color}
* *parameter 2:* {color:red}$expand={color}{color:green}Orders_FK0{color}
So from point of the specification it should be more like:
* get value of the parameter $id
* resolve URI for supplied entity's ID
* get value of the parameter $expand
* expand navigation property of the resolved entity
* return result
Your implementation forces the client to make your work and supply URI which you can use
to simply redirect the user and return the result.
So I still think that there is *no* typo in the documentation and that there is a bug in
the Teiid's OData V4 service.
Resolving of entityid with $expand or $select fails
---------------------------------------------------
Key: TEIID-4039
URL:
https://issues.jboss.org/browse/TEIID-4039
Project: Teiid
Issue Type: Sub-task
Components: OData
Reporter: Juraj Duráni
Assignee: Ramesh Reddy
*URL:*
http://localhost:8080/odata4/olingo_basic/Source/$entity/?$id=Customers(1...
*Returned status code:* 404
*URL:*
http://localhost:8080/odata4/olingo_basic/Source/$entity/?$id=Customers(1...
*Returned status code:* 500
In this case response does not contain mandatory OData-version header and server throws
exception:
{code:plain}
12:20:40,911 ERROR
[org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/odata4].[odata4]]
(http-/127.0.0.1:8080-1) JBWEB000236: Servlet.service() for servlet odata4 threw
exception: java.util.EmptyStackException
at java.util.Stack.peek(Stack.java:102) [rt.jar:1.8.0-internal]
at
org.apache.olingo.server.core.uri.parser.UriParseTreeVisitor.visitSelectSegment(UriParseTreeVisitor.java:2195)
at
org.apache.olingo.server.core.uri.antlr.UriParserParser$SelectSegmentContext.accept(UriParserParser.java:3611)
at
org.apache.olingo.server.core.uri.parser.UriParseTreeVisitor.visitSelectItem(UriParseTreeVisitor.java:2168)
at
org.apache.olingo.server.core.uri.antlr.UriParserParser$SelectItemContext.accept(UriParserParser.java:3541)
at
org.apache.olingo.server.core.uri.parser.UriParseTreeVisitor.visitSelectEOF(UriParseTreeVisitor.java:2153)
at org.apache.olingo.server.core.uri.parser.Parser.parseUri(Parser.java:228)
at org.apache.olingo.server.core.ErrorHandler.handleServerError(ErrorHandler.java:93)
at org.apache.olingo.server.core.ErrorHandler.handleException(ErrorHandler.java:85)
at org.apache.olingo.server.core.OData4HttpHandler.process(OData4HttpHandler.java:70)
at org.teiid.olingo.web.ODataServlet.service(ODataServlet.java:50)
[teiid-olingo-8.12.5.redhat-2.jar:8.12.5.redhat-2]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
[jboss-servlet-api_3.0_spec-1.0.2.Final-redhat-2.jar:1.0.2.Final-redhat-2]
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:295)
[jbossweb-7.5.11.Final-redhat-1.jar:7.5.11.Final-redhat-1]
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
[jbossweb-7.5.11.Final-redhat-1.jar:7.5.11.Final-redhat-1]
at org.teiid.olingo.web.ODataFilter.doFilter(ODataFilter.java:194)
[teiid-olingo-8.12.5.redhat-2.jar:8.12.5.redhat-2]
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:246)
[jbossweb-7.5.11.Final-redhat-1.jar:7.5.11.Final-redhat-1]
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
[jbossweb-7.5.11.Final-redhat-1.jar:7.5.11.Final-redhat-1]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:231)
[jbossweb-7.5.11.Final-redhat-1.jar:7.5.11.Final-redhat-1]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:149)
[jbossweb-7.5.11.Final-redhat-1.jar:7.5.11.Final-redhat-1]
at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:512)
[jbossweb-7.5.11.Final-redhat-1.jar:7.5.11.Final-redhat-1]
at
org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:169)
[jboss-as-web-7.5.4.Final-redhat-4.jar:7.5.4.Final-redhat-4]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:150)
[jbossweb-7.5.11.Final-redhat-1.jar:7.5.11.Final-redhat-1]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:97)
[jbossweb-7.5.11.Final-redhat-1.jar:7.5.11.Final-redhat-1]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:102)
[jbossweb-7.5.11.Final-redhat-1.jar:7.5.11.Final-redhat-1]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:344)
[jbossweb-7.5.11.Final-redhat-1.jar:7.5.11.Final-redhat-1]
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:854)
[jbossweb-7.5.11.Final-redhat-1.jar:7.5.11.Final-redhat-1]
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:653)
[jbossweb-7.5.11.Final-redhat-1.jar:7.5.11.Final-redhat-1]
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:926)
[jbossweb-7.5.11.Final-redhat-1.jar:7.5.11.Final-redhat-1]
at java.lang.Thread.run(Thread.java:744) [rt.jar:1.8.0-internal]
{code}
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)