l Server:包含有关文本以标识响应的服务器。该头只有以下的信息:
Server: Apache/1.3.14(Unix) PHP/4.0.4
l User-Agent:该请求头标的作用是为服务器标识当前用户的,在MIDP2.0规范中并没有要求MIDlet一定要设置User-Agent属性。下面的片段代码演示了设置User-Agent域的版本号为该设备上CLDC和MIDP实现的版本号的方法
StringBuffer sb=new StringBuffer(60;
sb.append(“Configuration/”);
sb.append(System.getProperty(“microedition.configuration”));
String prof=System.getProperty(“microedition.profiles”);
int i=0;int j=0;
while ((j=prof.indexof(‘’,i))!=-1){
sb.append(“ Profile/”);
sb.append(prof.substring(i,j));
i=j+i;
}
sb.append(“ Profile/”);
sb.append(prof.substring(i));
c.setRequestProperty(“User-agent”,sb.toString());
l Accept-Language:用来设置使用指定的语言请求文档。该请求头的属性一般可以设置为系统属性microedition.locale,还是来看一下代码片段:
String locale=System.getProperty(“microedition.locale”);
if(locale!=null){
c.setRequestProperty(“Accept-Language”,locale);
}