troubles with links.xml

Poster Content
nk4um Administrator
Posts: 607
December 30, 2007 15:00"1" is a relative URI
Sorry about that, the id argument is considered a URI and because it has no scheme is considered relative and xrl is trying to absolutize it. This then fails because you don''t have a CWU (current working URI) set. Best solution is to change the rewrite to put the id argument in as an absolute URI,

<rewrite>
  <rule>
    <match>ffcpl:/intervention/delete/(.*)</match>
    <to>ffcpl:/intervention/delete-inner+id@ffcpl:/$1</to>
  </rule>
</rewrite>


Cheers, Tony
Like · Post Reply
nk4um User
Posts: 131
December 30, 2007 14:13the request
Greetings,

Here''s the request ...
Request:   [SOURCE active:mapper+operator@ffcpl:/links.xml+operand@ffcpl:/intervention/delete-inner+id@1 in urn:org:ten60:netkernel:ext:xrl as com.ten60.netkernel.urii.aspect.IAspectBinaryStream]


So my rewrite is working as I expect it ... but obviously I''m not expecting the correct thing ?

Regards,
Tom
Like · Post Reply
nk4um User
Posts: 131
December 30, 2007 14:05havent quite found it yet
Greetings,

Thanks for the reply. Its clearer now. Still haven''t figured it out completely though ... lets see, in module.xml
   <export>
      <uri>
      <match>ffcpl:/intervention/.*</match>
    </uri>
   </export>
  <rewrite>
    <rule>
      <match>ffcpl:/intervention/delete/(.*)</match>
      <to>ffcpl:/intervention/delete-inner+id@$1</to>
    </rule>
  </rewrite>
  <mapping>
    <rewrite>
      <match>(ffcpl:/intervention/.*)</match>
      <to>active:mapper+operator@ffcpl:/links.xml+operand@$1</to>
    </rewrite>


So, I catch everthing that starts with /intervention ...
Everything that begins with /intervention/delete gets rewritten slightly.
The whole shebang is then send to the links.xml for further matching.
<?xml version="1.0" encoding="UTF-8"?>
<links basepath="ffcpl:/intervention/">

<!-- main entrypoints -->
<link>
  <name>list</name>
   <ext>/list</ext>
   <int>active:dpml+operand@ffcpl:/resources/list_intervention.idoc</int>
   <args>links</args>
</link>

<link>
  <name>create</name>
   <ext>/create</ext>
   <int>active:dpml+operand@ffcpl:/resources/create_intervention.idoc</int>
   <args>links</args>
</link>

<link>
  <name>delete</name>
  <ext>/delete-inner</ext>
  <int>active:dpml+operand@ffcpl:/resources/delete_intervention.idoc</int>
  <args>links,id</args>
</link>


In links.xml I send everything to the corresponding idoc. Only the deletes get an extra parameter, the id ...
Seems to be pretty much what you hinted at ... but now I get
No CWU
Failed to resolve relative URI
1
When I enter /intervention/delete/1
So I guess I didn''t completely get it.

Any more pointers (I''ll be experimenting until I get it right anyway, but you might save me some time) ?
Regards,
Tom
Like · Post Reply
nk4um Administrator
Posts: 607
December 27, 2007 08:23XRL is just a 1->1 mapping
Hi Tom,

Unfortunately XRL is only capable of (bi-directional) direct 1->1 mappings. Yours is an example of many->1. The way to achieve what you want is to put a rewrite rule in your module xml like this:

<rewrite>
  <match>ffcpl:/create/(.*)</match>
  <to>ffcpl:/create-inner+id@$1</to>
</rewrite>


and then change your links to use the path create-inner. eg.

<link>
  <name>create</name>
  <ext>/create-inner</ext>
  <int>active:dpml+operand@ffcpl:/resources/create_intervention.idoc</int>
  <args>links,id</args>
</link>


in the script you can then access the id as this:param:id.

Cheers,
Tony
Like · Post Reply
nk4um User
Posts: 131
December 26, 2007 19:45troubles with links.xml
Greetings,

Simple application ... I list the interventions ...
My links.xml reflects this :
 <link>
  <name>list</name>
   <ext>/list</ext>
   <int>active:dpml+operand@ffcpl:/resources/list_intervention.idoc</int>
   <args>links</args>
</link>


I create interventions ...
Again ...
<link>
  <name>create</name>
   <ext>/create</ext>
   <int>active:dpml+operand@ffcpl:/resources/create_intervention.idoc</int>
   <args>links</args>
</link>


At some point I want to modify or delete those interventions. However, this is not so straightforward ... I want to "catch"
/delete/1
/modify/2
/delete/2
/modify/3
and so on ...
The same idoc would handle things (one for delete, one for modify), but how do I "map" this (I think map is the keyword here) so that I get the 1,2,3 as a parameter to the idoc ...

Simple probably, I know ... but it has been eluding me for a while now.
Any pointers gratefully accepted.

Regards,
Tom
Like · Post Reply