Package org.restlet.resource

Examples of org.restlet.resource.ResourceException


  {
    Query query = RequestAtt.getQuery(getRequest());

    if (query == null) {
      // query is expected to be available in the request attributes
      throw new ResourceException(SERVER_ERROR_INTERNAL, "missing query attribute");
    }

    String queryID = getConnection().storeQuery(query);

    Reference queryRef = getRequest().getResourceRef().clone();
View Full Code Here


      try {
        connection.close();
        return null;
      }
      catch (StoreException e) {
        throw new ResourceException(e);
      }
    }

    return null;
  }
View Full Code Here

      }

      return result;
    }
    catch (StoreConfigException e) {
      throw new ResourceException(e);
    }
  }
View Full Code Here

  {
    try {
      ConfigTemplate template = getRepositoryManager().getConfigTemplateManager().getTemplate(templateID);

      if (template == null) {
        throw new ResourceException(CLIENT_ERROR_NOT_FOUND, "No such template: " + templateID);
      }

      return new ModelRepresentation(template.getModel(), factory, mediaType);
    }
    catch (StoreConfigException e) {
      throw new ResourceException(e);
    }
  }
View Full Code Here

    try {
      getRepositoryManager().getConfigTemplateManager().addTemplate(templateID, model);
      return null;
    }
    catch (StoreConfigException e) {
      throw new ResourceException(e);
    }
    // finally {
    // ConditionalRequestInterceptor.managerModified(request);
    // }
  }
View Full Code Here

    try {
      configChanged = getRepositoryManager().getConfigTemplateManager().removeTemplate(templateID);
    }
    catch (StoreConfigException e) {
      throw new ResourceException(e);
    }
    finally {
      if (configChanged) {
        // ConditionalRequestInterceptor.managerModified(request);
      }
    }

    if (!configChanged) {
      throw new ResourceException(CLIENT_ERROR_NOT_FOUND, "No such template: " + templateID);
    }

    return null;
  }
View Full Code Here

      parser.parse(entity.getStream(), "");

      return model;
    }
    catch (UnsupportedRDFormatException e) {
      throw new ResourceException(CLIENT_ERROR_UNSUPPORTED_MEDIA_TYPE,
          "No RDF parser available for format " + rdfFormat.getName());
    }
    catch (RDFParseException e) {
      throw new ErrorInfoException(MALFORMED_DATA, e.getMessage());
    }
    catch (IOException e) {
      throw new ResourceException(e);
    }
    catch (RDFHandlerException e) {
      throw new ResourceException(e);
    }
  }
View Full Code Here

  {
    Query query = RequestAtt.getQuery(getRequest());

    if (query == null) {
      // query is expected to be available in the request attributes
      throw new ResourceException(SERVER_ERROR_INTERNAL, "missing query attribute");
    }

    if (!(query instanceof BooleanQuery)) {
      throw new ResourceException(SERVER_ERROR_INTERNAL, "unexpected query type: "
          + query.getClass().getName());
    }

    try {
      return ((BooleanQuery)query).evaluate();
    }
    catch (StoreException e) {
      throw new ResourceException(e);
    }
  }
View Full Code Here

      if (MediaType.APPLICATION_WWW_FORM.equals(mediaType, true)) {
        return request.getEntityAsForm();
      }
      else {
        throw new ResourceException(CLIENT_ERROR_UNSUPPORTED_MEDIA_TYPE);
      }
    }

    return null;
  }
View Full Code Here

    String paramValue = queryParams.getFirstValue(paramName);
    try {
      return Protocol.decodeValue(paramValue, vf);
    }
    catch (IllegalArgumentException e) {
      throw new ResourceException(CLIENT_ERROR_BAD_REQUEST, "Invalid value for parameter '" + paramName
          + "': " + paramValue);
    }
  }
View Full Code Here

TOP

Related Classes of org.restlet.resource.ResourceException

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.