Package org.restlet.client.data

Examples of org.restlet.client.data.Reference


     *            The method to call.
     * @param uri
     *            The target URI.
     */
    public ClientResource(Context context, Method method, String uri) {
        this(context, method, new Reference(uri));
    }
View Full Code Here


             com.google.gwt.core.client.GWT.getHostPageBaseURL());
             setReference(getReference().getTargetRef());
             }

            Protocol rProtocol = getProtocol();
            Reference rReference = getReference();
            Protocol protocol = (rProtocol != null) ? rProtocol
                    : (rReference != null) ? rReference.getSchemeProtocol()
                            : null;

            if (protocol != null) {
                 result = new Client(protocol);
            }
View Full Code Here

            throws ResourceException {
        ClientResource result = null;

        if ((relativeRef != null) && relativeRef.isRelative()) {
            result = new ClientResource(this);
            result.setReference(new Reference(getReference().getTargetRef(),
                    relativeRef).getTargetRef());
        } else {
            doError(Status.CLIENT_ERROR_BAD_REQUEST,
                    "The child URI is not relative.");
        }
View Full Code Here

     *            resource seen as the parent resource.
     * @return The child resource.
     * @throws ResourceException
     */
    public ClientResource getChild(String relativeUri) throws ResourceException {
        return getChild(new Reference(relativeUri));
    }
View Full Code Here

     * @param next
     *            The next handler handling the call.
     */
    protected void redirect(Request request, Response response,
            List<Reference> references, int retryAttempt, Uniform next) {
        Reference newTargetRef = response.getLocationRef();

        if ((references != null) && references.contains(newTargetRef)) {
            getLogger().warning(
                    "Infinite redirection loop detected with URI: "
                            + newTargetRef);
View Full Code Here

                    .getFrom(), headers);
        }

        // Manually add the host name and port when it is potentially
        // different from the one specified in the target resource reference.
        Reference hostRef = (request.getResourceRef().getBaseRef() != null) ? request
                .getResourceRef().getBaseRef() : request.getResourceRef();

        if (hostRef.getHostDomain() != null) {
            String host = hostRef.getHostDomain();
            int hostRefPortValue = hostRef.getHostPort();

            if ((hostRefPortValue != -1)
                    && (hostRefPortValue != request.getProtocol()
                            .getDefaultPort())) {
                host = host + ':' + hostRefPortValue;
View Full Code Here

     *            The call's method.
     * @param resourceUri
     *            The resource URI.
     */
    public Request(Method method, String resourceUri) {
        this(method, new Reference(resourceUri));
    }
View Full Code Here

     *            The resource URI.
     * @param entity
     *            The entity.
     */
    public Request(Method method, String resourceUri, Representation entity) {
        this(method, new Reference(resourceUri), entity);
    }
View Full Code Here

     *
     * @param request
     *            The request to copy.
     */
    public Request(Request request) {
        this(request.getMethod(), new Reference(request.getResourceRef()),
                request.getEntity());
        challengeResponse = request.getChallengeResponse();

        // Copy client info
        ClientInfo rci = request.getClientInfo();
        clientInfo = new ClientInfo();

        for (Preference<CharacterSet> o : rci.getAcceptedCharacterSets()) {
            clientInfo.getAcceptedCharacterSets().add(o);
        }

        for (Preference<Encoding> o : rci.getAcceptedEncodings()) {
            clientInfo.getAcceptedEncodings().add(o);
        }

        for (Preference<Language> o : rci.getAcceptedLanguages()) {
            clientInfo.getAcceptedLanguages().add(o);
        }

        for (Preference<MediaType> o : rci.getAcceptedMediaTypes()) {
            clientInfo.getAcceptedMediaTypes().add(o);
        }

        clientInfo.setAddress(rci.getAddress());
        clientInfo.setAgent(rci.getAgent());

        for (String o : rci.getForwardedAddresses()) {
            clientInfo.getForwardedAddresses().add(o);
        }

        clientInfo.setFrom(rci.getFrom());
        clientInfo.setPort(rci.getPort());


        // Copy conditions
        conditions = new Conditions();

        for (Tag o : request.getConditions().getMatch()) {
            conditions.getMatch().add(o);
        }

        conditions.setModifiedSince(request.getConditions().getModifiedSince());

        for (Tag o : request.getConditions().getNoneMatch()) {
            conditions.getNoneMatch().add(o);
        }

        conditions.setRangeDate(request.getConditions().getRangeDate());
        conditions.setRangeTag(request.getConditions().getRangeTag());
        conditions.setUnmodifiedSince(request.getConditions()
                .getUnmodifiedSince());

        for (Cookie o : request.getCookies()) {
            getCookies().add(o);
        }

        this.hostRef = request.getHostRef();
        this.maxForwards = request.getMaxForwards();
        this.originalRef = (request.getOriginalRef() == null) ? null
                : new Reference(request.getOriginalRef());
        this.onResponse = request.getOnResponse();
        this.protocol = request.getProtocol();

        for (Range o : request.getRanges()) {
            getRanges().add(o);
        }

        this.referrerRef = (request.getReferrerRef() == null) ? null
                : new Reference(request.getReferrerRef());
        this.rootRef = (request.getRootRef() == null) ? null : request
                .getRootRef();

        for (Entry<String, Object> e : request.getAttributes().entrySet()) {
            getAttributes().put(e.getKey(), e.getValue());
View Full Code Here

     *
     * @param hostUri
     *            The host URI.
     */
    public void setHostRef(String hostUri) {
        setHostRef(new Reference(hostUri));
    }
View Full Code Here

TOP

Related Classes of org.restlet.client.data.Reference

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.