Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events

parameter value is "null" || Rest endpoint Adaptive form


Level 4


I am submitting my form to a rest endpot which is a slingservlet with metho= POST. The request parameters are null in the my servlet implementation

After some debugging, I can see that my request is coming upto foundation class-  /libs/fd/af/components/guidesubmittype/restendpoint/post.POST.jsp 

Then it is sent to my custom servlet which I configured in the form. Here, the statement # 96 is being called w/o updating the 'new' values and is being called with original parameter and my actual parameters are missing (refer attached file)

SlingHttpServletResponse wrappedResponse = GuideUtils.processInternalPostOnRestEndPoint(slingRequest, slingResponse, postUrl);

servlet snippet.

protected void doGet(SlingHttpServletRequest request, SlingHttpServletResponse response) throws ServletException, IOException { String username = request.getParameter("username"); ... }

Is there a any other way I can update the request object here within the context ?


2 Replies


Level 4

Since the form Adaptive form uses - contentType: 'application/x-www-form-urlencoded',

I am able to retrieve the form parameters. The parameter name I was looking for is - "_guideValuesMap"

Iterator<RequestParameter> reqParamsIterator = request.getRequestParameterList().iterator(); while(reqParamsIterator.hasNext() ){ reqParam = reqParamsIterator.next(); if(reqParam.isFormField() && reqParam.getName().equals("_guideValuesMap")){ formParams = reqParam.getString(); try { parsed= new JSONObject(formParams); field1 = (String) parsed.get("field1"); field2 = (String) parsed.get("field2"); } catch (JSONException e) { LOG.error(e.getMessage()); } } }


Can anyone confirm if it is safe / correct or is it expected to be in another parameter / field name