-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhttps_status.TXT
More file actions
96 lines (75 loc) · 2.07 KB
/
https_status.TXT
File metadata and controls
96 lines (75 loc) · 2.07 KB
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
public class HTTP_Status {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner scan = new Scanner(System.in);
System.out.println("Enter status code:");
int status = scan.nextInt();
switch(status) {
case 200:
System.out.println("OK");
break;
case 201:
System.out.println("Created");
break;
case 202:
System.out.println("Accepted");
break;
case 301:
System.out.println("Moved Permanently");
break;
case 303:
System.out.println("See Other");
break;
case 304:
System.out.println("Not Modified");
break;
case 307:
System.out.println("Temporary Redirect");
break;
case 400:
System.out.println("Bad Request");
break;
case 401:
System.out.println("Unauthorized");
break;
case 403:
System.out.println("Forbidden");
break;
case 404:
System.out.println("Not Found");
break;
case 410:
System.out.println("Gone");
break;
case 500:
System.out.println("Internal Server Error");
break;
case 503:
System.out.println("Service Unavailable");
break;
default:
System.out.println("Invalid status code!");
}
/*HTTP is the protocol that governs communications between web servers and web clients (i.e. browsers). Part of the protocol includes a status code returned by the server to tell the browser the status of its most recent page request. Some of the codes and their meanings are listed below:
STATUS CODES
200, OK
201, Created
202, Accepted
301, Moved Permanently
303, See Other
304, Not Modified
307, Temporary Redirect
400, Bad Request
401, Unauthorized
403, Forbidden
404, Not Found
410, Gone
500, Internal Server Error
503, Service Unavailable
Given an int variable status, write a switch statement that prints out, on a line by itself, the appropriate label from the above list based on status. Otherwise, print warning message: "Invalid status code!".
Example:
Display message: "Enter status code:"
input: 200
Display message: "OK"*/
}
}