avoided NPE in example

This commit is contained in:
Greg Wilkins 2016-05-04 10:53:05 +10:00
parent 90110659e2
commit a32e3a2091
1 changed files with 4 additions and 2 deletions

View File

@ -179,8 +179,10 @@ public class Http2Server
content+="session="+session.getId()+(session.isNew()?"(New)\n":"\n");
content+="date="+new Date()+"\n";
for (Cookie c : request.getCookies())
content+="cookie "+c.getName()+"="+c.getValue()+"\n";
Cookie[] cookies = request.getCookies();
if (cookies!=null && cookies.length>0)
for (Cookie c : cookies)
content+="cookie "+c.getName()+"="+c.getValue()+"\n";
response.setContentLength(content.length());
response.getOutputStream().print(content);