Example usage for javax.servlet.http HttpServletResponse SC_EXPECTATION_FAILED

List of usage examples for javax.servlet.http HttpServletResponse SC_EXPECTATION_FAILED

Introduction

In this page you can find the example usage for javax.servlet.http HttpServletResponse SC_EXPECTATION_FAILED.

Prototype

int SC_EXPECTATION_FAILED

To view the source code for javax.servlet.http HttpServletResponse SC_EXPECTATION_FAILED.

Click Source Link

Document

Status code (417) indicating that the server could not meet the expectation given in the Expect request header.

Usage

From source file:com.eureka.v1_0.account.information.api.AccountInformationController.java

@ResponseBody
@RequestMapping(method = RequestMethod.POST, consumes = MediaType.TEXT_XML_VALUE, produces = MediaType.TEXT_XML_VALUE, value = "/details")
public GetAccountResponse getAccounts(@RequestBody GetAccountRequest getAccountRequest,
        HttpServletRequest request, HttpServletResponse response) {
    if (getAccountRequest != null) {
        try {/* w w  w  .j a v a2 s .c  o m*/
            witLoggerService.debug(JaxbHandler.toXml(getAccountRequest));
            GetAccountResponse getAccountResponse = this.accountInformationApiService
                    .getAccountDetails(getAccountRequest);
            if (getAccountResponse != null) {
                witLoggerService.debug(JaxbHandler.toXml(getAccountResponse));
                response.setStatus(HttpServletResponse.SC_OK);
                return getAccountResponse;
            } else {
                response.setStatus(HttpServletResponse.SC_EXPECTATION_FAILED);
            }
        } catch (Exception ex) {
            witLoggerService.warn(ex);
            ex.printStackTrace();
            response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
        }

    }
    response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
    return null;
}

From source file:com.lp.webapp.cc.CCOrderResponseServlet.java

private int getHttpStatusforEjbStatus(CreateOrderResult result) {
    if (Helper.isOneOf(result.getRc(),
            new int[] { CreateOrderResult.ERROR_EMPTY_ORDER, CreateOrderResult.ERROR_JAXB_EXCEPTION,
                    CreateOrderResult.ERROR_SAX_EXCEPTION, CreateOrderResult.ERROR_UNMARSHALLING })) {
        return HttpServletResponse.SC_BAD_REQUEST;
    }//ww w  . j a  va 2  s  .com

    if (result.getRc() == CreateOrderResult.ERROR_AUTHENTIFICATION) {
        return HttpServletResponse.SC_FORBIDDEN;
    }

    if (result.getRc() == CreateOrderResult.ERROR_CUSTOMER_NOT_FOUND) {
        return HttpServletResponse.SC_NOT_FOUND;
    }

    if (result.getRc() >= CreateOrderResult.ERROR_EJB_EXCEPTION) {
        return HttpServletResponse.SC_INTERNAL_SERVER_ERROR;
    }

    if (result.getRc() == BaseRequestResult.OKAY) {
        return HttpServletResponse.SC_CREATED;
    }

    return HttpServletResponse.SC_EXPECTATION_FAILED;
}

From source file:com.eureka.v1_0.kyc.information.api.KycInformationApiController.java

@ResponseBody
@RequestMapping(method = RequestMethod.POST, consumes = MediaType.TEXT_XML_VALUE, produces = MediaType.TEXT_XML_VALUE, value = "/findpersonalinformationbyaccountname")
public FindPersonalInformationByAccountNameResponse findPersonalInformationByAccountName(
        @RequestBody FindPersonalInformationByAccountNameRequest findPersonalInformationByAccountNameRequest,
        HttpServletResponse response, HttpServletRequest request) {
    if (findPersonalInformationByAccountNameRequest != null) {
        try {// www.ja v  a 2s .  co  m
            witLoggerService.debug(JaxbHandler.toXml(findPersonalInformationByAccountNameRequest));
            FindPersonalInformationByAccountNameResponse findPersonalInformationByAccountNameResponse = this.kycInformationApiService
                    .findPersonalInformationByAccountName(findPersonalInformationByAccountNameRequest);
            if (findPersonalInformationByAccountNameResponse != null) {
                witLoggerService.debug(JaxbHandler.toXml(findPersonalInformationByAccountNameResponse));
                response.setStatus(HttpServletResponse.SC_OK);
                return findPersonalInformationByAccountNameResponse;
            } else {
                response.setStatus(HttpServletResponse.SC_EXPECTATION_FAILED);
            }
        } catch (Exception ex) {
            witLoggerService.warn(ex);
            response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
        }
    }
    response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
    return null;
}

From source file:com.eureka.v1_0.kyc.information.api.KycInformationApiController.java

