Package org.gsm.oneapi.responsebean

Examples of org.gsm.oneapi.responsebean.RequestError


            response=smsSendResponseProcessor.getResponse(con, OneAPIServlet.CREATED);
    } catch (Exception e) {
      response.setHTTPResponseCode(responseCode);
      response.setContentType(contentType);
     
      response.setRequestError(new RequestError(RequestError.SERVICEEXCEPTION, "SVCJAVA", e.getMessage(), e.getClass().getName()));

      logger.error("Exception "+e.getMessage()+" "+e.getLocalizedMessage());
    }         
    return response;
  }
View Full Code Here


        logger.error("Exception "+e.getMessage()+" "+e.getLocalizedMessage());
        e.printStackTrace();
        response.setHTTPResponseCode(responseCode);
        response.setContentType(contentType);
       
        response.setRequestError(new RequestError(RequestError.SERVICEEXCEPTION, "SVCJAVA", e.getMessage(), e.getClass().getName()));
      }
    }
    return response;
  }
View Full Code Here

              response=smsDeliveryReceiptSubscriptionProcessor.getResponse(con, OneAPIServlet.CREATED);
      } catch (Exception e) {
        response.setHTTPResponseCode(responseCode);
        response.setContentType(contentType);
       
        response.setRequestError(new RequestError(RequestError.SERVICEEXCEPTION, "SVCJAVA", e.getMessage(), e.getClass().getName()));
        logger.error("Exception "+e.getMessage()+" "+e.getLocalizedMessage());
      }
    }
    return response;
  }
View Full Code Here

   * @param errorInformation
   */
  public static void sendError(HttpServletResponse response, int errorCode, int errorType, String messageId, String errorText, String errorInformation) {
    response.setContentType("application/json");
   
    RequestError error=new RequestError(errorType, messageId, errorText, errorInformation);
   
    ObjectMapper mapper=new ObjectMapper();     
    String jsonResponse=null;
    try {
      jsonResponse = "{\"requestError\":"+mapper.writeValueAsString(error)+"}";
View Full Code Here

        logger.error("Exception "+e.getMessage()+" "+e.getLocalizedMessage());
        e.printStackTrace();
        response.setHTTPResponseCode(responseCode);
        response.setContentType(contentType);
       
        response.setRequestError(new RequestError(RequestError.SERVICEEXCEPTION, "SVCJAVA", e.getMessage(), e.getClass().getName()));
      }
    }
    return response;
  }
View Full Code Here

              response=smsMessageReceiptSubscriptionProcessor.getResponse(con, OneAPIServlet.CREATED);
      } catch (Exception e) {
        response.setHTTPResponseCode(responseCode);
        response.setContentType(contentType);
       
        response.setRequestError(new RequestError(RequestError.SERVICEEXCEPTION, "SVCJAVA", e.getMessage(), e.getClass().getName()));
       
        logger.error("Exception "+e.getMessage()+" "+e.getLocalizedMessage());
      }
    }
    return response;
View Full Code Here

                  } else if (response!=null && requestErrorSetter!=null) {
                      ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
                    ObjectMapper errorMapper=new ObjectMapper();
                   
                    RequestError errorResponse=errorMapper.readValue(bais, RequestError.class);
                    if (errorResponse!=null) {
              try {
                requestErrorSetter.invoke(response, errorResponse);
              } catch (Exception e) {
                e.printStackTrace();
              }
                    }
                    tryAndIdentifyError=false;
                  }
                 
          }
        } else {
                InputStream is = con.getErrorStream();
                if (is == null) {
                    is = con.getInputStream();
                }
                baos = new ByteArrayOutputStream();
                int i;
                while ((i = (byte) is.read()) != -1) baos.write(i);
        }
            if (response!=null && responseCodeSetter!=null) {
              try {
          responseCodeSetter.invoke(response, responseCode);
        } catch (Exception e) {
          e.printStackTrace();
        }
            }
            if (response!=null && contentTypeSetter!=null) {
              try {
                contentTypeSetter.invoke(response, contentType);
        } catch (Exception e) {
          e.printStackTrace();
        }
            }
            if (tryAndIdentifyError && response!=null && baos!=null && requestErrorSetter!=null) {
                ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
                ObjectMapper errorMapper=new ObjectMapper();
               
                try {
                  RequestErrorWrapper errorResponse=errorMapper.readValue(bais, RequestErrorWrapper.class);
                  if (errorResponse!=null && errorResponse.getRequestError()!=null) {
            requestErrorSetter.invoke(response, errorResponse.getRequestError());
                  }
                } catch (Exception e) {
                  logger.warn("Exception "+e.getMessage()+" trying to identify error response");
                }
View Full Code Here

      System.out.println("Exception "+e.getMessage()+" "+e.getLocalizedMessage());
      e.printStackTrace();
      response.setHTTPResponseCode(responseCode);
      response.setContentType(contentType);
     
      response.setRequestError(new RequestError(RequestError.SERVICEEXCEPTION, "SVCJAVA", e.getMessage(), e.getClass().getName()));
    }         
    return response;
  }
View Full Code Here

      System.out.println("Exception "+e.getMessage()+" "+e.getLocalizedMessage());
      e.printStackTrace();
      response.setHTTPResponseCode(responseCode);
      response.setContentType(contentType);
     
      response.setRequestError(new RequestError(RequestError.SERVICEEXCEPTION, "SVCJAVA", e.getMessage(), e.getClass().getName()));
    }         
    return response;
  }
View Full Code Here

      System.out.println("Exception "+e.getMessage()+" "+e.getLocalizedMessage());
      e.printStackTrace();
      response.setHTTPResponseCode(responseCode);
      response.setContentType(contentType);
     
      response.setRequestError(new RequestError(RequestError.SERVICEEXCEPTION, "SVCJAVA", e.getMessage(), e.getClass().getName()));
    }         
    return response;
  }
View Full Code Here

TOP

Related Classes of org.gsm.oneapi.responsebean.RequestError

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.