MCPcopy Create free account
hub / github.com/beanshell/beanshell / run

Method run

src/bsh/util/Httpd.java:87–132  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

85 }
86
87 public void run()
88 {
89 try
90 {
91 in = new BufferedReader( new InputStreamReader(
92 client.getInputStream() ) );
93 out = client.getOutputStream();
94 pout = new PrintStream(out);
95
96 String request = in.readLine();
97 if ( request == null )
98 error(400, "Empty Request");
99
100 if(request.toLowerCase().indexOf("http/1.") != -1)
101 {
102 String s;
103 while((!(s = in.readLine()).equals("")) && (s != null))
104 { ; }
105
106 isHttp1 = true;
107 }
108
109 StringTokenizer st = new StringTokenizer(request);
110 if(st.countTokens() < 2)
111 error(400, "Bad Request");
112 else
113 {
114 String command = st.nextToken();
115 if(command.equals("GET"))
116 serveFile(st.nextToken());
117 else
118 error(400, "Bad Request");
119 }
120
121 client.close();
122 }
123 catch(IOException e)
124 {
125 System.out.println("I/O error " + e);
126 try
127 {
128 client.close();
129 }
130 catch(Exception e2) { }
131 }
132 }
133
134 private void serveFile(String file)
135 throws FileNotFoundException, IOException

Callers

nothing calls this directly

Calls 7

errorMethod · 0.95
serveFileMethod · 0.95
getInputStreamMethod · 0.80
getOutputStreamMethod · 0.80
printlnMethod · 0.65
equalsMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected