@java.lang.Override
public java.lang.String executeAction() throws Exception
{
// BEGIN USER CODE
Optional<IMxRuntimeRequest> optionalMXRequest = getContext().getRuntimeRequest();
if(optionalMXRequest.isEmpty()) {
LOG.error("Context has empty IMXRuntimeRequest");
throw new Exception("No IMxRuntimeRequest found");
}
LOG.debug("Context has IMXRuntimeRequest");
IMxRuntimeRequest request = optionalMXRequest.get();
LOG.debug("request headers start");
Enumeration<String> headerNames = request.getHttpServletRequest().getHeaderNames();
String value = "";
while(headerNames.hasMoreElements()) {
if(this.Key==((String) headerNames.nextElement())) {
value = request.getHeader(this.Key);
LOG.debug(this.Key+":"+value);
}
}
if(value=="") {
LOG.error("Header with Key:"+this.Key+" Does not exist");
throw new Exception("Header not found");
}
LOG.debug("request headers end");
return value;
// END USER CODE
}
Hi Alwyn,
Make sure you have an httpRequest parameter in your webservice microflow, then you can just do a retrieve by association from $httpRequest/HttpHeaders
Hi ,
Have you tried using JamCommons ? it has a javaaction to get header value https://marketplace.mendix.com/link/component/71280
Hope this helps.
Thanks