Simple Post Servlet for AEM 6.3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.sourcedcode.core.servlets; | |
import org.apache.sling.api.SlingHttpServletRequest; | |
import org.apache.sling.api.SlingHttpServletResponse; | |
import org.apache.sling.api.servlets.HttpConstants; | |
import org.apache.sling.api.servlets.SlingAllMethodsServlet; | |
import org.osgi.service.component.annotations.Component; | |
import javax.servlet.Servlet; | |
import java.io.IOException; | |
@Component( | |
service = Servlet.class, | |
property = { | |
"sling.servlet.paths=/bin/simple-post", | |
"sling.servlet.methods=" + HttpConstants.METHOD_POST | |
}) | |
public class SimplePostServlet extends SlingAllMethodsServlet { | |
@Override | |
protected void doPost(final SlingHttpServletRequest req, final SlingHttpServletResponse resp) throws IOException { | |
resp.setStatus(200); | |
resp.getWriter().write("Simple Post Test"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment