Examples of EmptyRepresentation


Examples of org.restlet.representation.EmptyRepresentation

        String action = getQuery().getFirstValue("action");
        // Came back after user interacted with the page
        if (action != null) {
            String[] scopes = getQuery().getValuesArray("scope");
            handleAction(action, scopes);
            return new EmptyRepresentation();
        }

        // Check if an auth page is set in the Context
        String authPage = OAuthHelper.getAuthPageTemplate(getContext());
        getLogger().info("this is auth page: " + authPage);
        if (authPage != null && authPage.length() > 0) {
            getLogger().info("loading authPage: " + authPage);
            // Check if we should skip the page if already approved scopes
            boolean sameScope = OAuthHelper.getAuthSkipApproved(getContext());
            if (sameScope) {
                String[] scopesArray = getQuery().getValuesArray("scope");

                List<String> scopes = Arrays.asList(scopesArray);
                List<String> previousScopes = Arrays.asList(getQuery()
                        .getValuesArray("grantedScope"));

                if (previousScopes.containsAll(scopes)) {
                    // we already have approved the current scopes being
                    // requested...
                    getLogger().fine(
                            "All scopes already approved. - skip auth page.");
                    handleAction("Accept", scopesArray);
                    return new EmptyRepresentation(); // Will redirect
                }
            }

            getResponse().setCacheDirectives(noCache);
            return getPage(authPage);
        }
        getLogger().info("accepting scopes since no authPage: " + authPage);
        // No page automatically accept all the scopes requested
        handleAction("Accept", getQuery().getValuesArray("scope"));
        getLogger().info("action handled");
        return new EmptyRepresentation(); // Will redirect
    }
View Full Code Here

Examples of org.restlet.representation.EmptyRepresentation

        assertEquals(r.getResponseEntity().getText(), text);
        r.release();

        // Put a directory
        ClientResource rd = new ClientResource(fzd);
        rd.put(new EmptyRepresentation());
        assertTrue(rd.getStatus().equals(Status.SUCCESS_OK));

        rd.get();
        assertTrue(rd.getStatus().equals(Status.SUCCESS_OK));

        // Checking second one was output
        r2.get();
        assertTrue("Could not get " + fzr2, r2.getStatus().equals(
                Status.SUCCESS_OK));
        assertEquals(r2.getResponseEntity().getText(), text2);

        ClientResource rTest2 = new ClientResource(zr + "!test2");
        rTest2.get();
        assertFalse(rTest2.getStatus().equals(Status.SUCCESS_OK));

        // Try to replace file by directory
        ClientResource r2d = new ClientResource(fzr2 + "/");
        r2d.put(new EmptyRepresentation());
        assertFalse(r2d.getStatus().equals(Status.SUCCESS_OK));
    }
View Full Code Here

Examples of org.restlet.representation.EmptyRepresentation

                headers.add(new Parameter(headerName, hValue));
            }
        }

        if (restletResponse.getEntity() == null) {
            restletResponse.setEntity(new EmptyRepresentation());
        }

        HeaderUtils.copyResponseTransportHeaders(headers, restletResponse);
        HeaderUtils.extractEntityHeaders(headers, restletResponse.getEntity());
View Full Code Here

Examples of org.restlet.representation.EmptyRepresentation

                        contentLength);
                result.setSize(contentLength);
                setMessageState(MessageState.BODY);
            }
        } else {
            result = new EmptyRepresentation();
        }

        if (headers != null) {
            try {
                result = HeaderUtils.extractEntityHeaders(headers, result);
View Full Code Here

Examples of org.restlet.representation.EmptyRepresentation

        }

        getPipelines().remove(id);

        setStatus(Status.SUCCESS_OK);
        return new EmptyRepresentation();
    }
View Full Code Here

Examples of org.restlet.representation.EmptyRepresentation

        if (pipeconfig.defoutput != null) {
            return getOutput(pipeconfig, pipeconfig.defoutput);
        } else {
            setStatus(Status.SUCCESS_OK);
            return new EmptyRepresentation();
        }
    }
View Full Code Here

Examples of org.restlet.representation.EmptyRepresentation

        }

        Vector<XdmNode> nodes = pipeconfig.outputs.get(port);
        if (nodes.size() == 0) {
            setStatus(Status.SUCCESS_NO_CONTENT);
            return new EmptyRepresentation();
        }

        XdmNode doc = nodes.firstElement();
        nodes.remove(0);
View Full Code Here

Examples of org.restlet.representation.EmptyRepresentation

    private HandlerCommand invokeCommand( Reference ref, Method method, Object requestObject, ResponseHandler responseHandler, ResponseHandler processingErrorHandler )
    {
        Request request = new Request( method, ref );

        if (requestObject == null)
            requestObject = new EmptyRepresentation();

        contextResourceFactory.writeRequest( request, requestObject );

        contextResourceFactory.updateCommandRequest( request );
View Full Code Here

Examples of org.restlet.representation.EmptyRepresentation

        {
            uow.discard();
            getResponse().setStatus( Status.CLIENT_ERROR_NOT_FOUND );
        }

        return new EmptyRepresentation();
    }
View Full Code Here

Examples of org.restlet.representation.EmptyRepresentation

            throw new ResourceException( Status.CLIENT_ERROR_GONE );
        }

        getResponse().setStatus( Status.SUCCESS_RESET_CONTENT );

        return new EmptyRepresentation();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.