@Test public void missingHeaderTest() { framework.addAtmosphereHandler("/*", handler); AtmosphereResponse response = new AtmosphereResponseImpl.Builder() .header("header 1", "header 1 value") .header("header 2", null) .build(); assertEquals(response.getHeaders("header 3"), null); }
@Override public Collection<String> getHeaders(String name) { ArrayList<String> s = new ArrayList<>(); String h; if (name.equalsIgnoreCase("content-type")) { h = headers.get("Content-Type"); } else { h = headers.get(name); } if (headers.containsKey(name)) { s.add(h); } if (servlet30) { Collection<String> r = _r().getHeaders(name); if (r != null && !r.isEmpty()) { s.addAll(r); } } if (!s.isEmpty()) { return Collections.unmodifiableList(s); } return null; }
AtmosphereResponseImpl extends HttpServletResponseWrapper implements AtmosphereResponse, CompletionAware { @Override public Collection<String> getHeaders(String name) { ArrayList<String> s = new ArrayList<>(); String h; if (name.equalsIgnoreCase("content-type")) { h = headers.get("Content-Type"); } else { h = headers.get(name); } if (headers.containsKey(name)) { s.add(h); } if (servlet30) { Collection<String> r = _r().getHeaders(name); if (r != null && !r.isEmpty()) { s.addAll(r); } } if (!s.isEmpty()) { return Collections.unmodifiableList(s); } return null; } }
AtmosphereResponseImpl extends HttpServletResponseWrapper implements AtmosphereResponse, CompletionAware { @Override public Collection<String> getHeaders(String name) { ArrayList<String> s = new ArrayList<>(); String h; if (name.equalsIgnoreCase("content-type")) { h = headers.get("Content-Type"); } else { h = headers.get(name); } if (headers.containsKey(name)) { s.add(h); } if (servlet30) { Collection<String> r = _r().getHeaders(name); if (r != null && !r.isEmpty()) { s.addAll(r); } } if (!s.isEmpty()) { return Collections.unmodifiableList(s); } return null; } AtmosphereResponseImpl(AsyncIOWriter asyncIOWriter, AtmosphereRequest atmosphereRequest, boolean destroyable);  AtmosphereResponseImpl(HttpServletResponse r, AsyncIOWriter asyncIOWriter, AtmosphereRequest atmosphereRequest, boolean destroyable); private  AtmosphereResponseImpl(Builder b); }
AtmosphereResponseImpl extends HttpServletResponseWrapper implements AtmosphereResponse, CompletionAware { @Override public Collection<String> getHeaders(String name) { ArrayList<String> s = new ArrayList<>(); String h; if (name.equalsIgnoreCase("content-type")) { h = headers.get("Content-Type"); } else { h = headers.get(name); } if (headers.containsKey(name)) { s.add(h); } if (servlet30) { Collection<String> r = _r().getHeaders(name); if (r != null && !r.isEmpty()) { s.addAll(r); } } if (!s.isEmpty()) { return Collections.unmodifiableList(s); } return null; } AtmosphereResponseImpl(AsyncIOWriter asyncIOWriter, AtmosphereRequest atmosphereRequest, boolean destroyable);  AtmosphereResponseImpl(HttpServletResponse r, AsyncIOWriter asyncIOWriter, AtmosphereRequest atmosphereRequest, boolean destroyable); private  AtmosphereResponseImpl(Builder b); @Override void destroy(); @Override void destroy(boolean force); @Override boolean destroyed(); @Override void addCookie(Cookie cookie); @Override boolean containsHeader(String name); @Override String encodeURL(String url); @Override String encodeRedirectURL(String url); @Override String encodeUrl(String url); @Override String encodeRedirectUrl(String url); @Override AtmosphereResponse delegateToNativeResponse(boolean delegateToNativeResponse); @Override void sendError(int sc, String msg); @Override void sendError(int sc); @Override void sendRedirect(String location); @Override void setDateHeader(String name, long date); @Override void addDateHeader(String name, long date); @Override void setHeader(String name, String value); @Override void addHeader(String name, String value); @Override void setIntHeader(String name, int value); @Override void addIntHeader(String name, int value); @Override void setStatus(int status); @Override void setStatus(int status, String statusMessage); @Override int getStatus(); @Override ServletResponse getResponse(); @Override String getStatusMessage(); @Override Map<String, String> headers(); @Override String getHeader(String name); @Override Collection<String> getHeaders(String name); @Override Collection<String> getHeaderNames(); @Override void setCharacterEncoding(String charSet); @Override void flushBuffer(); @Override int getBufferSize(); @Override String getCharacterEncoding(); @Override boolean isDestroyable(); @Override AtmosphereResponse destroyable(boolean destroyable); @Override ServletOutputStream getOutputStream(); @Override PrintWriter getWriter(); @Override void setContentLength(int len); @Override void setContentType(String contentType); @Override String getContentType(); @Override boolean isCommitted(); @Override void reset(); @Override void resetBuffer(); @Override void setBufferSize(int size); @Override void setLocale(Locale locale); @Override Locale getLocale(); @Override AsyncIOWriter getAsyncIOWriter(); @Override AtmosphereResponse asyncIOWriter(AsyncIOWriter asyncIOWriter); @Override AtmosphereRequest request(); @Override AtmosphereResponse request(AtmosphereRequest atmosphereRequest); @Override void close(); @Override void closeStreamOrWriter(); @Override AtmosphereResponse write(String data); @Override AtmosphereResponse write(String data, boolean writeUsingOriginalResponse); @Override AtmosphereResponse write(byte[] data); @Override AtmosphereResponse write(byte[] data, boolean writeUsingOriginalResponse); @Override AtmosphereResponse write(byte[] data, int offset, int length); @Override AtmosphereResponse write(byte[] data, int offset, int length, boolean writeUsingOriginalResponse); @Override AtmosphereResource resource(); @Override void setResponse(ServletResponse response); static AtmosphereResponse newInstance(); static AtmosphereResponse newInstance(AtmosphereRequest request); static AtmosphereResponse newInstance(AtmosphereConfig config, AtmosphereRequest request, WebSocket webSocket); static AtmosphereResponse wrap(HttpServletResponse response); @Override String uuid(); @Override String toString(); @Override void onComplete(); @Override boolean completed(); }
AtmosphereResponseImpl extends HttpServletResponseWrapper implements AtmosphereResponse, CompletionAware { @Override public Collection<String> getHeaders(String name) { ArrayList<String> s = new ArrayList<>(); String h; if (name.equalsIgnoreCase("content-type")) { h = headers.get("Content-Type"); } else { h = headers.get(name); } if (headers.containsKey(name)) { s.add(h); } if (servlet30) { Collection<String> r = _r().getHeaders(name); if (r != null && !r.isEmpty()) { s.addAll(r); } } if (!s.isEmpty()) { return Collections.unmodifiableList(s); } return null; } AtmosphereResponseImpl(AsyncIOWriter asyncIOWriter, AtmosphereRequest atmosphereRequest, boolean destroyable);  AtmosphereResponseImpl(HttpServletResponse r, AsyncIOWriter asyncIOWriter, AtmosphereRequest atmosphereRequest, boolean destroyable); private  AtmosphereResponseImpl(Builder b); @Override void destroy(); @Override void destroy(boolean force); @Override boolean destroyed(); @Override void addCookie(Cookie cookie); @Override boolean containsHeader(String name); @Override String encodeURL(String url); @Override String encodeRedirectURL(String url); @Override String encodeUrl(String url); @Override String encodeRedirectUrl(String url); @Override AtmosphereResponse delegateToNativeResponse(boolean delegateToNativeResponse); @Override void sendError(int sc, String msg); @Override void sendError(int sc); @Override void sendRedirect(String location); @Override void setDateHeader(String name, long date); @Override void addDateHeader(String name, long date); @Override void setHeader(String name, String value); @Override void addHeader(String name, String value); @Override void setIntHeader(String name, int value); @Override void addIntHeader(String name, int value); @Override void setStatus(int status); @Override void setStatus(int status, String statusMessage); @Override int getStatus(); @Override ServletResponse getResponse(); @Override String getStatusMessage(); @Override Map<String, String> headers(); @Override String getHeader(String name); @Override Collection<String> getHeaders(String name); @Override Collection<String> getHeaderNames(); @Override void setCharacterEncoding(String charSet); @Override void flushBuffer(); @Override int getBufferSize(); @Override String getCharacterEncoding(); @Override boolean isDestroyable(); @Override AtmosphereResponse destroyable(boolean destroyable); @Override ServletOutputStream getOutputStream(); @Override PrintWriter getWriter(); @Override void setContentLength(int len); @Override void setContentType(String contentType); @Override String getContentType(); @Override boolean isCommitted(); @Override void reset(); @Override void resetBuffer(); @Override void setBufferSize(int size); @Override void setLocale(Locale locale); @Override Locale getLocale(); @Override AsyncIOWriter getAsyncIOWriter(); @Override AtmosphereResponse asyncIOWriter(AsyncIOWriter asyncIOWriter); @Override AtmosphereRequest request(); @Override AtmosphereResponse request(AtmosphereRequest atmosphereRequest); @Override void close(); @Override void closeStreamOrWriter(); @Override AtmosphereResponse write(String data); @Override AtmosphereResponse write(String data, boolean writeUsingOriginalResponse); @Override AtmosphereResponse write(byte[] data); @Override AtmosphereResponse write(byte[] data, boolean writeUsingOriginalResponse); @Override AtmosphereResponse write(byte[] data, int offset, int length); @Override AtmosphereResponse write(byte[] data, int offset, int length, boolean writeUsingOriginalResponse); @Override AtmosphereResource resource(); @Override void setResponse(ServletResponse response); static AtmosphereResponse newInstance(); static AtmosphereResponse newInstance(AtmosphereRequest request); static AtmosphereResponse newInstance(AtmosphereConfig config, AtmosphereRequest request, WebSocket webSocket); static AtmosphereResponse wrap(HttpServletResponse response); @Override String uuid(); @Override String toString(); @Override void onComplete(); @Override boolean completed();  }