@SuppressWarnings("unchecked") @Override public Response process(Request request, Execution execution) { // process the request request.properties().set("foo", "bar"); // pass it down the chain to get a response Response response = execution.process(request); // process the response response.data().add(new StringData(request, message)); // return the response up the chain return response; }
@Override public Response process(Request request, Execution execution) { Response r = new Response(request); @SuppressWarnings("unchecked") DataList<Data> current = r.data(); DataList<Data> previous = null; String exampleProperty = request.properties().getString(DemoHandler.REQUEST_URI); Object o = request.properties().get(AnnotatingProcessor.DemoProperty.NAME_AS_COMPOUND); if (exampleProperty != null) { current.add(new DemoData(request, exampleProperty)); } if (o instanceof AnnotatingProcessor.DemoProperty) { // create a nested result set with a level for each term for (String s : ((AnnotatingProcessor.DemoProperty) o).terms()) { String normalized = termChecker.normalize(s); DemoData data = new DemoData(request, normalized); if (current == null) { current = ArrayDataList.create(request); } current.add(data); if (previous != null) { previous.add(current); } previous = current; current = null; } } return r; }