/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can
* obtain a copy of the License at
* or packager/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at packager/legal/LICENSE.txt.
*
* GPL Classpath Exception:
* Oracle designates this particular file as subject to the "Classpath"
* exception as provided by Oracle in the GPL Version 2 section of the License
* file that accompanied this code.
*
* Modifications:
* If applicable, add the following below the License Header, with the fields
* enclosed by brackets [] replaced by your own identifying information:
* "Portions Copyright [year] [name of copyright owner]"
*
* Contributor(s):
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*
*
* This file incorporates work covered by the following copyright and
* permission notice:
*
* Copyright 2004 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/** Generic input stream impl on top of ajp
*/
// Holds incoming chunks of request body data
private boolean end_of_stream=false;
private boolean isEmpty = true;
private boolean isFirst = true;
private boolean isReplay = false;
private boolean isReadRequired = false;
static {
// Make certain HttpMessages is loaded for SecurityManager
try {
// ignore
}
}
else
this.packetSize = bsize;
}
/**
* @deprecated
*/
}
// -------------------- Jk specific methods --------------------
/**
* Set the flag saying that the server is sending a body
*/
}
/**
* Return the flag saying that the server is sending a body
*/
public boolean isReadRequired() {
return isReadRequired;
}
/** Must be called before or after each request
*/
public void recycle() {
if(isReadRequired && isFirst) {
// The Servlet never read the request body, so we need to junk it
try {
receive();
} catch(IOException iex) {
}
}
end_of_stream = false;
isEmpty = true;
isFirst = true;
isReplay = false;
isReadRequired = false;
}
}
// -------------------- OutputBuffer implementation --------------------
throws IOException {
if (!res.isCommitted()) {
// Send the connector a request for commit. The connector should
// then validate the headers, send them (using sendHeader) and
// set the filters accordingly.
res.sendHeaders();
}
// 4 - hardcoded, byte[] marshalling overhead
int off=0;
while( len > 0 ) {
}
}
return 0;
}
throws IOException {
if( end_of_stream ) {
return -1;
}
if( isFirst && isReadRequired ) {
// Handle special first-body-chunk, but only if httpd expects it.
if( !receive() ) {
return 0;
}
} else if(isEmpty) {
if ( !refillReadBuffer() ){
return -1;
}
}
isEmpty = true;
return responseChunk.getLength();
}
/** Receive a chunk of data. Called to implement the
* 'special' packet in ajp13 and to receive the data
* after we send a GET_BODY packet
*/
isFirst = false;
if(err < 0) {
throw new IOException();
}
// No data received.
// Don't mark 'end of stream' for the first chunk.
// end_of_stream = true;
return false;
}
if( blen == 0 ) {
return false;
}
}
isEmpty = false;
return true;
}
/**
* Get more request body data from the web server and store it in the
* internal buffer.
*
* @return true if there is more data, false if not.
*/
{
// If the server returns an empty packet, assume that that end of
// the stream has been reached (yuck -- fix protocol??).
if(isReplay) {
end_of_stream = true; // we've read everything there is
}
if (end_of_stream) {
return false;
}
// Why not use outBuf??
// bodyMsg.appendInt(AjpConstants.MAX_READ_SIZE);
// In JNI mode, response will be in bodyMsg. In TCP mode, response need to be
// read
if( !moreData ) {
end_of_stream=true;
}
return moreData;
}
if (res.isAllowCustomReasonPhrase()) {
}
} else {
}
// XXX add headers
if( contentType != null ) {
}
if( contentLanguage != null ) {
}
if( contentLength >= 0 ) {
}
for( int i=0; i<numHeaders; i++ ) {
// no header to sc conversion - there's little benefit
// on this direction
}
}
/**
* Set the replay buffer for Form auth
*/
isFirst = false;
isEmpty = false;
isReplay = true;
}
}