Manikanta B
Manikanta B

Reputation: 1174

Error parsing HTTP request header in Spring Boot

I've created a rest call to save list of timesheet entries.

Method:

@RequestMapping(value = "/saveListOfTimesheetEntries", method = { RequestMethod.POST }, produces = {
            "application/json" })
    public ResponseEntity<CustomResponse> saveListOfTimesheetEntries(@RequestBody String timesheetEntriesDataString) {

and i'm using object mapper to convert them to my class.

List<TimesheetEntryDataModel> timesheetsListData = new ObjectMapper().readValue(timesheetEntriesDataString,
                    new TypeReference<List<TimesheetEntryDataModel>>() {
                    });

Request method using Axios:

axios({
            method: 'post',
            url: this.state.appUrl+':6060/timesheetEntry/saveNewListOfTimesheetEntries',
            headers : {
                'Authorization': this.state.accessToken
            },
            params: {
                timesheetEntriesDataString : JSON.stringify(this.state.timesheets)
            } 
        }).then(response => {
            console.log('response:',response.data);
            this.showAlert('Success', 'Timesheets Submitted successfuly');
        })
        .catch(error => {
            console.log('Error fetching and parsing data', error);
            this.showAlert('Error', 'Oops something went wrong, try again');
        });

The above code is working fine with less number of records, once the number of timesheets are increased in request it's not working.

enter image description here

How can i solve this issue, thanks in advance.

For reference this is the request captured from network tab in chrome:

http://localhost:6060/timesheetEntry/saveNewListOfTimesheetEntries?timesheetEntriesDataString=[%7B%22entryId%22:null,%22tasks%22:null,%22hrsSpent%22:null,%22month%22:%2209%22,%22year%22:%222018%22,%22date%22:null,%22startDate%22:null,%22endDate%22:null,%22numberOfLeaves%22:0,%22actualWorkingDays%22:19,%22employeeId%22:%22CSB00914%22,%22employeeName%22:%22Fathima+Shaik++%22,%22projectId%22:%22ceri-intc-012%22,%22createdBy%22:null,%22createdDate%22:null,%22lastUpdatedBy%22:null,%22lastUpdatedDate%22:null,%22isActive%22:null,%22checked%22:null%7D,%7B%22entryId%22:null,%22tasks%22:null,%22hrsSpent%22:null,%22month%22:%2209%22,%22year%22:%222018%22,%22date%22:null,%22startDate%22:null,%22endDate%22:null,%22numberOfLeaves%22:0,%22actualWorkingDays%22:19,%22employeeId%22:%22CSB00866%22,%22employeeName%22:%22Gubbala+Sri+Lalitha+%22,%22projectId%22:%22ceri-intc-012%22,%22createdBy%22:null,%22createdDate%22:null,%22lastUpdatedBy%22:null,%22lastUpdatedDate%22:null,%22isActive%22:null,%22checked%22:null%7D,%7B%22entryId%22:null,%22tasks%22:null,%22hrsSpent%22:null,%22month%22:%2209%22,%22year%22:%222018%22,%22date%22:null,%22startDate%22:null,%22endDate%22:null,%22numberOfLeaves%22:0,%22actualWorkingDays%22:19,%22employeeId%22:%22CSB00834%22,%22employeeName%22:%22Jayaprakash+Madhavan+%22,%22projectId%22:%22ceri-intc-012%22,%22createdBy%22:null,%22createdDate%22:null,%22lastUpdatedBy%22:null,%22lastUpdatedDate%22:null,%22isActive%22:null,%22checked%22:null%7D,%7B%22entryId%22:null,%22tasks%22:null,%22hrsSpent%22:null,%22month%22:%2209%22,%22year%22:%222018%22,%22date%22:null,%22startDate%22:null,%22endDate%22:null,%22numberOfLeaves%22:0,%22actualWorkingDays%22:19,%22employeeId%22:%22CSB00852%22,%22employeeName%22:%22Pranoti+Onkareshwar+Gonnade+%22,%22projectId%22:%22ceri-intc-012%22,%22createdBy%22:null,%22createdDate%22:null,%22lastUpdatedBy%22:null,%22lastUpdatedDate%22:null,%22isActive%22:null,%22checked%22:null%7D,%7B%22entryId%22:null,%22tasks%22:null,%22hrsSpent%22:null,%22month%22:%2209%22,%22year%22:%222018%22,%22date%22:null,%22startDate%22:null,%22endDate%22:null,%22numberOfLeaves%22:0,%22actualWorkingDays%22:19,%22employeeId%22:%22CSB00942%22,%22employeeName%22:%22Elizabeth+Ca+%22,%22projectId%22:%22ceri-intc-012%22,%22createdBy%22:null,%22createdDate%22:null,%22lastUpdatedBy%22:null,%22lastUpdatedDate%22:null,%22isActive%22:null,%22checked%22:null%7D,%7B%22entryId%22:null,%22tasks%22:null,%22hrsSpent%22:null,%22month%22:%2209%22,%22year%22:%222018%22,%22date%22:null,%22startDate%22:null,%22endDate%22:null,%22numberOfLeaves%22:0,%22actualWorkingDays%22:19,%22employeeId%22:%22CSB00931%22,%22employeeName%22:%22Sesha+Sri+Harsha+Mallampalli+%22,%22projectId%22:%22ceri-intc-012%22,%22createdBy%22:null,%22createdDate%22:null,%22lastUpdatedBy%22:null,%22lastUpdatedDate%22:null,%22isActive%22:null,%22checked%22:null%7D,%7B%22entryId%22:null,%22tasks%22:null,%22hrsSpent%22:null,%22month%22:%2209%22,%22year%22:%222018%22,%22date%22:null,%22startDate%22:null,%22endDate%22:null,%22numberOfLeaves%22:0,%22actualWorkingDays%22:19,%22employeeId%22:%22CSB00863%22,%22employeeName%22:%22Kamal+Dey+%22,%22projectId%22:%22ceri-intc-012%22,%22createdBy%22:null,%22createdDate%22:null,%22lastUpdatedBy%22:null,%22lastUpdatedDate%22:null,%22isActive%22:null,%22checked%22:null%7D,%7B%22entryId%22:null,%22tasks%22:null,%22hrsSpent%22:null,%22month%22:%2209%22,%22year%22:%222018%22,%22date%22:null,%22startDate%22:null,%22endDate%22:null,%22numberOfLeaves%22:0,%22actualWorkingDays%22:19,%22employeeId%22:%22CSB00864%22,%22employeeName%22:%22Pradeep+Kumar+%22,%22projectId%22:%22ceri-intc-012%22,%22createdBy%22:null,%22createdDate%22:null,%22lastUpdatedBy%22:null,%22lastUpdatedDate%22:null,%22isActive%22:null,%22checked%22:null%7D,%7B%22entryId%22:null,%22tasks%22:null,%22hrsSpent%22:null,%22month%22:%2209%22,%22year%22:%222018%22,%22date%22:null,%22startDate%22:null,%22endDate%22:null,%22numberOfLeaves%22:0,%22actualWorkingDays%22:19,%22employeeId%22:%22CSB00925%22,%22employeeName%22:%22Mirza+Afsar+Baig+%22,%22projectId%22:%22ceri-intc-012%22,%22createdBy%22:null,%22createdDate%22:null,%22lastUpdatedBy%22:null,%22lastUpdatedDate%22:null,%22isActive%22:null,%22checked%22:null%7D,%7B%22entryId%22:null,%22tasks%22:null,%22hrsSpent%22:null,%22month%22:%2209%22,%22year%22:%222018%22,%22date%22:null,%22startDate%22:null,%22endDate%22:null,%22numberOfLeaves%22:0,%22actualWorkingDays%22:19,%22employeeId%22:%22CSB00930%22,%22employeeName%22:%22Sharukh+Shaikh+Shahgir+%22,%22projectId%22:%22ceri-intc-012%22,%22createdBy%22:null,%22createdDate%22:null,%22lastUpdatedBy%22:null,%22lastUpdatedDate%22:null,%22isActive%22:null,%22checked%22:null%7D,%7B%22entryId%22:null,%22tasks%22:null,%22hrsSpent%22:null,%22month%22:%2209%22,%22year%22:%222018%22,%22date%22:null,%22startDate%22:null,%22endDate%22:null,%22numberOfLeaves%22:0,%22actualWorkingDays%22:19,%22employeeId%22:%22CSB00933%22,%22employeeName%22:%22Trushna+Tushar+Chaudhari+%22,%22projectId%22:%22ceri-intc-012%22,%22createdBy%22:null,%22createdDate%22:null,%22lastUpdatedBy%22:null,%22lastUpdatedDate%22:null,%22isActive%22:null,%22checked%22:null%7D,%7B%22entryId%22:null,%22tasks%22:null,%22hrsSpent%22:null,%22month%22:%2209%22,%22year%22:%222018%22,%22date%22:null,%22startDate%22:null,%22endDate%22:null,%22numberOfLeaves%22:0,%22actualWorkingDays%22:19,%22employeeId%22:%22CSB00923%22,%22employeeName%22:%22Thanusha+Palavalasa+%22,%22projectId%22:%22ceri-intc-012%22,%22createdBy%22:null,%22createdDate%22:null,%22lastUpdatedBy%22:null,%22lastUpdatedDate%22:null,%22isActive%22:null,%22checked%22:null%7D,%7B%22entryId%22:null,%22tasks%22:null,%22hrsSpent%22:null,%22month%22:%2209%22,%22year%22:%222018%22,%22date%22:null,%22startDate%22:null,%22endDate%22:null,%22numberOfLeaves%22:0,%22actualWorkingDays%22:19,%22employeeId%22:%22CSB00945%22,%22employeeName%22:%22SWETHA+HARIKUMAR+%22,%22projectId%22:%22ceri-intc-012%22,%22createdBy%22:null,%22createdDate%22:null,%22lastUpdatedBy%22:null,%22lastUpdatedDate%22:null,%22isActive%22:null,%22checked%22:null%7D,%7B%22entryId%22:null,%22tasks%22:null,%22hrsSpent%22:null,%22month%22:%2209%22,%22year%22:%222018%22,%22date%22:null,%22startDate%22:null,%22endDate%22:null,%22numberOfLeaves%22:0,%22actualWorkingDays%22:19,%22employeeId%22:%22CSB00924%22,%22employeeName%22:%22Teja+Venkata+Sai+Krishna+Kanamarlapudi+%22,%22projectId%22:%22ceri-intc-012%22,%22createdBy%22:null,%22createdDate%22:null,%22lastUpdatedBy%22:null,%22lastUpdatedDate%22:null,%22isActive%22:null,%22checked%22:null%7D,%7B%22entryId%22:null,%22tasks%22:null,%22hrsSpent%22:null,%22month%22:%2209%22,%22year%22:%222018%22,%22date%22:null,%22startDate%22:null,%22endDate%22:null,%22numberOfLeaves%22:0,%22actualWorkingDays%22:19,%22employeeId%22:%22CSB00835%22,%22employeeName%22:%22Vishwanath+T+%22,%22projectId%22:%22ceri-intc-012%22,%22createdBy%22:null,%22createdDate%22:null,%22lastUpdatedBy%22:null,%22lastUpdatedDate%22:null,%22isActive%22:null,%22checked%22:null%7D,%7B%22entryId%22:null,%22tasks%22:null,%22hrsSpent%22:null,%22month%22:%2209%22,%22year%22:%222018%22,%22date%22:null,%22startDate%22:null,%22endDate%22:null,%22numberOfLeaves%22:0,%22actualWorkingDays%22:19,%22employeeId%22:%22CSB00845%22,%22employeeName%22:%22Garvesh+Purushottam+Sonone+%22,%22projectId%22:%22ceri-intc-012%22,%22createdBy%22:null,%22createdDate%22:null,%22lastUpdatedBy%22:null,%22lastUpdatedDate%22:null,%22isActive%22:null,%22checked%22:null%7D,%7B%22entryId%22:null,%22tasks%22:null,%22hrsSpent%22:null,%22month%22:%2209%22,%22year%22:%222018%22,%22date%22:null,%22startDate%22:null,%22endDate%22:null,%22numberOfLeaves%22:0,%22actualWorkingDays%22:19,%22employeeId%22:%22CSB00941%22,%22employeeName%22:%22Veeramuthupandi+G++%22,%22projectId%22:%22ceri-intc-012%22,%22createdBy%22:null,%22createdDate%22:null,%22lastUpdatedBy%22:null,%22lastUpdatedDate%22:null,%22isActive%22:null,%22checked%22:null%7D]

Upvotes: 1

Views: 5462

Answers (1)

clevertension
clevertension

Reputation: 7077

you should enlarge your maxHttpHeaderSize in your application.properties

server.maxHttpHeaderSize = 102400

or application.yml

server
  maxHttpHeaderSize: 102400

Upvotes: 1

Related Questions