[ 
https://issues.apache.org/jira/browse/OLINGO-677?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14591425#comment-14591425
 ] 

Michael Bolz commented on OLINGO-677:
-------------------------------------

Hi,

the issue is related to the *JPA Processor* and parsing of the binding url (in 
{{ODataEntityParser.parseBindingLink()}}, more details below).

[~chandan.v.a]: Could you please take a look into this issue and check for the 
best way to fix it?

Best regards, Michael

*More details about the issue:*
{{UriParserImpl.handleNormalInitialSegment():195}} use -> {{percentDecode}} to 
get the entity container name
This method does a split at the {{.}} for 
{{hre=f"http://localhost:8080/SalesOrderProcessing.svc/StoreDetails('1')"}}
which results in {{entityContainerName = 
"http://localhost:8080/SalesOrderProcessing"}} and {{SegmentName = 
"svc/StoreDetails"}}.
The following call of {{"edm.getEntityContainer(entityContainerName);"}} 
results in  {{"null"}} and afterwards the {{"UriParserImpl"}} throws
an 
{{"UriNotMatchingException(UriNotMatchingException.CONTAINERNOTFOUND.addContent(entityContainerName));"}}.

*StackTrace*:
{code}
stackTrace = {java.lang.StackTraceElement[49]@5472} 
 0 = {java.lang.StackTraceElement@5474} 
"org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeException.throwException(ODataJPARuntimeException.java:98)"
 1 = {java.lang.StackTraceElement@5475} 
"org.apache.olingo.odata2.jpa.processor.core.ODataEntityParser.parseBindingLink(ODataEntityParser.java:146)"
 2 = {java.lang.StackTraceElement@5476} 
"org.apache.olingo.odata2.jpa.processor.core.access.data.JPALink.create(JPALink.java:188)"
 3 = {java.lang.StackTraceElement@5477} 
"org.apache.olingo.odata2.jpa.processor.core.access.data.JPAEntity.create(JPAEntity.java:151)"
 4 = {java.lang.StackTraceElement@5478} 
"org.apache.olingo.odata2.jpa.processor.core.access.data.JPAProcessorImpl.processCreate(JPAProcessorImpl.java:448)"
 5 = {java.lang.StackTraceElement@5479} 
"org.apache.olingo.odata2.jpa.processor.core.access.data.JPAProcessorImpl.process(JPAProcessorImpl.java:305)"
 6 = {java.lang.StackTraceElement@5480} 
"org.apache.olingo.odata2.jpa.processor.core.ODataJPAProcessorDefault.createEntity(ODataJPAProcessorDefault.java:122)"
 7 = {java.lang.StackTraceElement@5481} 
"org.apache.olingo.odata2.core.Dispatcher.dispatch(Dispatcher.java:79)"
 8 = {java.lang.StackTraceElement@5482} 
"org.apache.olingo.odata2.core.ODataRequestHandler.handle(ODataRequestHandler.java:129)"
 9 = {java.lang.StackTraceElement@5483} 
"org.apache.olingo.odata2.core.rest.ODataSubLocator.handle(ODataSubLocator.java:167)"
 10 = {java.lang.StackTraceElement@5484} 
"org.apache.olingo.odata2.core.rest.ODataSubLocator.handlePost(ODataSubLocator.java:86)"
 11 = {java.lang.StackTraceElement@5485} 
"sun.reflect.GeneratedMethodAccessor27.invoke(Unknown Source)"
{code}

> Unable to create entity with absolute path in href attrbute of links
> --------------------------------------------------------------------
>
>                 Key: OLINGO-677
>                 URL: https://issues.apache.org/jira/browse/OLINGO-677
>             Project: Olingo
>          Issue Type: Bug
>          Components: odata2-annotation, odata2-core, odata4-server
>    Affects Versions: V2 2.0.3
>            Reporter: Prashanth
>            Assignee: Michael Bolz
>            Priority: Blocker
>
> We are trying to create an entity having links with absolute path in href 
> attribute but its failing because of absolute path.
> Actual Problem :
> When input contains link with absolute url , response is 404.
> Ex :
> <link href="http://localhost:8080/odataweb/odata.svc/Containers(1)" 
> rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ContainerDetails";
>  title="ContainerDetails" type="application/atom+xml;type=feed"/>
> When input contains link with relative url , response is 201 created.
> Ex :
> <link href="Containers(1)" 
> rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ContainerDetails";
>  title="ContainerDetails" type="application/atom+xml;type=feed"/>
> Need to resolved : Olingo should process requesst successfully irrespective 
> of the link href path ( absolute or relative )
> Following are not working and working cases :
> 1) Not Working Example input :
> <?xml version='1.0' encoding='utf-8'?>
> <entry 
>     xmlns="http://www.w3.org/2005/Atom"; 
>     xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"; 
>     xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"; 
> xml:base="http://localhost:8080/odataweb/odata.svc/";>
>       <title type="text">ContainerEvents</title>
>     <category term="CASM-JPA.ContainerEvent" 
> scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/>
>       <link href="http://localhost:8080/odataweb/odata.svc/Containers(1)" 
> rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ContainerDetails";
>  title="ContainerDetails" type="application/atom+xml;type=feed"/>
>     <content type="application/xml">
>         <m:properties>
>             <d:Evt>test_14</d:Evt>
>             <d:Id>60</d:Id>
>             <d:Value>test_14</d:Value>
>         </m:properties>
>     </content>
> </entry>
> Output :
> 404 Error with following response .
> <?xml version='1.0' encoding='UTF-8'?>
> <error 
>     xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata";>
>     <code/>
>     <message xml:lang="en-US">Could not find container with name: 
> 'http://localhost:8080/odataweb/odata'.</message>
> </error>
> 2) Working Example input :
> <?xml version='1.0' encoding='utf-8'?>
> <entry 
>     xmlns="http://www.w3.org/2005/Atom"; 
>     xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"; 
>     xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"; 
> xml:base="http://localhost:8080/odataweb/odata.svc/";>
>       <title type="text">ContainerEvents</title>
>     <category term="CASM-JPA.ContainerEvent" 
> scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/>
>     <link href="Containers(1)" 
> rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ContainerDetails";
>  title="ContainerDetails" type="application/atom+xml;type=feed"/>
>     <content type="application/xml">
>         <m:properties>
>             <d:Evt>test_14</d:Evt>
>             <d:Id>14</d:Id>
>             <d:Value>test_14</d:Value>
>         </m:properties>
>     </content>
> </entry>
> Output :
> 201 Created and the response includes the entity created.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to