How to register Servlet or Routes without a GUI / Navigation Bar and no Authentication?

Is there a way to create routes without authentication and without Navigation GUI?

For example:

package de.bytestore.hostinger.api;

import jakarta.servlet.ServletException;
import jakarta.servlet.ServletResponse;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

import java.io.IOException;

@WebServlet("/api/authentication")
public class AuthenticationAPIRoute extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        resp.getWriter().write("Hello from AuthenticationAPIRoute!");
    }
}

image

Hi,
May be you need to exclude your path from Vaadin handler?
More info here
Regards,
Mikhail

Sadly this didn’t worked for me…

Application Properties:

vaadin.exclude-urls=/api/**

API WebServlet:

@WebServlet(urlPatterns = "/api/authentication", name = "Authentication API Endpoint", loadOnStartup = 1)
public class AuthenticationAPIRoute extends HttpServlet {
    protected static final Logger log = LoggerFactory.getLogger(AuthenticationAPIRoute.class);

    @Override
    public void init(ServletConfig config) throws ServletException {
        log.info("Authentication APIRoute registered.");
    }

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        resp.getWriter().write("Hello from AuthenticationAPIRoute!");
    }
}