summaryrefslogtreecommitdiff
path: root/ACE/examples/Web_Crawler/HTTP_URL.h
blob: e18025de69704d96217de13cbd43be257bca7012 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/* -*- C++ -*- */

//=============================================================================
/**
 *  @file    HTTP_URL.h
 *
 *  @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
 */
//=============================================================================


#ifndef _HTTP_URL_H
#define _HTTP_URL_H

#include "URL_Status.h"
#include "URL.h"
#include "Options.h"

#if !defined (ACE_LACKS_PRAGMA_ONCE)
#pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */

/**
 * @class HTTP_URL
 *
 * @brief An ADT for an HTTP URL.
 *
 * This class plays the "element" role in the Visitor pattern.
 */
class HTTP_URL : public URL
{
public:
  /**
   * The <url_addr> is the URL that we're going to be visiting.  We
   * also keep track of the containing page, if any, which is used to
   * print out more meaningful messages.
   */
  HTTP_URL (const ACE_URL_Addr &url_addr,
            HTTP_URL *containing_page = 0);

  /**
   * Accept the visitor, which will then perform a particular
   * visitation strategy on the URL.  This method is part of the
   * Visitor pattern.
   */
  virtual int accept (URL_Visitor *visitor);

  /// Send a <GET> command to fetch the contents in the URI from the
  /// server.
  virtual ssize_t send_request (void);

  /// Returns the URL that we represent.
  virtual const ACE_URL_Addr &url_addr (void) const;

  /// Commit suicide
  int destroy (void);
private:
  /// Address of the URL we're connected to.
  ACE_URL_Addr url_addr_;

  /// Page that contained us.
  HTTP_URL *containing_page_;
};

#endif /* _HTTP_URL_H */