1

I want to insert a new (key -> value) pair in response header from Endeca Assembler. Is it possible to do this?

Thanks

user_1357
  • 7,766
  • 13
  • 63
  • 106

2 Answers2

0

First of all, I want to clarify some things because the terminology about Assembler can get a little confusing. I'm not sure how you have designed your program, but just keep in mind that Assembler is just a Java API, so it's kind of unclear to say something like "response header from Endeca Assembler". That statement seems to imply that Assembler is a webservice, but it isn't. In my experience, people commonly mistakenly refer to the discover-data (Discover service) example app as "Assembler" or "Assembler Service", but it really isn't a general-purpose webservice; it's designed as a reference application to be used specifically with the Discover dataset (But people still use discover-data as a starting point for building production-facing applications). So, bear in mind that I'm not exactly sure what you are referring to.

Anyway, somewhere in your code, you should have a call of something like "contentItem.assemble()", which runs your cartridge handlers on that content item and returns an object of type ContentItem. In the Discover webapp, it then serializes this content item to JSON or XML or renders a JSP page (depending on the request parameters). I assume your application does something similar.

It's a simple matter of adding properties to ContentItem, because ContentItem implements map. So, you can do something like this:

ContentItem responseContentItem = contentItem.assemble();
responseContentItem.put("myKey","myValue");
...continue by serializing responseContentItem or whatever you want to do with it
chairbender
  • 839
  • 6
  • 14
0

Do like this:

responseContentItem.put("key", "value");

as the resposne from Endeca Assembler is simply a Map.

KrishPrabakar
  • 2,824
  • 2
  • 31
  • 44