Package org.apache.olingo.odata2.core.exception

Examples of org.apache.olingo.odata2.core.exception.ODataRuntimeException


  @Test
  public void testODataRuntimeException() throws Exception {
    // prepare
    String exceptionMessage = "Some odd runtime exception";
    Exception exception = new ODataRuntimeException(exceptionMessage);

    // execute
    Response response = exceptionMapper.toResponse(exception);

    // verify
View Full Code Here


          .header("Content-Disposition", isDownload ?
              "attachment; filename=OData-Response." + new Date().toString().replace(' ', '_').replace(':', '.')
                  + ".html" : null)
          .build();
    } catch (final ODataException e) {
      throw new ODataRuntimeException("Should not happen", e);
    } catch (final IOException e) {
      throw new ODataRuntimeException("Should not happen", e);
    }
  }
View Full Code Here

          .header(ODataHttpHeaders.DATASERVICEVERSION, ODataServiceVersion.V10)
          .status(status);
      return response.build();
    } catch (Exception e) {
      csb.close();
      throw new ODataRuntimeException(e);
    }
  }
View Full Code Here

        }
      }
      break;

    default:
      throw new ODataRuntimeException("Unknown or not implemented URI type: " + uriInfo.getUriType());
    }
  }
View Full Code Here

  @Override
  protected void service(final HttpServletRequest req, final HttpServletResponse resp) throws IOException {
    final String factoryClassName = getInitParameter(ODataServiceFactory.FACTORY_LABEL);
    if (factoryClassName == null) {
      throw new ODataRuntimeException("config missing: org.apache.olingo.odata2.processor.factory");
    }
    try {

      ClassLoader cl = (ClassLoader) req.getAttribute(ODataServiceFactory.FACTORY_CLASSLOADER_LABEL);
      if (cl == null) {
        serviceFactory = (ODataServiceFactory) Class.forName(factoryClassName).newInstance();
      } else {
        serviceFactory = (ODataServiceFactory) Class.forName(factoryClassName, true, cl).newInstance();
      }

    } catch (Exception e) {
      throw new ODataRuntimeException(e);
    }
    final String pathSplitAsString = getInitParameter(ODataServiceFactory.PATH_SPLIT_LABEL);
    if (pathSplitAsString != null) {
      pathSplit = Integer.parseInt(pathSplitAsString);
    }
View Full Code Here

  public ODataResponse writeErrorDocument(final ODataErrorContext context) {
    try {
      return create(context.getContentType()).writeErrorDocument(context.getHttpStatus(), context.getErrorCode(),
          context.getMessage(), context.getLocale(), context.getInnerError());
    } catch (EntityProviderException e) {
      throw new ODataRuntimeException(e);
    }
  }
View Full Code Here

  public ODataExceptionWrapper(final HttpServletRequest req) {
    try {
      requestUri = new URI(req.getRequestURI());
    } catch (URISyntaxException e) {
      throw new ODataRuntimeException(e);
    }
    httpRequestHeaders = RestUtil.extractHeaders(req);
    Map<String, String> queryParameters = RestUtil.extractQueryParameters(req.getQueryString());
    List<Locale> acceptableLanguages = RestUtil.extractAcceptableLanguage(req.getHeader("Accept-Language"));
    List<String> acceptHeaders = RestUtil.extractAcceptHeaders(req.getHeader("Accept"));
View Full Code Here

    } finally {// NOPMD (suppress DoNotThrowExceptionInFinally)
      scanner.close();
      try {
        in.close();
      } catch (IOException e) {
        throw new ODataRuntimeException(e);
      }
    }
    return responseList;
  }
View Full Code Here

    } finally {// NOPMD (suppress DoNotThrowExceptionInFinally)
      scanner.close();
      try {
        in.close();
      } catch (IOException e) {
        throw new ODataRuntimeException(e);
      }
    }
    return requestList;
  }
View Full Code Here

          .entity(buffer.getInputStream())
          .header(ODataHttpHeaders.DATASERVICEVERSION, ODataServiceVersion.V10)
          .build();
    } catch (Exception e) {
      buffer.close();
      throw new ODataRuntimeException(e);
    }
  }
View Full Code Here

TOP

Related Classes of org.apache.olingo.odata2.core.exception.ODataRuntimeException

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.