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");
    }

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

    try {
      GraphResult queryResult = ((GraphQuery)query).evaluate();
      return new ModelResultRepresentation(queryResult, service, mediaType);
    }
    catch (StoreException e) {
      throw new ResourceException(e);
    }
  }
View Full Code Here


      }

      return new TupleResultImpl(columnNames, contexts);
    }
    catch (StoreException e) {
      throw new ResourceException(e);
    }
  }
View Full Code Here

      getConnection().rollback();
      getResponse().setStatus(SUCCESS_NO_CONTENT);
      return null;
    }
    catch (StoreException e) {
      throw new ResourceException(SERVER_ERROR_INTERNAL, e);
    }
  }
View Full Code Here

            this.file = File.createTempFile("fr_", null);
            this.writer = new FileWriter(file);
        }
        catch (IOException e)
        {
            throw new ResourceException(Status.SERVER_ERROR_INTERNAL, "Cannot create temporary file", e);
        }
    }
View Full Code Here

        // B - Call the target resource
        final Response response = getContext().getClientDispatcher().handle(
                request);

        if (!response.getStatus().isSuccess()) {
            throw new ResourceException(Status.SERVER_ERROR_INTERNAL,
                    "Call to the target resource didn't succeed");
        }
    }
View Full Code Here

        }
        final Response response = getContext().getClientDispatcher().handle(
                request);

        if (response.getStatus().isError()) {
            throw new ResourceException(Status.SERVER_ERROR_INTERNAL,
                    "Unable to delete the mail from the mailbox");
        }
    }
View Full Code Here

        }
        final Response response = getContext().getClientDispatcher().handle(
                request);

        if (!response.getStatus().isSuccess()) {
            throw new ResourceException(Status.SERVER_ERROR_INTERNAL,
                    "Unable to get the mail from the mailbox");
        }

        return new DomRepresentation(response.getEntity());
    }
View Full Code Here

        }
        final Response response = getContext().getClientDispatcher().handle(
                request);

        if (!response.getStatus().isSuccess()) {
            throw new ResourceException(response.getStatus(),
                    "Cannot get the mail iddentifiers.");
        }

        // 2 - Parse the list of mails
        if (response.isEntityAvailable()) {
View Full Code Here

            // Log results
            getLogger().fine("Converted target URI: " + this.targetUri);
            getLogger().fine("Converted base name : " + this.baseName);
        } catch (IOException ioe) {
            throw new ResourceException(ioe);
        }
    }
View Full Code Here

    public Status getStatus(Throwable throwable, Request request,
            Response response) {
        Status result = null;

        if (throwable instanceof ResourceException) {
            ResourceException re = (ResourceException) throwable;

            if (re.getCause() != null) {
                // What is most interesting is the embedded cause
                result = new Status(re.getStatus(), re.getCause());
            } else {
                result = re.getStatus();
            }
        } else {
            result = new Status(Status.SERVER_ERROR_INTERNAL, throwable);
        }
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.