@ResponseBody
@RequestMapping(method = RequestMethod.POST, consumes = MediaType.TEXT_XML_VALUE, produces = MediaType.TEXT_XML_VALUE, value = "/findpersonalinformationbyemail")
public FindPersonalInformationByEmailResponse findPersonalInformationByEmail(
        @RequestBody FindPersonalInformationByEmailRequest findPersonalInformationByEmailRequest,
        HttpServletRequest request, HttpServletResponse response) {
    if (findPersonalInformationByEmailRequest != null) {
        try {/*from   w  w  w  . j av  a2s .  co  m*/
            witLoggerService.debug(JaxbHandler.toXml(findPersonalInformationByEmailRequest));
            FindPersonalInformationByEmailResponse findPersonalInformationByEmailResponse = this.kycInformationApiService
                    .findPersonalInformationByEmail(findPersonalInformationByEmailRequest);
            if (findPersonalInformationByEmailResponse != null) {
                witLoggerService.debug(JaxbHandler.toXml(findPersonalInformationByEmailResponse));
                response.setStatus(HttpServletResponse.SC_OK);
                return findPersonalInformationByEmailResponse;
            } else {
                response.setStatus(HttpServletResponse.SC_EXPECTATION_FAILED);
            }
        } catch (Exception ex) {
            witLoggerService.warn(ex);
            response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
        }
    }
    response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
    return null;
}

From source file:com.eureka.v1_0.kyc.information.api.KycInformationApiController.java

@ResponseBody
@RequestMapping(method = RequestMethod.POST, consumes = MediaType.TEXT_XML_VALUE, produces = MediaType.TEXT_XML_VALUE, value = "/findpersonalinformationbyuid")
public FindPersonalInformationByUidResponse findPersonalInformationByUid(
        @RequestBody FindPersonalInformationByUidRequest findPersonalInformationByUidRequest,
        HttpServletRequest request, HttpServletResponse response) {
    if (findPersonalInformationByUidRequest != null) {
        try {/*  w  ww  .j a v a  2s  .c om*/
            witLoggerService.debug(JaxbHandler.toXml(findPersonalInformationByUidRequest));
            FindPersonalInformationByUidResponse findPersonalInformationByUidResponse = this.kycInformationApiService
                    .findPersonalInformationByUid(findPersonalInformationByUidRequest);
            if (findPersonalInformationByUidResponse != null) {
                witLoggerService.debug(JaxbHandler.toXml(findPersonalInformationByUidResponse));
                response.setStatus(HttpServletResponse.SC_OK);
                return findPersonalInformationByUidResponse;
            } else {
                response.setStatus(HttpServletResponse.SC_EXPECTATION_FAILED);
            }
        } catch (Exception ex) {
            witLoggerService.warn(ex);
            response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
        }
    }
    response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
    return null;
}

From source file:com.eureka.v1_0.kyc.information.api.KycInformationApiController.java

@ResponseBody
@RequestMapping(method = RequestMethod.POST, consumes = MediaType.TEXT_XML_VALUE, produces = MediaType.TEXT_XML_VALUE, value = "/updatepersonalinformation")
public UpdatePersonalInformationResponse updatePersonalInformation(
        @RequestBody UpdatePersonalInformationRequest updatePersonalInformationRequest,
        HttpServletResponse response, HttpServletRequest request) {
    if (updatePersonalInformationRequest != null) {
        try {//from w w  w .ja v  a2s  . c  o  m
            witLoggerService.debug(JaxbHandler.toXml(updatePersonalInformationRequest));
            UpdatePersonalInformationResponse updatePersonalInformationResponse = this.kycInformationApiService
                    .updatePersonalInformation(updatePersonalInformationRequest);
            if (updatePersonalInformationResponse != null) {
                witLoggerService.debug(JaxbHandler.toXml(updatePersonalInformationResponse));
                response.setStatus(HttpServletResponse.SC_OK);
                return updatePersonalInformationResponse;
            } else {
                response.setStatus(HttpServletResponse.SC_EXPECTATION_FAILED);
            }
        } catch (Exception ex) {
            witLoggerService.warn(ex);
            response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
        }
    }
    response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
    return null;
}

From source file:com.eureka.v1_0.kyc.information.api.KycInformationApiController.java

