2017-09-27 63 views
0

基本認証で安らかなAPIを作成しましたが、mi IDEとTomcatでうまく動作し、しかし、私はLinuxサーバにそれを展開し、私はerror.logファイルに次のエラーを持っているとき:これは展開の前にうまく機能として、私はこのエラーを持っている理由AH02429:レスポンスヘッダー名 'レコードが作成されました - 'に無効な文字が含まれており、リクエストが中止されました

- AH02429: Response header name 'record Created - ' contains invalid characters, aborting request 

私は理解していません。 サーバーを設定する必要はありますか? 助けてください。

私のコントローラ

@RequestMapping(value={"/record/add/"}, method={org.springframework.web.bind.annotation.RequestMethod.POST}, produces={"application/json"}) 
public ResponseEntity<Employee> createEmployee(@RequestBody Employee employee) { 
    HttpHeaders headers = new HttpHeaders(); 
    if (employee == null) { 
     return new ResponseEntity(HttpStatus.BAD_REQUEST); 
    } 
    employeeService.createEmployee(employee); 
    headers.add("record Created - ", String.valueOf(employee.getId())); 
    return new ResponseEntity(employee, headers, HttpStatus.CREATED); 
} 

私は郵便配達を使用してレコードを作成/挿入しよう:

{ "id": 1, "surname": "Flores", "address1": "igle", "town": "campo", "postcode": "g", "c_b_name": "Charles", "b_event": "Chavan" }

私は次のようなエラーがあります:サーバーで

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> 
<html> 
<head> 
    <title>500 Internal Server Error</title> 
</head> 
<body> 
    <h1>Internal Server Error</h1> 
    <p>The server encountered an internal error or 
misconfiguration and was unable to complete 
your request.</p> 
    <p>Please contact the server administrator at 
[email protected] to inform them of the time this error occurred, 
and the actions you performed just before this error.</p> 
    <p>More information about this error may be available 
in the server error log.</p> 
    <p>Additionally, a 500 Internal Server Error 
error was encountered while trying to use an ErrorDocument to handle the request.</p> 
    <hr> 
    <address>Apache/2.4.10 (Debian) Server at xxxxxxxx.com Port 80</address> 
</body> 
</html> 

をerror.log次のエラーがあります。

Response header name 'record Created - ' contains invalid characters, aborting request 
+0

ここで、 'record created - 'という名前のヘッダを作成しますか?あなたのコードで私はそれを表示しません –

+0

私は郵便配達でレコードを作成しました。作成されたレコードはデータベースに追加されましたが、 - AH02429:レスポンスヘッダー名 'Record Created - 'には無効な文字が含まれ、エラー – Sara

答えて

0

コントローラからhttpHeaderを削除して解決策を見つけました。

関連する問題