summaryrefslogtreecommitdiffstats
path: root/simple/simple-http/src/main/java/org/simpleframework/http/StatusLine.java
blob: 3ea0f162a0c30dcdb3018dcfa84f2624aed3378c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
/*
 * StatusLine.java February 2001
 *
 * Copyright (C) 2001, Niall Gallagher <niallg@users.sf.net>
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 
 * implied. See the License for the specific language governing 
 * permissions and limitations under the License.
 */
 
package org.simpleframework.http;

/**
 * The <code>StatusLine</code> is used to represent a HTTP status 
 * line. This provides several convenience methods that can be used 
 * to manipulate a HTTP status line. see the RFC (RFC 2616) for the 
 * syntax of a status line.
 *
 * @author Niall Gallagher
 */ 
public interface StatusLine {

   /**
    * This represents the status code of the HTTP response. 
    * The response code represents the type of message that is
    * being sent to the client. For a description of the codes
    * see RFC 2616 section 10, Status Code Definitions. 
    *
    * @return the status code that this HTTP response has
    */ 
   int getCode();
     
   /**
    * This method allows the status for the response to be 
    * changed. This MUST be reflected the the response content
    * given to the client. For a description of the codes see
    * RFC 2616 section 10, Status Code Definitions.
    *
    * @param code the new status code for the HTTP response
    */ 
   void setCode(int code);

   /**
    * This can be used to retrieve the text of a HTTP status
    * line. This is the text description for the status code.
    * This should match the status code specified by the RFC.
    *
    * @return the message description of the response
    */ 
   String getDescription();

   /**
    * This is used to set the text of the HTTP status line.
    * This should match the status code specified by the RFC.
    *
    * @param text the descriptive text message of the status
    */ 
   void setDescription(String text);
   
   /**
    * This is used to acquire the status from the response. 
    * The <code>Status</code> object returns represents the
    * code that has been set on the response, it does not
    * necessarily represent the description in the response.
    * 
    * @return this is the response for this status line
    */
   Status getStatus();
   
   /**
    * This is used to set the status code and description
    * for this response. Setting the code and description in
    * this manner provides a much more convenient way to set
    * the response status line details.
    * 
    * @param status this is the status to set on the response
    */
   void setStatus(Status status);

   /**
    * This can be used to get the major number from a HTTP
    * version. The major version corresponds to the major 
    * type that is the 1 of a HTTP/1.0 version string.
    *
    * @return the major version number for the response
    */ 
   int getMajor();

   /**
    * This can be used to specify the major version. This
    * should be the major version of the HTTP request.
    *
    * @param major this is the major number desired
    */ 
   void setMajor(int major);

   /**
    * This can be used to get the minor number from a HTTP
    * version. The major version corresponds to the minor
    * type that is the 0 of a HTTP/1.0 version string.
    *
    * @return the major version number for the response
    */ 
   int getMinor();
   
   /**
    * This can be used to specify the minor version. This
    * should not be set to zero if the HTTP request was 
    * for HTTP/1.1. The response must be equal or higher.
    *
    * @param minor this is the minor number desired
    */ 
   void setMinor(int minor);
}