133 |
return resp; |
return resp; |
134 |
} catch(FileNotFoundException e) { |
} catch(FileNotFoundException e) { |
135 |
return resf.makeError(404, "Not found"); |
return resf.makeError(404, "Not found"); |
136 |
|
} catch(IllegalArgumentException e) { |
137 |
|
HTTPResponse resp = resf.makeResponse(404, "Not found"); |
138 |
|
resp.setField("Content-Type", "text/plain"); |
139 |
|
Writer w = new OutputStreamWriter(resp.getOutputStream(), "US-ASCII"); |
140 |
|
w.write("404 - Not found\n\n"); |
141 |
|
w.write("The URN in request is invalid."); |
142 |
|
w.write("Requested URI: "+req.getRequestURI()+"\n"); |
143 |
|
w.close(); |
144 |
|
resp.close(); |
145 |
|
return resp; |
146 |
} catch(Exception e) { |
} catch(Exception e) { |
147 |
e.printStackTrace(); |
e.printStackTrace(); |
148 |
return resf.makeError(500, "Internal error"); |
return resf.makeError(500, "Internal error"); |