User: jung
Date: 00/12/22 00:34:48
Modified: src/de/infor/ce/http BodyException.java Command.java
Environment.java HeaderException.java
HeaderFormatException.java HttpException.java
ProcessException.java Request.java Response.java
Server.java StartLineException.java
StatusCodeException.java
UnknownHeaderFieldException.java
UnknownRequestMethodException.java http.dfPackage
Log:
began with exception redesign (messages+embedded throwables).
added a convenient logger console abstraction.
generic Environment.java for configuring packages.
some refactoring of the http package
began move to LGPL
Revision Changes Path
1.3 +44 -83 zoap/src/de/infor/ce/http/BodyException.java
Index: BodyException.java
===================================================================
RCS file: /products/cvs/ejboss/zoap/src/de/infor/ce/http/BodyException.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- BodyException.java 2000/12/04 12:35:46 1.2
+++ BodyException.java 2000/12/22 08:34:44 1.3
@@ -1,101 +1,53 @@
-/*
- * $Id: BodyException.java,v 1.2 2000/12/04 12:35:46 jung Exp $
- * Copyright 2000 (C) infor:business solutions AG, Hauerstrasse 12,
- * D-66299 Friedrichsthal, Germany. All Rights Reserved.
- *
- * License Statement
- *
- * Redistribution and use of this software and associated documentation
("Software"), with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain copyright statements and
notices.
- * Redistributions must also contain a copy of this document.
- *
- * 2. Redistributions in binary form must reproduce the attached copyright
notice, this list of
- * conditions and the following disclaimer in the documentation and/or
other materials provided
- * with the distribution.
- *
- * 3. The end-user documentation included with the redistribution, if any,
must include the following
- * acknowledgment: "This product includes software developed by infor:
business solutions AG
- * (http://www.infor.de/)." Alternately, this acknowledgment may appear
in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The name "infor" must not be used to endorse or promote products
derived from this
- * Software without prior written permission of infor: business solutions
AG.
- * For written permission, please contact [EMAIL PROTECTED]
- *
- * 5. Products derived from this Software may not be called "infor" nor may
"infor" appear
- * in their names without prior written permission of infor: business
solutions AG. infor
- * is a registered trademark of infor:business solutions AG.
- *
- * Disclaimer
- *
- * THIS SOFTWARE IS PROVIDED BY INFOR: BUSINESS SOLUTIONS AG AND CONTRIBUTORS "AS
IS" AND ANY
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- *
- * IN NO EVENT SHALL INFOR: BUSINESS SOLUTIONS AG OR ITS CONTRIBUTORS BE LIABLE
FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE,
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+/*
+ * $Source: /products/cvs/ejboss/zoap/src/de/infor/ce/http/BodyException.java,v $
+ * The Zero-effort Object Access Package is a library to support XML/SOAP
serialisation and invocation.
+ * Copyright (c) 2000 infor business solutions AG, Hauerstrasse 12,
+ * D-66299 Friedrichsthal, Germany. All Rights Reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package de.infor.ce.http;
/**
- * This exception is thrown if some error occurred when outputting or
- * reading the body of a command.
- *
- * @see <related>
- * @author $Author: jung $
- * @version $Revision: 1.2 $
+ * This exception is thrown if some error occurred when outputting or
internalising the body of a http command.
+ * @author jung
+ * @version $Revision: 1.3 $
*/
public class BodyException extends HttpException {
-}
-/*
- * $Log: BodyException.java,v $
- * Revision 1.2 2000/12/04 12:35:46 jung
- * adopted to latest jboss container,
- *
- * added decimal and date
- *
- * removed some problems due to forward-referencing in meta-data
- *
- * added serialisation policy
- *
- * Revision 1.1.1.1 2000/08/10 21:06:38 jung
- * Initial import.
- *
- *
- * Revision 1.1.1.1.2.1 2000/07/13 12:46:14 jung
- * package renaming, most of the zoap stuff now under org.zoap
- * util and http stay infor.ce, containerInvoker etc move to org.jboss
- *
- * changed the makefile, adopted most of the licenses
- *
- * Revision 1.1.1.1 2000/07/06 14:11:25 jung
- * Import of a pre beta version of ZOAP source with a new directory structure,
- * ant-based make, apache-kind of license, etc.
- *
- * jars are coming later because of cvs-history reasons.
- *
- * Revision 1.1.2.1 2000/06/13 15:01:42 jung
- * SOAP support begins to run
- *
- * Revision 1.2 2000/06/07 10:18:58 jung
- * added some service functionality to llokup other
- * beans and yourself as a bean. extended the test case
- * for that purpose.
- *
- * added a lookup service.
- *
- * Revision 1.1.1.1 2000/05/15 10:38:34 jung
- * Initial import of the directory structure. Contains templates and a batch file
to
- * create API documentation. Also contains the not yet
- * fully running directory service (AFDS).
- *
- */
+ /** default constructor */
+ public BodyException() {
+ }
+
+ /** message-based constructor */
+ public BodyException(String message) {
+ super(message);
+ }
+
+ /** message-based constructor with embedded throwable */
+
+ public BodyException(String message, Throwable throwable) {
+ super(message, throwable);
+ }
+
+ /** constructor with embedded throwable */
+ public BodyException(Throwable throwable) {
+ super(throwable);
+ }
+
+} // BodyException
+
1.3 +336 -402 zoap/src/de/infor/ce/http/Command.java
Index: Command.java
===================================================================
RCS file: /products/cvs/ejboss/zoap/src/de/infor/ce/http/Command.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Command.java 2000/12/04 12:35:46 1.2
+++ Command.java 2000/12/22 08:34:45 1.3
@@ -1,21 +1,22 @@
-/*
- * $Id: Command.java,v 1.2 2000/12/04 12:35:46 jung Exp $
- * Copyright (c) 2000 infor:business solutions AG, Hauerstrasse 12,
- * D-66299 Friedrichsthal, Germany. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+/*
+ * $Source: /products/cvs/ejboss/zoap/src/de/infor/ce/http/Command.java,v $
+ * The Zero-effort Object Access Package is a library to support XML/SOAP
serialisation and invocation.
+ * Copyright (c) 2000 infor business solutions AG, Hauerstrasse 12,
+ * D-66299 Friedrichsthal, Germany. All Rights Reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package de.infor.ce.http;
@@ -26,529 +27,453 @@
import java.io.BufferedReader;
/**
- * Java representation of a single, abstract http command.
- *
- * Each command belongs to a version of the http protocol stored in the
minor.major format.
- * It has a header stored in a hashtable and a body stored in a Java string,
- * depending on the concrete usage of that command.
- *
- * As for the header, there are
- * general and entitity header options that each command is able to support.
Further
- * headers can be extended in subclasses of Command.
- *
- * As for the body, it must be nun-null in order to be legal
- *
- * @see <related>
- * @author $Author: jung $
- * @version $Revision: 1.2 $
+ * Java representation of a single, abstract http command. Each command is
represented in a version of the http protocol that
+ * is stored in the minor.major format. Each command has a header (stored in a
hashtable) and a body (stored in a String)
+ * that depend on the concrete usage of that command. There is
+ * however a set of general and entitity header options that any command must be
able to understand. Further headers can be
+ * extended in subclasses of Command. The body of the command must be nun-null in
order to be legal.
+ * @version $Revision: 1.3 $
+ * @author jung
*/
public abstract class Command {
+
+ /** description of the understood general headers */
+
+ public static String[] GENERAL_HEADERS = new String[] {
+ "Cache-Control", "Date", "Pragma", "Trailer", "Transfer-Encoding",
+ "Upgrade", "Via", "Warning"
+ };
+
+ /** Connection is handled "natively" */
+ public static String CONNECTION_HEADER = "Connection";
+
+ /** Connection:Close option is handled "natively" */
+ public static String CONNECTION_OPTION_CLOSE = "Close";
+
+ /** Connection:Keep-Alive is handled "natively" */
+ public static String CONNECTION_OPTION_KEEP_ALIVE = "Keep-Alive";
+
+ /** description of the understood entity headers */
- /**
- * the minor protocol version
- */
+ public static String[] ENTITY_HEADERS = new String[] {
+ "Allow", "Content-Encoding", "Content-Language", "Content-Location",
+ "Content-MD5", "Content-Range", "Content-Type", "Expires",
"Last-Modified"
+ };
- private int protocolMinorVersion=1;
+ /** Content-Length is handled "natively" */
- /**
- * the major protocol version
- */
+ public static String CONTENT_LENGTH_HEADER = "Content-Length";
- private int protocolMajorVersion=1;
+ /** prefix to the protocol flag of a request start line */
+ public static String HTTP_PROTOCOL_PREFIX = "HTTP/";
- /**
- * the length of this command, -1 if not indicated
- */
+ /** the minor protocol version */
- private int length=-1;
+ protected int protocolMinorVersion = 1;
- /**
- * whether the connection should be closed
- */
+ /** the major protocol version */
- private boolean connectionClose;
+ protected int protocolMajorVersion = 1;
- /**
- * description of the understood general headers
- *
- * Connection is handled "natively"
- */
+ /** the length of this command, -1 if not indicated */
- public static String[] GENERAL_HEADERS= new String[] {
- "Cache-Control", "Date", "Pragma", "Trailer", "Transfer-Encoding",
- "Upgrade", "Via", "Warning"};
+ protected int length = -1;
- /**
- * description of the understood entity headers
- *
- * Content-Length is handled "natively"
- */
+ /** whether the connection should be closed */
- public static String[] ENTITY_HEADERS= new String[] {
- "Allow", "Content-Encoding", "Content-Language", "Content-Location",
- "Content-MD5", "Content-Range", "Content-Type", "Expires", "Last-Modified"
- };
+ protected boolean connectionClose;
- /**
- * a hashtable to store the header contents
- */
- private Hashtable header;
+ /** a hashtable to store the header contents */
- /**
- * the content of the command
- */
+ protected Hashtable header;
- private String body;
+ /** the content of the command */
- /**
- * constructor: initially set the header (copy semantics), the protocol version
- * and the body
- */
+ protected String body;
- public Command(Hashtable theHeader,int theMinor, int theMajor, String theBody,
boolean close) {
- if(Environment.DEBUG_HTTP)
-
Environment.out.println("Command("+theHeader+","+theMinor+","+theMajor+","+theBody+","+close+")");
+ /** constructor: initially set the header (copy semantics), the protocol
version and the body */
- // null allowed in copying hashtable?
- if(theHeader!=null)
- header=new Hashtable(theHeader);
- else
- header=new Hashtable();
+ public Command(Hashtable theHeader, int theMinor, int theMajor, String
theBody, boolean close) {
- // set protocol
- protocolMinorVersion=theMinor;
- protocolMajorVersion=theMajor;
+ if (Environment.DEBUG_LEVEL > 0)
+ Environment.CONSOLE.debug(toString() + "(" + theHeader + "," +
theMinor + "," + theMajor + "," + theBody + "," + close + ")");
- // set body
- setBody(theBody);
+ // null allowed in copying hashtable?
+ if (theHeader != null)
+ header = new Hashtable(theHeader);
+ else
+ header = new Hashtable();
- // set the connection close flag
- connectionClose=close;
- }
+ // set protocol
+ protocolMinorVersion = theMinor;
+ protocolMajorVersion = theMajor;
- /**
- * writes this http command to an output-writer @arg writer
- * @throws IOException if some IO things are broken
- * @throws HttpException if some internal structure of the command is broken.
- *
- * This method is final since the general structure of a command is fixed: It
consists
- * of a start line, a header section and a body, hence this method calls the
- * writeStartLine(), writeHeaders() and writeBody() methods in turn
- */
+ // set body
+ setBody(theBody);
- final public void write(PrintWriter writer) throws IOException, HttpException {
+ // set the connection close flag
+ connectionClose = close;
+ }
- if(Environment.DEBUG_HTTP)
- Environment.out.println("Command.write("+writer+")");
+ /**
+ * writes this http command to an output-writer @arg writer
+ * @throws IOException if some IO things are broken
+ * @throws HttpException if some internal structure of the command is broken.
+ * This method is final since the general structure of a command is fixed: It
consists
+ * of a start line, a header section and a body, hence this method calls the
+ * writeStartLine(), writeHeaders() and writeBody() methods in turn
+ */
- // first the initial line which differs depending on the proper subtype of
command
- writeStartLine(writer);
+ final public void write(PrintWriter writer) throws IOException, HttpException {
- // next the header
- writeHeader(writer);
+ if (Environment.DEBUG_LEVEL > 0)
+ Environment.CONSOLE.debug(toString() + ".write(" + writer +
")");
- // a crlf line is left between header and content
- writer.println();
+ // first the initial line which differs depending on the proper
subtype of command
+ writeStartLine(writer);
- // next the body
- writeBody(writer);
- }
+ // next the header
+ writeHeader(writer);
- /**
- * the abstract method to write the start line of an http command
- * should be implemented by the proper subtypes. It is not exposed publically.
- */
+ // a crlf line is left between header and content
+ writer.println();
- abstract protected void writeStartLine(PrintWriter writer) throws IOException,
StartLineException;
+ // next the body
+ writeBody(writer);
+ }
- /**
- * private method to write the header of this command to the writer @arg writer
- * it is private, because the header structure is fixed. It calls the extendible
method
- * writeHeaderLine() which can be overwritten in order to enforce more
- * specific format restrictions.
- */
+ /**
+ * the abstract method to write the start line of an http command
+ * should be implemented by the proper subtypes. It is not exposed publically.
+ */
- protected void writeHeader(PrintWriter writer) throws IOException,
HeaderException {
+ abstract protected void writeStartLine(PrintWriter writer) throws IOException,
StartLineException;
- if(Environment.DEBUG_HTTP)
- Environment.out.println("Command.writeHeader("+writer+")");
+ /**
+ * private method to write the header of this command to the writer @arg writer
+ * it is private, because the header structure is fixed. It calls the
extendible method
+ * writeHeaderLine() which can be overwritten in order to enforce more
specific format restrictions.
+ */
- //simply take all the keys out of the hashtable
- java.util.Enumeration allHeaders=header.keys();
+ protected void writeHeader(PrintWriter writer) throws IOException,
HeaderException {
- // and write them in the correct format to the stream
- while(allHeaders.hasMoreElements()) {
- String fieldName=(String) allHeaders.nextElement();
- Object fieldValue=header.get(fieldName);
- writeHeaderLine(fieldName,fieldValue,writer);
- }
+ if (Environment.DEBUG_LEVEL > 0)
+ Environment.CONSOLE.debug(toString() + ".writeHeader(" +
writer + ")");
- // utter the length if correctly set
- if(length!=-1)
- writer.println("Content-Length:"+length);
+ //simply take all the keys out of the hashtable
+ java.util.Enumeration allHeaders = header.keys();
- if(connectionClose)
- writer.println("Connection:Close");
- else
- writer.println("Connection:Keep-Alive");
+ // and write them in the correct format to the stream
+ while (allHeaders.hasMoreElements()) {
+ String fieldName = (String)allHeaders.nextElement();
+ Object fieldValue = header.get(fieldName);
+ writeHeaderLine(fieldName, fieldValue, writer);
+ }
- }
+ // utter the length if correctly set
+ if (length != -1)
+ writer.println(CONTENT_LENGTH_HEADER + ":" + length);
- /**
- * this method is called to output a single line of the header that is determined
by
- * its string-based name and its arbitrary fieldValue
- *
- * the default behaviour is to use the toString method on the value to reach
- * some pattern like fieldName:fieldValue
- *
- * overwrite this to implement more specific header formats.
- */
+ if (connectionClose)
+ writer.println(CONNECTION_HEADER + ":" +
CONNECTION_OPTION_CLOSE);
+ else
+ writer.println(CONNECTION_HEADER + ":" +
CONNECTION_OPTION_KEEP_ALIVE);
- protected void writeHeaderLine(String fieldName, Object fieldValue, PrintWriter
writer)
- throws IOException, HeaderException {
+ }
- if(Environment.DEBUG_HTTP)
-
Environment.out.println("Command.writeHeaderLine("+fieldName+","+fieldValue+","+writer+")");
+ /**
+ * this method is called to output a single line of the header that is
determined by
+ * its string-based name and its arbitrary fieldValue the default behaviour is
to use the toString method on the value to reach
+ * some pattern like fieldName:fieldValue overwrite this to implement more
specific header formats.
+ */
- writer.println(fieldName+":"+fieldValue.toString());
- }
+ protected void writeHeaderLine(String fieldName, Object fieldValue,
PrintWriter writer)
+ throws IOException, HeaderException {
- /**
- * the writeBody outputs the body of the command.
- *
- * the default implementation prints the body via toString.
- *
- * overwrite this to get more reasonable formats.
- */
+ if (Environment.DEBUG_LEVEL > 0)
+ Environment.CONSOLE.debug(toString() + ".writeHeaderLine(" +
fieldName + "," + fieldValue + "," + writer + ")");
- protected void writeBody(PrintWriter writer) throws IOException, BodyException {
+ writer.println(fieldName + ":" + fieldValue.toString());
+ }
- if(Environment.DEBUG_HTTP)
- Environment.out.println("Command.writeBody("+writer+")");
+ /**
+ * the writeBody outputs the body of the command. the default implementation
prints the body via toString.
+ * overwrite this to get more reasonable formats.
+ */
- if(getBody()!=null)
- writer.print(getBody());
- }
+ protected void writeBody(PrintWriter writer) throws IOException, BodyException
{
- /**
- * parses an incoming command from a character stream. Is final because of the
fixed structure
- * of a command, because it always starts by parsing the start line, parsing the
headers and
- * parsing the body, afterwards.
- */
+ if (Environment.DEBUG_LEVEL > 0)
+ Environment.CONSOLE.debug(toString() + ".writeBody(" + writer
+ ")");
- final public void read(BufferedReader reader)
- throws IOException, HttpException {
+ if (getBody() != null)
+ writer.print(getBody());
+ }
- if(Environment.DEBUG_HTTP)
- Environment.out.println("Command.read("+reader+")");
+ /**
+ * parses an incoming command from a character stream. Is final because of the
fixed structure
+ * of a command, because it always starts by parsing the start line, parsing
the headers and parsing the body, afterwards.
+ */
- // reinitialise length
- length=-1;
+ final public void read(BufferedReader reader)
+ throws IOException, HttpException {
- // first the startline
- readStartLine(reader);
+ if (Environment.DEBUG_LEVEL > 0)
+ Environment.CONSOLE.debug(toString() + ".read(" + reader +
")");
- // then the headers including a trailing crlf
- readHeader(reader);
+ // reinitialise length
+ length = -1;
- // then the body
- readBody(reader);
+ // first the startline
+ readStartLine(reader);
- }
+ // then the headers including a trailing crlf
+ readHeader(reader);
- /**
- * an abstract method to read the start line, must be implemented by the proper
- * subtypes of command
- */
+ // then the body
+ readBody(reader);
- abstract protected void readStartLine(BufferedReader reader) throws IOException,
StartLineException;
+ }
- /**
- * a private method that can be called from within read to
- * parse the header of a command
- * @throws HeaderException if the header format is violated
- */
+ /** an abstract method to read the start line, must be implemented by the
proper subtypes of command */
- protected void readHeader(BufferedReader reader) throws IOException,
HeaderException {
+ abstract protected void readStartLine(BufferedReader reader) throws
IOException, StartLineException;
- if(Environment.DEBUG_HTTP)
- Environment.out.println("Command.readHeader("+reader+")");
+ /**
+ * a private method that can be called from within read to parse the header of
a command
+ * @throws HeaderException if the header format is violated
+ */
- // read until a single crlf is encountered
- String line=reader.readLine();
+ protected void readHeader(BufferedReader reader) throws IOException,
HeaderException {
- if(line==null)
- throw new IOException();
+ if (Environment.DEBUG_LEVEL > 0)
+ Environment.CONSOLE.debug(toString() + ".readHeader(" + reader
+ ")");
- while(!line.equals("")) {
+ // read until a single crlf is encountered
+ String line = reader.readLine();
- try{
+ if (line == null) {
+ if (Environment.LOG_LEVEL > 0) {
+ Environment.CONSOLE.error(toString() +
+ ".readHeader(" + reader + "): could not read header
line.");
+ }
- // sepearate the fieldname from the value
- readHeaderLine(line.substring(0,line.indexOf(":")),
- line.substring(line.indexOf(":")+1));
+ throw new HeaderException(toString() + ".readHeader(" + reader
+ "): could not read header line");
+ }
- } catch(IndexOutOfBoundsException e) {
+ while (!line.equals("")) {
- if(Environment.DEBUG_HTTP)
- Environment.err.println("Command.readHeader("+reader+"): encountered
formatting error "+e);
+ try {
- throw new HeaderException();
+ // sepearate the fieldname from the value
+ readHeaderLine(line.substring(0, line.indexOf(":")),
+ line.substring(line.indexOf(":") + 1));
- } // try
+ } catch (IndexOutOfBoundsException e) {
- // get the next line and loop
- line=reader.readLine();
+ if (Environment.LOG_LEVEL > 0) {
+ Environment.CONSOLE.error(toString() +
+ ".readHeader(" + reader + "): encountered
formatting error " + e);
+ }
- } // while
+ throw new HeaderException(toString() + ".readHeader("
+ reader + "): encountered formatting error", e);
- } // readHeader
+ } // try
- /**
- * this method processes a single headerentry wrt general and entity header
- * options. At the moment just checks whether they are understood and
- * adds the unprocessed values to the hashtable. Overwrite to add features
- */
+ // get the next line and loop
+ line = reader.readLine();
- protected void readHeaderLine(String fieldName, String fieldValue)
- throws UnknownHeaderFieldException, HeaderFormatException {
+ } // while
- if(Environment.DEBUG_HTTP)
-
Environment.out.println("Command.readHeaderLine("+fieldName+","+fieldValue+")");
+ } // readHeader
- // first check whether it is the content-length thing
- try{
+ /**
+ * this method processes a single headerentry wrt general and entity header
+ * options. At the moment just checks whether they are understood and
+ * adds the unprocessed values to the hashtable. Overwrite to add features
+ */
- if("Content-Length".equalsIgnoreCase(fieldName)) {
+ protected void readHeaderLine(String fieldName, String fieldValue)
+ throws UnknownHeaderFieldException, HeaderFormatException {
- while(fieldValue.startsWith(" "))
- fieldValue=fieldValue.substring(1);
+ if (Environment.DEBUG_LEVEL > 0)
+ Environment.CONSOLE.debug(toString() + ".readHeaderLine(" +
fieldName + "," + fieldValue + ")");
- length=Integer.parseInt(fieldValue);
+ // first check whether it is the content-length thing
+ try {
- return;
- }
+ if (CONTENT_LENGTH_HEADER.equalsIgnoreCase(fieldName)) {
- } catch(java.lang.NumberFormatException e) {
+ length = Integer.parseInt(fieldValue.trim());
- if(Environment.DEBUG_HTTP)
- Environment.err.println("Command.readHeaderLine("+fieldName+";"+fieldValue+
- "): encountered number format exception"+e);
+ return;
+ }
- throw new HeaderFormatException();
- }
+ } catch (java.lang.NumberFormatException e) {
- if("Connection".equalsIgnoreCase(fieldName)) {
+ if (Environment.LOG_LEVEL > 0) {
+ Environment.CONSOLE.error(toString() +
".readHeaderLine(" + fieldName + "," + fieldValue +
+ "): encountered number format exception" + e);
+ }
- while(fieldValue.startsWith(" "))
- fieldValue=fieldValue.substring(1);
+ throw new HeaderFormatException(toString() +
".readHeaderLine(" + fieldName + "," + fieldValue + "): encountered number format
exception", e);
+ }
- if("Close".equalsIgnoreCase(fieldValue))
- connectionClose=true;
- else if("Keep-Alive".equalsIgnoreCase(fieldValue))
- connectionClose=false;
- else
- throw new HeaderFormatException();
+ if (CONNECTION_HEADER.equalsIgnoreCase(fieldName)) {
- return;
- }
+ fieldValue = fieldValue.trim();
- // next check whether it belongs to a general heading
- for(int count=0;count<GENERAL_HEADERS.length;count++)
- if(GENERAL_HEADERS[count].equalsIgnoreCase(fieldName)) {
- header.put(GENERAL_HEADERS[count],fieldValue);
- return;
- }
+ if (CONNECTION_OPTION_CLOSE.equalsIgnoreCase(fieldValue))
+ connectionClose = true;
+ else if
(CONNECTION_OPTION_KEEP_ALIVE.equalsIgnoreCase(fieldValue))
+ connectionClose = false;
+ else {
+ if (Environment.LOG_LEVEL > 0) {
+ Environment.CONSOLE.error(toString() +
".readHeaderLine(" + fieldName + "," + fieldValue + "): unsupported value for
Connection header.");
+ }
+ throw new HeaderFormatException(toString() +
".readHeaderLine(" + fieldName + "," + fieldValue + "): unsupported value for
Connection header");
+ }
- // could also be an entity heading
- for(int count=0;count<ENTITY_HEADERS.length;count++)
- if(ENTITY_HEADERS[count].equalsIgnoreCase(fieldName)) {
- header.put(ENTITY_HEADERS[count],fieldValue);
- return;
- }
+ return;
+ }
- throw new UnknownHeaderFieldException();
+ // next check whether it belongs to a general heading
+ for (int count = 0; count < GENERAL_HEADERS.length; count++)
+ if (GENERAL_HEADERS[count].equalsIgnoreCase(fieldName)) {
+ header.put(GENERAL_HEADERS[count], fieldValue);
+ return;
+ }
- } // readHeaderLine
+ // could also be an entity heading
+ for (int count = 0; count < ENTITY_HEADERS.length; count++)
+ if (ENTITY_HEADERS[count].equalsIgnoreCase(fieldName)) {
+ header.put(ENTITY_HEADERS[count], fieldValue);
+ return;
+ }
- /**
- * a method to read the body of a message, default does just
- * get the content as a big string until EOF is reached
- *
- * note that this presumes either a http/1.0-close connectionless behaviour
- * or a decent reader implementation that is able to simulate EOF depending on
- * the given encoding.
- */
+ if (Environment.LOG_LEVEL > 0) {
+ Environment.CONSOLE.error(toString() + ".readHeaderLine(" +
fieldName + "," + fieldValue + "): header not unterstood.");
+ }
- protected void readBody(BufferedReader reader) throws IOException, BodyException {
+ throw new UnknownHeaderFieldException(toString() + ".readHeaderLine("
+ fieldName + "," + fieldValue + "): header not unterstood");
- if(Environment.DEBUG_HTTP)
- Environment.out.println("Command.readBody("+reader+")");
+ } // readHeaderLine
- // see whether we have a content-length encoding
- if(length!=-1) {
+ /**
+ * a method to read the body of a message, default does just get the content
as a big string until EOF is reached
+ * note that this presumes either a http/1.0-close connectionless behaviour
+ * or a decent reader implementation that is able to simulate EOF depending on
the given encoding.
+ */
- int count=0;
+ protected void readBody(BufferedReader reader) throws IOException,
BodyException {
- char[] bodyBuffer=new char[length];
+ if (Environment.DEBUG_LEVEL > 0)
+ Environment.CONSOLE.debug(toString() + ".readBody(" + reader +
")");
- while(count<length)
- count+=reader.read(bodyBuffer,count,length-count);
+ // see whether we have a content-length encoding
+ if (length != -1) {
- setBody(new String(bodyBuffer));
+ int count = 0;
- } else {
+ char[] bodyBuffer = new char[length];
- // else we do it line by line
- String line=reader.readLine();
- // and put it incrementally to the body
- String newBody=new String();
+ while (count < length)
+ count += reader.read(bodyBuffer, count, length -
count);
- while(line!=null) {
- newBody=(String) body+"\r\n"+line;
- line=reader.readLine();
- }
+ setBody(
+ new String(bodyBuffer));
- // determine the length of the body posthum
- setBody(newBody);
+ } else {
- } // if
+ // else we do it line by line
+ String line = reader.readLine();
+ // and put it incrementally to the body
+ String newBody = new String();
- } // readBody
+ while (line != null) {
+ newBody = (String)body + "\r\n" + line;
+ line = reader.readLine();
+ }
- /**
- * accessor to minor protocol version
- */
+ // determine the length of the body posthum
+ setBody(newBody);
- public int getProtocolMinorVersion() {
- return protocolMinorVersion;
- }
+ } // if
- /**
- * accessor to major protocol version
- */
+ } // readBody
- public int getProtocolMajorVersion() {
- return protocolMajorVersion;
- }
+ /** accessor to minor protocol version */
- /**
- * accessor to minor protocol version
- */
+ public int getProtocolMinorVersion() {
+ return protocolMinorVersion;
+ }
- public void setProtocolMinorVersion(int theMinor) {
- protocolMinorVersion=theMinor;
- }
+ /** accessor to major protocol version */
- /**
- * accessor to major protocol version
- */
+ public int getProtocolMajorVersion() {
+ return protocolMajorVersion;
+ }
- public void setProtocolMajorVersion(int theMajor) {
- protocolMajorVersion=theMajor;
- }
+ /** accessor to minor protocol version */
- /**
- * reconstruct protocol number string
- */
+ public void setProtocolMinorVersion(int theMinor) {
+ protocolMinorVersion = theMinor;
+ }
- public String getProtocolVersion() {
- return getProtocolMinorVersion()+"."+getProtocolMajorVersion();
- }
+ /** accessor to major protocol version */
- /**
- * accessor to private hashtable
- */
+ public void setProtocolMajorVersion(int theMajor) {
+ protocolMajorVersion = theMajor;
+ }
- public void putHeader(String key, Object value) {
- header.put(key,value);
- }
+ /** reconstruct protocol number string */
- /**
- * accessor to private hashtable
- */
+ public String getProtocolVersion() {
+ return getProtocolMinorVersion() + "." + getProtocolMajorVersion();
+ }
- public Object getHeader(String key) {
- return header.get(key);
- }
+ /** accessor to private hashtable */
- /**
- * accessor to body
- */
+ public void putHeader(String key, Object value) {
+ header.put(key, value);
+ }
- public String getBody() {
- return body;
- }
+ /** accessor to private hashtable */
- /**
- * accessor to body
- */
+ public Object getHeader(String key) {
+ return header.get(key);
+ }
- public void setBody(String theBody) {
- body=theBody;
+ /** accessor to body */
- if(body!=null)
- length=theBody.length();
- else
- length=-1;
- }
+ public String getBody() {
+ return body;
+ }
- public void setConnectionClose(boolean flag) {
- connectionClose=flag;
- }
+ /** accessor to body */
- public boolean isConnectionClose() {
- return connectionClose;
- }
+ public void setBody(String theBody) {
+ body = theBody;
+ if (body != null)
+ length = theBody.length();
+ else
+ length = -1;
+ }
+
+ /** specifies whether this command will keep the http connection persistent or
not */
+ public void setConnectionClose(boolean flag) {
+ connectionClose = flag;
+ }
+
+ /** whether this command will keep the http connection persistent or not */
+
+ public boolean isConnectionClose() {
+ return connectionClose;
+ }
+
} // Command
-/*
- * $Log: Command.java,v $
- * Revision 1.2 2000/12/04 12:35:46 jung
- * adopted to latest jboss container,
- *
- * added decimal and date
- *
- * removed some problems due to forward-referencing in meta-data
- *
- * added serialisation policy
- *
- * Revision 1.1.1.1 2000/08/10 21:06:40 jung
- * Initial import.
- *
- *
- * Revision 1.1.1.1.2.2 2000/07/17 12:46:14 jung
- * refactored package and meta-model
- *
- * Revision 1.1.1.1.2.1 2000/07/13 12:46:14 jung
- * package renaming, most of the zoap stuff now under org.zoap
- * util and http stay infor.ce, containerInvoker etc move to org.jboss
- *
- * changed the makefile, adopted most of the licenses
- *
- * Revision 1.1.1.1 2000/07/06 14:11:26 jung
- * Import of a pre beta version of ZOAP source with a new directory structure,
- * ant-based make, apache-kind of license, etc.
- *
- * jars are coming later because of cvs-history reasons.
- *
- * Revision 1.1.2.1 2000/06/13 15:01:42 jung
- * SOAP support begins to run
- *
- * Revision 1.2 2000/06/07 10:18:58 jung
- * added some service functionality to llokup other
- * beans and yourself as a bean. extended the test case
- * for that purpose.
- *
- * added a lookup service.
- *
- * Revision 1.1.1.1 2000/05/15 10:38:34 jung
- * Initial import of the directory structure. Contains templates and a batch file
to
- * create API documentation. Also contains the not yet
- * fully running directory service (AFDS).
- *
- */
1.3 +168 -136 zoap/src/de/infor/ce/http/Environment.java
Index: Environment.java
===================================================================
RCS file: /products/cvs/ejboss/zoap/src/de/infor/ce/http/Environment.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Environment.java 2000/12/04 12:35:46 1.2
+++ Environment.java 2000/12/22 08:34:45 1.3
@@ -1,159 +1,182 @@
/*
- * $Id: Environment.java,v 1.2 2000/12/04 12:35:46 jung Exp $
- * Copyright 2000 (C) infor:business solutions AG, Hauerstrasse 12,
- * D-66299 Friedrichsthal, Germany. All Rights Reserved.
- *
- * License Statement
- *
- * Redistribution and use of this software and associated documentation
("Software"), with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain copyright statements and
notices.
- * Redistributions must also contain a copy of this document.
- *
- * 2. Redistributions in binary form must reproduce the attached copyright
notice, this list of
- * conditions and the following disclaimer in the documentation and/or
other materials provided
- * with the distribution.
- *
- * 3. The end-user documentation included with the redistribution, if any,
must include the following
- * acknowledgment: "This product includes software developed by infor:
business solutions AG
- * (http://www.infor.de/)." Alternately, this acknowledgment may appear
in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The name "infor" must not be used to endorse or promote products
derived from this
- * Software without prior written permission of infor: business solutions
AG.
- * For written permission, please contact [EMAIL PROTECTED]
- *
- * 5. Products derived from this Software may not be called "infor" nor may
"infor" appear
- * in their names without prior written permission of infor: business
solutions AG. infor
- * is a registered trademark of infor:business solutions AG.
- *
- * Disclaimer
- *
- * THIS SOFTWARE IS PROVIDED BY INFOR: BUSINESS SOLUTIONS AG AND CONTRIBUTORS "AS
IS" AND ANY
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- *
- * IN NO EVENT SHALL INFOR: BUSINESS SOLUTIONS AG OR ITS CONTRIBUTORS BE LIABLE
FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE,
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * $Source: /products/cvs/ejboss/zoap/src/de/infor/ce/http/Environment.java,v $
+ * The Zero-effort Object Access Package is a library to support XML/SOAP
serialisation and invocation.
+ * Copyright (c) 2000 infor business solutions AG, Hauerstrasse 12,
+ * D-66299 Friedrichsthal, Germany. All Rights Reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package de.infor.ce.http;
import java.util.Properties;
-
-import java.io.PrintStream;
-import java.io.InputStream;
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+import de.infor.ce.console.Console;
/**
- * Environment collects all package-local configurations and provides an
- * interface for file-based and method-based access.
- *
- * @see <related>
- * @author $Author: jung $
- * @version $Revision: 1.2 $
+ * Environment contains static variables and other helping stuff that either
influence
+ * the compilation of the package or initialise its runtime environment from config
files.
+ * @author jung
+ * @version $Revision: 1.3 $
*/
public abstract class Environment {
-
- /**
- * whether DEBUG messages are produced
- */
-
- public static final boolean DEBUG_HTTP=false;
-
- /**
- * runtime logging settings
- */
-
- public static int LOG_HTTP=1;
-
- /**
- * compile-time constants
- */
-
- public final static String PROPERTY="http";
- public final static String CONFIG_FILE=PROPERTY+".conf";
-
- /**
- * runtime streams
- */
-
- public final static PrintStream out=System.out;
- public final static InputStream in=System.in;
- public final static PrintStream err=System.err;
-
- /**
- * usual pool size for the http server
- */
- static int serverPoolSize=10;
+ //
+ // Place your non-final public statics here
+ //
+
+ /** default thread pool size of the http server */
+ public static int SERVER_THREAD_POOL_SIZE = 10;
+
+ /** prefix for the threads in the servers threadpool */
+ public static String SERVER_THREAD_POOL_NAME = "HTTP";
+
+ /** whether the server pool blocks upon too many requests */
+ public static boolean SERVER_THREAD_POOL_BLOCKS = true;
+
+ //
+ // non-final public system statics
+ //
+
+ /** runtime logging settings */
+ public static int LOG_LEVEL = 1;
+
+ /** the properties belonging to this module */
+ public static Properties PROPERTIES = System.getProperties();
+
+ /** the logger for this module */
+ public static Console CONSOLE = null;
+
+ //
+ // final public system static
+ //
+
+ /** whether debug messages are produced, compile-time switch */
+ public static final int DEBUG_LEVEL = 0;
+
+ /** how this module is called */
+ public static final String MODULE_NAME =
Environment.class.getName().substring(0,
+ Environment.class.getName().length() - 12);
+
+ /** where the resources needed to configure this module are found */
+ public static final String RESOURCE_PATH = "";
+
+ /** whether a config file is loaded */
+ public static final boolean READ_CONFIG_FILE = true;
+
+ /** where the resources needed to configure this module are found */
+ public static final String CONFIG_FILE_SUFFIX = ".conf";
+
+ //
+ // static initialisation part, DO NOT MODIFY
+ //
+
+ /** initialisation is done at class loading time */
+ static {
+
+ try {
+ CONSOLE =
de.infor.ce.console.Environment.CONSOLE_FACTORY.createConsole(MODULE_NAME);
+ } catch (Exception e) { }
+
+ if (READ_CONFIG_FILE) {
+ try {
+
+ if (DEBUG_LEVEL > 0)
+ CONSOLE.log(Environment.class.toString() +
+ "_static initializer: trying to load
configuration resource file " +
+ RESOURCE_PATH + MODULE_NAME +
CONFIG_FILE_SUFFIX);
+
+ // and add your personal configuration file
+ PROPERTIES.load(Environment.class.getClassLoader().
+ getResourceAsStream(RESOURCE_PATH + MODULE_NAME +
CONFIG_FILE_SUFFIX));
+ } catch (Exception e) {
+
+ if (DEBUG_LEVEL > 0) {
+ CONSOLE.error(Environment.class.toString() +
+ "_static initializer: encountered " + e + "
while trying to load configuration resource file " +
+ RESOURCE_PATH + MODULE_NAME +
CONFIG_FILE_SUFFIX);
+ CONSOLE.exception(e);
+ }
+ }
+ }
+
+ try {
+ Field[] fields = Environment.class.getFields();
+
+ for (int count = 0; count < fields.length; count++) {
+ try {
+ if
(PROPERTIES.containsKey(fields[count].getName()) &&
+
Modifier.isStatic(fields[count].getModifiers()) &&
+
!Modifier.isFinal(fields[count].getModifiers())) {
+
+
+ if (DEBUG_LEVEL > 0)
+
CONSOLE.log(Environment.class.toString() +
+ "_static initializer: trying
to initialize field " + fields[count].getName()
+ + " with configuration
property " +
+
PROPERTIES.getProperty(fields[count].getName()));
+
+ fields[count].setAccessible(true);
+
+ if
(fields[count].getType().equals(boolean.class) ||
+
fields[count].getType().equals(Boolean.class)) {
+
fields[count].set(Environment.class,
+ new
Boolean(PROPERTIES.getProperty(fields[count].getName())));
+ } else if
(fields[count].getType().equals(int.class) ||
+
fields[count].getType().equals(Integer.class)) {
+
fields[count].set(Environment.class,
+ new
Integer(PROPERTIES.getProperty(fields[count].getName())));
+ } else if
(fields[count].getType().equals(double.class) ||
+
fields[count].getType().equals(Double.class)) {
+
fields[count].set(Environment.class,
+ new
Double(PROPERTIES.getProperty(fields[count].getName())));
+ } else if
(fields[count].getType().equals(float.class) ||
+
fields[count].getType().equals(Float.class)) {
+
fields[count].set(Environment.class,
+ new
Float(PROPERTIES.getProperty(fields[count].getName())));
+ } else if
(fields[count].getType().equals(String.class)) {
+
fields[count].set(Environment.class, PROPERTIES.
+
getProperty(fields[count].getName()));
+ } else {
+
+ if (DEBUG_LEVEL > 0)
+
CONSOLE.warning(Environment.class.toString() +
+ "_static initializer:
type " + fields[count].getType().getName() + " of field " +
+
fields[count].getName() + " is not supported by the reflection configurator.");
+
+ }
+
+ }
+ } catch (Exception e) {
+ if (DEBUG_LEVEL > 0) {
+
CONSOLE.error(Environment.class.toString() +
+ "_static initializer: encountered " +
e + " while trying to initialise field " + fields[count].getName());
+ CONSOLE.exception(e);
+ }
+ }
+ }
+ } catch (Exception e) {
+ if (DEBUG_LEVEL > 0) {
+ CONSOLE.error(Environment.class.toString() +
+ "_static initializer: encountered " + e + " while
trying to get class fields");
+ CONSOLE.exception(e);
+ }
+ }
- /**
- * whether the server uses to block on too much connections
- */
+ } // static
- static boolean serverBlocks=false;
-
-}
-
-/*
- * $Log: Environment.java,v $
- * Revision 1.2 2000/12/04 12:35:46 jung
- * adopted to latest jboss container,
- *
- * added decimal and date
- *
- * removed some problems due to forward-referencing in meta-data
- *
- * added serialisation policy
- *
- * Revision 1.1.1.1 2000/08/10 21:06:40 jung
- * Initial import.
- *
- *
- * Revision 1.1.1.1.2.3 2000/08/04 17:20:18 jung
- * close to beta stadium. Meta-Data import now works.
- *
- * Revision 1.1.1.1.2.2 2000/07/17 12:46:14 jung
- * refactored package and meta-model
- *
- * Revision 1.1.1.1.2.1 2000/07/13 12:46:14 jung
- * package renaming, most of the zoap stuff now under org.zoap
- * util and http stay infor.ce, containerInvoker etc move to org.jboss
- *
- * changed the makefile, adopted most of the licenses
- *
- * Revision 1.1.1.1 2000/07/06 14:11:26 jung
- * Import of a pre beta version of ZOAP source with a new directory structure,
- * ant-based make, apache-kind of license, etc.
- *
- * jars are coming later because of cvs-history reasons.
- *
- * Revision 1.1.2.1 2000/06/13 15:01:42 jung
- * SOAP support begins to run
- *
- * Revision 1.1.2.1 2000/06/08 17:15:47 jung
- * added initial soap service that uses the infor:X framework.
- *
- * Revision 1.1 2000/06/05 09:16:55 jung
- * added an initial revision of infor:X, the
- * XML (de-)serialisation service of infor:CE.
- *
- * supports meta-data structures, namespaces, schemas.
- *
- * lacks collection support, forward-references, multiple roots
- * and external resolution.
- *
- * Revision 1.2 2000/05/16 15:29:33 jung
- * added initial vbsf support
- *
- * Revision 1.1.1.1 2000/05/15 10:38:34 jung
- * Initial import of the directory structure. Contains templates and a batch file to
- * create API documentation. Also contains the not yet
- * fully running directory service (AFDS).
- */
+} // Environment
1.3 +45 -84 zoap/src/de/infor/ce/http/HeaderException.java
Index: HeaderException.java
===================================================================
RCS file: /products/cvs/ejboss/zoap/src/de/infor/ce/http/HeaderException.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- HeaderException.java 2000/12/04 12:35:47 1.2
+++ HeaderException.java 2000/12/22 08:34:45 1.3
@@ -1,101 +1,53 @@
-/*
- * $Id: HeaderException.java,v 1.2 2000/12/04 12:35:47 jung Exp $
- * Copyright 2000 (C) infor:business solutions AG, Hauerstrasse 12,
- * D-66299 Friedrichsthal, Germany. All Rights Reserved.
- *
- * License Statement
- *
- * Redistribution and use of this software and associated documentation
("Software"), with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain copyright statements and
notices.
- * Redistributions must also contain a copy of this document.
- *
- * 2. Redistributions in binary form must reproduce the attached copyright
notice, this list of
- * conditions and the following disclaimer in the documentation and/or
other materials provided
- * with the distribution.
- *
- * 3. The end-user documentation included with the redistribution, if any,
must include the following
- * acknowledgment: "This product includes software developed by infor:
business solutions AG
- * (http://www.infor.de/)." Alternately, this acknowledgment may appear
in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The name "infor" must not be used to endorse or promote products
derived from this
- * Software without prior written permission of infor: business solutions
AG.
- * For written permission, please contact [EMAIL PROTECTED]
- *
- * 5. Products derived from this Software may not be called "infor" nor may
"infor" appear
- * in their names without prior written permission of infor: business
solutions AG. infor
- * is a registered trademark of infor:business solutions AG.
- *
- * Disclaimer
- *
- * THIS SOFTWARE IS PROVIDED BY INFOR: BUSINESS SOLUTIONS AG AND CONTRIBUTORS "AS
IS" AND ANY
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- *
- * IN NO EVENT SHALL INFOR: BUSINESS SOLUTIONS AG OR ITS CONTRIBUTORS BE LIABLE
FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE,
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+/*
+ * $Source: /products/cvs/ejboss/zoap/src/de/infor/ce/http/HeaderException.java,v $
+ * The Zero-effort Object Access Package is a library to support XML/SOAP
serialisation and invocation.
+ * Copyright (c) 2000 infor business solutions AG, Hauerstrasse 12,
+ * D-66299 Friedrichsthal, Germany. All Rights Reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package de.infor.ce.http;
/**
- * This exception is thrown when something has gone wrong while outputting or
- * processing the header of an http command.
- *
- * @see <related>
- * @author $Author: jung $
- * @version $Revision: 1.2 $
+ * This exception is thrown when something has gone wrong while outputting or
processing the header of an http command.
+ * @version $Revision: 1.3 $
+ * @author jung
*/
-public class HeaderException extends HttpException {
-}
+public class HeaderException extends HttpException {
-/*
- * $Log: HeaderException.java,v $
- * Revision 1.2 2000/12/04 12:35:47 jung
- * adopted to latest jboss container,
- *
- * added decimal and date
- *
- * removed some problems due to forward-referencing in meta-data
- *
- * added serialisation policy
- *
- * Revision 1.1.1.1 2000/08/10 21:06:40 jung
- * Initial import.
- *
- *
- * Revision 1.1.1.1.2.1 2000/07/13 12:46:14 jung
- * package renaming, most of the zoap stuff now under org.zoap
- * util and http stay infor.ce, containerInvoker etc move to org.jboss
- *
- * changed the makefile, adopted most of the licenses
- *
- * Revision 1.1.1.1 2000/07/06 14:11:26 jung
- * Import of a pre beta version of ZOAP source with a new directory structure,
- * ant-based make, apache-kind of license, etc.
- *
- * jars are coming later because of cvs-history reasons.
- *
- * Revision 1.1.2.1 2000/06/13 15:01:42 jung
- * SOAP support begins to run
- *
- * Revision 1.2 2000/06/07 10:18:58 jung
- * added some service functionality to llokup other
- * beans and yourself as a bean. extended the test case
- * for that purpose.
- *
- * added a lookup service.
- *
- * Revision 1.1.1.1 2000/05/15 10:38:34 jung
- * Initial import of the directory structure. Contains templates and a batch file
to
- * create API documentation. Also contains the not yet
- * fully running directory service (AFDS).
- *
- */
+ /** default constructor */
+ public HeaderException() {
+ }
+
+ /** message-based constructor */
+
+ public HeaderException(String message) {
+ super(message);
+ }
+
+ /** message based constructor with embedded throwable */
+
+ public HeaderException(String message, Throwable throwable) {
+ super(message, throwable);
+ }
+
+ /** constructor with embedded throwable */
+
+ public HeaderException(Throwable throwable) {
+ super(throwable);
+ }
+}
1.3 +43 -79 zoap/src/de/infor/ce/http/HeaderFormatException.java
Index: HeaderFormatException.java
===================================================================
RCS file: /products/cvs/ejboss/zoap/src/de/infor/ce/http/HeaderFormatException.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- HeaderFormatException.java 2000/12/04 12:35:47 1.2
+++ HeaderFormatException.java 2000/12/22 08:34:45 1.3
@@ -1,95 +1,50 @@
-/*
- * $Id: HeaderFormatException.java,v 1.2 2000/12/04 12:35:47 jung Exp $
- * Copyright 2000 (C) infor:business solutions AG, Hauerstrasse 12,
- * D-66299 Friedrichsthal, Germany. All Rights Reserved.
- *
- * License Statement
- *
- * Redistribution and use of this software and associated documentation
("Software"), with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain copyright statements and
notices.
- * Redistributions must also contain a copy of this document.
- *
- * 2. Redistributions in binary form must reproduce the attached copyright
notice, this list of
- * conditions and the following disclaimer in the documentation and/or
other materials provided
- * with the distribution.
- *
- * 3. The end-user documentation included with the redistribution, if any,
must include the following
- * acknowledgment: "This product includes software developed by infor:
business solutions AG
- * (http://www.infor.de/)." Alternately, this acknowledgment may appear
in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The name "infor" must not be used to endorse or promote products
derived from this
- * Software without prior written permission of infor: business solutions
AG.
- * For written permission, please contact [EMAIL PROTECTED]
- *
- * 5. Products derived from this Software may not be called "infor" nor may
"infor" appear
- * in their names without prior written permission of infor: business
solutions AG. infor
- * is a registered trademark of infor:business solutions AG.
- *
- * Disclaimer
- *
- * THIS SOFTWARE IS PROVIDED BY INFOR: BUSINESS SOLUTIONS AG AND CONTRIBUTORS "AS
IS" AND ANY
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- *
- * IN NO EVENT SHALL INFOR: BUSINESS SOLUTIONS AG OR ITS CONTRIBUTORS BE LIABLE
FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE,
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+/*
+ * $Source:
/products/cvs/ejboss/zoap/src/de/infor/ce/http/HeaderFormatException.java,v $
+ * The Zero-effort Object Access Package is a library to support XML/SOAP
serialisation and invocation.
+ * Copyright (c) 2000 infor business solutions AG, Hauerstrasse 12,
+ * D-66299 Friedrichsthal, Germany. All Rights Reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+
package de.infor.ce.http;
/**
- * <Description>
- * @see <related>
- * @author $Author: jung $
- * @version $Revision: 1.2 $
+ * indicates that the format of some header option produced a processing error.
+ * @version $Revision: 1.3 $
+ * @author jung
*/
-public class HeaderFormatException extends HeaderException {
-}
+public class HeaderFormatException extends HeaderException {
-/*
- * $Log: HeaderFormatException.java,v $
- * Revision 1.2 2000/12/04 12:35:47 jung
- * adopted to latest jboss container,
- *
- * added decimal and date
- *
- * removed some problems due to forward-referencing in meta-data
- *
- * added serialisation policy
- *
- * Revision 1.1.1.1 2000/08/10 21:06:41 jung
- * Initial import.
- *
- *
- * Revision 1.1.1.1.2.1 2000/07/13 12:46:14 jung
- * package renaming, most of the zoap stuff now under org.zoap
- * util and http stay infor.ce, containerInvoker etc move to org.jboss
- *
- * changed the makefile, adopted most of the licenses
- *
- * Revision 1.1.1.1 2000/07/06 14:11:26 jung
- * Import of a pre beta version of ZOAP source with a new directory structure,
- * ant-based make, apache-kind of license, etc.
- *
- * jars are coming later because of cvs-history reasons.
- *
- * Revision 1.2 2000/06/07 10:18:58 jung
- * added some service functionality to llokup other
- * beans and yourself as a bean. extended the test case
- * for that purpose.
- *
- * added a lookup service.
- *
- * Revision 1.1.1.1 2000/05/15 10:38:34 jung
- * Initial import of the directory structure. Contains templates and a batch file
to
- * create API documentation. Also contains the not yet
- * fully running directory service (AFDS).
- *
- */
+ /** empty constructor */
+ public HeaderFormatException() {
+ }
+
+ /** message-based constructor */
+ public HeaderFormatException(String message) {
+ super(message);
+ }
+
+ /** message-based constructor with embedded throwable */
+ public HeaderFormatException(String message, Throwable throwable) {
+ super(message, throwable);
+ }
+
+ /** constructor with embedded throwable */
+ public HeaderFormatException(Throwable throwable) {
+ super(throwable);
+ }
+}
1.3 +81 -82 zoap/src/de/infor/ce/http/HttpException.java
Index: HttpException.java
===================================================================
RCS file: /products/cvs/ejboss/zoap/src/de/infor/ce/http/HttpException.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- HttpException.java 2000/12/04 12:35:47 1.2
+++ HttpException.java 2000/12/22 08:34:45 1.3
@@ -1,101 +1,91 @@
/*
- * $Id: HttpException.java,v 1.2 2000/12/04 12:35:47 jung Exp $
- * Copyright 2000 (C) infor:business solutions AG, Hauerstrasse 12,
- * D-66299 Friedrichsthal, Germany. All Rights Reserved.
- *
- * License Statement
- *
- * Redistribution and use of this software and associated documentation
("Software"), with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain copyright statements and
notices.
- * Redistributions must also contain a copy of this document.
- *
- * 2. Redistributions in binary form must reproduce the attached copyright
notice, this list of
- * conditions and the following disclaimer in the documentation and/or
other materials provided
- * with the distribution.
- *
- * 3. The end-user documentation included with the redistribution, if any,
must include the following
- * acknowledgment: "This product includes software developed by infor:
business solutions AG
- * (http://www.infor.de/)." Alternately, this acknowledgment may appear
in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The name "infor" must not be used to endorse or promote products
derived from this
- * Software without prior written permission of infor: business solutions
AG.
- * For written permission, please contact [EMAIL PROTECTED]
- *
- * 5. Products derived from this Software may not be called "infor" nor may
"infor" appear
- * in their names without prior written permission of infor: business
solutions AG. infor
- * is a registered trademark of infor:business solutions AG.
- *
- * Disclaimer
- *
- * THIS SOFTWARE IS PROVIDED BY INFOR: BUSINESS SOLUTIONS AG AND CONTRIBUTORS "AS
IS" AND ANY
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- *
- * IN NO EVENT SHALL INFOR: BUSINESS SOLUTIONS AG OR ITS CONTRIBUTORS BE LIABLE
FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE,
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * $Source: /products/cvs/ejboss/zoap/src/de/infor/ce/http/HttpException.java,v $
+ * The Zero-effort Object Access Package is a library to support XML/SOAP
serialisation and invocation.
+ * Copyright (c) 2000 infor business solutions AG, Hauerstrasse 12,
+ * D-66299 Friedrichsthal, Germany. All Rights Reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package de.infor.ce.http;
/**
- * The most general exception thrown in this package. Something must have been
wrong. Catch
- * this if you are an ignorant or just lazy.
- *
- * @see <related>
- * @author $Author: jung $
- * @version $Revision: 1.2 $
+ * The most general exception thrown in this http-server package. Something must
have been wrong. Catch
+ * this if you are an ignorant or just lazy.
+ * @author jung
+ * @version $Revision: 1.3 $
*/
public class HttpException extends Exception {
-}
-/*
- * $Log: HttpException.java,v $
- * Revision 1.2 2000/12/04 12:35:47 jung
- * adopted to latest jboss container,
- *
- * added decimal and date
- *
- * removed some problems due to forward-referencing in meta-data
- *
- * added serialisation policy
- *
- * Revision 1.1.1.1 2000/08/10 21:06:41 jung
- * Initial import.
- *
- *
- * Revision 1.1.1.1.2.1 2000/07/13 12:46:14 jung
- * package renaming, most of the zoap stuff now under org.zoap
- * util and http stay infor.ce, containerInvoker etc move to org.jboss
- *
- * changed the makefile, adopted most of the licenses
- *
- * Revision 1.1.1.1 2000/07/06 14:11:26 jung
- * Import of a pre beta version of ZOAP source with a new directory structure,
- * ant-based make, apache-kind of license, etc.
- *
- * jars are coming later because of cvs-history reasons.
- *
- * Revision 1.1.2.1 2000/06/13 15:01:42 jung
- * SOAP support begins to run
- *
- * Revision 1.2 2000/06/07 10:18:58 jung
- * added some service functionality to llokup other
- * beans and yourself as a bean. extended the test case
- * for that purpose.
- *
- * added a lookup service.
- *
- * Revision 1.1.1.1 2000/05/15 10:38:34 jung
- * Initial import of the directory structure. Contains templates and a batch file
to
- * create API documentation. Also contains the not yet
- * fully running directory service (AFDS).
- *
- */
+ /** an embedded exception */
+ Throwable actualThrowable;
+
+ /** default constructor */
+
+ public HttpException() {
+ }
+
+ /*
+ * message-based constructor
+ */
+
+ public HttpException(String message) {
+ super(message);
+ }
+
+ /** message-based constructor for embedding an arbitrary throwable */
+
+ public HttpException(String message, Throwable throwable) {
+ super(message);
+ actualThrowable = throwable;
+ }
+
+ /** constructor for embedding an arbitrary throwable */
+
+ public HttpException(Throwable throwable) {
+ super();
+ actualThrowable = throwable;
+ }
+
+ /** manipulate the toString method to also show the embedded throwable */
+
+ public String toString() {
+ return super.toString() + ": embedded exception " +
actualThrowable.toString();
+ }
+
+ /** accesses the embedded throwable */
+
+ public Throwable getActualThrowable() {
+ return actualThrowable;
+ }
+
+ /** accesses the embedded throwable */
+
+ public void setActualThrowable(Throwable throwable) {
+ actualThrowable = throwable;
+ }
+
+ /** the printStackTrace method produces recursive traces */
+ public void printStackTrace() {
+ super.printStackTrace();
+ if(actualThrowable!=null)
+ actualThrowable.printStackTrace();
+ }
+
+
+} // HttpException
+
+
1.3 +45 -83 zoap/src/de/infor/ce/http/ProcessException.java
Index: ProcessException.java
===================================================================
RCS file: /products/cvs/ejboss/zoap/src/de/infor/ce/http/ProcessException.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ProcessException.java 2000/12/04 12:35:47 1.2
+++ ProcessException.java 2000/12/22 08:34:45 1.3
@@ -1,101 +1,54 @@
-/*
- * $Id: ProcessException.java,v 1.2 2000/12/04 12:35:47 jung Exp $
- * Copyright 2000 (C) infor:business solutions AG, Hauerstrasse 12,
- * D-66299 Friedrichsthal, Germany. All Rights Reserved.
- *
- * License Statement
- *
- * Redistribution and use of this software and associated documentation
("Software"), with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain copyright statements and
notices.
- * Redistributions must also contain a copy of this document.
- *
- * 2. Redistributions in binary form must reproduce the attached copyright
notice, this list of
- * conditions and the following disclaimer in the documentation and/or
other materials provided
- * with the distribution.
- *
- * 3. The end-user documentation included with the redistribution, if any,
must include the following
- * acknowledgment: "This product includes software developed by infor:
business solutions AG
- * (http://www.infor.de/)." Alternately, this acknowledgment may appear
in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The name "infor" must not be used to endorse or promote products
derived from this
- * Software without prior written permission of infor: business solutions
AG.
- * For written permission, please contact [EMAIL PROTECTED]
- *
- * 5. Products derived from this Software may not be called "infor" nor may
"infor" appear
- * in their names without prior written permission of infor: business
solutions AG. infor
- * is a registered trademark of infor:business solutions AG.
- *
- * Disclaimer
- *
- * THIS SOFTWARE IS PROVIDED BY INFOR: BUSINESS SOLUTIONS AG AND CONTRIBUTORS "AS
IS" AND ANY
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- *
- * IN NO EVENT SHALL INFOR: BUSINESS SOLUTIONS AG OR ITS CONTRIBUTORS BE LIABLE
FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE,
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+/*
+ * $Source: /products/cvs/ejboss/zoap/src/de/infor/ce/http/ProcessException.java,v $
+ * The Zero-effort Object Access Package is a library to support XML/SOAP
serialisation and invocation.
+ * Copyright (c) 2000 infor business solutions AG, Hauerstrasse 12,
+ * D-66299 Friedrichsthal, Germany. All Rights Reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package de.infor.ce.http;
/**
- * An exception that is thrown when the processing of some http request has
produced
- * a failure.
- *
- * @see <related>
- * @author $Author: jung $
- * @version $Revision: 1.2 $
+ * An exception that is thrown when the processing of some http request that should
normally result in a valid response has
+ * produced some failure. ProcessException hence is more to indicate some "system"
error than a "logical" error that should be
+ * already caught in the main processing.
+ * @version $Revision: 1.3 $
+ * @author jung
*/
public class ProcessException extends HttpException {
-}
-/*
- * $Log: ProcessException.java,v $
- * Revision 1.2 2000/12/04 12:35:47 jung
- * adopted to latest jboss container,
- *
- * added decimal and date
- *
- * removed some problems due to forward-referencing in meta-data
- *
- * added serialisation policy
- *
- * Revision 1.1.1.1 2000/08/10 21:06:42 jung
- * Initial import.
- *
- *
- * Revision 1.1.1.1.2.1 2000/07/13 12:46:14 jung
- * package renaming, most of the zoap stuff now under org.zoap
- * util and http stay infor.ce, containerInvoker etc move to org.jboss
- *
- * changed the makefile, adopted most of the licenses
- *
- * Revision 1.1.1.1 2000/07/06 14:11:26 jung
- * Import of a pre beta version of ZOAP source with a new directory structure,
- * ant-based make, apache-kind of license, etc.
- *
- * jars are coming later because of cvs-history reasons.
- *
- * Revision 1.1.2.1 2000/06/13 15:01:42 jung
- * SOAP support begins to run
- *
- * Revision 1.2 2000/06/07 10:18:58 jung
- * added some service functionality to llokup other
- * beans and yourself as a bean. extended the test case
- * for that purpose.
- *
- * added a lookup service.
- *
- * Revision 1.1.1.1 2000/05/15 10:38:34 jung
- * Initial import of the directory structure. Contains templates and a batch file
to
- * create API documentation. Also contains the not yet
- * fully running directory service (AFDS).
- *
- */
+ /** default constructor */
+ public ProcessException() {
+ }
+
+ /** message-based constructor */
+
+ public ProcessException(String message) {
+ super(message);
+ }
+
+ /** message-based constructor with embedded throwable */
+ public ProcessException(String message, Throwable throwable) {
+ super(message, throwable);
+ }
+
+ /** constructor with embedded throwable */
+
+ public ProcessException(Throwable throwable) {
+ super(throwable);
+ }
+} // ProcessException
1.3 +266 -354 zoap/src/de/infor/ce/http/Request.java
Index: Request.java
===================================================================
RCS file: /products/cvs/ejboss/zoap/src/de/infor/ce/http/Request.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Request.java 2000/12/04 12:35:47 1.2
+++ Request.java 2000/12/22 08:34:45 1.3
@@ -1,45 +1,22 @@
-/*
- * $Id: Request.java,v 1.2 2000/12/04 12:35:47 jung Exp $
- * Copyright 2000 (C) infor:business solutions AG, Hauerstrasse 12,
- * D-66299 Friedrichsthal, Germany. All Rights Reserved.
- *
- * License Statement
- *
- * Redistribution and use of this software and associated documentation
("Software"), with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain copyright statements and
notices.
- * Redistributions must also contain a copy of this document.
- *
- * 2. Redistributions in binary form must reproduce the attached copyright
notice, this list of
- * conditions and the following disclaimer in the documentation and/or
other materials provided
- * with the distribution.
- *
- * 3. The end-user documentation included with the redistribution, if any,
must include the following
- * acknowledgment: "This product includes software developed by infor:
business solutions AG
- * (http://www.infor.de/)." Alternately, this acknowledgment may appear
in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The name "infor" must not be used to endorse or promote products
derived from this
- * Software without prior written permission of infor: business solutions
AG.
- * For written permission, please contact [EMAIL PROTECTED]
- *
- * 5. Products derived from this Software may not be called "infor" nor may
"infor" appear
- * in their names without prior written permission of infor: business
solutions AG. infor
- * is a registered trademark of infor:business solutions AG.
- *
- * Disclaimer
- *
- * THIS SOFTWARE IS PROVIDED BY INFOR: BUSINESS SOLUTIONS AG AND CONTRIBUTORS "AS
IS" AND ANY
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- *
- * IN NO EVENT SHALL INFOR: BUSINESS SOLUTIONS AG OR ITS CONTRIBUTORS BE LIABLE
FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE,
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+/*
+ * $Source: /products/cvs/ejboss/zoap/src/de/infor/ce/http/Request.java,v $
+ * The Zero-effort Object Access Package is a library to support XML/SOAP
serialisation and invocation.
+ * Copyright (c) 2000 infor business solutions AG, Hauerstrasse 12,
+ * D-66299 Friedrichsthal, Germany. All Rights Reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package de.infor.ce.http;
@@ -54,439 +31,365 @@
/**
* Request is the implementation of a http/1.1 request command that is either
received
- * by some external entity or is created to connect some external entity.
- *
- * Request understands the usual http-request methods and the corresponding headers
- * It comes with a send() method to connect to a remote http-server using this
request as the payload. Request comes
- * with an extensible response factory to deliver appropriate response structures
upon
- * being sent.
- *
- * In the near future, we would like to add support for establishing persistent
connections
- * from the client-side through reusing one request.
- *
+ * by some external entity or is created to connect some external entity.
+ * Request understands the usual http-request methods and the corresponding headers
+ * It comes with a send() method to connect to a remote http-server using this
request as the payload. Request comes
+ * with an extensible response factory to deliver appropriate response structures
upon being sent.
+ * In the near future, we would like to add support for establishing persistent
connections
+ * from the client-side through reusing one request.
* @see <related>
- * @author $Author: jung $
- * @version $Revision: 1.2 $
+ * @author jung
+ * @version $Revision: 1.3 $
*/
public class Request extends Command {
+ /** special request headers that extend the general command headers */
+ static String[] REQUEST_HEADERS = new String[] {
+ "Cache-Control", "Connection", "Date", "Pragma", "Trailer",
"Transfer-Encoding",
+ "Upgrade", "Via", "Warning", "Accept", "Accept-Charset",
"Accept-Encoding",
+ "Accept-Language", "Authorization", "Expect", "From", "Host",
"If-Match",
+ "If-Modified-Since", "If-None-Match", "If-Range",
"If-Unmodified-Since", "Max-Forwards",
+ "Proxy-Authorization", "Range", "Referer", "TE", "User-Agent"
+ };
+
+ /** each request has a set of methods at its disposal */
- /**
- * special request headers that extend the general command headers
- */
+ static String[] METHODS = new String[] {
+ "OPTIONS", "GET", "HEAD", "POST", "PUT", "DELETE", "TRACE", "CONNECT"
+ };
- static String[] REQUEST_HEADERS= new String[] {
- "Cache-Control", "Connection", "Date", "Pragma", "Trailer", "Transfer-Encoding",
- "Upgrade", "Via", "Warning", "Accept", "Accept-Charset", "Accept-Encoding",
- "Accept-Language", "Authorization", "Expect", "From", "Host", "If-Match",
- "If-Modified-Since", "If-None-Match", "If-Range", "If-Unmodified-Since",
"Max-Forwards",
- "Proxy-Authorization", "Range", "Referer", "TE", "User-Agent" };
+ /** the method that has been assigned to this request encoded as an integer */
- /**
- * each request has a set of methods at its disposal
- */
+ protected int method = -1;
- static String[] METHODS = new String [] {
- "OPTIONS","GET","HEAD","POST","PUT","DELETE","TRACE","CONNECT"
- };
+ /** the list of method to integer encodings */
- /**
- * the method that has been assigned to this request
- * encoded as an integer
- */
+ public static int METHOD_OPTIONS = 0;
+ public static int METHOD_GET = 1;
+ public static int METHOD_HEAD = 2;
+ public static int METHOD_POST = 3;
+ public static int METHOD_PUT = 4;
+ public static int METHOD_DELETE = 5;
+ public static int METHOD_TRACE = 6;
+ public static int METHOD_CONNECT = 7;
- int method=-1;
+ /** each request has a proxy url to which it is sent to */
- /**
- * the list of method to integer encodings
- */
+ protected URL proxyUrl;
- static int METHOD_OPTIONS=0;
- static int METHOD_GET=1;
- static int METHOD_HEAD=2;
- static int METHOD_POST=3;
- static int METHOD_PUT=4;
- static int METHOD_DELETE=5;
- static int METHOD_TRACE=6;
- static int METHOD_CONNECT=7;
+ /** each request has a destination url that is interpreted relative to the
proxy url */
- /**
- * each request has a proxy url to which it is sent to
- */
+ protected URL url;
- URL proxyUrl;
+ /** the open socket to the other side */
- /**
- * each request has a destination url that is interpreted
- * relative to the proxy url
- */
+ protected Socket connection;
- URL url;
+ /** the streams sitting on the connection */
- /**
- * the open socket to the other side
- */
+ protected PrintWriter outputWriter;
+ protected BufferedReader inputReader;
- Socket connection;
+ /** constructor */
- /**
- * the streams sitting on the connection
- */
+ public Request(Hashtable theHeader, int theMinor, int theMajor, String
theBody, boolean close, URL theProxyUrl, URL theUrl, String theMethod)
+ throws UnknownRequestMethodException {
- PrintWriter outputWriter;
- BufferedReader inputReader;
+ // call super constructor immediately
+ super(theHeader, theMinor, theMajor, theBody, close);
- /**
- * constructor
- */
+ // give out some message
+ if (Environment.DEBUG_LEVEL > 0)
+ Environment.CONSOLE.debug(toString() + "(" + theHeader + "," +
theMinor + "," + theMajor + "," + theBody + "," + close + "," + theProxyUrl +
+ "," + theUrl + "," + theMethod + ")");
- public Request(Hashtable theHeader,int theMinor, int theMajor, String theBody,
boolean close, URL theProxyUrl, URL theUrl, String theMethod)
- throws UnknownRequestMethodException {
+ // and set the url
+ url = theUrl;
+ // set the proxy url
+ proxyUrl = theProxyUrl;
+ // the method
+ setMethod(theMethod);
+ }
- // call super constructor immediately
- super(theHeader,theMinor,theMajor,theBody,close);
+ /** how to write the start line of the request */
- // give out some message
- if(Environment.DEBUG_HTTP)
-
Environment.out.println("Request("+theHeader+","+theMinor+","+theMajor+","+theBody+","+close+","+theProxyUrl+
- ","+theUrl+","+theMethod+")");
+ protected void writeStartLine(PrintWriter writer) throws IOException {
- // and set the url
- url=theUrl;
- // set the proxy url
- proxyUrl=theProxyUrl;
- // the method
- setMethod(theMethod);
- }
+ if (Environment.DEBUG_LEVEL > 0)
+ Environment.CONSOLE.debug(toString() + ".writeStartLine(" +
writer + ")");
- /**
- * how to write the start line of the request
- */
+ writer.println(getMethod(method) + " " + url.toString() + " " +
HTTP_PROTOCOL_PREFIX + getProtocolVersion());
+ }
- protected void writeStartLine(PrintWriter writer) throws IOException {
+ /** this method converts the integer method encoding back into strings */
- if(Environment.DEBUG_HTTP)
- Environment.out.println("Request.writeStartLine("+writer+")");
+ protected String getMethod(int method) {
+ return METHODS[method];
+ }
- writer.println(getMethod(method)+" "+url.toString()+"
HTTP/"+getProtocolVersion());
- }
+ /** this method converts the string method encoding back into integers */
- /**
- * this method converts the integer method encoding back into
- * strings
- */
+ protected void setMethod(String theMethod) throws
UnknownRequestMethodException {
- protected String getMethod(int method) {
- return METHODS[method];
- }
+ if (Environment.DEBUG_LEVEL > 0)
+ Environment.CONSOLE.debug(toString() + ".setMethod(" +
theMethod + ")");
- /**
- * this method converts the string method encoding back into
- * integers
- */
+ for (int count = 0; count < METHODS.length; count++)
+ if (METHODS[count].equals(theMethod)) {
+ method = count;
+ return;
+ }
- protected void setMethod(String theMethod) throws UnknownRequestMethodException {
+ throw new UnknownRequestMethodException(toString() + ".setMethod(" +
theMethod + "): method not supported");
+ }
- if(Environment.DEBUG_HTTP)
- Environment.out.println("Request.setMethod("+theMethod+")");
+ /** read the starting line of the command */
- for(int count=0;count<METHODS.length;count++)
- if(METHODS[count].equals(theMethod)) {
- method=count;
- return;
- }
+ protected void readStartLine(BufferedReader reader) throws IOException,
StartLineException {
- throw new UnknownRequestMethodException();
- }
+ if (Environment.DEBUG_LEVEL > 0)
+ Environment.CONSOLE.debug(toString() + ".readStartLine(" +
reader + ")");
- /**
- * read the starting line of the command
- */
+ // read the next line
+ String line = reader.readLine();
- protected void readStartLine(BufferedReader reader) throws IOException,
StartLineException {
+ if (line == null)
+ throw new StartLineException(toString() + ".readStartLine(" +
reader + ") could not read start line ");
- if(Environment.DEBUG_HTTP)
- Environment.out.println("Request.readStartLine("+reader+")");
+ try {
- // read the next line
- String line=reader.readLine();
+ // get the first token which should be the method of this
request
+ String firstToken = line.substring(0, line.indexOf(" "));
- if(line==null)
- throw new IOException();
+ // and interpret it as a method
+ setMethod(firstToken);
- try{
+ // ok we have got the request, now get the URI
+ String secondToken =
+ line.substring(line.indexOf(" ") + 1, line.indexOf(" ",
line.indexOf(" ") + 1));
- // get the first token which should be the method of this request
- String firstToken=line.substring(0,line.indexOf(" "));
+ // it could be a "*", a path, or an authority, but we suspect
it
+ // the final url that is tried to obtain
+ // is parsed in relation to the proxyUrl
+ url = new URL(proxyUrl, secondToken);
- // and interpret it as a method
- setMethod(firstToken);
+ // now get the protocol version
+ String thirdToken = line.substring(line.indexOf(" ",
line.indexOf(" ") + 1) + 1, line.length());
- // ok we have got the request, now get the URI
- String secondToken=
- line.substring(line.indexOf(" ")+1,line.indexOf(" ",line.indexOf(" ")+1));
+ // must start with HTTP/
+ if (!thirdToken.startsWith(HTTP_PROTOCOL_PREFIX))
+ throw new StartLineException();
- // it could be a "*", a path, or an authority, but we suspect it
- // the final url that is tried to obtain
- // is parsed in relation to the proxyUrl
- url=new URL(proxyUrl,secondToken);
+ // followed by x.y
+ String pureVersionNumber = thirdToken.substring(5);
- // now get the protocol version
- String thirdToken=line.substring(line.indexOf(" ",line.indexOf("
")+1)+1,line.length());
+ int theMinor = Integer.parseInt(pureVersionNumber.
+ substring(0, pureVersionNumber.indexOf(".")));
- // must start with HTTP/
- if(!thirdToken.startsWith("HTTP/"))
- throw new StartLineException();
+ int theMajor = Integer.parseInt(pureVersionNumber.
+ substring(pureVersionNumber.indexOf(".") + 1));
- // followed by x.y
- String pureVersionNumber=thirdToken.substring(5);
+ // set the protocol versions
+ setProtocolMinorVersion(theMinor);
+ setProtocolMajorVersion(theMajor);
- int theMinor=Integer.parseInt(pureVersionNumber.
- substring(0,pureVersionNumber.indexOf(".")));
+ } catch (IndexOutOfBoundsException e) {
- int theMajor=Integer.parseInt(pureVersionNumber.
- substring(pureVersionNumber.indexOf(".")+1));
+ if (Environment.DEBUG_LEVEL > 0)
+ Environment.CONSOLE.error(toString() +
".readStartLine(" + reader +
+ "): encountered a format exception " + e);
- // set the protocol versions
- setProtocolMinorVersion(theMinor);
- setProtocolMajorVersion(theMajor);
+ throw new StartLineException(toString() + ".readStartLine(" +
reader +
+ "): encountered a format exception ", e);
- } catch(IndexOutOfBoundsException e) {
+ } catch (NumberFormatException e) {
- if(Environment.DEBUG_HTTP)
- Environment.err.println("Request.readStartLine("+reader+
- "): encountered a format exception "+e);
+ if (Environment.DEBUG_LEVEL > 0)
+ Environment.CONSOLE.error(toString() +
".readStartLine(" + reader +
+ "): encountered a format exception " + e);
- throw new StartLineException();
+ throw new StartLineException(toString() + ".readStartLine(" +
reader +
+ "): encountered a format exception ", e);
- } catch(NumberFormatException e) {
+ } // try
- if(Environment.DEBUG_HTTP)
- Environment.err.println("Request.readStartLine("+reader+
- "): encountered a format exception "+e);
+ } // readStartLine
- throw new StartLineException();
+ /** overloads the readHeaderLine from Command to cater for extended settings */
- } // try
+ protected void readHeaderLine(String fieldName, String fieldValue)
+ throws UnknownHeaderFieldException, HeaderFormatException {
- } // readStartLine
+ if (Environment.DEBUG_LEVEL > 0)
+ Environment.CONSOLE.debug(toString() + ".readHeaderLine(" +
fieldName + "," + fieldValue + ")");
- /**
- * overloads the readHeaderLine from Command to cater for extended settings
- */
+ for (int count = 0; count < REQUEST_HEADERS.length; count++)
+ if (REQUEST_HEADERS[count].equalsIgnoreCase(fieldName)) {
+ putHeader(fieldName, fieldValue);
+ return;
+ }
- protected void readHeaderLine(String fieldName, String fieldValue)
- throws UnknownHeaderFieldException, HeaderFormatException {
+ super.readHeaderLine(fieldName, fieldValue);
- if(Environment.DEBUG_HTTP)
-
Environment.out.println("Request.readHeaderLine("+fieldName+","+fieldValue+")");
+ }
- for(int count=0;count<REQUEST_HEADERS.length;count++)
- if(REQUEST_HEADERS[count].equalsIgnoreCase(fieldName)) {
- putHeader(fieldName,fieldValue);
- return;
- }
+ /**
+ * this method sends the request across the network to the builtin URL
+ * and gets a default response for it, overwrite to do more useful things
+ */
- super.readHeaderLine(fieldName,fieldValue);
+ public Response send() throws IOException, HttpException {
- }
+ if (Environment.DEBUG_LEVEL > 0)
+ Environment.CONSOLE.debug(toString() + ".send()");
- /**
- * this method sends the request across the network to the builtin URL
- * and gets a default response for it, overwrite to do more useful things
- */
+ if (url == null)
+ throw new HttpException(toString() + ".send(): cannot connect
to null url.");
- public Response send() throws IOException, HttpException {
+ return send(proxyUrl.getHost(), proxyUrl.getPort());
+ }
- if(Environment.DEBUG_HTTP)
- Environment.out.println("Request.send()");
+ /**
+ * this method sends the request to a dedicated proxy and gets a response for
+ * it. If not yet established the connection, it will create a persistent
connection
+ * to the server and leave it open until the connection is closed.
+ */
- if(url==null)
- throw new HttpException();
+ public synchronized Response send(String host, int port) throws IOException,
HttpException {
- return send(proxyUrl.getHost(),proxyUrl.getPort());
- }
+ if (Environment.DEBUG_LEVEL > 0)
+ Environment.CONSOLE.debug(toString() + ".send(" + host + "," +
port + ")");
- /**
- * this method sends the request to a dedicated proxy and gets a response for
- * it. If not yet established the connection, it will create a persistent
connection
- * to the server and leave it open until the connection is closed.
- */
+ try {
- public synchronized Response send(String host, int port) throws IOException,
HttpException {
+ if (connection == null) {
- if(Environment.DEBUG_HTTP)
- Environment.out.println("Request.send("+host+","+port+")");
+ if (Environment.DEBUG_LEVEL > 1)
+ Environment.CONSOLE.debug(toString() +
".send(" + host + "," + port + "): Establishing new connection.");
- try{
+ // open a new TCP/IP socket to the given URL
+ connection = new Socket(host, port);
+ // construct the ios
+ outputWriter = new
PrintWriter(connection.getOutputStream());
+ inputReader = new BufferedReader(
+ new
InputStreamReader(connection.getInputStream()));
+ }
- if(connection==null) {
+ // output the request structure to the other side
+ write(outputWriter);
- if(Environment.DEBUG_HTTP)
- Environment.out.println("Request.send("+host+","+port+"): Establishing
new connection.");
+ // flush it
+ outputWriter.flush();
- // open a new TCP/IP socket to the given URL
- connection=new Socket (host, port);
- // construct the ios
- outputWriter = new PrintWriter (connection.getOutputStream ());
- inputReader = new BufferedReader (new InputStreamReader
(connection.getInputStream ()));
- }
+ // and close the output from your side if connection:close is
send
+ // this is important for some old HTTP/1.0 servers which
expect EOF
+ // to complete request parsing
+ if (isConnectionClose()) {
- // output the request structure to the other side
- write(outputWriter);
+ if (Environment.DEBUG_LEVEL > 1)
+ Environment.CONSOLE.debug(toString() +
".send(" + host + "," + port + "): Closing Intendedly OutputStream.");
- // flush it
- outputWriter.flush();
+ connection.shutdownOutput();
+ }
- // and close the output from your side if connection:close is send
- if(isConnectionClose()) {
+ // create a response using the factory method
+ Response result = createResponse();
- if(Environment.DEBUG_HTTP)
- Environment.out.println("Request.send("+host+","+port+"): Closing
Intendedly OutputStream.");
+ // and fill it with the incoming buffer
+ result.read(inputReader);
- connection.shutdownOutput();
- }
+ // close the socket silently
+ if (result.isConnectionClose() || isConnectionClose()) {
+ try {
- // create a response using the factory method
- Response result=createResponse();
+ if (Environment.DEBUG_LEVEL > 1)
+ Environment.CONSOLE.debug(toString() +
".send(" + host + "," + port + "): Closing Intendedly Socket.");
- // and fill it with the incoming buffer
- result.read(inputReader);
+ connection.close();
+ } catch (IOException e) { }
+ finally { connection = null; }
+ }
- // close the socket silently
- if(result.isConnectionClose() || isConnectionClose()) {
- try{
+ return result;
- if(Environment.DEBUG_HTTP)
- Environment.out.println("Request.send("+host+","+port+"): Closing
Intendedly Socket.");
+ } catch (IOException e) {
- connection.close();
- } catch(IOException e) {}
- connection=null;
- }
+ if (Environment.LOG_LEVEL > 0 || Environment.DEBUG_LEVEL > 0)
+ Environment.CONSOLE.error(toString() + ".send(" + host
+ "," + port + "): encountered " + e);
- return result;
+ try {
- } catch(IOException e) {
+ if (Environment.DEBUG_LEVEL > 1)
+ Environment.CONSOLE.debug(toString() +
".send(" + host + "," + port + "): Closing Socket");
- try{
+ connection.close();
+ } catch (IOException e2) {
+ } finally {
+ connection = null;
+ }
- if(Environment.DEBUG_HTTP)
- Environment.out.println("Request.send("+host+","+port+"): Closing
Socket because of io exception."+e);
+ throw e;
- connection.close();
- } catch(IOException e2) {
- }
+ } catch (HttpException e) {
- connection=null;
- throw e;
+ if (Environment.LOG_LEVEL > 0 || Environment.DEBUG_LEVEL > 0)
+ Environment.CONSOLE.error(toString() + ".send(" + host
+ "," + port + "): encountered " + e);
- } catch(HttpException e) {
+ try {
- try{
+ if (Environment.DEBUG_LEVEL > 1)
+ Environment.CONSOLE.debug(toString() +
".send(" + host + "," + port + "): Closing Socket");
- if(Environment.DEBUG_HTTP)
- Environment.out.println("Request.send("+host+","+port+"): Closing
Socket because of http exception."+e);
+ connection.close();
+ } catch (IOException e2) {
+ } finally {
- connection.close();
- } catch(IOException e2) {
- }
+ connection = null;
+ }
+ throw e;
+ }
- connection=null;
+ } // send
- throw e;
- }
+ /** factory method for responses */
- } // send
+ protected Response createResponse() throws StatusCodeException {
- /**
- * factory method for responses
- */
+ if (Environment.DEBUG_LEVEL > 0)
+ Environment.CONSOLE.debug(toString() + ".createResponse()");
- protected Response createResponse() throws StatusCodeException {
+ return new Response(null, 1, 1, null, false, 100, "OK");
- if(Environment.DEBUG_HTTP)
- Environment.out.println("Request.createResponse()");
+ }
- return new Response(null,1,1,null,false,100,"OK");
+ /** we expose the finalize method which enables to free resources explicitely
*/
- }
+ public synchronized void finalize() {
- /**
- * access the url
- */
+ if (Environment.DEBUG_LEVEL > 0)
+ Environment.CONSOLE.debug(toString() + ".finalize()");
- public URL getURL() {
- return url;
- }
+ if (connection != null) {
+ try {
+ connection.close();
+ } catch (IOException e) { }
+ finally {
+ connection = null;
+ }
+ }
+ }
- public synchronized void finalize() {
+ /** access the url */
- if(Environment.DEBUG_HTTP)
- Environment.out.println("Request.finalize()");
+ public URL getUrl() {
+ return url;
+ }
- if(connection!=null) {
- try {
- connection.close();
- } catch(IOException e) {}
- connection=null;
- }
- }
+ /** access the url */
+ public void setUrl(URL url) {
+ this.url = url;
+ }
} // Request
-/*
- * $Log: Request.java,v $
- * Revision 1.2 2000/12/04 12:35:47 jung
- * adopted to latest jboss container,
- *
- * added decimal and date
- *
- * removed some problems due to forward-referencing in meta-data
- *
- * added serialisation policy
- *
- * Revision 1.1.1.1 2000/08/10 21:06:43 jung
- * Initial import.
- *
- *
- * Revision 1.1.1.1.2.2 2000/07/17 12:46:14 jung
- * refactored package and meta-model
- *
- * Revision 1.1.1.1.2.1 2000/07/13 12:46:14 jung
- * package renaming, most of the zoap stuff now under org.zoap
- * util and http stay infor.ce, containerInvoker etc move to org.jboss
- *
- * changed the makefile, adopted most of the licenses
- *
- * Revision 1.1.1.1 2000/07/06 14:11:26 jung
- * Import of a pre beta version of ZOAP source with a new directory structure,
- * ant-based make, apache-kind of license, etc.
- *
- * jars are coming later because of cvs-history reasons.
- *
- * Revision 1.1.2.2 2000/06/16 08:03:03 jung
- * removed the bug that expected a fully-qualified url
- * in a request.
- *
- * requests now have two urls: one (fully-qualified) of the proxy that they talk
to
- * and one (relative to the first one) that identifies the file that you
- * addess.
- *
- * Revision 1.1.2.1 2000/06/13 15:01:42 jung
- * SOAP support begins to run
- *
- * Revision 1.2 2000/06/07 10:18:58 jung
- * added some service functionality to llokup other
- * beans and yourself as a bean. extended the test case
- * for that purpose.
- *
- * added a lookup service.
- *
- * Revision 1.1.1.1 2000/05/15 10:38:34 jung
- * Initial import of the directory structure. Contains templates and a batch file
to
- * create API documentation. Also contains the not yet
- * fully running directory service (AFDS).
- *
- */
1.3 +46 -105 zoap/src/de/infor/ce/http/Response.java
Index: Response.java
===================================================================
RCS file: /products/cvs/ejboss/zoap/src/de/infor/ce/http/Response.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Response.java 2000/12/04 12:35:47 1.2
+++ Response.java 2000/12/22 08:34:46 1.3
@@ -1,45 +1,22 @@
-/*
- * $Id: Response.java,v 1.2 2000/12/04 12:35:47 jung Exp $
- * Copyright 2000 (C) infor:business solutions AG, Hauerstrasse 12,
- * D-66299 Friedrichsthal, Germany. All Rights Reserved.
- *
- * License Statement
- *
- * Redistribution and use of this software and associated documentation
("Software"), with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain copyright statements and
notices.
- * Redistributions must also contain a copy of this document.
- *
- * 2. Redistributions in binary form must reproduce the attached copyright
notice, this list of
- * conditions and the following disclaimer in the documentation and/or
other materials provided
- * with the distribution.
- *
- * 3. The end-user documentation included with the redistribution, if any,
must include the following
- * acknowledgment: "This product includes software developed by infor:
business solutions AG
- * (http://www.infor.de/)." Alternately, this acknowledgment may appear
in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The name "infor" must not be used to endorse or promote products
derived from this
- * Software without prior written permission of infor: business solutions
AG.
- * For written permission, please contact [EMAIL PROTECTED]
- *
- * 5. Products derived from this Software may not be called "infor" nor may
"infor" appear
- * in their names without prior written permission of infor: business
solutions AG. infor
- * is a registered trademark of infor:business solutions AG.
- *
- * Disclaimer
- *
- * THIS SOFTWARE IS PROVIDED BY INFOR: BUSINESS SOLUTIONS AG AND CONTRIBUTORS "AS
IS" AND ANY
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- *
- * IN NO EVENT SHALL INFOR: BUSINESS SOLUTIONS AG OR ITS CONTRIBUTORS BE LIABLE
FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE,
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+/*
+ * $Source: /products/cvs/ejboss/zoap/src/de/infor/ce/http/Response.java,v $
+ * The Zero-effort Object Access Package is a library to support XML/SOAP
serialisation and invocation.
+ * Copyright (c) 2000 infor business solutions AG, Hauerstrasse 12,
+ * D-66299 Friedrichsthal, Germany. All Rights Reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package de.infor.ce.http;
@@ -51,14 +28,13 @@
/**
- * Response is the implementation of a http/1.1 response command that is either
received
- * by some external entity or is created to reply to some requesting entity.
+ * Response is the implementation of a http/1.1 response command that is either
received
+ * by some external entity or is created to reply to some requesting entity.
*
- * Response understands the usual error codes and the corresponding headers.
+ * Response understands the usual error codes and the corresponding headers.
*
- * @see <related>
- * @author $Author: jung $
- * @version $Revision: 1.2 $
+ * @author jung
+ * @version $Revision: 1.3 $
*/
public class Response extends Command {
@@ -73,7 +49,7 @@
};
/**
- * Status code encodings
+ * Status encodings
*/
public static int[] STATUS_CODES=new int[] {
@@ -85,13 +61,13 @@
* a response has a status code
*/
- int statusCode=-1;
+ protected int statusCode=-1;
/**
* an arbitrary reason phrase, normally its "OK"
*/
- String reasonPhrase;
+ protected String reasonPhrase;
/**
* constructor
@@ -102,11 +78,11 @@
super(theHeader,theMinor,theMajor,theBody,close);
- if(Environment.DEBUG_HTTP)
-
Environment.out.println("Reponse("+theHeader+","+theMinor+","+theMajor+","+theBody+","+close+","+theStatus+","+
+ if(Environment.DEBUG_LEVEL>0)
+
Environment.CONSOLE.debug(toString()+"("+theHeader+","+theMinor+","+theMajor+","+theBody+","+close+","+theStatus+","+
theReason+")");
- setStatusCode(theStatus);
+ statusCode=theStatus;
reasonPhrase=theReason;
}
@@ -116,10 +92,10 @@
protected void writeStartLine(PrintWriter writer) throws IOException {
- if(Environment.DEBUG_HTTP)
- Environment.out.println("Response.writeStartLine("+writer+")");
+ if(Environment.DEBUG_LEVEL>0)
+ Environment.CONSOLE.debug(toString()+".writeStartLine("+writer+")");
- writer.println("HTTP/"+getProtocolVersion()+" "+statusCode+" "+reasonPhrase);
+ writer.println(HTTP_PROTOCOL_PREFIX+getProtocolVersion()+" "+statusCode+"
"+reasonPhrase);
}
/**
@@ -128,19 +104,19 @@
protected void readStartLine(BufferedReader reader) throws IOException,
StartLineException {
- if(Environment.DEBUG_HTTP)
- Environment.out.println("Response.readStartLine("+reader+")");
+ if(Environment.DEBUG_LEVEL>0)
+ Environment.CONSOLE.debug(toString()+".readStartLine("+reader+")");
String line=reader.readLine();
if(line==null)
- throw new IOException();
+ throw new StartLineException(toString()+".readStartLine("+reader+"): could
not read start line.");
try{
String firstToken=line.substring(0,line.indexOf(" "));
- if(!firstToken.startsWith("HTTP/"))
+ if(!firstToken.startsWith(HTTP_PROTOCOL_PREFIX))
throw new StartLineException();
String protocolVersionNumber=firstToken.substring(5);
@@ -160,10 +136,10 @@
} catch(IndexOutOfBoundsException e) {
- if(Environment.DEBUG_HTTP)
- Environment.err.println("Response.readStartLine("+reader+"): encountered
format error "+e);
+ if(Environment.DEBUG_LEVEL>0)
+ Environment.CONSOLE.error(toString()+".readStartLine("+reader+"):
encountered format error "+e);
- throw new StartLineException();
+ throw new StartLineException(toString()+".readStartLine("+reader+"):
encountered format error",e);
}
@@ -175,13 +151,16 @@
public void setStatusCode(int code) throws StatusCodeException {
+ if(Environment.DEBUG_LEVEL>0)
+ Environment.CONSOLE.debug(toString()+".setStatusCode("+code+")");
+
for(int count=0;count<STATUS_CODES.length;count++)
if(STATUS_CODES[count]==code) {
statusCode=code;
return;
}
- throw new StatusCodeException();
+ throw new StatusCodeException(toString()+".setStatusCode("+code+"): unknown
status code");
}
/**
@@ -191,8 +170,8 @@
protected void readHeaderLine(String fieldName, String fieldValue)
throws UnknownHeaderFieldException, HeaderFormatException {
- if(Environment.DEBUG_HTTP)
-
Environment.out.println("Response.readHeaderLine("+fieldName+","+fieldValue+")");
+ if(Environment.DEBUG_LEVEL>0)
+
Environment.CONSOLE.debug(toString()+".readHeaderLine("+fieldName+","+fieldValue+")");
for(int count=0;count<RESPONSE_HEADERS.length;count++)
if(RESPONSE_HEADERS[count].equalsIgnoreCase(fieldName)) {
@@ -205,50 +184,3 @@
}
} // response
-
-/*
- * $Log: Response.java,v $
- * Revision 1.2 2000/12/04 12:35:47 jung
- * adopted to latest jboss container,
- *
- * added decimal and date
- *
- * removed some problems due to forward-referencing in meta-data
- *
- * added serialisation policy
- *
- * Revision 1.1.1.1 2000/08/10 21:06:43 jung
- * Initial import.
- *
- *
- * Revision 1.1.1.1.2.2 2000/07/17 12:46:14 jung
- * refactored package and meta-model
- *
- * Revision 1.1.1.1.2.1 2000/07/13 12:46:14 jung
- * package renaming, most of the zoap stuff now under org.zoap
- * util and http stay infor.ce, containerInvoker etc move to org.jboss
- *
- * changed the makefile, adopted most of the licenses
- *
- * Revision 1.1.1.1 2000/07/06 14:11:26 jung
- * Import of a pre beta version of ZOAP source with a new directory structure,
- * ant-based make, apache-kind of license, etc.
- *
- * jars are coming later because of cvs-history reasons.
- *
- * Revision 1.1.2.1 2000/06/13 15:01:42 jung
- * SOAP support begins to run
- *
- * Revision 1.2 2000/06/07 10:18:58 jung
- * added some service functionality to llokup other
- * beans and yourself as a bean. extended the test case
- * for that purpose.
- *
- * added a lookup service.
- *
- * Revision 1.1.1.1 2000/05/15 10:38:34 jung
- * Initial import of the directory structure. Contains templates and a batch file
to
- * create API documentation. Also contains the not yet
- * fully running directory service (AFDS).
- *
- */
1.3 +253 -296 zoap/src/de/infor/ce/http/Server.java
Index: Server.java
===================================================================
RCS file: /products/cvs/ejboss/zoap/src/de/infor/ce/http/Server.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Server.java 2000/12/04 12:35:47 1.2
+++ Server.java 2000/12/22 08:34:46 1.3
@@ -1,45 +1,22 @@
-/*
- * $Id: Server.java,v 1.2 2000/12/04 12:35:47 jung Exp $
- * Copyright 2000 (C) infor:business solutions AG, Hauerstrasse 12,
- * D-66299 Friedrichsthal, Germany. All Rights Reserved.
- *
- * License Statement
- *
- * Redistribution and use of this software and associated documentation
("Software"), with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain copyright statements and
notices.
- * Redistributions must also contain a copy of this document.
- *
- * 2. Redistributions in binary form must reproduce the attached copyright
notice, this list of
- * conditions and the following disclaimer in the documentation and/or
other materials provided
- * with the distribution.
- *
- * 3. The end-user documentation included with the redistribution, if any,
must include the following
- * acknowledgment: "This product includes software developed by infor:
business solutions AG
- * (http://www.infor.de/)." Alternately, this acknowledgment may appear
in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The name "infor" must not be used to endorse or promote products
derived from this
- * Software without prior written permission of infor: business solutions
AG.
- * For written permission, please contact [EMAIL PROTECTED]
- *
- * 5. Products derived from this Software may not be called "infor" nor may
"infor" appear
- * in their names without prior written permission of infor: business
solutions AG. infor
- * is a registered trademark of infor:business solutions AG.
- *
- * Disclaimer
- *
- * THIS SOFTWARE IS PROVIDED BY INFOR: BUSINESS SOLUTIONS AG AND CONTRIBUTORS "AS
IS" AND ANY
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- *
- * IN NO EVENT SHALL INFOR: BUSINESS SOLUTIONS AG OR ITS CONTRIBUTORS BE LIABLE
FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE,
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+/*
+ * $Source: /products/cvs/ejboss/zoap/src/de/infor/ce/http/Server.java,v $
+ * The Zero-effort Object Access Package is a library to support XML/SOAP
serialisation and invocation.
+ * Copyright (c) 2000 infor business solutions AG, Hauerstrasse 12,
+ * D-66299 Friedrichsthal, Germany. All Rights Reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package de.infor.ce.http;
@@ -60,366 +37,346 @@
import java.util.Hashtable;
/**
- * An HTTP/1.1-compliant server with dummy functionality that can be extended
in order
- * to derive useful web services, such as class-loading, file-serving or
messaging.
- *
- * It is implemented after the pattern of com.dreambean.dynaserver.DynaServer
where
- * we have a single runnable that spawns multiple threads going through it
- * to handle a bunch of connections.
- *
- * It currently lacks support for sophisticated tranfer-encodings and
- * multiple-commands per connection which should be incorporated in the near
- * future.
- *
- * @see <related>
- * @author $Author: jung $
- * @version $Revision: 1.2 $
+ * An HTTP/1.1-compliant server with dummy functionality that can be extended in
order
+ * to derive useful web services, such as class-loading, file-serving or messaging.
+ * It is implemented after the pattern of com.dreambean.dynaserver.DynaServer where
+ * we have a single runnable that spawns multiple threads going through it to
handle a bunch of connections.
+ * It currently lacks support for sophisticated tranfer-encodings and
+ * multiple-commands per connection which should be incorporated in the near future.
+ * @author jung
+ * @version $Revision: 1.3 $
*/
-
-public class Server implements Runnable
-{
-
- /**
- * the server socket that this Server is listening to
- */
-
- private ServerSocket server;
-
- /**
- * the url that this server has
- */
- private URL url;
+public class Server implements Runnable {
- /**
- * the all-embracing error response
- */
+ /** the server socket that this Server is listening to */
- private static Response GENERAL_ERROR;
+ protected ServerSocket server;
- // is statically initialised as follows
- static {
+ /** the url that this server has */
- if(Environment.DEBUG_HTTP)
- Environment.out.println("Server.static initializer");
+ protected URL url;
- try{
- GENERAL_ERROR=new Response(null,1,1,null,true,500,"ERROR");
- } catch(StatusCodeException e) {
+ /** the all-embracing error response, will need it surely, so we make it a
static ;-) */
- if(Environment.DEBUG_HTTP)
- Environment.err.println("Server.static initializer: encountered wrong
status whil constructing internal error "+e);
+ private static Response GENERAL_ERROR;
- }
- }
+ // is statically initialised as follows
+ static {
- /**
- * the port on which this server should run on
- */
+ if (Environment.DEBUG_LEVEL > 0)
+ Environment.CONSOLE.debug(Server.class.toString() + ".static
initializer of GENERAL_ERROR");
- private int httpPort=-1;
+ try {
+ GENERAL_ERROR = new Response(null, 1, 1, null, true, 500,
"ERROR");
+ } catch (StatusCodeException e) {
- /**
- * thread pool for that server
- */
+ if (Environment.LOG_LEVEL > 0 || Environment.DEBUG_LEVEL > 0) {
+ Environment.CONSOLE.error(Server.class.toString() +
".static initializer of GENERAL_ERROR: encountered " + e + " which hints to a major
bug.");
+ Environment.CONSOLE.exception(e);
+ }
- private ThreadPool threadPool;
+ }
+ }
- /**
- * constructor sets the port and the url
- */
+ /** the port on which this server should run on */
- public Server(int thePort) throws UnknownHostException, MalformedURLException {
+ protected int httpPort = -1;
- if(Environment.DEBUG_HTTP)
- Environment.out.print("Server()\n");
+ /** thread pool for that server */
- httpPort=thePort;
+ protected ThreadPool threadPool;
- threadPool=new
ThreadPool(Environment.serverPoolSize,Environment.serverBlocks,"HTTP",false);
+ /** constructor sets the port and the url */
- url=new URL("http",InetAddress.getLocalHost().getHostName(),httpPort,"/");
+ public Server(int thePort) throws UnknownHostException, MalformedURLException {
- }
+ if (Environment.DEBUG_LEVEL > 0)
+ Environment.CONSOLE.debug(toString() + "(" + thePort + ")");
- /**
- * the finalize method - destroys the pool with it
- */
+ httpPort = thePort;
- public void finalize() {
+ threadPool = new ThreadPool(Environment.SERVER_THREAD_POOL_SIZE,
Environment.SERVER_THREAD_POOL_BLOCKS, Environment.SERVER_THREAD_POOL_NAME, false);
- if(Environment.DEBUG_HTTP)
- Environment.out.println("Server.finalize()");
+ url = new URL("http", InetAddress.getLocalHost().getHostName(),
httpPort, "/");
- stop();
+ }
- }
+ /** we expose the finalize method - destroys the pool with it at the same time
*/
- /**
- * start method
- */
+ public void finalize() {
- public void start() throws IOException {
+ if (Environment.DEBUG_LEVEL > 0)
+ Environment.CONSOLE.debug(toString() + ".finalize()");
- if(Environment.DEBUG_HTTP)
- Environment.out.println("Server.start()");
+ stop();
- // create a new server socket
- server = new ServerSocket(httpPort);
+ }
- // set the correct max size in the thread pool
- threadPool.setMaxSize(Environment.serverPoolSize);
+ /** start method, enables the service to run */
- // and a thread to listen on it
- listen();
- }
+ public void start() throws IOException {
- /**
- * local helper to start a new thread around this runnable
- */
+ if (Environment.DEBUG_LEVEL > 0)
+ Environment.CONSOLE.debug(toString() + ".start()");
- protected void listen() {
+ // create a new server socket
+ server = new ServerSocket(httpPort);
- if(Environment.DEBUG_HTTP)
- Environment.out.println("Server.listen()");
+ // set the correct max size in the thread pool
+ threadPool.setMaxSize(Environment.SERVER_THREAD_POOL_SIZE);
- // use the thread pool
- threadPool.run(this);
- }
+ // and a thread to listen on it
+ listen();
+ }
- /**
- * stop method, close the listening socket, hence
- * interrupt the listening thread if started.
- */
+ /** local helper to start a new thread around this runnable */
- public void stop() {
+ protected void listen() {
- if(Environment.DEBUG_HTTP)
- Environment.out.println("Server.stop()");
+ if (Environment.DEBUG_LEVEL > 0)
+ Environment.CONSOLE.debug(toString() + ".listen()");
- // safely take the socket away
- ServerSocket serversocket = server;
- server = null;
- try {
+ // use the thread pool to run a runnable, that is, yourself
+ threadPool.run(this);
+ }
- // and close it, afterwards
- serversocket.close();
- } catch(Exception _ex) { }
+ /** stop method, close the listening socket, hence interrupt the listening
thread if started. */
- // and kill the threadpool
- threadPool.finalize();
+ public void stop() {
- } // stop()
+ if (Environment.DEBUG_LEVEL > 0)
+ Environment.CONSOLE.debug(toString() + ".stop()");
- /**
- * the run method that is called, whenever this runnable interface is
- * put into a new thread. It will first listen to the servers socket to
- * accept incoming connections. Upon connection, it will spawn a new thread
- * that keeps listening and process the incoming http request.
- *
- * The connection is immediately closed afterwards. At least, the
Connection:Closed
- * header is produced in order to ensure compatibility with full-fledged
- * http/1.1 clients.
- */
+ // safely take the socket away from processing
+ ServerSocket serversocket = server;
+ // will force a NullPointerException when accessed by
+ // the running service
+ server = null;
+ try {
+ // and close it, afterwards
+ serversocket.close();
+ } catch (Exception _ex) { }
+ finally {
+ // and kill the threadpool
+ threadPool.finalize();
+ }
+ } // stop()
- public void run() {
+ /**
+ * the run method that is called, whenever this runnable interface is
+ * put into a new thread. It will first listen to the servers socket to
+ * accept incoming connections. Upon connection, it will spawn a new thread
+ * that keeps listening and process the incoming http request. The connection
is immediately closed afterwards. At least, the
+ * Connection:Closed header is produced in order to ensure compatibility with
full-fledged http/1.1 clients.
+ */
- if(Environment.DEBUG_HTTP)
- Environment.out.println("Server.run()");
+ public void run() {
- // the new socket that is accepted
- Socket socket = null;
+ if (Environment.DEBUG_LEVEL > 0)
+ Environment.CONSOLE.debug(toString() + ".run()");
- try {
+ // the new socket that is accepted
+ Socket socket = null;
- // accept incoming connections
- socket = server.accept();
+ try {
- } catch(IOException e) {
+ // accept incoming connections
+ socket = server.accept();
- if(Environment.DEBUG_HTTP)
- Environment.err.println("Server.run(): encountered IOException "+e);
+ } catch (IOException e) {
- // interrupted: have we been finished?
- if(server != null) {
+ if (Environment.DEBUG_LEVEL > 0 || Environment.LOG_LEVEL > 0) {
+ Environment.CONSOLE.error(toString() + ".run():
encountered IOException " + e);
+ Environment.CONSOLE.exception(e);
+ }
- // no, then we have to recover !
- if(Environment.DEBUG_HTTP)
- Environment.out.println("Server.run(): Trying to recover.");
+ // interrupted: have we been finished?
+ if (server != null) {
- try{
- start();
- } catch(IOException _ex) {
+ // no, then we have to recover !
+ if (Environment.DEBUG_LEVEL > 1)
+ Environment.CONSOLE.debug(toString() +
".run(): Trying to recover from " + e);
- if(Environment.DEBUG_HTTP)
- Environment.err.println("Server.run(): recoverage failed"+e);
+ try {
+ start();
+ } catch (IOException _ex) {
- } // try
- } // if
+ if (Environment.DEBUG_LEVEL > 0 ||
Environment.LOG_LEVEL > 0) {
+ Environment.CONSOLE.error(toString() +
".run(): recoverage failed " + e);
+ Environment.CONSOLE.exception(e);
+ }
- // in each case, end this thread
- return;
+ } // try
+ } // if
- } catch(NullPointerException e) {
+ // in each case, end this thread
+ return;
- if(Environment.DEBUG_HTTP)
- Environment.err.println("Server.run(): encountered Nullpointer Exception
"+e);
+ } catch (NullPointerException e) {
- // happens if the server socket has already been set to null before
- // listen has been called
- return;
+ if (Environment.DEBUG_LEVEL > 0 || Environment.LOG_LEVEL > 0) {
+ Environment.CONSOLE.error(toString() + ".run():
encountered " + e+" which probably means that this service has been stopped.");
+ Environment.CONSOLE.exception(e);
+ }
- } // try
+ // happens if the server socket has already been set to null
before
+ // listen has been called
+ return;
- // when we are here, a new connection has been accepted
- // hence, spawn a new thread that keeps listening on the server socket
- listen();
+ } // try
- // process the request(s) by yourself
- try{
+ // when we are here, a new connection has been accepted
+ // hence, spawn a new thread that keeps listening on the server socket
+ listen();
- // we construct some output stream to give responses back
- PrintWriter dataoutputstream =
- new PrintWriter(socket.getOutputStream());
+ // process the request(s) by yourself
+ try {
- // construct a reader to read requests in
- BufferedReader bufferedreader =
- new BufferedReader(new InputStreamReader(socket.getInputStream()));
+ // we construct some output stream to give responses back
+ PrintWriter dataoutputstream =
+ new PrintWriter(socket.getOutputStream());
- // whether this session should be closed
- boolean hasBeenClosed=false;
+ // construct a reader to read requests in
+ BufferedReader bufferedreader =
+ new BufferedReader(
+ new InputStreamReader(socket.getInputStream()));
- try{
- // loop until closed
- while(!hasBeenClosed) {
+ // whether this session should be closed
+ boolean hasBeenClosed = false;
+ try {
+ // loop until closed
+ while (!hasBeenClosed) {
- // no, then we have to recover !
- if(Environment.DEBUG_HTTP)
- Environment.out.println("Server.run(): going into reception loop.");
+ // no, then we have to recover !
+ if (Environment.DEBUG_LEVEL > 1)
+ Environment.CONSOLE.debug(toString() +
".run(): going into reception loop.");
+ // create a new request using an extensible
factory method
+ // that can be overridden to implement more
specialised request structures
+ Request request = createRequest();
- // create a new request using an extensible factory method
- // that can be overridden to implement more specialised request structures
- Request request=createRequest();
+ // let the request fill itself using the input
buffer
+ request.read(bufferedreader);
- // let the request fill itself using the input buffer
- request.read(bufferedreader);
+ // create a response to the given request
+ Response response = processRequest(request);
- // create a response to the given request
- Response response=processRequest(request);
+ // find out whether an explicit closing is
required
+ hasBeenClosed = request.isConnectionClose() ||
+ response.isConnectionClose();
- // find out whether an explicit closing is required
- hasBeenClosed=request.isConnectionClose() || response.isConnectionClose();
+ // mark it in the response
+ response.setConnectionClose(hasBeenClosed);
- // mark it in the response
- response.setConnectionClose(hasBeenClosed);
+ // and write to the outstream
+ response.write(dataoutputstream);
- // and write to the outstream
- response.write(dataoutputstream);
+ // flush the output
+ dataoutputstream.flush();
+ } // while(!hasBeenClosed)
- // flush the output
- dataoutputstream.flush();
- } // while(!hasBeenClosed)
+ } catch (HttpException e) {
- } catch(HttpException e) {
+ if (Environment.DEBUG_LEVEL > 0 ||
Environment.LOG_LEVEL > 0) {
+ Environment.CONSOLE.error(toString() +
".run(): encountered " + e);
+ Environment.CONSOLE.exception(e);
+ }
- if(Environment.DEBUG_HTTP)
- Environment.out.println("Server.run(): encountered http exception "+e);
+ if (Environment.DEBUG_LEVEL > 1)
+ Environment.CONSOLE.debug(toString() +
".run(): responding with general error.");
- try{
- GENERAL_ERROR.write(dataoutputstream);
- } catch (HttpException e2) {
+ try {
+ GENERAL_ERROR.write(dataoutputstream);
+ } catch (HttpException e2) {
- if(Environment.DEBUG_HTTP)
- Environment.out.println("Server.run(): encountered http exception"+
- " while responding error."+e);
+ if (Environment.DEBUG_LEVEL > 0 ||
Environment.LOG_LEVEL > 0) {
+ Environment.CONSOLE.debug(toString() +
".run(): encountered " + e2 +
+ " while responding error.");
+ Environment.CONSOLE.exception(e2);
+ }
- }
+ }
- } // try
+ } // try
- // close the socket to indicate EOF
- socket.shutdownOutput();
+ // close the socket to indicate EOF
+ socket.shutdownOutput();
- } catch(IOException e) {
+ } catch (IOException e) {
- if(Environment.DEBUG_HTTP)
- Environment.err.println("Server.run(): encountered IOException"+
- " while trying to open and read from socket"+e);
+ if (Environment.DEBUG_LEVEL > 0) {
+ Environment.CONSOLE.error(toString() + ".run():
encountered " + e +
+ " while trying to open and read from socket.");
+ Environment.CONSOLE.exception(e);
+ }
- // ignored - we close the socket. our partner was seemingly unable to
- // communicate, so do we
+ // ignored - we close the socket. our partner was seemingly
unable to
+ // communicate, so do we
- } finally {
+ } finally {
- if(Environment.DEBUG_HTTP)
- Environment.out.println("Server.run(): closing socket.");
+ if (Environment.DEBUG_LEVEL > 1)
+ Environment.CONSOLE.debug(toString() + ".run():
closing socket.");
- // close the socket created by accept()
- try {
- socket.close();
- // ignore any errors here
- } catch(IOException _ex) { }
+ // close the socket created by accept()
+ try {
+ socket.close();
+ // ignore any errors here
+ } catch (IOException _ex) { }
- } // try
+ } // try
- } // run
+ } // run
- /**
- * factory method to create new request structures
- * may throw an @throws UnknowRequestException to indicate that
- * the construction of the request did not succeed. It is called by the
- * server, whenever a new request comes in and must be parsed.
- *
- * Please overwrite this method to generate more specialised requests
- */
+ /**
+ * factory method to create new request structures may throw an
+ * @throws UnknowRequestException to indicate that the construction of the
request did not succeed. It is called by the
+ * server, whenever a new request comes in and must be parsed.
+ * Please overwrite this method to generate more specialised requests
+ */
- protected Request createRequest() throws UnknownRequestMethodException {
+ protected Request createRequest() throws UnknownRequestMethodException {
- if(Environment.DEBUG_HTTP)
- Environment.out.println("Server.createRequest()");
+ if (Environment.DEBUG_LEVEL > 0)
+ Environment.CONSOLE.debug(toString() + ".createRequest()");
- return new Request(null,1,1,null,false,getURL(),null,"GET");
- }
+ return new Request(null, 1, 1, null, false, getURL(), null, "GET");
+ }
- /**
- * this method is called by the server, whenever an incoming
- * @arg request has been sucessfully parsed. It returns a corresponding
- * @arg Response that will be delivered to the client in return. It may
- * throw an @throws ProcessException to indicate a failure in processing
- * that message.
- *
- * This default implementation simply returns the general "not implemented"
response.
- * Overwrite to get useful services.
- */
+ /**
+ * this method is called by the server, whenever an incoming
+ * @arg request has been sucessfully parsed. It returns a corresponding
+ * @arg Response that will be delivered to the client in return. It may
+ * throw an @throws ProcessException to indicate a failure in processing that
message.
+ * This default implementation simply returns the general "not implemented"
response. Overwrite to get useful services.
+ */
- protected Response processRequest(Request request) throws ProcessException {
+ protected Response processRequest(Request request) throws ProcessException {
- if(Environment.DEBUG_HTTP)
- Environment.out.println("Server.processRequest("+request+")");
+ if (Environment.DEBUG_LEVEL > 0)
+ Environment.CONSOLE.debug(toString() + ".processRequest(" +
request + ")");
- try{
+ try {
- return new Response(null,1,1,null,true,501,"ERROR");
+ return new Response(null, 1, 1, null, true, 501, "ERROR");
- } catch(StatusCodeException e) {
+ } catch (StatusCodeException e) {
- if(Environment.DEBUG_HTTP)
- Environment.err.println("Server.processRequest("+request+"): encountered
status exception "+e);
+ if (Environment.DEBUG_LEVEL > 0 || Environment.LOG_LEVEL > 0)
+ Environment.CONSOLE.error(toString() +
".processRequest(" + request + "): encountered " + e + " which hints to a major bug!");
- throw new ProcessException();
+ throw new ProcessException(toString() + ".processRequest(" +
request + "): encountered status code exception", e);
- }
+ }
- }
+ }
- /**
- * returns the URL of this server
- */
+ /** returns the URL of this server */
- public URL getURL() {
- return url;
- }
+ public URL getURL() {
+ return url;
+ }
} // Server
1.3 +37 -82 zoap/src/de/infor/ce/http/StartLineException.java
Index: StartLineException.java
===================================================================
RCS file: /products/cvs/ejboss/zoap/src/de/infor/ce/http/StartLineException.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- StartLineException.java 2000/12/04 12:35:47 1.2
+++ StartLineException.java 2000/12/22 08:34:46 1.3
@@ -1,101 +1,47 @@
-/*
- * $Id: StartLineException.java,v 1.2 2000/12/04 12:35:47 jung Exp $
- * Copyright 2000 (C) infor:business solutions AG, Hauerstrasse 12,
- * D-66299 Friedrichsthal, Germany. All Rights Reserved.
- *
- * License Statement
- *
- * Redistribution and use of this software and associated documentation
("Software"), with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain copyright statements and
notices.
- * Redistributions must also contain a copy of this document.
- *
- * 2. Redistributions in binary form must reproduce the attached copyright
notice, this list of
- * conditions and the following disclaimer in the documentation and/or
other materials provided
- * with the distribution.
- *
- * 3. The end-user documentation included with the redistribution, if any,
must include the following
- * acknowledgment: "This product includes software developed by infor:
business solutions AG
- * (http://www.infor.de/)." Alternately, this acknowledgment may appear
in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The name "infor" must not be used to endorse or promote products
derived from this
- * Software without prior written permission of infor: business solutions
AG.
- * For written permission, please contact [EMAIL PROTECTED]
- *
- * 5. Products derived from this Software may not be called "infor" nor may
"infor" appear
- * in their names without prior written permission of infor: business
solutions AG. infor
- * is a registered trademark of infor:business solutions AG.
- *
- * Disclaimer
- *
- * THIS SOFTWARE IS PROVIDED BY INFOR: BUSINESS SOLUTIONS AG AND CONTRIBUTORS "AS
IS" AND ANY
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- *
- * IN NO EVENT SHALL INFOR: BUSINESS SOLUTIONS AG OR ITS CONTRIBUTORS BE LIABLE
FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE,
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+/*
+ * $Source:
/products/cvs/ejboss/zoap/src/de/infor/ce/http/StartLineException.java,v $
+ * The Zero-effort Object Access Package is a library to support XML/SOAP
serialisation and invocation.
+ * Copyright (c) 2000 infor business solutions AG, Hauerstrasse 12,
+ * D-66299 Friedrichsthal, Germany. All Rights Reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package de.infor.ce.http;
/**
- * is thrown when outputting or reading the starting line of a command did not
- * work.
- *
- * @see <related>
- * @author $Author: jung $
- * @version $Revision: 1.2 $
+ * is thrown when outputting or reading the starting line of a command did not work.
+ * @author jung
+ * @author $Author: jung $
+ * @version $Revision: 1.3 $
*/
public class StartLineException extends HttpException {
+ public StartLineException() {
+ }
+
+ public StartLineException(String message) {
+ super(message);
+ }
+
+ public StartLineException(String message, Throwable throwable) {
+ super(message, throwable);
+ }
+
+ public StartLineException(Throwable throwable) {
+ super(throwable);
+ }
}
-/*
- * $Log: StartLineException.java,v $
- * Revision 1.2 2000/12/04 12:35:47 jung
- * adopted to latest jboss container,
- *
- * added decimal and date
- *
- * removed some problems due to forward-referencing in meta-data
- *
- * added serialisation policy
- *
- * Revision 1.1.1.1 2000/08/10 21:06:44 jung
- * Initial import.
- *
- *
- * Revision 1.1.1.1.2.1 2000/07/13 12:46:14 jung
- * package renaming, most of the zoap stuff now under org.zoap
- * util and http stay infor.ce, containerInvoker etc move to org.jboss
- *
- * changed the makefile, adopted most of the licenses
- *
- * Revision 1.1.1.1 2000/07/06 14:11:26 jung
- * Import of a pre beta version of ZOAP source with a new directory structure,
- * ant-based make, apache-kind of license, etc.
- *
- * jars are coming later because of cvs-history reasons.
- *
- * Revision 1.1.2.1 2000/06/13 15:01:42 jung
- * SOAP support begins to run
- *
- * Revision 1.2 2000/06/07 10:18:58 jung
- * added some service functionality to llokup other
- * beans and yourself as a bean. extended the test case
- * for that purpose.
- *
- * added a lookup service.
- *
- * Revision 1.1.1.1 2000/05/15 10:38:34 jung
- * Initial import of the directory structure. Contains templates and a batch file
to
- * create API documentation. Also contains the not yet
- * fully running directory service (AFDS).
- *
- */
1.3 +43 -44 zoap/src/de/infor/ce/http/StatusCodeException.java
Index: StatusCodeException.java
===================================================================
RCS file: /products/cvs/ejboss/zoap/src/de/infor/ce/http/StatusCodeException.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- StatusCodeException.java 2000/12/04 12:35:48 1.2
+++ StatusCodeException.java 2000/12/22 08:34:46 1.3
@@ -1,62 +1,63 @@
-/*
- * $Id: StatusCodeException.java,v 1.2 2000/12/04 12:35:48 jung Exp $
- * Copyright 2000 (C) infor:business solutions AG, Hauerstrasse 12,
- * D-66299 Friedrichsthal, Germany. All Rights Reserved.
- *
- * License Statement
- *
- * Redistribution and use of this software and associated documentation
("Software"), with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain copyright statements and
notices.
- * Redistributions must also contain a copy of this document.
- *
- * 2. Redistributions in binary form must reproduce the attached copyright
notice, this list of
- * conditions and the following disclaimer in the documentation and/or
other materials provided
- * with the distribution.
- *
- * 3. The end-user documentation included with the redistribution, if any,
must include the following
- * acknowledgment: "This product includes software developed by infor:
business solutions AG
- * (http://www.infor.de/)." Alternately, this acknowledgment may appear
in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The name "infor" must not be used to endorse or promote products
derived from this
- * Software without prior written permission of infor: business solutions
AG.
- * For written permission, please contact [EMAIL PROTECTED]
- *
- * 5. Products derived from this Software may not be called "infor" nor may
"infor" appear
- * in their names without prior written permission of infor: business
solutions AG. infor
- * is a registered trademark of infor:business solutions AG.
- *
- * Disclaimer
- *
- * THIS SOFTWARE IS PROVIDED BY INFOR: BUSINESS SOLUTIONS AG AND CONTRIBUTORS "AS
IS" AND ANY
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- *
- * IN NO EVENT SHALL INFOR: BUSINESS SOLUTIONS AG OR ITS CONTRIBUTORS BE LIABLE
FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE,
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+/*
+ * $Source:
/products/cvs/ejboss/zoap/src/de/infor/ce/http/StatusCodeException.java,v $
+ * The Zero-effort Object Access Package is a library to support XML/SOAP
serialisation and invocation.
+ * Copyright (c) 2000 infor business solutions AG, Hauerstrasse 12,
+ * D-66299 Friedrichsthal, Germany. All Rights Reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package de.infor.ce.http;
/**
* indicates a non-valid status code (error-code) in a http-response.
- *
* @see <related>
* @author $Author: jung $
- * @version $Revision: 1.2 $
+ * @version $Revision: 1.3 $
*/
public class StatusCodeException extends StartLineException {
+ public StatusCodeException() {
+ }
+
+ public StatusCodeException(String message) {
+ super(message);
+ }
+
+ public StatusCodeException(String message, Throwable throwable) {
+ super(message, throwable);
+ }
+
+ public StatusCodeException(Throwable throwable) {
+ super(throwable);
+ }
}
/*
* $Log: StatusCodeException.java,v $
+ * Revision 1.3 2000/12/22 08:34:46 jung
+ * began with exception redesign (messages+embedded throwables).
+ *
+ * added a convenient logger console abstraction.
+ *
+ * generic Environment.java for configuring packages.
+ *
+ * some refactoring of the http package
+ *
+ * began move to LGPL
+ *
* Revision 1.2 2000/12/04 12:35:48 jung
* adopted to latest jboss container,
*
1.3 +43 -44 zoap/src/de/infor/ce/http/UnknownHeaderFieldException.java
Index: UnknownHeaderFieldException.java
===================================================================
RCS file:
/products/cvs/ejboss/zoap/src/de/infor/ce/http/UnknownHeaderFieldException.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- UnknownHeaderFieldException.java 2000/12/04 12:35:48 1.2
+++ UnknownHeaderFieldException.java 2000/12/22 08:34:46 1.3
@@ -1,62 +1,63 @@
-/*
- * $Id: UnknownHeaderFieldException.java,v 1.2 2000/12/04 12:35:48 jung Exp $
- * Copyright 2000 (C) infor:business solutions AG, Hauerstrasse 12,
- * D-66299 Friedrichsthal, Germany. All Rights Reserved.
- *
- * License Statement
- *
- * Redistribution and use of this software and associated documentation
("Software"), with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain copyright statements and
notices.
- * Redistributions must also contain a copy of this document.
- *
- * 2. Redistributions in binary form must reproduce the attached copyright
notice, this list of
- * conditions and the following disclaimer in the documentation and/or
other materials provided
- * with the distribution.
- *
- * 3. The end-user documentation included with the redistribution, if any,
must include the following
- * acknowledgment: "This product includes software developed by infor:
business solutions AG
- * (http://www.infor.de/)." Alternately, this acknowledgment may appear
in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The name "infor" must not be used to endorse or promote products
derived from this
- * Software without prior written permission of infor: business solutions
AG.
- * For written permission, please contact [EMAIL PROTECTED]
- *
- * 5. Products derived from this Software may not be called "infor" nor may
"infor" appear
- * in their names without prior written permission of infor: business
solutions AG. infor
- * is a registered trademark of infor:business solutions AG.
- *
- * Disclaimer
- *
- * THIS SOFTWARE IS PROVIDED BY INFOR: BUSINESS SOLUTIONS AG AND CONTRIBUTORS "AS
IS" AND ANY
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- *
- * IN NO EVENT SHALL INFOR: BUSINESS SOLUTIONS AG OR ITS CONTRIBUTORS BE LIABLE
FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE,
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+/*
+ * $Source:
/products/cvs/ejboss/zoap/src/de/infor/ce/http/UnknownHeaderFieldException.java,v $
+ * The Zero-effort Object Access Package is a library to support XML/SOAP
serialisation and invocation.
+ * Copyright (c) 2000 infor business solutions AG, Hauerstrasse 12,
+ * D-66299 Friedrichsthal, Germany. All Rights Reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package de.infor.ce.http;
/**
* indicates a non-supported header field in an http command.
- *
* @see <related>
* @author $Author: jung $
- * @version $Revision: 1.2 $
+ * @version $Revision: 1.3 $
*/
public class UnknownHeaderFieldException extends HeaderException {
+ public UnknownHeaderFieldException() {
+ }
+
+ public UnknownHeaderFieldException(String message) {
+ super(message);
+ }
+
+ public UnknownHeaderFieldException(String message, Throwable throwable) {
+ super(message, throwable);
+ }
+
+ public UnknownHeaderFieldException(Throwable throwable) {
+ super(throwable);
+ }
}
/*
* $Log: UnknownHeaderFieldException.java,v $
+ * Revision 1.3 2000/12/22 08:34:46 jung
+ * began with exception redesign (messages+embedded throwables).
+ *
+ * added a convenient logger console abstraction.
+ *
+ * generic Environment.java for configuring packages.
+ *
+ * some refactoring of the http package
+ *
+ * began move to LGPL
+ *
* Revision 1.2 2000/12/04 12:35:48 jung
* adopted to latest jboss container,
*
1.3 +43 -44 zoap/src/de/infor/ce/http/UnknownRequestMethodException.java
Index: UnknownRequestMethodException.java
===================================================================
RCS file:
/products/cvs/ejboss/zoap/src/de/infor/ce/http/UnknownRequestMethodException.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- UnknownRequestMethodException.java 2000/12/04 12:35:48 1.2
+++ UnknownRequestMethodException.java 2000/12/22 08:34:46 1.3
@@ -1,62 +1,63 @@
-/*
- * $Id: UnknownRequestMethodException.java,v 1.2 2000/12/04 12:35:48 jung Exp $
- * Copyright 2000 (C) infor:business solutions AG, Hauerstrasse 12,
- * D-66299 Friedrichsthal, Germany. All Rights Reserved.
- *
- * License Statement
- *
- * Redistribution and use of this software and associated documentation
("Software"), with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain copyright statements and
notices.
- * Redistributions must also contain a copy of this document.
- *
- * 2. Redistributions in binary form must reproduce the attached copyright
notice, this list of
- * conditions and the following disclaimer in the documentation and/or
other materials provided
- * with the distribution.
- *
- * 3. The end-user documentation included with the redistribution, if any,
must include the following
- * acknowledgment: "This product includes software developed by infor:
business solutions AG
- * (http://www.infor.de/)." Alternately, this acknowledgment may appear
in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The name "infor" must not be used to endorse or promote products
derived from this
- * Software without prior written permission of infor: business solutions
AG.
- * For written permission, please contact [EMAIL PROTECTED]
- *
- * 5. Products derived from this Software may not be called "infor" nor may
"infor" appear
- * in their names without prior written permission of infor: business
solutions AG. infor
- * is a registered trademark of infor:business solutions AG.
- *
- * Disclaimer
- *
- * THIS SOFTWARE IS PROVIDED BY INFOR: BUSINESS SOLUTIONS AG AND CONTRIBUTORS "AS
IS" AND ANY
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- *
- * IN NO EVENT SHALL INFOR: BUSINESS SOLUTIONS AG OR ITS CONTRIBUTORS BE LIABLE
FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE,
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+/*
+ * $Source:
/products/cvs/ejboss/zoap/src/de/infor/ce/http/UnknownRequestMethodException.java,v $
+ * The Zero-effort Object Access Package is a library to support XML/SOAP
serialisation and invocation.
+ * Copyright (c) 2000 infor business solutions AG, Hauerstrasse 12,
+ * D-66299 Friedrichsthal, Germany. All Rights Reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package de.infor.ce.http;
/**
* indicates a non-supported request method.
- *
* @see <related>
* @author $Author: jung $
- * @version $Revision: 1.2 $
+ * @version $Revision: 1.3 $
*/
public class UnknownRequestMethodException extends StartLineException {
+ public UnknownRequestMethodException() {
+ }
+
+ public UnknownRequestMethodException(String message) {
+ super(message);
+ }
+
+ public UnknownRequestMethodException(String message, Throwable throwable) {
+ super(message, throwable);
+ }
+
+ public UnknownRequestMethodException(Throwable throwable) {
+ super(throwable);
+ }
}
/*
* $Log: UnknownRequestMethodException.java,v $
+ * Revision 1.3 2000/12/22 08:34:46 jung
+ * began with exception redesign (messages+embedded throwables).
+ *
+ * added a convenient logger console abstraction.
+ *
+ * generic Environment.java for configuring packages.
+ *
+ * some refactoring of the http package
+ *
+ * began move to LGPL
+ *
* Revision 1.2 2000/12/04 12:35:48 jung
* adopted to latest jboss container,
*
1.3 +26 -1 zoap/src/de/infor/ce/http/http.dfPackage
Index: http.dfPackage
===================================================================
RCS file: /products/cvs/ejboss/zoap/src/de/infor/ce/http/http.dfPackage,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- http.dfPackage 2000/12/04 12:35:48 1.2
+++ http.dfPackage 2000/12/22 08:34:46 1.3
@@ -105,7 +105,32 @@
*/
class __options {
}/**
-@__positions
+@__positions
<oigroup:<oiref:java#Class#de.infor.ce.http.Server:oiref>=249,612,219,317,1:oigroup>
+<oigroup:<oiref:java#Class#de.infor.ce.http.UnknownRequestMethodException:oiref>=682,454,203,119,1:oigroup>
+<oigroup:<oiref:java#Extends#de.infor.ce.http.Request#de.infor.ce.http.Command:oiref>=119,612,119,577,390,577,390,556:oigroup>
+<oigroup:<oiref:java#Class#de.infor.ce.http.Request:oiref>=10,612,219,527,1:oigroup>
+<oigroup:<oiref:java#Class#de.infor.ce.http.HttpException:oiref>=896,10,219,194,1:oigroup>
+<oigroup:<oiref:java#Extends#de.infor.ce.http.ProcessException#de.infor.ce.http.HttpException:oiref>=1117,260,1117,225,1005,225,1005,204:oigroup>
+<oigroup:<oiref:java#Extends#de.infor.ce.http.StartLineException#de.infor.ce.http.HttpException:oiref>=894,260,894,225,1005,225,1005,204:oigroup>
+<oigroup:<oiref:java#Class#de.infor.ce.http.Environment:oiref>=792,610,203,258,1:oigroup>
+<oigroup:<oiref:java#Extends#de.infor.ce.http.HeaderFormatException#de.infor.ce.http.HeaderException:oiref>=1452,454,1452,419,1340,419,1340,379:oigroup>
+<oigroup:<oiref:java#Extends#de.infor.ce.http.UnknownRequestMethodException#de.infor.ce.http.StartLineException:oiref>=783,454,783,419,894,419,894,379:oigroup>
+<oigroup:<oiref:design#Class#id3iqfxca3fgnbmca3tcayx.diagram:oiref>=1135,10,63,72,1:oigroup>
+<oigroup:<oiref:java#Extends#de.infor.ce.http.StatusCodeException#de.infor.ce.http.StartLineException:oiref>=1006,454,1006,419,894,419,894,379:oigroup>
+<oigroup:<oiref:java#Class#de.infor.ce.http.StartLineException:oiref>=793,260,203,119,1:oigroup>
+<oigroup:<oiref:java#Class#de.infor.ce.http.BodyException:oiref>=570,260,203,119,1:oigroup>
+<oigroup:MemberLink#<oiref:java#Member#de.infor.ce.http.Server#GENERAL_ERROR:oiref>=468,704,553,704:oigroup>
+<oigroup:<oiref:java#Extends#de.infor.ce.http.HeaderException#de.infor.ce.http.HttpException:oiref>=1340,260,1340,225,1005,225,1005,204:oigroup>
+<oigroup:<oiref:java#Class#de.infor.ce.http.ProcessException:oiref>=1016,260,203,119,1:oigroup>
+<oigroup:<oiref:java#Extends#de.infor.ce.http.Response#de.infor.ce.http.Command:oiref>=662,612,662,577,390,577,390,556:oigroup>
+<oigroup:<oiref:java#Class#de.infor.ce.http.HeaderException:oiref>=1239,260,203,119,1:oigroup>
+<oigroup:<oiref:java#Extends#de.infor.ce.http.UnknownHeaderFieldException#de.infor.ce.http.HeaderException:oiref>=1229,454,1229,419,1340,419,1340,379:oigroup>
+<oigroup:<oiref:java#Class#de.infor.ce.http.UnknownHeaderFieldException:oiref>=1128,454,203,119,1:oigroup>
+<oigroup:<oiref:java#Class#de.infor.ce.http.HeaderFormatException:oiref>=1351,454,203,119,1:oigroup>
+<oigroup:<oiref:java#Class#de.infor.ce.http.Response:oiref>=553,612,219,185,1:oigroup>
+<oigroup:<oiref:java#Class#de.infor.ce.http.Command:oiref>=281,10,219,546,1:oigroup>
+<oigroup:<oiref:java#Class#de.infor.ce.http.StatusCodeException:oiref>=905,454,203,119,1:oigroup>
+<oigroup:<oiref:java#Extends#de.infor.ce.http.BodyException#de.infor.ce.http.HttpException:oiref>=671,260,671,225,1005,225,1005,204:oigroup>
*/
class __positions {
}