为什么我得到错误:java.io.IOException:无效的标头字段

时间:2012-10-09 14:12:43

标签: java web-services resteasy

听到这是我学生的pojo课程......

 public class Student {

 private int id;

 private String name;

 private String address;

 private String gender;

 private String emailId;

 private String contactNo;
//setter getter

我将在下面开发一个列表类的学生:

public class StudentList {

@XmlElement
private List<Student> slist ;

public StudentList(List<Student> slist){
    this.slist= slist;
}//setter getter

我的学生服务课程如下:

  public class StudentService extends Application {
@GET
@Path("student/read") 
@Produces("application/json")      
@GZIP  public StudentList readstudent(@Context HttpServletRequest request){

    StudentList slistDetail = new StudentList();

    List<Student> s = new ArrayList<Student>();

    for(int i=0; i<50; i++)
    {
        Student st = new Student();
        st.setId(i);
        st.setName("name "+ i);
        st.setAddress("address "+ i);
        st.setContactNo("12345"+i);
        st.setEmailId("email"+i+"@gmail.com");
        st.setGender("m");

        s.add(st);
    }
    slistDetail.setSlist(s);
    return slistDetail;
}

Web.xml`

<context-param>
  <param-name>javax.ws.rs.core.Application</param-name>
  <param-value>com.service.StudentService</param-value>

 <listener>
  <listener-class>
     org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap
  </listener-class>

<servlet>
  <servlet-name>Resteasy</servlet-name>
  <servlet-class>
     org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher
  </servlet-class>

我发现以下错误:

java.io.IOException: invalid header field
at java.util.jar.Attributes.read(Unknown Source)
at java.util.jar.Manifest.read(Unknown Source)
at java.util.jar.Manifest.<init>(Unknown Source).....

所以,请告诉我为什么会出现这种类型的错误...提前谢谢

0 个答案:

没有答案