Content Management and Capture

Content Management and Capture

Come for answers. Stay for best practices. All we’re missing is you.

 View Only
  • 1.  update parameter in HttpServletRequest request

    Posted 09/16/20 11:58 AM

    Hi

    I need to update a parameter template_name in the HttpServletRequest passed before storing the document the required item type (template_name ). I use the the request filter to obtain the values being passed on /cm/addItem.

    Code:

    public String[] getFilteredServices() { return new String[] {"/cm/addItem"}; } public JSONObject filter(PluginServiceCallbacks callbacks, HttpServletRequest request, JSONArtifact jsonRequest) throws Exception { final String methodName = "execute"; callbacks.getLogger().logEntry(this, methodName, request); /** Get item type name. */ final String templateName = request.getParameter("template_name"); /** Get attribute values. */ JSONArray jsonCritera = null; if (jsonRequest != null) { jsonCritera = (JSONArray) jsonRequest; } final String itemType = "NewItemType"; request.setAttribute("template_name", itemType); } callbacks.getLogger().logExit(this, methodName, request); return null; }

    Any suggestions?



    #IBMContentNavigator(ICN)
    #Support
    #SupportMigration


  • 2.  RE: update parameter in HttpServletRequest request

    Posted 09/17/20 01:17 AM

    Have you tried to get it from jsonRequest?

    String templateName = (String) jsonResponse.get("template_name");



    #IBMContentNavigator(ICN)
    #Support
    #SupportMigration


  • 3.  RE: update parameter in HttpServletRequest request

    Posted 09/17/20 09:55 AM

    template_name does not exist in jsonRequest in the Request Filter, only the response filter.

    I managed to resolve the problem using PluginRequestUtil thanks to a colleagues assistance. A whole one liner was the solution :D

    final String itemType = "NewItemType"; PluginRequestUtil.setRequestParameter(request, "template_name", itemType, false);



    #IBMContentNavigator(ICN)
    #Support
    #SupportMigration