Java HTTP Component - HTTP Class, HTTP Bean, HTTP Object, HTTP Client, HTTP Control
Home Search Knowledge Base Support

Support

Click here for access to live sales support.

For technical support please submit a ticket to the Help Desk.

 

Java and .NET Help

iPod shuffle offer

For a limited time get the newly re-designed iPod shuffle free with qualifying purchase.

Click for details.


News

JSCAPE Secure FTP Server 6.4 Released
01/18/2010 03:58 PM

JSCAPE Secure FTP Server 6.3 Released
12/14/2009 05:45 PM

Secure iNet Factory 8.3.1 Released
12/04/2009 04:26 PM

SSH Factory 3.5 Released
11/10/2009 01:46 PM

Secure iNet Factory 8.3 Released
11/10/2009 01:43 PM

Secure FTP Factory 8.3 Released
11/10/2009 01:37 PM

more...


Tutorials

Enabling Phone Authentication
04/08/2009 11:24 AM

Detecting and Handling Brute Force Password Attacks
01/29/2009 09:44 AM

Creating a Domain
12/15/2008 11:33 AM

Public key authentication with SFTP
10/02/2008 07:59 AM

Formatting MimeMessages using .NET
09/14/2008 04:31 PM

Communicating with an IMAP4 server in .NET
09/14/2008 03:54 PM

more...


Articles

Streamlining web uploads with ZIP archives
12/14/2009 10:11 AM

Using regular expressions in complex trigger conditions
09/08/2009 07:42 AM

Using custom forms to automate business processes
07/03/2009 08:51 AM

Public key authentication with SFTP
10/02/2008 07:59 AM

Best Practices for Configuring Your FTP Server
06/03/2008 04:47 PM

What is the difference between passive and active FTP?
05/20/2008 09:27 AM

more...


Feedback

Request a feature or component

Request a Java or .NET component


 

Java HTTP/S Component

The HTTP component provides an easy to use API for communicating with an HTTP server. Written using 100% Java and delivered as a Java Bean makes the HTTP component usable in a wide variety of IDE and platform configurations. Download Secure iNet Factory Evaluation

Features

  • GET, POST and PUT support - Full support for GET, POST and PUT operations emulating all the core functionality of a typical web browser.
  • SSL support - Access secure web pages using HTTPS (SSL)
  • File upload support - Easily upload files to a web server for processing by a CGI or servlet.
  • Parameter management - Simple API allows easy addition or removal of CGI name/value parameters from a HTTP request.
  • Basic authentication - Provides methods for retrieving HTTP documents which require a user supplied username and password.
  • Cookie management - Add cookie values to a HTTP request, as well as retrieve cookie data from a HTTP response.
  • Header management - Easily define HTTP request header values for submission with a HTTP request or retrieve header values from a HTTP response.
  • Proxy support - Provides methods for retrieving HTTP documents from behind a firewall.

Code Example

The following example demonstrates how to retrieve the contents of a web page from an HTTP server.

/*
 * @(#)HttpExample.java
 *
 * Copyright (c) 2001-2002 JScape
 * 1147 S. 53rd Pl., Mesa, Arizona, 85206, U.S.A.
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of
 * JScape. ("Confidential Information").  You shall not disclose such
 * Confidential Information and shall use it only in accordance with
 * the terms of the license agreement you entered into with JScape.
 */

import com.jscape.inet.http.*;
import com.jscape.inet.mime.MimeException;
import java.io.*;

public class HttpExample extends HttpAdapter {
    private String url;
    
    public HttpExample(String url) {
        this.url = url;
    }
    
    // print out contents of URL
    public void getUrl() throws HttpException, MimeException {
      // create new Http instance
        Http http = new Http();
        
        // register this class to capture HTTP related events
        http.addHttpListener(this);
        
        // create HTTP request
        HttpRequest request = new HttpRequest(url,"GET");
        
        // get HTTP response and print body to console
        HttpResponse response = http.getResponse(request);
        System.out.println(response.getBody());
        
    }
    
    public void connected(HttpConnectedEvent evt) {
        System.out.println("Connected to: " + evt.getURL());
    }
    
    public void disconnected(HttpDisconnectedEvent evt) {
        System.out.println("Disconnected from: " + evt.getURL());
    }
    
    public static void main(String[] args) {
        String url;
        try {
            BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
            System.out.print("Enter web address to retrieve (e.g. http://www.yahoo.com): ");
            url = reader.readLine();
            HttpExample example = new HttpExample(url);
            example.getUrl();
        }
        catch(Exception e) {
            e.printStackTrace();
        }
    }
}