Adding new page with XWiki backend

Hi,

I was trying to evaluate if embedded Cristal instance (1.9.0) on XWiki 18.6.0 is something that could be already used as simplified main UI for users to view and edit pages (while keeping the XWiki UI for admins mostly), however I run into a one of issue where I am not sure if it is a bug or configuration related or simply not implemented yet.

Because editor currently does support only markdown syntax, I installed CommonMark Markdown Syntax 1.2 (8.9.1) extension. Now editing works, but creation of new pages I did not manage to get running. The modal dialog does not closes after clicking on create and it DevTools I see 404 response of GET request:

rest/wikis/xwiki/spaces/MarkDownPage/spaces/TestNewPage/pages/WebHome?checkRight=edit&supportedSyntax=markdown%2F1.2

Looks like Cristal expect JSON response, trying to switch to edit mode but the page was not created and tomcat gives back standard 404 page not found HTML response.

Maybe somebody can point me to the right direction. Only tried it with embedded Cristal.

best

Tomas

Hi, thanks for your feedback!

First of all, you should not have needed to install the Markdown extension manually, I just opened a new issue for this: Loading...

Second, I tried to reproduce your creation issue, but it seems to work fine on my end…
Since you know how to use the DevTools, can you check that after the 404 for the GET request you see a PUT request? Getting a 404 at first is actually expected, because Cristal needs to check whether or not the page already exists in the backend (XWiki in this case).

image

Thanks!
Pierre

I checked again, and there is no follow up PUT request executed afterwards. The issue is that cristal seems to be expecting some sort of JSON formatted response, but it gets back standard 404 from tomcat which is basically HTML formatted error page and then if fails because it tries to parse it as json:

SyntaxError: Unexpected token '<', "<!doctype "... is not valid JSON

best

Tomas

Thanks for the follow-up, the problem is that no one actually tried the setup on Tomcat and then reported the issue, so I’m really grateful for that.

It doesn’t seem like Tomcat actually respects the contents of the Accept header when there is an error during the request (Cristal expects the server to return valid JSON even in the case of a 404 NOT FOUND error).

This should hopefully be fixed in the next release of Cristal, see Loading... for a follow-up.

Best,
Pierre

I see, yes that explains it, I will test with next release. Thanks for help!

Tomas