File src/de/openrat/client/util/HttpResponse.java

Last commit: Fri Sep 30 22:45:01 2016 +0200	dankert	first version of the java api.
1 /* 2 OpenRat Java-Client 3 Copyright (C) 2009 Jan Dankert 4 5 This library is free software; you can redistribute it and/or 6 modify it under the terms of the GNU Library General Public 7 License as published by the Free Software Foundation; either 8 version 2 of the License, or (at your option) any later version. 9 10 This library is distributed in the hope that it will be useful, 11 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 Library General Public License for more details. 14 15 You should have received a copy of the GNU Library General Public 16 License along with this library; if not, write to the 17 Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, 18 Boston, MA 02110-1301, USA. 19 20 */ 21 package de.openrat.client.util; 22 23 /** 24 * API-Request to the OpenRat Content Management System. <br> 25 * <br> 26 * The call to the CMS server is done via a (non-SSL) HTTP connection.<br> 27 * <br> 28 * Before a call you are able to set some key/value-pairs as parameters. After 29 * calling the CMS a DOM-document is returned, which contains the server 30 * response.<br> 31 * Example <br> 32 * 33 * <pre> 34 * CMSRequest request = new CMSRequest(&quot;your.openrat.example.com&quot;); 35 * // prints tracing information to stdout. 36 * request.trace = true; 37 * try 38 * { 39 * request.parameter.put(&quot;action&quot;, &quot;index&quot;); 40 * request.parameter.put(&quot;subaction&quot;, &quot;showlogin&quot;); // login page 41 * request.parameter.put(&quot;...&quot;, &quot;...&quot;); 42 * Document response = request.call(); 43 * // now traverse through the dom tree and get your information. 44 * } 45 * catch (IOException e) 46 * { 47 * // your error handling. 48 * } 49 * </pre> 50 * 51 * @author Jan Dankert 52 */ 53 public class HttpResponse 54 { 55 56 private HttpHeaderMap responseHeader = new HttpHeaderMap(); 57 private String payload; 58 59 private HttpStatus httpStatus; 60 61 /** 62 * Inhalt des Feldes <code>payload</code>. 63 * 64 * @return payload 65 */ 66 public String getPayload() 67 { 68 return payload; 69 } 70 71 /** 72 * Setzt das Feld <code>payload</code>. 73 * 74 * @param payload 75 * payload 76 */ 77 public void setPayload(String payload) 78 { 79 this.payload = payload; 80 } 81 82 /** 83 * Inhalt des Feldes <code>responseHeader</code>. 84 * 85 * @return responseHeader 86 */ 87 public HttpHeaderMap getResponseHeader() 88 { 89 return responseHeader; 90 } 91 92 /** 93 * Inhalt des Feldes <code>httpStatus</code>. 94 * 95 * @return httpStatus 96 */ 97 public HttpStatus getHttpStatus() 98 { 99 return httpStatus; 100 } 101 102 /** 103 * Setzt das Feld <code>httpStatus</code>. 104 * 105 * @param httpStatus 106 * httpStatus 107 */ 108 public void setHttpStatus(HttpStatus httpStatus) 109 { 110 this.httpStatus = httpStatus; 111 } 112 113 }
Download src/de/openrat/client/util/HttpResponse.java
History Fri, 30 Sep 2016 22:45:01 +0200 dankert first version of the java api.