2013-04-09 3 views
0

디바이스에 POST HTTP/1.0 요청을 전송하는 UBlox (하드웨어 구성 요소)가 있습니다. 내가 톰캣에서 수신Tomcat이 서블릿을 실행하지 않고 400을 리턴합니다.

헤더는 다음과 같습니다

POST sc2-http-connector-3.0.0/report HTTP/1.0 
Content-Type: application/octet-stream 
Host: xx.xx.xx.xx:8080 
Connection: TE, close 
TE: trailers 
Content-Length: 152 

요청 몸은 실제로 바이너리 데이터입니다. Tomcat은 클라이언트에 400을 반환하고 헤더, 본문 등을 출력하는 서블릿을 실행하지 않습니다.

public void doPost(HttpServletRequest request, HttpServletResponse response) 
     throws ServletException, IOException { 

    System.out.println("getMethod :: " + request.getMethod()); 
    System.out.println("getContentLength :: " + request.getContentLength()); 
    System.out.println("getContentType :: " + request.getContentType()); 
    System.out.println("getProtocol :: " + request.getProtocol()); 
    System.out.println("getRemoteAddr :: " + request.getRemoteAddr()); 
    System.out.println("getRemoteHost :: " + request.getRemoteHost()); 
    System.out.println("getRemotePort :: " + request.getRemotePort()); 
    System.out.println("getRemoteUser :: " + request.getRemoteUser()); 

    printHeaders(request); 

    printByteStream(request.getInputStream()); 

    System.out.println("------------- parts, if any -------------"); 
    for (Part part : request.getParts()) { 
     System.out.println("size :: " + part.getSize()); 
     System.out.println("contentType :: " + part.getContentType()); 
     System.out.println("name :: " + part.getName()); 
     printHeaders(part); 
     printByteStream(part.getInputStream()); 
    } 

    response.setStatus(HttpServletResponse.SC_OK); 
} 

헤더에 문제가없는 것 같습니다. 데이터에 문제가 있다고 생각합니다. 하지만 여전히 Tomcat이 400을 반환하고 서블릿에 제어권을 넘겨주지 않는 이유는 무엇입니까? 어떻게 디버깅 할 수 있습니까?

답변

0

POST 명령의 경로에 슬래시가 없습니다.