Servlets
@Component(metatype=true)
@Service(Servlet.class)
@Properties({
@Property(name="sling.description",value="My Service"),
@Property(name="sling.servlet.paths",value="/bin/myservice"),
@Property(name="sling.servlet.methods=",value="GET")
})
public class MyServlet extends SlingAllMethodServlet{
@overide
protected void doGet(SlingHttpServletRequest request,SlingHttpServletResponse) throws ServletException,IOException{
System.out.println("Inside the servlet");
}
}
Servlet Annotation
@SlingServlet(paths="/bin/JsonServlet")
public class JsonServlet extends SlingAllMethodServlet{
protected void doGet(SlingHttpServletRequest request,SlingHttpServletResponse) throws ServletException,IOException{
System.out.println("Inside the servlet");
}
}
@Component(metatype=true)
@Service(Servlet.class)
@Properties({
@Property(name="sling.description",value="My Service"),
@Property(name="sling.servlet.paths",value="/bin/myservice"),
@Property(name="sling.servlet.methods=",value="GET")
})
public class MyServlet extends SlingAllMethodServlet{
@overide
protected void doGet(SlingHttpServletRequest request,SlingHttpServletResponse) throws ServletException,IOException{
System.out.println("Inside the servlet");
}
}
Servlet Annotation
@SlingServlet(paths="/bin/JsonServlet")
public class JsonServlet extends SlingAllMethodServlet{
protected void doGet(SlingHttpServletRequest request,SlingHttpServletResponse) throws ServletException,IOException{
System.out.println("Inside the servlet");
}
}
No comments:
Post a Comment