Created
September 7, 2018 16:47
-
-
Save lesutton/fc4b18dbe34db8518903d7f138d821f7 to your computer and use it in GitHub Desktop.
Quick Example / Starting Point for a REST end point to Submit an AEM Adaptive Form to
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.adobe.aem.forms.servlets; | |
import java.io.IOException; | |
import javax.servlet.ServletException; | |
import org.apache.felix.scr.annotations.sling.SlingServlet; | |
import org.apache.sling.api.SlingHttpServletRequest; | |
import org.apache.sling.api.SlingHttpServletResponse; | |
import org.slf4j.Logger; | |
import org.slf4j.LoggerFactory; | |
@SlingServlet(paths = "/bin/formpost", methods = "POST", metatype = true) | |
public class FormPost extends org.apache.sling.api.servlets.SlingAllMethodsServlet { | |
private final Logger log = LoggerFactory.getLogger(getClass()); | |
@Override | |
protected void doPost(final SlingHttpServletRequest request, final SlingHttpServletResponse response) | |
throws ServletException, IOException { | |
log.info("Update - Starting doPost"); | |
response.setCharacterEncoding("UTF-8"); | |
response.setHeader("Content-Type", "application/json"); | |
response.setContentType("application/json"); | |
String data = request.getParameter("dataXml"); | |
log.info("Received :{}", data); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment