Hello @shivamaembackend,
I am not 100% sure about the business that you are trying to tackle, however it seems you want to bind the publish URL with a servlet. I recommend proceeding with servlet binding with resourceTypes. Below is the configuration for binding a servlet with resoruceType(page template in this case)
@Component(service = Servlet.class,
property = {
Constants.SERVICE_DESCRIPTION + "=Servlet for page load",
ServletResolverConstants.SLING_SERVLET_METHODS + "=" + HttpConstants.METHOD_GET,
ServletResolverConstants.SLING_SERVLET_RESOURCE_TYPES + "=project-name/components/structure/your-page-template"
})
let me know if this serves you purpose. You can also share more insight on the business you are targeting for better assistance.