Package org.eclipse.jetty.util

Examples of org.eclipse.jetty.util.UrlEncoded


      // Throws CharacterCodingException.
      CharBuffer parsed = utf8Decoder.decode(ByteBuffer.wrap(utf8Bytes));
      parametersLine = parsed.toString();

      MultiMap<String> parameters = new UrlEncoded(parametersLine);
      CallbackHandler callbackHandler = new HttpRequestBasedCallbackHandler(parameters);

      LoginContext context = new LoginContext("Wave", subject, callbackHandler, configuration);

      // If authentication fails, login() will throw a LoginException.
View Full Code Here


            String url = config.getLoginUrl() + OAUTH2_TOKEN_PATH;
            loginPost.setURL(url);
            loginPost.setMethod(HttpMethods.POST);
            loginPost.setRequestContentType(FORM_CONTENT_TYPE);

            final UrlEncoded nvps = new UrlEncoded();
            nvps.put("grant_type", "password");
            nvps.put("client_id", config.getClientId());
            nvps.put("client_secret", config.getClientSecret());
            nvps.put("username", config.getUserName());
            nvps.put("password", config.getPassword());
            nvps.put("format", "json");

            try {

                LOG.info("Logging clientId: {} into Salesforce url: {}", config.getClientId(), url);

                // set form content
                loginPost.setRequestContent(new ByteArrayBuffer(
                        nvps.encode(StringUtil.__UTF8, true).getBytes(StringUtil.__UTF8)));
                httpClient.send(loginPost);

                // wait for the login to finish
                final int exchangeState = loginPost.waitForDone();
View Full Code Here

            assertTrue(requestAttributeNames.containsAll(expectedAttributeNames));

            assertEquals(null, request.getPathInfo());
            assertEquals(null, request.getPathTranslated());
           
            UrlEncoded query = new UrlEncoded();
            query.decode(request.getQueryString());
            assertThat(query.getString("do"), is("end"));
           
            // Russian for "selected=Temperature"
            UrlEncoded q2=new UrlEncoded();
            q2.decode(query.getString("else"));
            String russian = q2.encode();
            assertThat(russian, is("%D0%B2%D1%8B%D0%B1%D1%80%D0%B0%D0%BD%D0%BE=%D0%A2%D0%B5%D0%BC%D0%BF%D0%B5%D1%80%D0%B0%D1%82%D1%83%D1%80%D0%B0"));
            assertThat(query.getString("test"), is("1"));
            assertThat(query.containsKey("foreign"), is(true));
           
            String[] vals = request.getParameterValues("foreign");
View Full Code Here

            final StatusExceptionExchange loginPost = new StatusExceptionExchange(true);
            loginPost.setURL(config.getLoginUrl() + OAUTH2_TOKEN_PATH);
            loginPost.setMethod(HttpMethods.POST);
            loginPost.setRequestContentType(FORM_CONTENT_TYPE);

            final UrlEncoded nvps = new UrlEncoded();
            nvps.put("grant_type", "password");
            nvps.put("client_id", config.getClientId());
            nvps.put("client_secret", config.getClientSecret());
            nvps.put("username", config.getUserName());
            nvps.put("password", config.getPassword());
            nvps.put("format", "json");

            try {

                // set form content
                loginPost.setRequestContent(new ByteArrayBuffer(
                        nvps.encode(StringUtil.__UTF8, true).getBytes(StringUtil.__UTF8)));
                httpClient.send(loginPost);

                // wait for the login to finish
                final int exchangeState = loginPost.waitForDone();
View Full Code Here

      // Throws CharacterCodingException.
      CharBuffer parsed = utf8Decoder.decode(ByteBuffer.wrap(utf8Bytes));
      parametersLine = parsed.toString();

      MultiMap<String> parameters = new UrlEncoded(parametersLine);
      CallbackHandler callbackHandler = new HttpRequestBasedCallbackHandler(parameters);

      LoginContext context = new LoginContext("Wave", subject, callbackHandler, configuration);

      // If authentication fails, login() will throw a LoginException.
View Full Code Here

TOP

Related Classes of org.eclipse.jetty.util.UrlEncoded

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.