antlr / antlr4-lab

A client/server for trying out and learning about ANTLR
MIT License
36 stars 11 forks source link

Help me to start service locally #2

Closed Serhioromano closed 2 years ago

Serhioromano commented 2 years ago

I am complete noob in Java. I do not even have a general knowledge. I want to test my contribution locally. I followed the steps and when I run sudo nohup java -cp ~/.m2/repository/org/antlr/antlr4-lab/0.1-SNAPSHOT/antlr4-lab-0.1-SNAPSHOT-complete.jar org.antlr.v4.server.ANTLRHttpServer I have output

nohup: ignoring input and appending output to 'nohup.out'

And terminal is waiting.

I fill like it was successful as url http://localhost/antlr/ shows

HTTP ERROR 404 Not Found
URI:    /antlr/
STATUS: 404
MESSAGE:    Not Found
SERVLET:    org.antlr.v4.server.ANTLRHttpServer$ParseServlet-6b4a4e18
Powered by Jetty:// 11.0.11

And when I test I have this error in console.

Access to XMLHttpRequest at 'http://localhost/antlr/' from origin 'http://localhost:5500' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.

My http://localhost:5500 is a live server on a static ащдвукю

How to fix this problem?

parrt commented 2 years ago

When you see that the terminal is waiting that means you can go to port 80 because the server is running. :) you probably have to run a post to the URL or something:

curl -d grammar=foo http://localhost/parse

This fails to get a good answer of course but at least it contacts the server. Note I have changed the URL to parse from antlr.

Serhioromano commented 2 years ago

I looked to code and I can even change port now. The problem is CORS as it is in error message. It cannot accept requests from other URL.

parrt commented 2 years ago

I was wondering how to fix that myself. Turns out the answer was trivial. I now just pull from the server that gave us index.html. Please try again

Serhioromano commented 2 years ago

I was wondering how to fix that myself. Turns out the answer was trivial. I now just pull from the server that gave us index.html. Please try again

I think I no longer need to launch server as I do not need to test any new PR.