java.lang.IllegalArgumentException: java.text.ParseException: End of header

痴心易碎 提交于 2019-12-02 07:12:46

I resolved the issue by changing the getEmplByPostReqParam() as follows:

@POST
@Path("/get")
public Response getEmplByPostReqParam(@FormParam("param1") String id) {
    System.out.println("getEmplByPostReqParam");
    EmployeeDAO dbHandler = new EmployeeDAOImpl();
    Employee fetchedEmployee = dbHandler.findEmployee(Integer.parseInt(id));
    ResponseBuilder rb = new ResponseBuilderImpl();
    rb.type(MediaType.APPLICATION_ATOM_XML);
    rb.entity(fetchedEmployee);
    return rb.build();
}

This is working fine for me, if their is some better approach or their is something wrong with this approach, please post comment.

If you notice your annotation (@Produces) argument is passed in double quotes. remove the double quotes and it should work

@Produces("MediaType.TEXT_PLAIN")

should look like below

@Produces(MediaType.TEXT_PLAIN)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!