views:

165

answers:

1

Hi, I try to publish Atom feed (generated with Rome) using Java 6 SE httpserver. For correct feed discovery in FireFox I need custom headers.

This is my code:

 Headers headers=e.getRequestHeaders();
 ArrayList<String>list=new ArrayList<String>();
 list.add("application/atom+xml");
 headers.put("content-type", list);
 e.sendResponseHeaders(200, 0);

Unfortunately feed is displaying like xml (browser doesn't, ask me what to do with feed) and sniffing with livehttpheaders shows that there isn't content-type attribute.

+1  A: 

You can set the response headers like this:

Headers headers = exchange.getResponseHeaders();
headers.add("Content-Type", "application/atom+xml");
exchange.sendResponseHeaders(200, 0);
Tony Edgecombe