Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make schemas available via servlet: for example, http://localhost:8888/schema/xhtml5.rnc #258

Open
GrahamHannington opened this issue Mar 11, 2016 · 2 comments

Comments

@GrahamHannington
Copy link

I would like the v.Nu servlet to make the v.Nu RELAX NG compact syntax schema files available via HTTP.

I would like the path component of these HTTP URLs to be /schema, followed by the paths specified by the http://s.validator.nu URLs listed in nu/validator/localentities/files/entitymap.

For example, if I start the servlet with the following command:

java -Xss512k -cp vnu.jar nu.validator.servlet.Main 8888

then I would like to use the following URL:

http://localhost:8888/schema/xhtml5.rnc

to get the file referred to in entitymap as:

http://s.validator.nu/xhtml5.rnc  schema_xhtml5_rnc

Similarly (note the html5 subdirectory in the path):

http://localhost:8888/schema/html5/rdfa.rnc

to get:

http://s.validator.nu/html5/rdfa.rnc  schema_html5_rdfa_rnc

I will freely admit that this issue is related to issue #251. However, here, I'm not asking for any changes to schemas; just to make available via HTTP the schemas as they are already distributed, with no changes.

Perhaps this is already possible, but I've overlooked it? (I've looked at the source: the direct get requests to the servlet appear to be restricted to a small number of files.)

Just a thought (I'm a Java newbie, so, with apologies, this might be utter nonsense)... you could add to the doGet method in src/nu/validator/servlet/VerifierServlet.java a check for request paths that begin with /schema, then use LocalCacheEntityResolver.resolveEntity to check for the existence of a corresponding URI in entitymap; if it exists, return the corresponding .rnc file as content type application/relax-ng-compact-syntax (as per LocalCacheEntityResolver.getType).

@sideshowbarker
Copy link
Contributor

I will freely admit that this issue is related to issue #251. However, here, I'm not asking for any changes to schemas; just to make available via HTTP the schemas as they are already distributed, with no changes.

That’s a non-trivial just.

Perhaps this is already possible, but I've overlooked it?

The service does not in any way right now expose the schemas in the way you describe. It would certainly be do-able to make it expose them that way, but it’s not something that it seems like there’s a wide need for and for me at least is nowhere near registering as important enough to just me spending time on implementing it.

I would be happy to review a patch that provided it but even then I’m not certain we would want to go ahead and just land it even if we had it. But anyway the first step would be having a concrete patch.

@GrahamHannington
Copy link
Author

Thanks for the reply. Yes, all valid points.

You can probably see where I'm going with this: if a user already has the servlet running, then they could point their other tools, such as validating XML editors, at the HTTP URLs I'm proposing for the schemas, so that their editors would be using exactly the same RELAX NG schemas as their instance of v.Nu, without having to use a script to extract the schemas from the files directory in the .jar, and rename'n'copy them into a structure corresponding to the URLs in the entitymap.

If I get time, I'll write a patch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants