📄 简单的用 java socket 编写的 http 服务器应用,帮助学习http协议.htm
字号:
style="COLOR: #000000"> Integer.parseInt(args[</SPAN><SPAN
style="COLOR: #000000">0</SPAN><SPAN
style="COLOR: #000000">]);<BR> }<BR> } </SPAN><SPAN
style="COLOR: #0000ff">catch</SPAN><SPAN
style="COLOR: #000000"> (Exception ex) {<BR> System.err.println(</SPAN><SPAN
style="COLOR: #000000">"</SPAN><SPAN
style="COLOR: #000000">Invalid port arguments. It must be a integer that greater than 0</SPAN><SPAN
style="COLOR: #000000">"</SPAN><SPAN
style="COLOR: #000000">);<BR> }<BR> <BR> </SPAN><SPAN
style="COLOR: #0000ff">new</SPAN><SPAN
style="COLOR: #000000"> SimpleHttpServer();<BR> }<BR> <BR>}</SPAN> <BR></DIV></DIV></DIV>
<TABLE>
<TBODY>
<TR>
<TD></TD></TR></TBODY></TABLE>
<SCRIPT type=text/javascript><!--
google_ad_client = "pub-6625678643128649";
google_ad_width = 728;
google_ad_height = 90;
google_ad_format = "728x90_as";
google_ad_type = "text_image";
google_ad_channel = "";
//-->
</SCRIPT>
<SCRIPT
src="简单的用%20Java%20Socket%20编写的%20HTTP%20服务器应用,帮助学习HTTP协议_files/show_ads.js"
type=text/javascript>
</SCRIPT>
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<TR>
<TD class=p2 align=right bgColor=#fdf9e7 height=22><A
href="http://www.360doc.com/showWeb/0/5/649453.aspx">上一篇</A> <A
href="http://www.360doc.com/showWeb/0/5/647586.aspx">下一篇</A> (<A
href="http://www.360doc.com/UserHome/36481.aspx">小啸笑</A>的分类目录[<A
href="http://www.360doc.com/UserArt.aspx?UserID=36481&CategoryID=5&GroupID=-1">JAVA开发</A>]中共49篇)
</TD></TR></TBODY></TABLE>
<TABLE>
<TBODY>
<TR>
<TD class=p4 height=20><A id=HyperLink2
href="http://www.google.cn/search?hl=zh-CN&q=println%2bhttp%2bsocket&lr=lang_zh-CN"
target=_blank>以文找文</A><IMG
src="简单的用%20Java%20Socket%20编写的%20HTTP%20服务器应用,帮助学习HTTP协议_files/new.gif">:搜索互联网上的相关文章</TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<TR>
<TD class=p2 bgColor=#fffcf4>相关文章</TD></TR>
<TR>
<TD align=middle height=2></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=1 cellPadding=0 width="100%" border=0>
<TBODY>
<TR>
<TD class=p3 vAlign=top>
<TABLE id=DataList1 style="WIDTH: 100%; BORDER-COLLAPSE: collapse"
cellSpacing=0 border=0>
<TBODY>
<TR>
<TD>
<DIV class=p2>• <A id=DataList1__ctl0_HyperLink1
title='Servlet学习笔记(六)-----Servlet之间的通信 这是4个Servlet之间的通信。out.println("&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp");(cLoan_id char(10) not null references Loan(cLoan_id),cLoan_Registration_id char(10) not null references Loan_Registration(cLoan_Registration_id),raiserror(‘Inserting EarnestBank_Counter....‘,0,1)insert into Counter values(‘CT0001‘,‘Hummingway Street NY‘, 8000, '
href="http://www.360doc.com/showWeb/0/0/649017.aspx"
target=_blank>Servlet学习笔记(六)-----Servlet之间的通信</A> <NOBR><FONT
color=#6f6f6f size=1> 07.08.02 </FONT> <FONT
color=#008000 size=1>from <A class=p5 id=DataList1__ctl0_Hyperlink4
href="http://www.360doc.com/UserHome/26823.aspx"
target=_blank>N_once</A></FONT></NOBR> </DIV></TD></TR>
<TR>
<TD>
<DIV class=p2>• <A id=DataList1__ctl1_HyperLink1
title="WWW的核心——HTTP协议。HTTP/1.0的响应消息格式如下: 响应消息=状态行(通用信息头|响应头|实体头) CRLF 〔实体内容〕 状 态 行=HTTP版本号 状态码 原因叙述 状态码表示响应类型 1** 保留 2** 表示请求成功地接收 3** 为完成请求客户需进一步细化请求 4** 客户错误 5** 服务器错误 响应头的信息包括:服务程序名,通知客户请求的URL需要认证,请求的资源何时能使用。"
href="http://www.360doc.com/showWeb/0/0/648423.aspx"
target=_blank>WWW的核心——HTTP协议 - song2004_2008的专栏 - CSDNBlog</A>
<NOBR><FONT color=#6f6f6f size=1> 07.08.01
</FONT> <FONT color=#008000 size=1>from <A class=p5
id=DataList1__ctl1_Hyperlink4
href="http://www.360doc.com/UserHome/36481.aspx"
target=_blank>小啸笑</A></FONT></NOBR> </DIV></TD></TR>
<TR>
<TD>
<DIV class=p2>• <A id=DataList1__ctl2_HyperLink1
title="Http( 超文本传输协议及HTTP包)HTTP协议是一种请求-应答式的协议——客户端发送一个请求,服务器返回该请求的应答,所有的请求与应答都是HTTP包。HTTP的第一个版本是HTTP/0.9,后来发展到了HTTP/1.0,现在最新的版本是HTTP/1.1。HTTP请求包 HTTP请求包(GET、POST等请求方法)由三个部分构成,分别是:方法-URI-协议/版本,请求头,请求正文。"
href="http://www.360doc.com/showWeb/0/0/648417.aspx"
target=_blank>一些网络协议的定义和内容(如Http等) - joephoenix的专栏 - CSDNBl...</A>
<NOBR><FONT color=#6f6f6f size=1> 07.08.01
</FONT> <FONT color=#008000 size=1>from <A class=p5
id=DataList1__ctl2_Hyperlink4
href="http://www.360doc.com/UserHome/36481.aspx"
target=_blank>小啸笑</A></FONT></NOBR> </DIV></TD></TR>
<TR>
<TD>
<DIV class=p2>• <A id=DataList1__ctl3_HyperLink1
title='十步搞定tomcat4.1.18 Servlet中的SQL SERVER2000数据库连接池。5.编写servlet程序JDBCPoolServ.javaimport java.sql.*;import javax.naming.Context;import javax.sql.DataSource;import javax.naming.InitialContext;import javax.servlet.*;import javax.servlet.http.*;import java.io.*;6.编译JDBCPoolServ.java得到JDBCPoolServ.class(注意加入servlet.jar包),将其COPY到"myweb\WEB-INF\classes"下。'
href="http://www.360doc.com/showWeb/0/0/617232.aspx"
target=_blank>十步搞定tomcat4.1.18 Servlet中的SQL SERVER2000数据库连接池</A>
<NOBR><FONT color=#6f6f6f size=1> 07.07.18
</FONT> <FONT color=#008000 size=1>from <A class=p5
id=DataList1__ctl3_Hyperlink4
href="http://www.360doc.com/UserHome/26823.aspx"
target=_blank>N_once</A></FONT></NOBR> </DIV></TD></TR>
<TR>
<TD>
<DIV class=p2>• <A id=DataList1__ctl4_HyperLink1
title='JAVA日期问题总结。Date myDate = new Date();<%@ page import="java.util.Date"%><%@ page import="java.text.DateFormat"%><%.SimpleDateFormat formatter = new SimpleDateFormat("E yyyy.MM.dd ‘at‘ hh:mm:ss a zzz");out.println("It is now "+ formatter.format(now.getTime()));now.add(Calendar.DAY_OF_YEAR,-(365*2));out.println("<br>");out.println('
href="http://www.360doc.com/showWeb/0/0/604523.aspx"
target=_blank>JAVA日期问题总结</A> <NOBR><FONT color=#6f6f6f
size=1> 07.07.10 </FONT> <FONT color=#008000
size=1>from <A class=p5 id=DataList1__ctl4_Hyperlink4
href="http://www.360doc.com/UserHome/36370.aspx"
target=_blank>zhangnet1</A></FONT></NOBR> </DIV></TD></TR></TBODY></TABLE>
<DIV class=p2 align=center><A
href="http://www.360doc.com/showRelevantArt.aspx?ArticleID=648400&ArticleNum=55"><B><FONT
color=#261cdc>>>更多相关文章</FONT></B></A> </DIV></TD></TR></TBODY></TABLE>
<FORM id=showWeb name=showWeb
action=648400.aspx?Cream=0&CategoryID=0&ArticleID=648400
method=post><INPUT type=hidden
value=dDwtMTQyMDEyNTUyNzs7Pn48Z0ai8N1YwjfMOnBRaCR9Db6a name=__VIEWSTATE>
<TABLE id=Reflection cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<TR>
<TD class=p2 bgColor=#fffcf4><SPAN id=Label1></SPAN></TD></TR>
<TR>
<TD></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<TR>
<TD class=p2 bgColor=#fffcf4>发表评论</TD></TR>
<TR>
<TD align=middle height=2></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=1 cellPadding=0 width="100%" border=0>
<TBODY>
<TR>
<TD vAlign=top width=30></TD>
<TD vAlign=top>
<TABLE cellSpacing=0 cellPadding=0 width="80%" border=0>
<TBODY>
<TR>
<TD class=p2 align=middle colSpan=2>游客请<A
href="http://www.360doc.com/login.aspx?type=14&ArticleID=648400">登录</A>后再发表评论!<BR> 您还没<A
href="http://www.360doc.com/register.aspx">注册</A>?30秒快速拥有您的“个人图书馆”!</TD></TR></TBODY></TABLE></TD></TR>
<TR>
<TD height=15></TD></TR></TBODY></TABLE></FORM></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -