001: /*
002: * ChainBuilder ESB
003: * Visual Enterprise Integration
004: *
005: * Copyright (C) 2007 Bostech Corporation
006: *
007: * This program is free software; you can redistribute it and/or modify it
008: * under the terms of the GNU General Public License as published by the
009: * Free Software Foundation; either version 2 of the License, or (at your option)
010: * any later version.
011: *
012: * This program is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
014: * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
015: * for more details.
016: *
017: * You should have received a copy of the GNU General Public License along with
018: * this program; if not, write to the Free Software Foundation, Inc.,
019: * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
020: *
021: *
022: * $Id: IHttpRequest.java 8973 2007-09-07 01:29:55Z mpreston $
023: */
024: package com.bostechcorp.cbesb.runtime.ccsl.lib;
025:
026: import java.util.List;
027:
028: import javax.xml.transform.Source;
029:
030: /**
031: * Used by the HTTP Component in consumer non-soap mode to
032: * send a request to an external HTTP Server.
033: */
034: public interface IHttpRequest {
035:
036: public static final byte METHOD_GET = 0;
037: public static final byte METHOD_POST = 1;
038: public static final byte METHOD_PUT = 2;
039:
040: /**
041: * Gets the method of the request. One of:
042: * <ul>
043: * <li>METHOD_GET</li>
044: * <li>METHOD_POST</li>
045: * <li>METHOD_PUT</li>
046: * </ul>
047: * @return
048: */
049: public byte getMethod();
050:
051: /**
052: * Sets the method of the request. One of:
053: * <ul>
054: * <li>METHOD_GET</li>
055: * <li>METHOD_POST</li>
056: * <li>METHOD_PUT</li>
057: * </ul>
058: * @param method
059: */
060: public void setMethod(byte method);
061:
062: public String getURL();
063:
064: public void setURL(String URL);
065:
066: /**
067: * Returns the body of the request as a Source.
068: * @return
069: */
070: public Source getBody();
071:
072: /**
073: * Sets the body of the request.
074: * @param body
075: */
076: public void setBody(Source body);
077:
078: /**
079: * Gets a List containing all of the HTTP Headers
080: * in the request.
081: * @return
082: */
083: public List<IHttpHeader> getHeaders();
084:
085: /**
086: * Sets the List of HTTP Headers in the request.
087: * @param httpHeaders
088: */
089: public void setHeaders(List<IHttpHeader> httpHeaders);
090:
091: /**
092: * Removes all HTTP Headers from the request.
093: *
094: */
095: public void clearHeaders();
096:
097: /**
098: * Adds a single header to the request.
099: * @param httpHeader
100: */
101: public void addHeader(IHttpHeader httpHeader);
102:
103: /**
104: * Creates a new IHttpHeader instance and adds it to the request
105: * @param name
106: * @param value
107: * @return
108: */
109: public IHttpHeader createHeader(String name, String value);
110: }
|