001: /*
002:
003: This software is OSI Certified Open Source Software.
004: OSI Certified is a certification mark of the Open Source Initiative.
005:
006: The license (Mozilla version 1.0) can be read at the MMBase site.
007: See http://www.MMBase.org/license
008:
009: */
010:
011: package org.mmbase.util;
012:
013: import org.mmbase.bridge.Cloud;
014: import javax.servlet.http.HttpServletRequest;
015: import javax.servlet.http.HttpServletResponse;
016:
017: /**
018: * The PageInfo is a container class.
019: * Needed for the ProcessorInterface.
020: *
021: * @since MMBase 1.8
022: * @author Pierre van Rooden
023: * @version $Id: PageInfo.java,v 1.3 2005/11/04 23:28:02 michiel Exp $
024: */
025: public class PageInfo {
026: /**
027: * The request object associated with the current page.
028: * Not a very good name - and should not be public, but needed for
029: * backward compatibility witH SCAN
030: */
031: public HttpServletRequest req;
032:
033: /**
034: * The response object associated with the current page.
035: * Not a very good name - and should not be public, but needed for
036: * backward compatibility witH SCAN
037: */
038: public HttpServletResponse res;
039:
040: private Cloud cloud;
041:
042: /**
043: * Empty constructor, needed for call from scanpage
044: */
045: protected PageInfo() {
046: }
047:
048: /**
049: * Creates a pagecontext with a user's request information.
050: * @param request the HttpServletRequest object for this request
051: * @param response the HttpServletResponse object for this request
052: */
053: public PageInfo(HttpServletRequest request,
054: HttpServletResponse response, Cloud cloud) {
055: setRequest(request);
056: setResponse(response);
057: this .cloud = cloud;
058: }
059:
060: public PageInfo(HttpServletRequest request,
061: HttpServletResponse response) {
062: setRequest(request);
063: setResponse(response);
064: }
065:
066: /**
067: * Returns the HttpServletRequest object for this request.
068: * @return a HttpServletRequest object, or <code>null</code> if none is available
069: */
070: public HttpServletRequest getRequest() {
071: return req;
072: }
073:
074: /**
075: * Sets the HttpServletRequest object for this request.
076: * @param request a HttpServletRequest object, or <code>null</code> if none is available
077: */
078: protected void setRequest(HttpServletRequest request) {
079: req = request;
080: }
081:
082: /**
083: * Returns the HttpServletResponse object for this request.
084: * @return a HttpServletResponse object, or <code>null</code> if none is available
085: */
086: public HttpServletResponse getResponse() {
087: return res;
088: }
089:
090: /**
091: * Sets the HttpServletResponse object for this request.
092: * @param response a HttpServletResponse object, or <code>null</code> if none is available
093: */
094: protected void setResponse(HttpServletResponse response) {
095: res = response;
096: }
097:
098: public Cloud getCloud() {
099: return cloud;
100: }
101:
102: public String toString() {
103: return "" + req + " " + res + " " + cloud
104: + (cloud != null ? ("" + cloud.getUser()) : "");
105: }
106:
107: }
|