Package org.restlet.representation

Examples of org.restlet.representation.EmptyRepresentation


  {
    String pgtId = getQuery().getFirstValue("pgtId");
    String pgtIou = getQuery().getFirstValue("pgtIou");

    if (pgtId != null && pgtIou != null) {
      return new EmptyRepresentation();
    }
    else {
      getResponse().setStatus(Status.CLIENT_ERROR_BAD_REQUEST);
      return null;
    }
View Full Code Here


  public Representation logData(String data)
  {
    if (logService != null)
      logService.log(LogService.LOG_INFO, data);

    return new EmptyRepresentation();
  }
View Full Code Here

    @Override
    protected Representation head() throws ResourceException {
        getLogger().info("IN head() OpenIDResource");
        setXRDSHeader();
        getLogger().info("Sending empty representation.");
        return new EmptyRepresentation();
    }
View Full Code Here

                // option1: GET HTTP-redirect to the return_to URL
                // return new
                // StringRepresentation(response.getDestinationUrl(true));
                redirectSeeOther(response.getDestinationUrl(true));
                return new EmptyRepresentation();

                // option2: HTML FORM Redirection
                // RequestDispatcher dispatcher =
                // getServletContext().getRequestDispatcher("formredirection.jsp");
                // httpReq.setAttribute("prameterMap",
View Full Code Here

            if (requestStream != null) {
                result = new InputRepresentation(requestStream, null,
                        contentLength);
            } else {
                result = new EmptyRepresentation();
            }

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

        // Extract some interesting header values
        for (Parameter header : getRequestHeaders()) {
            if (header.getName().equalsIgnoreCase(
View Full Code Here

     * @see HeaderUtils#copyResponseTransportHeaders(Series, Response)
     */
    public static Representation extractEntityHeaders(
            Iterable<Parameter> headers, Representation representation)
            throws NumberFormatException {
        Representation result = (representation == null) ? new EmptyRepresentation()
                : representation;
        boolean entityHeaderFound = false;

        if (headers != null) {
            for (Parameter header : headers) {
View Full Code Here

                        accMediaTypes);
            repr = new JaxRsOutputRepresentation<Object>(entity,
                    genericReturnType, respMediaType, methodAnnotations, mbw,
                    httpResponseHeaders);
        } else { // entity == null
            repr = new EmptyRepresentation();
            repr.setMediaType(determineMediaType(jaxRsResponseMediaType,
                    resourceMethod, entityClass, genericReturnType));
        }
        repr.setCharacterSet(getSupportedCharSet(httpResponseHeaders));
        return repr;
View Full Code Here

        String error = query.getFirstValue(OAuthServerResource.ERROR);

        if (error != null && error.length() > 0) {
            // Failed in initial auth resource request
            Representation repr = new EmptyRepresentation();
            String desc = query.getFirstValue(OAuthServerResource.ERROR_DESC);
            String uri = query.getFirstValue(OAuthServerResource.ERROR_URI);

            if (desc != null || uri != null) {
                StringBuilder sb = new StringBuilder();
View Full Code Here

        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

        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

TOP

Related Classes of org.restlet.representation.EmptyRepresentation

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.