cancel
Showing results for 
Search instead for 
Did you mean: 

Webscripts url mapping behaves differently when written in Java vs. Javascript

mathias_lin
Star Contributor
Star Contributor
I just noticed some behavior regarding web scripts. Maybe somebody has an idea why this happens or whether it's a bug in Alfresco.

I have two (GET) web scripts:

<strong>Webscript A</strong> has the following URL in it's descriptor:

<url>/api/v1/folders/{path}</url>


<strong>Webscript B</strong> has the following URL in it's descriptor:

<url>/api/v1/folders/{path}/files</url>


Note that the urls only differ with the "/files" in the end.


The strange thing now is that when both web scripts are written in javascript (thus also not needed to be registered in any xml context file), it's not possible to reach webscript B, because A already caught the requests falsely (because of the overlapping URL pattern, I assume, but without checking for further patterns that match better).
For example, I call the URL like:

GET /api/v1/folders/myFolderX/files


I would expect that the request would go to webscript B (due to the "/files" at the end), but instead it goes to webscript A, which throws an error due to mismatching business logic in there of course.

But: if I rewrite the web scripts in Java (and no changes to the descriptor or url pattern), register them in my xml context file, then everything works as expected and my request actually reaches webscript B.

Any idea why this is?


1 REPLY 1

mathias_lin
Star Contributor
Star Contributor
It seems to be a bug. I created a bug report in Jira: https://issues.alfresco.com/jira/browse/ALF-21404