Package javax.net.ssl

Examples of javax.net.ssl.HttpsURLConnection$DefaultHostnameVerifier


    public BuzzFeedEntry updatePost( String userId, String activityId, BuzzContent content )
        throws BuzzValidationException, BuzzIOException, BuzzAuthenticationException, BuzzParsingException
    {
        String payload = XMLGenerator.constructPayload( content, null );

        HttpsURLConnection request = BuzzIO.createRequest( BUZZ_URL_ACTIVITIES + userId + "/"
            + BuzzFeed.Type.PRIVATE.getName() + "/" + activityId, BuzzIO.HTTP_METHOD_PUT );

        buzzOAuth.signRequest( BuzzIO.addBody( request, payload ) );

        String xmlResponse = BuzzIO.send( request );
View Full Code Here


     */
    public BuzzComment createComment( String userId, String activityId, BuzzContent content )
        throws BuzzIOException, BuzzAuthenticationException, BuzzValidationException, BuzzParsingException
    {
        String payload = XMLGenerator.constructPayload( content, null );
        HttpsURLConnection request = BuzzIO.createRequest( BUZZ_URL_ACTIVITIES + userId + "/"
            + BuzzFeed.Type.PRIVATE.getName() + "/" + activityId + "/" + BuzzFeed.Type.COMMENTS.getName(),
                                                           BuzzIO.HTTP_METHOD_POST );
        buzzOAuth.signRequest( BuzzIO.addBody( request, payload ) );

        String xmlResponse = BuzzIO.send( request );
View Full Code Here

     * @throws BuzzAuthenticationException if any OAuth error occurs
     */
    public void deleteComment( String userId, String activityId, String commentId )
        throws BuzzIOException, BuzzAuthenticationException
    {
        HttpsURLConnection request = BuzzIO.createRequest( BUZZ_URL_ACTIVITIES + userId + "/"
            + BuzzFeed.Type.PRIVATE.getName() + "/" + activityId + "/" + BuzzFeed.Type.COMMENTS.getName() + "/"
            + commentId, BuzzIO.HTTP_METHOD_DELETE );

        buzzOAuth.signRequest( request );

View Full Code Here

     * @throws BuzzParsingException if a parsing error occurs
     */
    public BuzzComment getComment( String userId, String activityId, String commentId )
        throws BuzzIOException, BuzzAuthenticationException, BuzzParsingException
    {
        HttpsURLConnection request = BuzzIO.createRequest( BUZZ_URL_ACTIVITIES + userId + "/"
            + BuzzFeed.Type.PRIVATE.getName() + "/" + activityId + "/" + BuzzFeed.Type.COMMENTS.getName() + "/"
            + commentId );

        buzzOAuth.signRequest( request );

View Full Code Here

    public BuzzComment updateComment( String userId, String activityId, String commentId, BuzzContent content )
        throws BuzzValidationException, BuzzIOException, BuzzAuthenticationException, BuzzParsingException
    {
        String payload = XMLGenerator.constructPayload( content, null );

        HttpsURLConnection request = BuzzIO.createRequest( BUZZ_URL_ACTIVITIES + userId + "/"
            + BuzzFeed.Type.PRIVATE.getName() + "/" + activityId + "/" + BuzzFeed.Type.COMMENTS.getName() + "/"
            + commentId, BuzzIO.HTTP_METHOD_PUT );

        buzzOAuth.signRequest( BuzzIO.addBody( request, payload ) );
View Full Code Here

     * @throws BuzzIOException if any IO error occurs ( networking ).
     */
    public static HttpsURLConnection createRequest( String feedUrl, String httpMethod, Map<String, String> headers )
        throws BuzzIOException
    {
        HttpsURLConnection con;
        try
        {
            URL url = new URL( feedUrl );

            con = (HttpsURLConnection) url.openConnection();
            con.setRequestMethod( httpMethod );

            if ( headers != null && !headers.isEmpty() )
            {
                for ( String key : headers.keySet() )
                {
                    con.setRequestProperty( key, headers.get( key ) );
                }
            }
        }
        catch ( IOException e )
        {
View Full Code Here

       
       
       
        try {
            url = new URL("https://"+HOST+":"+PORT);
            HttpsURLConnection connection = (HttpsURLConnection)url.openConnection();
            connection.setHostnameVerifier(new NullHostNameVerifier());
           
            connection.setDoOutput(true);
            connection.setUseCaches(false);
            connection.setAllowUserInteraction(false);

            connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
           
            StringBuilder xml = createOrder(payinfo);
            String a = xml.toString();
            DataOutputStream out = new DataOutputStream(connection.getOutputStream());
            out.write(xml.toString().getBytes());
            out.flush();
           
            // process and read the gateway response
            BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));

            sReturned = in.readLine();
           
        } catch (IOException exIoe) {
            payinfo.paymentError(LocalRes.getIntString("exception.iofile"), exIoe.getMessage());
View Full Code Here

            + merchantKey).getBytes()));
      connection.setRequestProperty("Authorization", "Basic " + encoding);

      if (acceptAllCertificates) {
       if (connection instanceof HttpsURLConnection) {
         HttpsURLConnection sslConnection = (HttpsURLConnection) connection;
         // Accepts all certificates.
         sslConnection.setHostnameVerifier(new HostnameVerifier() {
          public boolean verify(final String hostName,
              final SSLSession session) {
            // Simply returns true to accept all certificates no matter which
            // one is received.
            return true;
          }
         });

       }
      } else {
        // We configure the client to accept certificates signed by one of our
        // trusted entities.
        if (clientSocketFactory != null) {
          if (connection instanceof HttpsURLConnection) {
            HttpsURLConnection sslConnection = (HttpsURLConnection) connection;
            sslConnection.setSSLSocketFactory(clientSocketFactory);
          }
        }
      }

      connection.setDoOutput(true);
View Full Code Here

        /**** create the connection. ****/
        URL url = new URL(urlStr);
        URLConnection con = url.openConnection();

        if (con instanceof HttpsURLConnection) {
            HttpsURLConnection connection = (HttpsURLConnection) con;
            SSLSocketFactory factory = null;
            String proxyHost = null;
            int proxyPort = 0;
           
            proxyHost = getProxyHost();
            proxyPort = getProxyPort();

            factory = new SSLTunnelSocketFactory(ctx, proxyHost, proxyPort);
            connection.setSSLSocketFactory(factory);
        }
        con.setDoInput(true);
        con.setDoOutput(true);
        return con;
    }
View Full Code Here

            System.clearProperty("jetty.ssl.password");
        }
        System.setProperty("javax.net.ssl.trustStore", "target/test-classes/tuscany.keyStore");
        System.setProperty("javax.net.ssl.trustStorePassword", "apache");
        URL url = new URL("https://127.0.0.1:8085/foo");
        HttpsURLConnection conn = (HttpsURLConnection)url.openConnection();
        conn.setHostnameVerifier(new HostnameVerifier() {
            public boolean verify(String hostname, SSLSession session) {
                return true;
            }
        });

        conn.connect();
        read(conn.getInputStream());

        service.stop();
        assertTrue(servlet.invoked);

    }
View Full Code Here

TOP

Related Classes of javax.net.ssl.HttpsURLConnection$DefaultHostnameVerifier

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.