Hi,
You can use below syntax for registering the servlet with paths
@Component(service = Servlet.class,
property = {
Constants.SERVICE_DESCRIPTION + "=Some Description",
"sling.servlet.methods=" + HttpConstants.METHOD_GET,
"sling.servlet.paths=" + "/bin/somepath",
"sling.servlet.extensions=json"
})
You can use the resourceType also to bind the servlet to a path
@component(service = Servlet.class, property = { Constants.SERVICE_DESCRIPTION + "=Some Description",
"sling.servlet.methods=" + HttpConstants.METHOD_POST,
"sling.servlet.resourceTypes=apps/servlets/sometext" })
Create a node under content folder and add the resourceType as given in the servlet and hitting the page url will trigger the servlet.
Url to trigger the servlet: http://localhost:4502/content/wknd-events/servlet_nodes/servlets/newservlet

Hope this helps