Alfresco Web Script format ‘*’ is not registered

I’ve just ran into a problem with a dot in URL. I had a webscript which had an url looking like this:

/package/name/webscriptName/{argument}

Now, the argument was a username. So when I called the webscript with my test usernames, it all worked. I was calling this from Share:

Alfresco.constants.PROXY_URI+”/package/name/webscriptName/”+user.name

So, for users like “zlatko”, “admin” and such, it all worked. But for users with a dot in the username, like “zlatko.duric”, the webscript got broken. I was getting the error from the title, for example:

Web Script format ‘duric’ is not registered.

So I figured that the url looked like /package/name/webscriptName/zlatko.duric and the webscript took the part behind the dot as the format argument (ie. json, html or something). But my installation didn’t have a “duric” format registered – so it broke there.

The solution here is simple: in the webscript declaration should have a line like this:

<format default=”json”>argument</format>

The default bit is important and the argument bit is important. The json bit can vary.

I hope this will help some poor googler solve the issue.

Leave a Reply