1 7 package com.inversoft.junit; 8 9 10 import java.net.HttpURLConnection ; 11 import java.io.InputStream ; 12 import java.io.IOException ; 13 import java.util.Map ; 14 import javax.servlet.http.Cookie ; 15 16 17 24 public class Response { 25 26 private Request request; 27 private int status; 28 String text; 29 private HttpURLConnection connection; 30 private InputStream inputStream; 31 private Map cookies; 32 33 34 47 public Response(Request request, int status, String text, 48 HttpURLConnection connection, InputStream inputStream, Map cookies) 49 { 50 this.request = request; 51 this.status = status; 52 this.text = text; 53 this.connection = connection; 54 this.inputStream = inputStream; 55 this.cookies = cookies; 56 } 57 58 59 64 public int getStatus() { 65 return status; 66 } 67 68 73 public Request getRequest() { 74 return request; 75 } 76 77 84 public HttpURLConnection getConnection() { 85 return connection; 86 } 87 88 95 public String getText() { 96 return text; 97 } 98 99 108 public InputStream getInputStream() throws IOException { 109 return inputStream; 110 } 111 112 120 public Cookie getCookie(String name) { 121 return (Cookie ) cookies.get(name); 122 } 123 124 130 public Cookie [] getCookies() { 131 return (Cookie []) cookies.values().toArray(new Cookie [0]); 132 } 133 } 134 | Popular Tags |