The difference with having support using the Responders solution is that they are per route. The suggested feature would be "global", for all routes, as I see it.
Perhaps we can achieve this by enabling route endpoints to fire an event like we did for the TODO app instead:
The endpoint method login above will fire a response header event with the auth token for the logged in user. In the TODO app, the CustomMediaTypeResponder @Observes this event and will set those header of the HttpServletResponse.
How about we move the ResponseHeaders (maybe call it something different) to the controller and build in the @Observer method into AbstractRestResponder. This way the "only" thing a developer has to do is fire the events with the header names and values that he/she wants to have set.
ResponseHeaders (which should really be have methods for adding more headers I just realized..doh) looks like this:
public class ResponseHeaders {
private Map<String, String> headers = new HashMap<String, String>();
public ResponseHeaders(finalString name, finalString value) {
headers.put(name, value);
}
public Map<String, String> getHeaders() {
return Collections.unmodifiableMap(headers);
}
}
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
The difference with having support using the Responders solution is that they are per route. The suggested feature would be "global", for all routes, as I see it.
Perhaps we can achieve this by enabling route endpoints to fire an event like we did for the TODO app instead:
The endpoint method login above will fire a response header event with the auth token for the logged in user. In the TODO app, the CustomMediaTypeResponder @Observes this event and will set those header of the HttpServletResponse.
How about we move the ResponseHeaders (maybe call it something different) to the controller and build in the @Observer method into AbstractRestResponder. This way the "only" thing a developer has to do is fire the events with the header names and values that he/she wants to have set.
ResponseHeaders (which should really be have methods for adding more headers I just realized..doh) looks like this: