Request.py :  » Web-Frameworks » Webware » Webware-1.0.2 » WebKit » Python Open Source

Home
Python Open Source
1.3.1.2 Python
2.Ajax
3.Aspect Oriented
4.Blog
5.Build
6.Business Application
7.Chart Report
8.Content Management Systems
9.Cryptographic
10.Database
11.Development
12.Editor
13.Email
14.ERP
15.Game 2D 3D
16.GIS
17.GUI
18.IDE
19.Installer
20.IRC
21.Issue Tracker
22.Language Interface
23.Log
24.Math
25.Media Sound Audio
26.Mobile
27.Network
28.Parser
29.PDF
30.Project Management
31.RSS
32.Search
33.Security
34.Template Engines
35.Test
36.UML
37.USB Serial
38.Web Frameworks
39.Web Server
40.Web Services
41.Web Unit
42.Wiki
43.Windows
44.XML
Python Open Source » Web Frameworks » Webware 
Webware » Webware 1.0.2 » WebKit » Request.py
from Common import *
from Message import Message


class Request(Message):
  """The abstract request class.

  Request is a type of Message that offers the following:

    * A time stamp (indicating when the request was made)
    * An input stream. @@ 2000-04-30 ce: resolve this
    * Remote request information (address, name)
    * Local host information (address, name, port)
    * A security indicator

  Request is an abstract class; developers typically use HTTPRequest.

  FUTURE
    * Consider if the local host information should be moved up to Message.
    * Locales
    * Secure requests, authentication, etc.

  """


  ## Init ##

  def __init__(self):
    """Initialize the request.

    Subclasses are responsible for invoking super
    and initializing self._time.

    """
    Message.__init__(self)
    self._transaction = None


  ## Access ##

  def time(self):
    return self._time

  def timeStamp(self):
    """Return time() as a human readable string, useful for logging and debugging."""
    return asclocaltime(self.time())


  ## Input ##

  def input(self):
    """Return a file-style object that the contents can be read from.

    # @@ 2000-05-03 ce: This is bogus. Disregard for now.

    """
    pass


  ## Remote info ##

  # @@ 2000-05-07 ce: Do remoteAddress() and remoteName()
  # have to be implemented here or should it be a subclass responsibility?

  def remoteAddress(self):
    """Get the remote address.

    Returns a string containing the Internet Protocol (IP) address
    of the client that sent the request.

    """
    raise NotImplementedError

  def remoteName(self):
    """Get the remote name.

    Returns the fully qualified name of the client that sent the request,
    or the IP address of the client if the name cannot be determined.

    """
    raise NotImplementedError


  ## Local info ##

  def localAddress(self):
    """Get local address.

    Returns a string containing the Internet Protocol (IP) address
    of the local host (e.g., the server) that received the request.

    """
    raise NotImplementedError

  def localName(self):
    """Get local name.

    Returns the fully qualified name of the local host (e.g., the server)
    that received the request.

    """
    return 'localhost'

  def localPort(self):
    """Get local port.

    Returns the port of the local host (e.g., the server)
    that received the request.

    """
    raise NotImplementedError


  ## Security ##

  def isSecure(self):
    """Check whether this is a secure channel.

    Returns true if request was made using a secure channel,
    such as HTTPS. This currently always returns false,
    since secure channels are not yet supported.

    """
    return False


  ## Transactions ##

  def responseClass(self):
    """Get the corresponding response class."""
    raise NotImplementedError

  def setTransaction(self, trans):
    """Set a transaction container."""
    self._transaction = trans

  def transaction(self):
    """Get the transaction container."""
    return self._transaction


  ## Cleanup ##

  def clearTransaction(self):
    del self._transaction
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.