1 /* 2 * Copyright (C) 2018, Thomas Wolf <thomas.wolf@paranor.ch> and others 3 * 4 * This program and the accompanying materials are made available under the 5 * terms of the Eclipse Distribution License v. 1.0 which is available at 6 * https://www.eclipse.org/org/documents/edl-v10.php. 7 * 8 * SPDX-License-Identifier: BSD-3-Clause 9 */ 10 package org.eclipse.jgit.internal.transport.sshd.proxy; 11 12 /** 13 * A very simple representation of a HTTP status line. 14 */ 15 public class StatusLine { 16 17 private final String version; 18 19 private final int resultCode; 20 21 private final String reason; 22 23 /** 24 * Create a new {@link StatusLine} with the given response code and reason 25 * string. 26 * 27 * @param version 28 * the version string (normally "HTTP/1.1" or "HTTP/1.0") 29 * @param resultCode 30 * the HTTP response code (200, 401, etc.) 31 * @param reason 32 * the reason phrase for the code 33 */ 34 public StatusLine(String version, int resultCode, String reason) { 35 this.version = version; 36 this.resultCode = resultCode; 37 this.reason = reason; 38 } 39 40 /** 41 * Retrieves the version string. 42 * 43 * @return the version string 44 */ 45 public String getVersion() { 46 return version; 47 } 48 49 /** 50 * Retrieves the HTTP response code. 51 * 52 * @return the code 53 */ 54 public int getResultCode() { 55 return resultCode; 56 } 57 58 /** 59 * Retrieves the HTTP reason phrase. 60 * 61 * @return the reason 62 */ 63 public String getReason() { 64 return reason; 65 } 66 }