RuleHelper extends Helper implements SessionManager { public Map<String, String> getHeaders(String type, Object target) { HeadersAccessor accessor = getHeadersAccessor(type); if (accessor != null) { Map<String, String> ret = accessor.getHeaders(target); return ret; } return null; } protected  RuleHelper(Rule rule); String getRuleName(); TraceCollector collector(); String createUUID(); String getID(String type, Object obj); boolean isInstanceOf(Object obj, Class<?> clz); T cast(Object obj, Class<T> clz); String simpleClassName(Object obj); String toString(Object obj); int hashCode(Object obj); String formatSQL(Object obj, Object expr); String faultName(Object fault); String faultDescription(Object fault); String removeSuffix(String original, String suffix); String removeAfter(String original, String marker); ArrayBuilder createArrayBuilder(); Map<String, String> getHeaders(String type, Object target); @Override boolean activate(String uri, String operation, String id); @Override boolean activate(String uri, String operation); @Override boolean isActive(); @Override void deactivate(); @Override void retainNode(String id); @Override void releaseNode(String id); @Override Node retrieveNode(String id); @Override void initiateCorrelation(String id); @Override boolean isCorrelated(String id); @Override void correlate(String id); @Override void completeCorrelation(String id, boolean allowSpawn); @Override void unlink(); @Override void suppress(); @Override void ignoreNode(); @Override void assertComplete(); String getTraceId(); String getTransactionName(); String getLevel(); void initInBuffer(Object obj); boolean isInBufferActive(Object obj); void appendInBuffer(Object obj, byte[] data, int offset, int len, boolean close); void recordInBuffer(Object obj); void initOutBuffer(Object obj); boolean isOutBufferActive(Object obj); void appendOutBuffer(Object obj, byte[] data, int offset, int len, boolean close); void recordOutBuffer(Object obj); boolean isInProcessed(); boolean isInContentProcessed(); boolean isOutProcessed(); boolean isOutContentProcessed(); OutputStream createInOutputStream(OutputStream os); OutputStream createInOutputStream(OutputStream os, String linkId); OutputStream createOutOutputStream(OutputStream os); OutputStream createOutOutputStream(OutputStream os, String linkId); InputStream createInInputStream(InputStream is); InputStream createOutInputStream(InputStream is); @Override void setState(Object context, String name, Object value, boolean session); @Override Object getState(Object context, String name, boolean session); static final String BINARY_SQL_MARKER; }
@Test public void testHeaders() { RuleHelper helper = new RuleHelper(null); TestHeadersObject target = new TestHeadersObject(); target.getProperties().put("hello", "world"); Map<String, String> headers = helper.getHeaders(TestHeadersObject.class.getName(), target); assertNotNull(headers); assertEquals(1, headers.size()); assertEquals("world", headers.get("hello")); }