@ResponseBody
@RequestMapping(method = RequestMethod.POST, consumes = MediaType.TEXT_XML_VALUE, produces = MediaType.TEXT_XML_VALUE, value = "/createmsisdninformation")
public CreateMsisdnInformationResponse createMsisdnInformation(
        @RequestBody CreateMsisdnInformationRequest createMsisdnInformationRequest,
        HttpServletResponse response, HttpServletRequest request) {
    if (createMsisdnInformationRequest != null) {
        try {//from  w  w w. ja v  a2s  .c  o  m
            witLoggerService.debug(JaxbHandler.toXml(createMsisdnInformationRequest));
            CreateMsisdnInformationResponse createMsisdnInformationResponse = this.kycInformationApiService
                    .createMsisdnInformation(createMsisdnInformationRequest);
            if (createMsisdnInformationResponse != null) {
                witLoggerService.debug(JaxbHandler.toXml(createMsisdnInformationResponse));
                response.setStatus(HttpServletResponse.SC_OK);
                return createMsisdnInformationResponse;
            } else {
                response.setStatus(HttpServletResponse.SC_EXPECTATION_FAILED);
            }
        } catch (Exception ex) {
            witLoggerService.warn(ex);
            response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
        }
    }
    response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
    return null;
}

From source file:com.eureka.v1_0.kyc.information.api.KycInformationApiController.java

@ResponseBody
@RequestMapping(method = RequestMethod.POST, consumes = MediaType.TEXT_XML_VALUE, produces = MediaType.TEXT_XML_VALUE, value = "/findaccountmsisdninformation")
public FindAccountMsisdnInformationResponse findAccountMsisdnInformation(
        @RequestBody FindAccountMsisdnInformationRequest findAccountMsisdnInformationRequest,
        HttpServletRequest request, HttpServletResponse response) {
    if (findAccountMsisdnInformationRequest != null) {
        try {/*from ww  w.j ava2 s.c o m*/
            FindAccountMsisdnInformationResponse findAccountMsisdnInformationResponse = this.kycInformationApiService
                    .findAccountMsisdnInformation(findAccountMsisdnInformationRequest);
            if (findAccountMsisdnInformationResponse != null) {
                witLoggerService.debug(JaxbHandler.toXml(findAccountMsisdnInformationResponse));
                response.setStatus(HttpServletResponse.SC_OK);
                return findAccountMsisdnInformationResponse;
            } else {
                response.setStatus(HttpServletResponse.SC_EXPECTATION_FAILED);
            }
        } catch (Exception ex) {
            witLoggerService.warn(ex);
            response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
        }
    }
    response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
    return null;
}

From source file:com.eureka.v1_0.kyc.information.api.KycInformationApiController.java

@ResponseBody
@RequestMapping(method = RequestMethod.POST, consumes = MediaType.TEXT_XML_VALUE, produces = MediaType.TEXT_XML_VALUE, value = "/findmsisdninformationbyuid")
public FindMsisdnInformationByUidResponse findMsisdnInformationByUid(
        @RequestBody FindMsisdnInformationByUidRequest findMsisdnInformationByUidRequest,
        HttpServletResponse response, HttpServletRequest request) {
    if (findMsisdnInformationByUidRequest != null) {
        try {// w  w w . ja  va2 s.c o m
            FindMsisdnInformationByUidResponse findMsisdnInformationByUidResponse = this.kycInformationApiService
                    .findMsisdnInformationByUid(findMsisdnInformationByUidRequest);
            if (findMsisdnInformationByUidResponse != null) {
                witLoggerService.debug(JaxbHandler.toXml(findMsisdnInformationByUidResponse));
                response.setStatus(HttpServletResponse.SC_OK);
                return findMsisdnInformationByUidResponse;
            } else {
                response.setStatus(HttpServletResponse.SC_EXPECTATION_FAILED);
            }
        } catch (Exception ex) {
            witLoggerService.warn(ex);
            response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
        }
    } else {
        response.setStatus(HttpServletResponse.SC_EXPECTATION_FAILED);
    }
    response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
    return null;
}

From source file:com.eureka.v1_0.kyc.information.api.KycInformationApiController.java

@ResponseBody
@RequestMapping(method = RequestMethod.POST, consumes = MediaType.TEXT_XML_VALUE, produces = MediaType.TEXT_XML_VALUE, value = "/removemsisdninformation")
public RemoveMsisdnInformationResponse removeMsisdnInformation(
        @RequestBody RemoveMsisdnInformationRequest removeMsisdnInformationRequest,
        HttpServletResponse response, HttpServletRequest request) {
    if (removeMsisdnInformationRequest != null) {
        try {// ww  w. ja va 2 s  . c  o  m
            RemoveMsisdnInformationResponse removeMsisdnInformationResponse = this.kycInformationApiService
                    .removeMsisdnInformation(removeMsisdnInformationRequest);
            if (removeMsisdnInformationResponse != null) {
                witLoggerService.debug(JaxbHandler.toXml(removeMsisdnInformationResponse));
                response.setStatus(HttpServletResponse.SC_OK);
                return removeMsisdnInformationResponse;
            } else {
                response.setStatus(HttpServletResponse.SC_EXPECTATION_FAILED);
            }
        } catch (Exception ex) {
            witLoggerService.warn(ex);
            response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
        }
    }
    response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
    return null;
}