Package org.restlet

Examples of org.restlet.Request


            throws ResourceException {
        // A - Build the mail URI
        final Reference mailRef = getMailRef(identifier);

        // B - Get the mail
        final Request request = new Request(Method.GET, mailRef);
        if (getMailboxChallengeScheme() != null) {
            final ChallengeResponse challengeResponse = new ChallengeResponse(
                    getMailboxChallengeScheme(), getMailboxLogin(),
                    getMailboxPassword());
            request.setChallengeResponse(challengeResponse);
        }
        final Response response = getContext().getClientDispatcher().handle(
                request);

        if (!response.getStatus().isSuccess()) {
View Full Code Here


     */
    protected List<String> getMailIdentifiers() throws ResourceException {
        final List<String> result = new ArrayList<String>();

        // 1 - Get to mailbox content
        final Request request = new Request(Method.GET, getMailboxUri());
        if (getMailboxChallengeScheme() != null) {
            final ChallengeResponse challengeResponse = new ChallengeResponse(
                    getMailboxChallengeScheme(), getMailboxLogin(),
                    getMailboxPassword());
            request.setChallengeResponse(challengeResponse);
        }
        final Response response = getContext().getClientDispatcher().handle(
                request);

        if (!response.getStatus().isSuccess()) {
View Full Code Here

     * {@link ClientInfo}.
     */
    public Response accessServer(Method httpMethod, Class<?> klasse,
            String subPath, Conditions conditions, ClientInfo clientInfo) {
        final Reference reference = createReference(klasse, subPath);
        final Request request = new Request(httpMethod, reference);
        if (conditions != null) {
            request.setConditions(conditions);
        }
        if (clientInfo != null) {
            request.setClientInfo(clientInfo);
        }
        return accessServer(request);
    }
View Full Code Here

     * @return
     */
    protected Request createGetRequest(String subPath) {
        final Reference reference = createReference(
                getRootResourceClassFromAppConf(), subPath);
        return new Request(Method.GET, reference);
    }
View Full Code Here

        }
        assertEquals(null, text);
    }

    public void testCookieArray() throws Exception {
        final Request request = createGetRequest("array");
        request.getCookies().add(new Cookie("c", "c1"));
        request.getCookies().add(new Cookie("c", "c2"));
        request.getCookies().add(new Cookie("d", "c3"));
        final Response response = accessServer(request);
        sysOutEntityIfError(response);
        assertEquals(Status.SUCCESS_OK, response.getStatus());
        final String entity = response.getEntity().getText();
        final String entityWithoutBrackets = entity.substring(1, entity
View Full Code Here

                .length() - 1);
        assertEquals("c1, c2", entityWithoutBrackets);
    }

    public void testCookieSet() throws Exception {
        final Request request = createGetRequest("Set");
        request.getCookies().add(new Cookie("c", "c1"));
        request.getCookies().add(new Cookie("c", "c2"));
        request.getCookies().add(new Cookie("d", "c3"));
        final Response response = accessServer(request);
        sysOutEntityIfError(response);
        assertEquals(Status.SUCCESS_OK, response.getStatus());
        final String entity = response.getEntity().getText();
        final String entityWithoutBrackets = entity.substring(1, entity
View Full Code Here

            assertEquals("c2, c1", entityWithoutBrackets);
        }
    }

    public void testCookieSortedSet() throws Exception {
        final Request request = createGetRequest("SortedSet");
        request.getCookies().add(new Cookie("c", "c1"));
        request.getCookies().add(new Cookie("c", "c2"));
        request.getCookies().add(new Cookie("d", "c3"));
        final Response response = accessServer(request);
        sysOutEntityIfError(response);
        assertEquals(Status.SUCCESS_OK, response.getStatus());
        final String entity = response.getEntity().getText();
        assertEquals("c1, c2", entity.substring(1, entity.length() - 1));
View Full Code Here

                targetRef = new Reference(href);
            }

            String targetUri = targetRef.getTargetRef().toString();
            Response response = this.context.getClientDispatcher().handle(
                    new Request(Method.GET, targetUri));

            if (response.getStatus().isSuccess()
                    && response.isEntityAvailable()) {
                try {
                    result = new StreamSource(response.getEntity().getStream());
View Full Code Here

     *            jdbc:mysql://[hostname]/[database]).
     * @param request
     *            The request to send (valid XML request).
     */
    public static Request create(String jdbcURI, Representation request) {
        Request result = new Request();
        result.getClientInfo().setAgent(Engine.VERSION_HEADER);
        result.setMethod(Method.POST);
        result.setResourceRef(jdbcURI);
        result.setEntity(request);
        return result;
    }
View Full Code Here

     * @param rootRef
     * @return
     */
    static ThreadLocalizedUriInfo newUriInfo(Reference resourceRef,
            Reference rootRef) {
        final Request request = new Request();
        request.setResourceRef(resourceRef);
        request.setOriginalRef(resourceRef);
        request.setRootRef(rootRef);
        final Response response = new Response(request);
        Response.setCurrent(response);
        final CallContext callContext = new CallContext(request, response);
        final ThreadLocalizedContext tlContext = new ThreadLocalizedContext();
        tlContext.set(callContext);
View Full Code Here

TOP

Related Classes of org.restlet.Request

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.