set content type

git-svn-id: http://jclouds.googlecode.com/svn/trunk@416 3d8758e0-26b5-11de-8745-db77d3ebf521
This commit is contained in:
adrian.f.cole 2009-05-05 20:51:47 +00:00
parent f854f1fa40
commit c20e124dad

View File

@ -55,15 +55,16 @@ public class JCloudsServlet extends HttpServlet {
protected void doGet(HttpServletRequest httpServletRequest, protected void doGet(HttpServletRequest httpServletRequest,
HttpServletResponse httpServletResponse) throws ServletException, HttpServletResponse httpServletResponse) throws ServletException,
IOException { IOException {
httpServletResponse.setContentType("text/plain");
Writer writer = httpServletResponse.getWriter(); Writer writer = httpServletResponse.getWriter();
try { try {
List<S3Bucket> myBuckets = context.getConnection().getBuckets() List<S3Bucket> myBuckets = context.getConnection().getBuckets()
.get(10, TimeUnit.SECONDS); .get(10, TimeUnit.SECONDS);
writer.write("List:\n"); writer.write("List:\n");
for (S3Bucket bucket : myBuckets) { for (S3Bucket bucket : myBuckets) {
writer.write(String.format(" %1s: %2s entries%n", bucket writer.write(String
.getName(), context.createInputStreamMap(bucket) .format(" %1s: %2s entries%n", bucket.getName(),
.size())); context.createInputStreamMap(bucket).size()));
} }
} catch (Exception e) { } catch (Exception e) {
throw new ServletException(e); throw new ServletException(e);