Package org.restlet.resource

Examples of org.restlet.resource.ResourceException


                                @SuppressWarnings("unchecked")
                                public void handle(Request request,
                                        Response response) {
                                    if (response.getStatus().isError()) {
                                        rCallback
                                                .onFailure(new ResourceException(
                                                        response.getStatus()));
                                    } else {
                                        if (actualType != null) {
                                            rCallback
                                                    .onSuccess(getClientResource()
View Full Code Here


                getResponse().setCacheDirectives(noStore);
                getResponse().setCacheDirectives(noCache);
                // response.put("expires", t.getToken());
            }
        } catch (JSONException e) {
            throw new ResourceException(Status.CLIENT_ERROR_BAD_REQUEST,
                    "Failed parse JSON", e);
        } catch (IOException e) {
            throw new ResourceException(Status.CLIENT_ERROR_BAD_REQUEST,
                    "Failed parse JSON", e);
        }
        return new JsonStringRepresentation(response);
    }
View Full Code Here

                body.put(EXPIRES_IN, et.getExpirePeriod());
                body.put(REFRESH_TOKEN, et.getRefreshToken());
            }
            // TODO add scope
        } catch (JSONException e) {
            throw new ResourceException(Status.SERVER_ERROR_INTERNAL,
                    "Failed to generate JSON", e);
        }

        return body;
    }
View Full Code Here

                        entity.getClass(), (Metadata) getMetadata(),
                        getLogger());
                Feed feed = new Feed();
                feed.getEntries().add(new Entry(rep, entryContentHandler));
            } catch (ResourceException re) {
                throw new ResourceException(re.getStatus(),
                        "Can't add entity to this entity set "
                                + resource.getReference());
            } finally {
                this.latestRequest = resource.getRequest();
                this.latestResponse = resource.getResponse();
View Full Code Here

        ClientResource resource = createResource(getSubpath(entity));

        try {
            resource.delete();
        } catch (ResourceException re) {
            throw new ResourceException(re.getStatus(),
                    "Can't delete this entity " + resource.getReference());
        } finally {
            this.latestRequest = resource.getRequest();
            this.latestResponse = resource.getResponse();
        }
View Full Code Here

        ClientResource resource = createResource(entitySubpath);

        try {
            resource.delete();
        } catch (ResourceException re) {
            throw new ResourceException(re.getStatus(),
                    "Can't delete this entity " + resource.getReference());
        } finally {
            this.latestRequest = resource.getRequest();
            this.latestResponse = resource.getResponse();
        }
View Full Code Here

                result = resource.handle();
                this.latestRequest = resource.getRequest();
                this.latestResponse = resource.getResponse();

                if (resource.getStatus().isError()) {
                    throw new ResourceException(resource.getStatus());
                }
            }
        }

        return result;
View Full Code Here

                StringRepresentation r = new StringRepresentation(
                        sb.toString(), MediaType.APPLICATION_XML);
                resource.put(r);
            } catch (ResourceException re) {
                throw new ResourceException(re.getStatus(),
                        "Can't set entity to this entity set "
                                + resource.getReference());
            } finally {
                this.latestRequest = resource.getRequest();
                this.latestResponse = resource.getResponse();
View Full Code Here

                // Add a condition
                resource.getConditions().setMatch(Arrays.asList(new Tag(tag)));
            }
            resource.put(r);
        } catch (ResourceException re) {
            throw new ResourceException(re.getStatus(),
                    "Can't update this entity " + resource.getReference());
        } finally {
            this.latestRequest = resource.getRequest();
            this.latestResponse = resource.getResponse();
        }
View Full Code Here

     */
    protected static final IOutputAwareFeedHandler makeFeedHandler(final Variant variant) throws ResourceException {
        IOutputAwareFeedHandler handler = FeedHandlerRegistry
                .createFeedHandler(MediaTypeUtils.toAtomicoMediaType(variant.getMediaType()));
        if (handler == null) {
            throw new ResourceException(Status.CLIENT_ERROR_NOT_ACCEPTABLE,
                    "No feed available for media type " + variant.getMediaType());
        }
        return handler;
    }
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.