السلام عليكــم ورحمـة الله وبركاتــة
انا جالس احاول اصمم خادم ويب يستقبل المدخلات من العميل
ويحاول يفسرها وبعدين يرجع الناتج @@ طبعا انا استخدم HTTP
انا استخدم طريقه معينه واشتغلت معي كويس @ لكن احس انها طريه بدائية وابغى طريقه ثانيه اذا ممكن
هذا الكود :
this.httpRequest = input.readLine();
// http request ---> GET /index.html HTTP/1.1
if(httpRequest.trim().toUpperCase().startsWith("GET")){
// هنا محاولة لتفسير المدخلات واستخراج مسار الملف index.html
String parse = new String(httpRequest);
int start = 0;
int end = 0;
for(int index = 0; index < parse.length(); index++){
if(parse.charAt(index) == ' ' && start != 0){
end = index;
break;
}
if(parse.charAt(index) == ' ' && start == 0){
start = index;
}
}
}
String path = new String();
path = parse.substring(start + 2, end);
FileInputStream requestedFile = null;
requestedFile = new FileInputStream(path);
<b>
</b>
شاكرا ومقدرا استجابتكم لي سلفا