/** * Copy the provided additional headers to the Netty's HttpMessage. * * @param message * @param headers */ protected void setAdditionalHeaders(HttpMessage message, Map<String, Object> headers) { for (String key : headers.keySet()) { String header = (String)headers.get(key); message.addHeader(key, headerCleanerPattern.matcher(header).replaceAll(" ")); } }
/** * Set the required headers in the Netty's HttpMessage to allow for proper authorization. * * @param message * @param callProps * @throws IOException */ protected void setAuthorization(HttpMessage message, Map<String, Object> callProps) throws IOException { //Get authentication type, default to BASIC authetication String authType = (String)callProps.get(StubExt.PROPERTY_AUTH_TYPE); if (authType == null) authType = StubExt.PROPERTY_AUTH_TYPE_BASIC; String username = (String)callProps.get(Stub.USERNAME_PROPERTY); String password = (String)callProps.get(Stub.PASSWORD_PROPERTY); if (username != null && password != null) { if (authType.equals(StubExt.PROPERTY_AUTH_TYPE_BASIC)) { message.addHeader(HttpHeaders.Names.AUTHORIZATION, getBasicAuthHeader(username, password)); } } }