init
This commit is contained in:
72
java/org/apache/catalina/connector/ClientAbortException.java
Normal file
72
java/org/apache/catalina/connector/ClientAbortException.java
Normal file
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You 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
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
package org.apache.catalina.connector;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Wrap an IOException identifying it as being caused by an abort
|
||||
* of a request by a remote client.
|
||||
*
|
||||
* @author Glenn L. Nielsen
|
||||
*/
|
||||
public final class ClientAbortException extends IOException {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
//------------------------------------------------------------ Constructors
|
||||
|
||||
/**
|
||||
* Construct a new ClientAbortException with no other information.
|
||||
*/
|
||||
public ClientAbortException() {
|
||||
super();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Construct a new ClientAbortException for the specified message.
|
||||
*
|
||||
* @param message Message describing this exception
|
||||
*/
|
||||
public ClientAbortException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Construct a new ClientAbortException for the specified throwable.
|
||||
*
|
||||
* @param throwable Throwable that caused this exception
|
||||
*/
|
||||
public ClientAbortException(Throwable throwable) {
|
||||
super(throwable);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Construct a new ClientAbortException for the specified message
|
||||
* and throwable.
|
||||
*
|
||||
* @param message Message describing this exception
|
||||
* @param throwable Throwable that caused this exception
|
||||
*/
|
||||
public ClientAbortException(String message, Throwable throwable) {
|
||||
super(message, throwable);
|
||||
}
|
||||
}
|
||||
1138
java/org/apache/catalina/connector/Connector.java
Normal file
1138
java/org/apache/catalina/connector/Connector.java
Normal file
File diff suppressed because it is too large
Load Diff
1318
java/org/apache/catalina/connector/CoyoteAdapter.java
Normal file
1318
java/org/apache/catalina/connector/CoyoteAdapter.java
Normal file
File diff suppressed because it is too large
Load Diff
290
java/org/apache/catalina/connector/CoyoteInputStream.java
Normal file
290
java/org/apache/catalina/connector/CoyoteInputStream.java
Normal file
@@ -0,0 +1,290 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You 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
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
package org.apache.catalina.connector;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedActionException;
|
||||
import java.security.PrivilegedExceptionAction;
|
||||
|
||||
import javax.servlet.ReadListener;
|
||||
import javax.servlet.ServletInputStream;
|
||||
|
||||
import org.apache.catalina.security.SecurityUtil;
|
||||
import org.apache.tomcat.util.res.StringManager;
|
||||
|
||||
/**
|
||||
* This class handles reading bytes.
|
||||
*
|
||||
* @author Remy Maucherat
|
||||
*/
|
||||
public class CoyoteInputStream extends ServletInputStream {
|
||||
|
||||
protected static final StringManager sm = StringManager.getManager(CoyoteInputStream.class);
|
||||
|
||||
|
||||
protected InputBuffer ib;
|
||||
|
||||
|
||||
protected CoyoteInputStream(InputBuffer ib) {
|
||||
this.ib = ib;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Clear facade.
|
||||
*/
|
||||
void clear() {
|
||||
ib = null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Prevent cloning the facade.
|
||||
*/
|
||||
@Override
|
||||
protected Object clone() throws CloneNotSupportedException {
|
||||
throw new CloneNotSupportedException();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int read() throws IOException {
|
||||
checkNonBlockingRead();
|
||||
|
||||
if (SecurityUtil.isPackageProtectionEnabled()) {
|
||||
|
||||
try {
|
||||
Integer result = AccessController
|
||||
.doPrivileged(new PrivilegedExceptionAction<Integer>() {
|
||||
|
||||
@Override
|
||||
public Integer run() throws IOException {
|
||||
Integer integer = Integer.valueOf(ib.readByte());
|
||||
return integer;
|
||||
}
|
||||
|
||||
});
|
||||
return result.intValue();
|
||||
} catch (PrivilegedActionException pae) {
|
||||
Exception e = pae.getException();
|
||||
if (e instanceof IOException) {
|
||||
throw (IOException) e;
|
||||
} else {
|
||||
throw new RuntimeException(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return ib.readByte();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int available() throws IOException {
|
||||
|
||||
if (SecurityUtil.isPackageProtectionEnabled()) {
|
||||
try {
|
||||
Integer result = AccessController
|
||||
.doPrivileged(new PrivilegedExceptionAction<Integer>() {
|
||||
|
||||
@Override
|
||||
public Integer run() throws IOException {
|
||||
Integer integer = Integer.valueOf(ib.available());
|
||||
return integer;
|
||||
}
|
||||
|
||||
});
|
||||
return result.intValue();
|
||||
} catch (PrivilegedActionException pae) {
|
||||
Exception e = pae.getException();
|
||||
if (e instanceof IOException) {
|
||||
throw (IOException) e;
|
||||
} else {
|
||||
throw new RuntimeException(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return ib.available();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int read(final byte[] b) throws IOException {
|
||||
checkNonBlockingRead();
|
||||
|
||||
if (SecurityUtil.isPackageProtectionEnabled()) {
|
||||
try {
|
||||
Integer result = AccessController
|
||||
.doPrivileged(new PrivilegedExceptionAction<Integer>() {
|
||||
|
||||
@Override
|
||||
public Integer run() throws IOException {
|
||||
Integer integer = Integer.valueOf(ib.read(b, 0, b.length));
|
||||
return integer;
|
||||
}
|
||||
|
||||
});
|
||||
return result.intValue();
|
||||
} catch (PrivilegedActionException pae) {
|
||||
Exception e = pae.getException();
|
||||
if (e instanceof IOException) {
|
||||
throw (IOException) e;
|
||||
} else {
|
||||
throw new RuntimeException(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return ib.read(b, 0, b.length);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int read(final byte[] b, final int off, final int len) throws IOException {
|
||||
checkNonBlockingRead();
|
||||
|
||||
if (SecurityUtil.isPackageProtectionEnabled()) {
|
||||
try {
|
||||
Integer result = AccessController
|
||||
.doPrivileged(new PrivilegedExceptionAction<Integer>() {
|
||||
|
||||
@Override
|
||||
public Integer run() throws IOException {
|
||||
Integer integer = Integer.valueOf(ib.read(b, off, len));
|
||||
return integer;
|
||||
}
|
||||
|
||||
});
|
||||
return result.intValue();
|
||||
} catch (PrivilegedActionException pae) {
|
||||
Exception e = pae.getException();
|
||||
if (e instanceof IOException) {
|
||||
throw (IOException) e;
|
||||
} else {
|
||||
throw new RuntimeException(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return ib.read(b, off, len);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Transfers bytes from the buffer to the specified ByteBuffer. After the
|
||||
* operation the position of the ByteBuffer will be returned to the one
|
||||
* before the operation, the limit will be the position incremented by
|
||||
* the number of the transferred bytes.
|
||||
*
|
||||
* @param b the ByteBuffer into which bytes are to be written.
|
||||
* @return an integer specifying the actual number of bytes read, or -1 if
|
||||
* the end of the stream is reached
|
||||
* @throws IOException if an input or output exception has occurred
|
||||
*/
|
||||
public int read(final ByteBuffer b) throws IOException {
|
||||
checkNonBlockingRead();
|
||||
|
||||
if (SecurityUtil.isPackageProtectionEnabled()) {
|
||||
try {
|
||||
Integer result = AccessController
|
||||
.doPrivileged(new PrivilegedExceptionAction<Integer>() {
|
||||
|
||||
@Override
|
||||
public Integer run() throws IOException {
|
||||
Integer integer = Integer.valueOf(ib.read(b));
|
||||
return integer;
|
||||
}
|
||||
|
||||
});
|
||||
return result.intValue();
|
||||
} catch (PrivilegedActionException pae) {
|
||||
Exception e = pae.getException();
|
||||
if (e instanceof IOException) {
|
||||
throw (IOException) e;
|
||||
} else {
|
||||
throw new RuntimeException(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return ib.read(b);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int readLine(byte[] b, int off, int len) throws IOException {
|
||||
return super.readLine(b, off, len);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Close the stream
|
||||
* Since we re-cycle, we can't allow the call to super.close()
|
||||
* which would permanently disable us.
|
||||
*/
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
|
||||
if (SecurityUtil.isPackageProtectionEnabled()) {
|
||||
try {
|
||||
AccessController.doPrivileged(new PrivilegedExceptionAction<Void>() {
|
||||
|
||||
@Override
|
||||
public Void run() throws IOException {
|
||||
ib.close();
|
||||
return null;
|
||||
}
|
||||
|
||||
});
|
||||
} catch (PrivilegedActionException pae) {
|
||||
Exception e = pae.getException();
|
||||
if (e instanceof IOException) {
|
||||
throw (IOException) e;
|
||||
} else {
|
||||
throw new RuntimeException(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ib.close();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFinished() {
|
||||
return ib.isFinished();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isReady() {
|
||||
return ib.isReady();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setReadListener(ReadListener listener) {
|
||||
ib.setReadListener(listener);
|
||||
}
|
||||
|
||||
|
||||
private void checkNonBlockingRead() {
|
||||
if (!ib.isBlocking() && !ib.isReady()) {
|
||||
throw new IllegalStateException(sm.getString("coyoteInputStream.nbNotready"));
|
||||
}
|
||||
}
|
||||
}
|
||||
171
java/org/apache/catalina/connector/CoyoteOutputStream.java
Normal file
171
java/org/apache/catalina/connector/CoyoteOutputStream.java
Normal file
@@ -0,0 +1,171 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You 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
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
package org.apache.catalina.connector;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.WriteListener;
|
||||
|
||||
import org.apache.tomcat.util.res.StringManager;
|
||||
|
||||
/**
|
||||
* Coyote implementation of the servlet output stream.
|
||||
*
|
||||
* @author Costin Manolache
|
||||
* @author Remy Maucherat
|
||||
*/
|
||||
public class CoyoteOutputStream extends ServletOutputStream {
|
||||
|
||||
protected static final StringManager sm = StringManager.getManager(CoyoteOutputStream.class);
|
||||
|
||||
|
||||
// ----------------------------------------------------- Instance Variables
|
||||
|
||||
protected OutputBuffer ob;
|
||||
|
||||
|
||||
// ----------------------------------------------------------- Constructors
|
||||
|
||||
|
||||
protected CoyoteOutputStream(OutputBuffer ob) {
|
||||
this.ob = ob;
|
||||
}
|
||||
|
||||
|
||||
// --------------------------------------------------------- Public Methods
|
||||
|
||||
|
||||
/**
|
||||
* Prevent cloning the facade.
|
||||
*/
|
||||
@Override
|
||||
protected Object clone() throws CloneNotSupportedException {
|
||||
throw new CloneNotSupportedException();
|
||||
}
|
||||
|
||||
|
||||
// -------------------------------------------------------- Package Methods
|
||||
|
||||
|
||||
/**
|
||||
* Clear facade.
|
||||
*/
|
||||
void clear() {
|
||||
ob = null;
|
||||
}
|
||||
|
||||
|
||||
// --------------------------------------------------- OutputStream Methods
|
||||
|
||||
|
||||
@Override
|
||||
public void write(int i) throws IOException {
|
||||
boolean nonBlocking = checkNonBlockingWrite();
|
||||
ob.writeByte(i);
|
||||
if (nonBlocking) {
|
||||
checkRegisterForWrite();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void write(byte[] b) throws IOException {
|
||||
write(b, 0, b.length);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void write(byte[] b, int off, int len) throws IOException {
|
||||
boolean nonBlocking = checkNonBlockingWrite();
|
||||
ob.write(b, off, len);
|
||||
if (nonBlocking) {
|
||||
checkRegisterForWrite();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void write(ByteBuffer from) throws IOException {
|
||||
boolean nonBlocking = checkNonBlockingWrite();
|
||||
ob.write(from);
|
||||
if (nonBlocking) {
|
||||
checkRegisterForWrite();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Will send the buffer to the client.
|
||||
*/
|
||||
@Override
|
||||
public void flush() throws IOException {
|
||||
boolean nonBlocking = checkNonBlockingWrite();
|
||||
ob.flush();
|
||||
if (nonBlocking) {
|
||||
checkRegisterForWrite();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Checks for concurrent writes which are not permitted. This object has no
|
||||
* state information so the call chain is
|
||||
* CoyoteOutputStream->OutputBuffer->CoyoteResponse.
|
||||
*
|
||||
* @return <code>true</code> if this OutputStream is currently in
|
||||
* non-blocking mode.
|
||||
*/
|
||||
private boolean checkNonBlockingWrite() {
|
||||
boolean nonBlocking = !ob.isBlocking();
|
||||
if (nonBlocking && !ob.isReady()) {
|
||||
throw new IllegalStateException(sm.getString("coyoteOutputStream.nbNotready"));
|
||||
}
|
||||
return nonBlocking;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Checks to see if there is data left in the Coyote output buffers (NOT the
|
||||
* servlet output buffer) and if so registers the associated socket for
|
||||
* write so the buffers will be emptied. The container will take care of
|
||||
* this. As far as the app is concerned, there is a non-blocking write in
|
||||
* progress. It doesn't have visibility of whether the data is buffered in
|
||||
* the socket buffer or the Coyote buffers.
|
||||
*/
|
||||
private void checkRegisterForWrite() {
|
||||
ob.checkRegisterForWrite();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
ob.close();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isReady() {
|
||||
return ob.isReady();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setWriteListener(WriteListener listener) {
|
||||
ob.setWriteListener(listener);
|
||||
}
|
||||
}
|
||||
|
||||
72
java/org/apache/catalina/connector/CoyotePrincipal.java
Normal file
72
java/org/apache/catalina/connector/CoyotePrincipal.java
Normal file
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You 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
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
package org.apache.catalina.connector;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.security.Principal;
|
||||
|
||||
/**
|
||||
* Generic implementation of <strong>java.security.Principal</strong> that
|
||||
* is used to represent principals authenticated at the protocol handler level.
|
||||
*
|
||||
* @author Remy Maucherat
|
||||
*/
|
||||
public class CoyotePrincipal implements Principal, Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
// ----------------------------------------------------------- Constructors
|
||||
|
||||
public CoyotePrincipal(String name) {
|
||||
|
||||
this.name = name;
|
||||
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------------------- Properties
|
||||
|
||||
|
||||
/**
|
||||
* The username of the user represented by this Principal.
|
||||
*/
|
||||
protected final String name;
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
|
||||
// --------------------------------------------------------- Public Methods
|
||||
|
||||
|
||||
/**
|
||||
* Return a String representation of this object, which exposes only
|
||||
* information that should be public.
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder("CoyotePrincipal[");
|
||||
sb.append(this.name);
|
||||
sb.append("]");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
217
java/org/apache/catalina/connector/CoyoteReader.java
Normal file
217
java/org/apache/catalina/connector/CoyoteReader.java
Normal file
@@ -0,0 +1,217 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You 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
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
package org.apache.catalina.connector;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
|
||||
|
||||
/**
|
||||
* Coyote implementation of the buffered reader.
|
||||
*
|
||||
* @author Remy Maucherat
|
||||
*/
|
||||
public class CoyoteReader
|
||||
extends BufferedReader {
|
||||
|
||||
|
||||
// -------------------------------------------------------------- Constants
|
||||
|
||||
|
||||
private static final char[] LINE_SEP = { '\r', '\n' };
|
||||
private static final int MAX_LINE_LENGTH = 4096;
|
||||
|
||||
|
||||
// ----------------------------------------------------- Instance Variables
|
||||
|
||||
|
||||
protected InputBuffer ib;
|
||||
|
||||
|
||||
protected char[] lineBuffer = null;
|
||||
|
||||
|
||||
// ----------------------------------------------------------- Constructors
|
||||
|
||||
|
||||
public CoyoteReader(InputBuffer ib) {
|
||||
super(ib, 1);
|
||||
this.ib = ib;
|
||||
}
|
||||
|
||||
|
||||
// --------------------------------------------------------- Public Methods
|
||||
|
||||
|
||||
/**
|
||||
* Prevent cloning the facade.
|
||||
*/
|
||||
@Override
|
||||
protected Object clone()
|
||||
throws CloneNotSupportedException {
|
||||
throw new CloneNotSupportedException();
|
||||
}
|
||||
|
||||
|
||||
// -------------------------------------------------------- Package Methods
|
||||
|
||||
|
||||
/**
|
||||
* Clear facade.
|
||||
*/
|
||||
void clear() {
|
||||
ib = null;
|
||||
}
|
||||
|
||||
|
||||
// --------------------------------------------------------- Reader Methods
|
||||
|
||||
|
||||
@Override
|
||||
public void close()
|
||||
throws IOException {
|
||||
ib.close();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int read()
|
||||
throws IOException {
|
||||
return ib.read();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int read(char[] cbuf)
|
||||
throws IOException {
|
||||
return ib.read(cbuf, 0, cbuf.length);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int read(char[] cbuf, int off, int len)
|
||||
throws IOException {
|
||||
return ib.read(cbuf, off, len);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public long skip(long n)
|
||||
throws IOException {
|
||||
return ib.skip(n);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean ready()
|
||||
throws IOException {
|
||||
return ib.ready();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean markSupported() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void mark(int readAheadLimit)
|
||||
throws IOException {
|
||||
ib.mark(readAheadLimit);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void reset()
|
||||
throws IOException {
|
||||
ib.reset();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String readLine()
|
||||
throws IOException {
|
||||
|
||||
if (lineBuffer == null) {
|
||||
lineBuffer = new char[MAX_LINE_LENGTH];
|
||||
}
|
||||
|
||||
String result = null;
|
||||
|
||||
int pos = 0;
|
||||
int end = -1;
|
||||
int skip = -1;
|
||||
StringBuilder aggregator = null;
|
||||
while (end < 0) {
|
||||
mark(MAX_LINE_LENGTH);
|
||||
while ((pos < MAX_LINE_LENGTH) && (end < 0)) {
|
||||
int nRead = read(lineBuffer, pos, MAX_LINE_LENGTH - pos);
|
||||
if (nRead < 0) {
|
||||
if (pos == 0 && aggregator == null) {
|
||||
return null;
|
||||
}
|
||||
end = pos;
|
||||
skip = pos;
|
||||
}
|
||||
for (int i = pos; (i < (pos + nRead)) && (end < 0); i++) {
|
||||
if (lineBuffer[i] == LINE_SEP[0]) {
|
||||
end = i;
|
||||
skip = i + 1;
|
||||
char nextchar;
|
||||
if (i == (pos + nRead - 1)) {
|
||||
nextchar = (char) read();
|
||||
} else {
|
||||
nextchar = lineBuffer[i+1];
|
||||
}
|
||||
if (nextchar == LINE_SEP[1]) {
|
||||
skip++;
|
||||
}
|
||||
} else if (lineBuffer[i] == LINE_SEP[1]) {
|
||||
end = i;
|
||||
skip = i + 1;
|
||||
}
|
||||
}
|
||||
if (nRead > 0) {
|
||||
pos += nRead;
|
||||
}
|
||||
}
|
||||
if (end < 0) {
|
||||
if (aggregator == null) {
|
||||
aggregator = new StringBuilder();
|
||||
}
|
||||
aggregator.append(lineBuffer);
|
||||
pos = 0;
|
||||
} else {
|
||||
reset();
|
||||
skip(skip);
|
||||
}
|
||||
}
|
||||
|
||||
if (aggregator == null) {
|
||||
result = new String(lineBuffer, 0, end);
|
||||
} else {
|
||||
aggregator.append(lineBuffer, 0, end);
|
||||
result = aggregator.toString();
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
317
java/org/apache/catalina/connector/CoyoteWriter.java
Normal file
317
java/org/apache/catalina/connector/CoyoteWriter.java
Normal file
@@ -0,0 +1,317 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You 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
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
package org.apache.catalina.connector;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
|
||||
/**
|
||||
* Coyote implementation of the servlet writer.
|
||||
*
|
||||
* @author Remy Maucherat
|
||||
*/
|
||||
public class CoyoteWriter extends PrintWriter {
|
||||
|
||||
|
||||
// -------------------------------------------------------------- Constants
|
||||
|
||||
private static final char[] LINE_SEP = System.lineSeparator().toCharArray();
|
||||
|
||||
|
||||
// ----------------------------------------------------- Instance Variables
|
||||
|
||||
|
||||
protected OutputBuffer ob;
|
||||
protected boolean error = false;
|
||||
|
||||
|
||||
// ----------------------------------------------------------- Constructors
|
||||
|
||||
|
||||
public CoyoteWriter(OutputBuffer ob) {
|
||||
super(ob);
|
||||
this.ob = ob;
|
||||
}
|
||||
|
||||
|
||||
// --------------------------------------------------------- Public Methods
|
||||
|
||||
|
||||
/**
|
||||
* Prevent cloning the facade.
|
||||
*/
|
||||
@Override
|
||||
protected Object clone()
|
||||
throws CloneNotSupportedException {
|
||||
throw new CloneNotSupportedException();
|
||||
}
|
||||
|
||||
|
||||
// -------------------------------------------------------- Package Methods
|
||||
|
||||
|
||||
/**
|
||||
* Clear facade.
|
||||
*/
|
||||
void clear() {
|
||||
ob = null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Recycle.
|
||||
*/
|
||||
void recycle() {
|
||||
error = false;
|
||||
}
|
||||
|
||||
|
||||
// --------------------------------------------------------- Writer Methods
|
||||
|
||||
|
||||
@Override
|
||||
public void flush() {
|
||||
|
||||
if (error) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
ob.flush();
|
||||
} catch (IOException e) {
|
||||
error = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
|
||||
// We don't close the PrintWriter - super() is not called,
|
||||
// so the stream can be reused. We close ob.
|
||||
try {
|
||||
ob.close();
|
||||
} catch (IOException ex ) {
|
||||
// Ignore
|
||||
}
|
||||
error = false;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean checkError() {
|
||||
flush();
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void write(int c) {
|
||||
|
||||
if (error) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
ob.write(c);
|
||||
} catch (IOException e) {
|
||||
error = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void write(char buf[], int off, int len) {
|
||||
|
||||
if (error) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
ob.write(buf, off, len);
|
||||
} catch (IOException e) {
|
||||
error = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void write(char buf[]) {
|
||||
write(buf, 0, buf.length);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void write(String s, int off, int len) {
|
||||
|
||||
if (error) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
ob.write(s, off, len);
|
||||
} catch (IOException e) {
|
||||
error = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void write(String s) {
|
||||
write(s, 0, s.length());
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------- PrintWriter Methods
|
||||
|
||||
|
||||
@Override
|
||||
public void print(boolean b) {
|
||||
if (b) {
|
||||
write("true");
|
||||
} else {
|
||||
write("false");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void print(char c) {
|
||||
write(c);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void print(int i) {
|
||||
write(String.valueOf(i));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void print(long l) {
|
||||
write(String.valueOf(l));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void print(float f) {
|
||||
write(String.valueOf(f));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void print(double d) {
|
||||
write(String.valueOf(d));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void print(char s[]) {
|
||||
write(s);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void print(String s) {
|
||||
if (s == null) {
|
||||
s = "null";
|
||||
}
|
||||
write(s);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void print(Object obj) {
|
||||
write(String.valueOf(obj));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void println() {
|
||||
write(LINE_SEP);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void println(boolean b) {
|
||||
print(b);
|
||||
println();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void println(char c) {
|
||||
print(c);
|
||||
println();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void println(int i) {
|
||||
print(i);
|
||||
println();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void println(long l) {
|
||||
print(l);
|
||||
println();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void println(float f) {
|
||||
print(f);
|
||||
println();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void println(double d) {
|
||||
print(d);
|
||||
println();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void println(char c[]) {
|
||||
print(c);
|
||||
println();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void println(String s) {
|
||||
print(s);
|
||||
println();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void println(Object o) {
|
||||
print(o);
|
||||
println();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
713
java/org/apache/catalina/connector/InputBuffer.java
Normal file
713
java/org/apache/catalina/connector/InputBuffer.java
Normal file
@@ -0,0 +1,713 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You 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
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
package org.apache.catalina.connector;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Reader;
|
||||
import java.nio.Buffer;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.CharBuffer;
|
||||
import java.nio.charset.Charset;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedActionException;
|
||||
import java.security.PrivilegedExceptionAction;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import javax.servlet.ReadListener;
|
||||
|
||||
import org.apache.catalina.security.SecurityUtil;
|
||||
import org.apache.coyote.ActionCode;
|
||||
import org.apache.coyote.ContainerThreadMarker;
|
||||
import org.apache.coyote.Request;
|
||||
import org.apache.juli.logging.Log;
|
||||
import org.apache.juli.logging.LogFactory;
|
||||
import org.apache.tomcat.util.buf.B2CConverter;
|
||||
import org.apache.tomcat.util.buf.ByteChunk;
|
||||
import org.apache.tomcat.util.collections.SynchronizedStack;
|
||||
import org.apache.tomcat.util.net.ApplicationBufferHandler;
|
||||
import org.apache.tomcat.util.res.StringManager;
|
||||
|
||||
/**
|
||||
* The buffer used by Tomcat request. This is a derivative of the Tomcat 3.3
|
||||
* OutputBuffer, adapted to handle input instead of output. This allows
|
||||
* complete recycling of the facade objects (the ServletInputStream and the
|
||||
* BufferedReader).
|
||||
*
|
||||
* @author Remy Maucherat
|
||||
*/
|
||||
public class InputBuffer extends Reader
|
||||
implements ByteChunk.ByteInputChannel, ApplicationBufferHandler {
|
||||
|
||||
/**
|
||||
* The string manager for this package.
|
||||
*/
|
||||
protected static final StringManager sm = StringManager.getManager(InputBuffer.class);
|
||||
|
||||
private static final Log log = LogFactory.getLog(InputBuffer.class);
|
||||
|
||||
public static final int DEFAULT_BUFFER_SIZE = 8 * 1024;
|
||||
|
||||
// The buffer can be used for byte[] and char[] reading
|
||||
// ( this is needed to support ServletInputStream and BufferedReader )
|
||||
public final int INITIAL_STATE = 0;
|
||||
public final int CHAR_STATE = 1;
|
||||
public final int BYTE_STATE = 2;
|
||||
|
||||
|
||||
/**
|
||||
* Encoder cache.
|
||||
*/
|
||||
private static final ConcurrentMap<Charset, SynchronizedStack<B2CConverter>> encoders = new ConcurrentHashMap<>();
|
||||
|
||||
// ----------------------------------------------------- Instance Variables
|
||||
|
||||
/**
|
||||
* The byte buffer.
|
||||
*/
|
||||
private ByteBuffer bb;
|
||||
|
||||
|
||||
/**
|
||||
* The char buffer.
|
||||
*/
|
||||
private CharBuffer cb;
|
||||
|
||||
|
||||
/**
|
||||
* State of the output buffer.
|
||||
*/
|
||||
private int state = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Flag which indicates if the input buffer is closed.
|
||||
*/
|
||||
private boolean closed = false;
|
||||
|
||||
|
||||
/**
|
||||
* Encoding to use.
|
||||
*/
|
||||
private String enc;
|
||||
|
||||
|
||||
/**
|
||||
* Current byte to char converter.
|
||||
*/
|
||||
protected B2CConverter conv;
|
||||
|
||||
|
||||
/**
|
||||
* Associated Coyote request.
|
||||
*/
|
||||
private Request coyoteRequest;
|
||||
|
||||
|
||||
/**
|
||||
* Buffer position.
|
||||
*/
|
||||
private int markPos = -1;
|
||||
|
||||
|
||||
/**
|
||||
* Char buffer limit.
|
||||
*/
|
||||
private int readLimit;
|
||||
|
||||
|
||||
/**
|
||||
* Buffer size.
|
||||
*/
|
||||
private final int size;
|
||||
|
||||
|
||||
// ----------------------------------------------------------- Constructors
|
||||
|
||||
|
||||
/**
|
||||
* Default constructor. Allocate the buffer with the default buffer size.
|
||||
*/
|
||||
public InputBuffer() {
|
||||
|
||||
this(DEFAULT_BUFFER_SIZE);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Alternate constructor which allows specifying the initial buffer size.
|
||||
*
|
||||
* @param size Buffer size to use
|
||||
*/
|
||||
public InputBuffer(int size) {
|
||||
|
||||
this.size = size;
|
||||
bb = ByteBuffer.allocate(size);
|
||||
clear(bb);
|
||||
cb = CharBuffer.allocate(size);
|
||||
clear(cb);
|
||||
readLimit = size;
|
||||
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------------------- Properties
|
||||
|
||||
|
||||
/**
|
||||
* Associated Coyote request.
|
||||
*
|
||||
* @param coyoteRequest Associated Coyote request
|
||||
*/
|
||||
public void setRequest(Request coyoteRequest) {
|
||||
this.coyoteRequest = coyoteRequest;
|
||||
}
|
||||
|
||||
|
||||
// --------------------------------------------------------- Public Methods
|
||||
|
||||
/**
|
||||
* Recycle the output buffer.
|
||||
*/
|
||||
public void recycle() {
|
||||
|
||||
state = INITIAL_STATE;
|
||||
|
||||
// If usage of mark made the buffer too big, reallocate it
|
||||
if (cb.capacity() > size) {
|
||||
cb = CharBuffer.allocate(size);
|
||||
clear(cb);
|
||||
} else {
|
||||
clear(cb);
|
||||
}
|
||||
readLimit = size;
|
||||
markPos = -1;
|
||||
clear(bb);
|
||||
closed = false;
|
||||
|
||||
if (conv != null) {
|
||||
conv.recycle();
|
||||
encoders.get(conv.getCharset()).push(conv);
|
||||
conv = null;
|
||||
}
|
||||
|
||||
enc = null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Close the input buffer.
|
||||
*
|
||||
* @throws IOException An underlying IOException occurred
|
||||
*/
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
closed = true;
|
||||
}
|
||||
|
||||
|
||||
public int available() {
|
||||
int available = availableInThisBuffer();
|
||||
if (available == 0) {
|
||||
coyoteRequest.action(ActionCode.AVAILABLE,
|
||||
Boolean.valueOf(coyoteRequest.getReadListener() != null));
|
||||
available = (coyoteRequest.getAvailable() > 0) ? 1 : 0;
|
||||
}
|
||||
return available;
|
||||
}
|
||||
|
||||
|
||||
private int availableInThisBuffer() {
|
||||
int available = 0;
|
||||
if (state == BYTE_STATE) {
|
||||
available = bb.remaining();
|
||||
} else if (state == CHAR_STATE) {
|
||||
available = cb.remaining();
|
||||
}
|
||||
return available;
|
||||
}
|
||||
|
||||
|
||||
public void setReadListener(ReadListener listener) {
|
||||
coyoteRequest.setReadListener(listener);
|
||||
|
||||
// The container is responsible for the first call to
|
||||
// listener.onDataAvailable(). If isReady() returns true, the container
|
||||
// needs to call listener.onDataAvailable() from a new thread. If
|
||||
// isReady() returns false, the socket will be registered for read and
|
||||
// the container will call listener.onDataAvailable() once data arrives.
|
||||
// Must call isFinished() first as a call to isReady() if the request
|
||||
// has been finished will register the socket for read interest and that
|
||||
// is not required.
|
||||
if (!coyoteRequest.isFinished() && isReady()) {
|
||||
coyoteRequest.action(ActionCode.DISPATCH_READ, null);
|
||||
if (!ContainerThreadMarker.isContainerThread()) {
|
||||
// Not on a container thread so need to execute the dispatch
|
||||
coyoteRequest.action(ActionCode.DISPATCH_EXECUTE, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public boolean isFinished() {
|
||||
int available = 0;
|
||||
if (state == BYTE_STATE) {
|
||||
available = bb.remaining();
|
||||
} else if (state == CHAR_STATE) {
|
||||
available = cb.remaining();
|
||||
}
|
||||
if (available > 0) {
|
||||
return false;
|
||||
} else {
|
||||
return coyoteRequest.isFinished();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public boolean isReady() {
|
||||
if (coyoteRequest.getReadListener() == null) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug(sm.getString("inputBuffer.requiresNonBlocking"));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (isFinished()) {
|
||||
// If this is a non-container thread, need to trigger a read
|
||||
// which will eventually lead to a call to onAllDataRead() via a
|
||||
// container thread.
|
||||
if (!ContainerThreadMarker.isContainerThread()) {
|
||||
coyoteRequest.action(ActionCode.DISPATCH_READ, null);
|
||||
coyoteRequest.action(ActionCode.DISPATCH_EXECUTE, null);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
// Checking for available data at the network level and registering for
|
||||
// read can be done sequentially for HTTP/1.x and AJP as there is only
|
||||
// ever a single thread processing the socket at any one time. However,
|
||||
// for HTTP/2 there is one thread processing the connection and separate
|
||||
// threads for each stream. For HTTP/2 the two operations have to be
|
||||
// performed atomically else it is possible for the connection thread to
|
||||
// read more data in to the buffer after the stream thread checks for
|
||||
// available network data but before it registers for read.
|
||||
if (availableInThisBuffer() > 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
AtomicBoolean result = new AtomicBoolean();
|
||||
coyoteRequest.action(ActionCode.NB_READ_INTEREST, result);
|
||||
return result.get();
|
||||
}
|
||||
|
||||
|
||||
boolean isBlocking() {
|
||||
return coyoteRequest.getReadListener() == null;
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------- Bytes Handling Methods
|
||||
|
||||
/**
|
||||
* Reads new bytes in the byte chunk.
|
||||
*
|
||||
* @throws IOException An underlying IOException occurred
|
||||
*/
|
||||
@Override
|
||||
public int realReadBytes() throws IOException {
|
||||
if (closed) {
|
||||
return -1;
|
||||
}
|
||||
if (coyoteRequest == null) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (state == INITIAL_STATE) {
|
||||
state = BYTE_STATE;
|
||||
}
|
||||
|
||||
try {
|
||||
return coyoteRequest.doRead(this);
|
||||
} catch (IOException ioe) {
|
||||
// An IOException on a read is almost always due to
|
||||
// the remote client aborting the request.
|
||||
throw new ClientAbortException(ioe);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public int readByte() throws IOException {
|
||||
if (closed) {
|
||||
throw new IOException(sm.getString("inputBuffer.streamClosed"));
|
||||
}
|
||||
|
||||
if (checkByteBufferEof()) {
|
||||
return -1;
|
||||
}
|
||||
return bb.get() & 0xFF;
|
||||
}
|
||||
|
||||
|
||||
public int read(byte[] b, int off, int len) throws IOException {
|
||||
if (closed) {
|
||||
throw new IOException(sm.getString("inputBuffer.streamClosed"));
|
||||
}
|
||||
|
||||
if (checkByteBufferEof()) {
|
||||
return -1;
|
||||
}
|
||||
int n = Math.min(len, bb.remaining());
|
||||
bb.get(b, off, n);
|
||||
return n;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Transfers bytes from the buffer to the specified ByteBuffer. After the
|
||||
* operation the position of the ByteBuffer will be returned to the one
|
||||
* before the operation, the limit will be the position incremented by
|
||||
* the number of the transferred bytes.
|
||||
*
|
||||
* @param to the ByteBuffer into which bytes are to be written.
|
||||
* @return an integer specifying the actual number of bytes read, or -1 if
|
||||
* the end of the stream is reached
|
||||
* @throws IOException if an input or output exception has occurred
|
||||
*/
|
||||
public int read(ByteBuffer to) throws IOException {
|
||||
if (closed) {
|
||||
throw new IOException(sm.getString("inputBuffer.streamClosed"));
|
||||
}
|
||||
|
||||
if (checkByteBufferEof()) {
|
||||
return -1;
|
||||
}
|
||||
int n = Math.min(to.remaining(), bb.remaining());
|
||||
int orgLimit = bb.limit();
|
||||
bb.limit(bb.position() + n);
|
||||
to.put(bb);
|
||||
bb.limit(orgLimit);
|
||||
to.limit(to.position()).position(to.position() - n);
|
||||
return n;
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------- Chars Handling Methods
|
||||
|
||||
|
||||
/**
|
||||
* @param s New encoding value
|
||||
*
|
||||
* @deprecated This method will be removed in Tomcat 9.0.x
|
||||
*/
|
||||
@Deprecated
|
||||
public void setEncoding(String s) {
|
||||
enc = s;
|
||||
}
|
||||
|
||||
|
||||
public int realReadChars() throws IOException {
|
||||
checkConverter();
|
||||
|
||||
boolean eof = false;
|
||||
|
||||
if (bb.remaining() <= 0) {
|
||||
int nRead = realReadBytes();
|
||||
if (nRead < 0) {
|
||||
eof = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (markPos == -1) {
|
||||
clear(cb);
|
||||
} else {
|
||||
// Make sure there's enough space in the worst case
|
||||
makeSpace(bb.remaining());
|
||||
if ((cb.capacity() - cb.limit()) == 0 && bb.remaining() != 0) {
|
||||
// We went over the limit
|
||||
clear(cb);
|
||||
markPos = -1;
|
||||
}
|
||||
}
|
||||
|
||||
state = CHAR_STATE;
|
||||
conv.convert(bb, cb, this, eof);
|
||||
|
||||
if (cb.remaining() == 0 && eof) {
|
||||
return -1;
|
||||
} else {
|
||||
return cb.remaining();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int read() throws IOException {
|
||||
|
||||
if (closed) {
|
||||
throw new IOException(sm.getString("inputBuffer.streamClosed"));
|
||||
}
|
||||
|
||||
if (checkCharBufferEof()) {
|
||||
return -1;
|
||||
}
|
||||
return cb.get();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int read(char[] cbuf) throws IOException {
|
||||
|
||||
if (closed) {
|
||||
throw new IOException(sm.getString("inputBuffer.streamClosed"));
|
||||
}
|
||||
|
||||
return read(cbuf, 0, cbuf.length);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int read(char[] cbuf, int off, int len) throws IOException {
|
||||
|
||||
if (closed) {
|
||||
throw new IOException(sm.getString("inputBuffer.streamClosed"));
|
||||
}
|
||||
|
||||
if (checkCharBufferEof()) {
|
||||
return -1;
|
||||
}
|
||||
int n = Math.min(len, cb.remaining());
|
||||
cb.get(cbuf, off, n);
|
||||
return n;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public long skip(long n) throws IOException {
|
||||
if (closed) {
|
||||
throw new IOException(sm.getString("inputBuffer.streamClosed"));
|
||||
}
|
||||
|
||||
if (n < 0) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
long nRead = 0;
|
||||
while (nRead < n) {
|
||||
if (cb.remaining() >= n) {
|
||||
cb.position(cb.position() + (int) n);
|
||||
nRead = n;
|
||||
} else {
|
||||
nRead += cb.remaining();
|
||||
cb.position(cb.limit());
|
||||
int nb = realReadChars();
|
||||
if (nb < 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return nRead;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean ready() throws IOException {
|
||||
if (closed) {
|
||||
throw new IOException(sm.getString("inputBuffer.streamClosed"));
|
||||
}
|
||||
if (state == INITIAL_STATE) {
|
||||
state = CHAR_STATE;
|
||||
}
|
||||
return (available() > 0);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean markSupported() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void mark(int readAheadLimit) throws IOException {
|
||||
|
||||
if (closed) {
|
||||
throw new IOException(sm.getString("inputBuffer.streamClosed"));
|
||||
}
|
||||
|
||||
if (cb.remaining() <= 0) {
|
||||
clear(cb);
|
||||
} else {
|
||||
if ((cb.capacity() > (2 * size)) && (cb.remaining()) < (cb.position())) {
|
||||
cb.compact();
|
||||
cb.flip();
|
||||
}
|
||||
}
|
||||
readLimit = cb.position() + readAheadLimit + size;
|
||||
markPos = cb.position();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void reset() throws IOException {
|
||||
|
||||
if (closed) {
|
||||
throw new IOException(sm.getString("inputBuffer.streamClosed"));
|
||||
}
|
||||
|
||||
if (state == CHAR_STATE) {
|
||||
if (markPos < 0) {
|
||||
clear(cb);
|
||||
markPos = -1;
|
||||
throw new IOException();
|
||||
} else {
|
||||
cb.position(markPos);
|
||||
}
|
||||
} else {
|
||||
clear(bb);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void checkConverter() throws IOException {
|
||||
if (conv != null) {
|
||||
return;
|
||||
}
|
||||
|
||||
Charset charset = null;
|
||||
|
||||
if (coyoteRequest != null) {
|
||||
charset = coyoteRequest.getCharset();
|
||||
}
|
||||
|
||||
if (charset == null) {
|
||||
if (enc == null) {
|
||||
charset = org.apache.coyote.Constants.DEFAULT_BODY_CHARSET;
|
||||
} else {
|
||||
charset = B2CConverter.getCharset(enc);
|
||||
}
|
||||
}
|
||||
|
||||
SynchronizedStack<B2CConverter> stack = encoders.get(charset);
|
||||
if (stack == null) {
|
||||
stack = new SynchronizedStack<>();
|
||||
encoders.putIfAbsent(charset, stack);
|
||||
stack = encoders.get(charset);
|
||||
}
|
||||
conv = stack.pop();
|
||||
|
||||
if (conv == null) {
|
||||
conv = createConverter(charset);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static B2CConverter createConverter(final Charset charset) throws IOException {
|
||||
if (SecurityUtil.isPackageProtectionEnabled()) {
|
||||
try {
|
||||
return AccessController.doPrivileged(new PrivilegedExceptionAction<B2CConverter>() {
|
||||
|
||||
@Override
|
||||
public B2CConverter run() throws IOException {
|
||||
return new B2CConverter(charset);
|
||||
}
|
||||
});
|
||||
} catch (PrivilegedActionException ex) {
|
||||
Exception e = ex.getException();
|
||||
if (e instanceof IOException) {
|
||||
throw (IOException) e;
|
||||
} else {
|
||||
throw new IOException(e);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return new B2CConverter(charset);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setByteBuffer(ByteBuffer buffer) {
|
||||
bb = buffer;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ByteBuffer getByteBuffer() {
|
||||
return bb;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void expand(int size) {
|
||||
// no-op
|
||||
}
|
||||
|
||||
|
||||
private boolean checkByteBufferEof() throws IOException {
|
||||
if (bb.remaining() == 0) {
|
||||
int n = realReadBytes();
|
||||
if (n < 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean checkCharBufferEof() throws IOException {
|
||||
if (cb.remaining() == 0) {
|
||||
int n = realReadChars();
|
||||
if (n < 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void clear(Buffer buffer) {
|
||||
buffer.rewind().limit(0);
|
||||
}
|
||||
|
||||
private void makeSpace(int count) {
|
||||
int desiredSize = cb.limit() + count;
|
||||
if(desiredSize > readLimit) {
|
||||
desiredSize = readLimit;
|
||||
}
|
||||
|
||||
if(desiredSize <= cb.capacity()) {
|
||||
return;
|
||||
}
|
||||
|
||||
int newSize = 2 * cb.capacity();
|
||||
if(desiredSize >= newSize) {
|
||||
newSize= 2 * cb.capacity() + count;
|
||||
}
|
||||
|
||||
if (newSize > readLimit) {
|
||||
newSize = readLimit;
|
||||
}
|
||||
|
||||
CharBuffer tmp = CharBuffer.allocate(newSize);
|
||||
int oldPosition = cb.position();
|
||||
cb.position(0);
|
||||
tmp.put(cb);
|
||||
tmp.flip();
|
||||
tmp.position(oldPosition);
|
||||
cb = tmp;
|
||||
tmp = null;
|
||||
}
|
||||
}
|
||||
90
java/org/apache/catalina/connector/LocalStrings.properties
Normal file
90
java/org/apache/catalina/connector/LocalStrings.properties
Normal file
@@ -0,0 +1,90 @@
|
||||
# Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
# contributor license agreements. See the NOTICE file distributed with
|
||||
# this work for additional information regarding copyright ownership.
|
||||
# The ASF licenses this file to You 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
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# 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.
|
||||
|
||||
coyoteAdapter.accesslogFail=Exception while attempting to add an entry to the access log
|
||||
coyoteAdapter.asyncDispatch=Exception while processing an asynchronous request
|
||||
coyoteAdapter.authenticate=Authenticated user [{0}] provided by connector
|
||||
coyoteAdapter.authorize=Authorizing user [{0}] using Tomcat''s Realm
|
||||
coyoteAdapter.checkRecycled.request=Encountered a non-recycled request and recycled it forcedly.
|
||||
coyoteAdapter.checkRecycled.response=Encountered a non-recycled response and recycled it forcedly.
|
||||
coyoteAdapter.debug=The variable [{0}] has value [{1}]
|
||||
coyoteAdapter.nullRequest=An asynchronous dispatch may only happen on an existing request
|
||||
|
||||
coyoteConnector.invalidEncoding=The encoding [{0}] is not recognised by the JRE. The Connector will continue to use [{1}]
|
||||
coyoteConnector.invalidPort=The connector cannot start since the specified port value of [{0}] is invalid
|
||||
coyoteConnector.parseBodyMethodNoTrace=TRACE method MUST NOT include an entity (see RFC 2616 Section 9.6)
|
||||
coyoteConnector.protocolHandlerDestroyFailed=Protocol handler destroy failed
|
||||
coyoteConnector.protocolHandlerInitializationFailed=Protocol handler initialization failed
|
||||
coyoteConnector.protocolHandlerInstantiationFailed=Protocol handler instantiation failed
|
||||
coyoteConnector.protocolHandlerNoAprListener=The configured protocol [{0}] requires the AprLifecycleListener which is not available
|
||||
coyoteConnector.protocolHandlerNoAprLibrary=The configured protocol [{0}] requires the APR/native library which is not available
|
||||
coyoteConnector.protocolHandlerPauseFailed=Protocol handler pause failed
|
||||
coyoteConnector.protocolHandlerResumeFailed=Protocol handler resume failed
|
||||
coyoteConnector.protocolHandlerStartFailed=Protocol handler start failed
|
||||
coyoteConnector.protocolHandlerStopFailed=Protocol handler stop failed
|
||||
|
||||
coyoteInputStream.nbNotready=In non-blocking mode you may not read from the ServletInputStream until the previous read has completed and isReady() returns true
|
||||
|
||||
coyoteOutputStream.nbNotready=In non-blocking mode you may not write to the ServletOutputStream until the previous write has completed and isReady() returns true
|
||||
|
||||
coyoteRequest.alreadyAuthenticated=This request has already been authenticated
|
||||
coyoteRequest.attributeEvent=Exception thrown by attributes event listener
|
||||
coyoteRequest.authenticate.ise=Cannot call authenticate() after the response has been committed
|
||||
coyoteRequest.changeSessionId=Cannot change session ID. There is no session associated with this request.
|
||||
coyoteRequest.chunkedPostTooLarge=Parameters were not parsed because the size of the posted data was too big. Because this request was a chunked request, it could not be processed further. Use the maxPostSize attribute of the connector to resolve this if the application should accept large POSTs.
|
||||
coyoteRequest.filterAsyncSupportUnknown=Unable to determine if any filters do not support async processing
|
||||
coyoteRequest.getContextPath.ise=Unable to find match between the canonical context path [{0}] and the URI presented by the user agent [{1}]
|
||||
coyoteRequest.getInputStream.ise=getReader() has already been called for this request
|
||||
coyoteRequest.getReader.ise=getInputStream() has already been called for this request
|
||||
coyoteRequest.gssLifetimeFail=Failed to obtain remaining lifetime for user principal [{0}]
|
||||
coyoteRequest.maxPostSizeExceeded=The multi-part request contained parameter data (excluding uploaded files) that exceeded the limit for maxPostSize set on the associated connector
|
||||
coyoteRequest.noAsync=Unable to start async because the following classes in the processing chain do not support async [{0}]
|
||||
coyoteRequest.noMultipartConfig=Unable to process parts as no multi-part configuration has been provided
|
||||
coyoteRequest.parseParameters=Exception thrown whilst processing POSTed parameters
|
||||
coyoteRequest.postTooLarge=Parameters were not parsed because the size of the posted data was too big. Use the maxPostSize attribute of the connector to resolve this if the application should accept large POSTs.
|
||||
coyoteRequest.sendfileNotCanonical=Unable to determine canonical name of file [{0}] specified for use with sendfile
|
||||
coyoteRequest.sessionCreateCommitted=Cannot create a session after the response has been committed
|
||||
coyoteRequest.sessionEndAccessFail=Exception triggered ending access to session while recycling request
|
||||
coyoteRequest.setAttribute.namenull=Cannot call setAttribute with a null name
|
||||
coyoteRequest.uploadCreate=Creating the temporary upload location [{0}] as it is required by the servlet [{1}]
|
||||
coyoteRequest.uploadCreateFail=Failed to create the upload location [{0}]
|
||||
coyoteRequest.uploadLocationInvalid=The temporary upload location [{0}] is not valid
|
||||
|
||||
coyoteResponse.encoding.invalid=The encoding [{0}] is not recognised by the JRE
|
||||
coyoteResponse.getOutputStream.ise=getWriter() has already been called for this response
|
||||
coyoteResponse.getWriter.ise=getOutputStream() has already been called for this response
|
||||
coyoteResponse.reset.ise=Cannot call reset() after response has been committed
|
||||
coyoteResponse.resetBuffer.ise=Cannot reset buffer after response has been committed
|
||||
coyoteResponse.sendError.ise=Cannot call sendError() after the response has been committed
|
||||
coyoteResponse.sendRedirect.ise=Cannot call sendRedirect() after the response has been committed
|
||||
coyoteResponse.sendRedirect.note=<html><body><p>Redirecting to <a href="{0}">{0}</a></p></body></html>
|
||||
coyoteResponse.setBufferSize.ise=Cannot change buffer size after data has been written
|
||||
|
||||
inputBuffer.requiresNonBlocking=Not available in non blocking mode
|
||||
inputBuffer.streamClosed=Stream closed
|
||||
|
||||
outputBuffer.writeNull=The String argument to write(String,int,int) may not be null
|
||||
|
||||
request.asyncNotSupported=A filter or servlet of the current chain does not support asynchronous operations.
|
||||
request.fragmentInDispatchPath=The fragment in dispatch path [{0}] has been removed
|
||||
request.illegalWrap=The request wrapper must wrap the request obtained from getRequest()
|
||||
request.notAsync=It is illegal to call this method if the current request is not in asynchronous mode (i.e. isAsyncStarted() returns false)
|
||||
|
||||
requestFacade.nullRequest=The request object has been recycled and is no longer associated with this facade
|
||||
|
||||
response.illegalWrap=The response wrapper must wrap the response obtained from getResponse()
|
||||
response.sendRedirectFail=Failed to redirect to [{0}]
|
||||
|
||||
responseFacade.nullResponse=The response object has been recycled and is no longer associated with this facade
|
||||
@@ -0,0 +1,26 @@
|
||||
# Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
# contributor license agreements. See the NOTICE file distributed with
|
||||
# this work for additional information regarding copyright ownership.
|
||||
# The ASF licenses this file to You 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
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# 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.
|
||||
|
||||
coyoteAdapter.checkRecycled.response=Eine nicht recycelte Antwort wurde erkannt und recylet
|
||||
coyoteAdapter.debug=Die Variable [{0}] hat den Wert [{1}]
|
||||
|
||||
coyoteConnector.invalidEncoding=Das Encoding [{0}] wird von der JRE nicht erkannt. Der Konnektor wird weiterhin [{1}] nutzen
|
||||
coyoteConnector.invalidPort=Der Konnektor kann nicht starten, da der als Port angegebene Wert [{0}] nicht gültig ist.
|
||||
coyoteConnector.protocolHandlerStartFailed=Der Start des Protokoll-Handlers ist fehlgeschlagen
|
||||
|
||||
coyoteRequest.filterAsyncSupportUnknown=Es konnte nicht ermittelt werden ob einer der Filter asyncrone Bearbeitung nicht unterstützt
|
||||
coyoteRequest.gssLifetimeFail=Die verbleibende Lebenzeit für den Principal [{0}] konnte nicht ermittelt werden.
|
||||
|
||||
responseFacade.nullResponse=Das Response Objekt ist wiederverwendet worden und nicht mehr mit der Facade verknüpft.
|
||||
@@ -0,0 +1,62 @@
|
||||
# Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
# contributor license agreements. See the NOTICE file distributed with
|
||||
# this work for additional information regarding copyright ownership.
|
||||
# The ASF licenses this file to You 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
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# 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.
|
||||
|
||||
coyoteAdapter.accesslogFail=Excepción al intentar añadir una entrada al historial de acceso
|
||||
coyoteAdapter.checkRecycled.response=Se encontró una respuesta no reciclable y se crecicló a la fuerza
|
||||
coyoteAdapter.debug=La variable [{0}] tiene el valor [{1}]
|
||||
|
||||
coyoteConnector.invalidEncoding=La codificación [{0}] no esta reconocida por JRE. El conector continuará usando [{1}]\n
|
||||
coyoteConnector.invalidPort=El conector no puede inciar debido a que el valor del puerto especificado [{0}] no es válido
|
||||
coyoteConnector.parseBodyMethodNoTrace=El método TRACE NO DEBE DE incluir una entidad (vea RFC 2616 Sección 9.6)
|
||||
coyoteConnector.protocolHandlerDestroyFailed=Falló la destrucción del manejador de protocolo
|
||||
coyoteConnector.protocolHandlerInitializationFailed=Falló la inicialización del manejador de protocolo
|
||||
coyoteConnector.protocolHandlerInstantiationFailed=Falló la instanciación del manejador de protocolo
|
||||
coyoteConnector.protocolHandlerPauseFailed=Ha fallado la pausa del manejador de protocolo
|
||||
coyoteConnector.protocolHandlerResumeFailed=Ha fallado el rearranque del manejador de protocolo
|
||||
coyoteConnector.protocolHandlerStartFailed=Falló el arranque del manejador de protocolo
|
||||
coyoteConnector.protocolHandlerStopFailed=Ocurrió un fallo al detener el manejador del protocolo
|
||||
|
||||
coyoteInputStream.nbNotready=En modo non-blocking usted no puede leer desde ServletInputStream hasta que la lectura previa haya sido completada y isReady() devuelva verdadero
|
||||
|
||||
coyoteRequest.alreadyAuthenticated=Este requerimiento ya ha sido autenticado
|
||||
coyoteRequest.attributeEvent=Excepción lanzada mediante el escuchador de eventos de atributos
|
||||
coyoteRequest.authenticate.ise=No puedo llamar a authenticate() tras haberse acometido la respuesta
|
||||
coyoteRequest.changeSessionId=No se puede cambiar el ID de sesión. No hay sesión asociada con esta solicitud
|
||||
coyoteRequest.chunkedPostTooLarge=No se han analizado los parámetros porque la medida de los datos enviados meiante "post" era demasiado grande. Debido a que este requerimiento es una parte del original, no puede ser procesado. Utiliza el atributo "maxPostSize" del conector para resolver esta situación, en caso de que la aplicación deba de aceptar POSTs mayores.
|
||||
coyoteRequest.filterAsyncSupportUnknown=Imposible determinar si algún filtro no soporta procesamiento asincrónico
|
||||
coyoteRequest.getInputStream.ise=getReader() ya ha sido llamado para este requerimiento
|
||||
coyoteRequest.getReader.ise=getInputStream() ya ha sido llamado para este requerimiento
|
||||
coyoteRequest.gssLifetimeFail=Fallo al obtener el tiempo de vida restante para el usuario principal [{0}]\n
|
||||
coyoteRequest.noMultipartConfig=Imposible procesar partes debido a que se ha proveído una configuración no multipartes
|
||||
coyoteRequest.parseParameters=Excepción lanzada al procesar parámetros POST
|
||||
coyoteRequest.postTooLarge=No se analizaron los parámetros porque la medida de los datos enviados era demasiado grande. Usa el atributo maxPostSize del conector para resolver esto en caso de que la aplicación debiera de aceptar POSTs más grandes.
|
||||
coyoteRequest.sendfileNotCanonical=Incapaz de determinar el nombre canónico del archivo [{0}] especificado para ser usado con sendfile
|
||||
coyoteRequest.sessionCreateCommitted=No puedo crear una sesión después de llevar a cabo la respueta
|
||||
coyoteRequest.sessionEndAccessFail=Excepción disparada acabando acceso a sesión mientras se reciclaba el requerimiento
|
||||
coyoteRequest.setAttribute.namenull=No pudeo llamar a setAttribute con un nombre nulo
|
||||
coyoteRequest.uploadLocationInvalid=No es válida la localización [{0}] de carga temporal
|
||||
|
||||
coyoteResponse.getOutputStream.ise=getWriter() ya ha sido llamado para esta respuesta
|
||||
coyoteResponse.getWriter.ise=getOutputStream() ya ha sido llamado para esta respuesta
|
||||
coyoteResponse.resetBuffer.ise=No puedo limpiar el búfer después de que la respuesta ha sido llevada a cabo
|
||||
coyoteResponse.sendError.ise=No puedo llamar a sendError() tras llevar a cabo la respuesta
|
||||
coyoteResponse.sendRedirect.ise=No puedo llamar a sendRedirect() tras llevar a cabo la respuesta
|
||||
coyoteResponse.setBufferSize.ise=No puedo cambiar la medida del búfer tras escribir los datos
|
||||
|
||||
inputBuffer.streamClosed=Flujo cerrado
|
||||
|
||||
requestFacade.nullRequest=El objeto de requerimiento ha sido reciclado y ya no está asociado con esta fachada
|
||||
|
||||
responseFacade.nullResponse=El objeto de respuesta ha sido reciclado y ya no está asociado con esta fachada
|
||||
@@ -0,0 +1,90 @@
|
||||
# Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
# contributor license agreements. See the NOTICE file distributed with
|
||||
# this work for additional information regarding copyright ownership.
|
||||
# The ASF licenses this file to You 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
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# 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.
|
||||
|
||||
coyoteAdapter.accesslogFail=Exception lors d'une tentative d'ajout d'une entrée au journal d'accès (access log)
|
||||
coyoteAdapter.asyncDispatch=Exception lors du traitement d'une requête asynchrone
|
||||
coyoteAdapter.authenticate=L''utilisateur authentifié [{0}] a été fourni par le connecteur
|
||||
coyoteAdapter.authorize=Autorisation de l''utilisateur [{0}] en utilisant le Realm de Tomcat
|
||||
coyoteAdapter.checkRecycled.request=Trouvé une requête non recyclée dont le recyclage a été forcé
|
||||
coyoteAdapter.checkRecycled.response=Trouvé une réponse non recyclée, et forcé son recyclage
|
||||
coyoteAdapter.debug=La variable [{0}] a la valeur [{1}]
|
||||
coyoteAdapter.nullRequest=Un dispatch asynchrone peut seulement se produire sur une requête existante
|
||||
|
||||
coyoteConnector.invalidEncoding=L''encodage [{0}] n''est pas reconnu par la JRE. Le connecteur (Connector) continuera à utiliser [{1}]
|
||||
coyoteConnector.invalidPort=Le connecteur ne peut pas démarrer, parce que la valeur spécifiée du port [{0}] n''est pas valide
|
||||
coyoteConnector.parseBodyMethodNoTrace=La méthode "TRACE" NE PEUT PAS contenir une entité (voir RFC 2616 Section 9.6)
|
||||
coyoteConnector.protocolHandlerDestroyFailed=La destruction du gestionnaire de protocole a échoué
|
||||
coyoteConnector.protocolHandlerInitializationFailed=L'initialisation du gestionnaire de protocole a échoué
|
||||
coyoteConnector.protocolHandlerInstantiationFailed=L'instantiation du gestionnaire de protocole a échoué
|
||||
coyoteConnector.protocolHandlerNoAprLibrary=Le protocole configuré [{0}] requiert la librairie APR/native qui n''est pas disponible
|
||||
coyoteConnector.protocolHandlerNoAprListener=Le protocole configuré [{0}] requiert AprLifecycleListener qui n''est pas disponible
|
||||
coyoteConnector.protocolHandlerPauseFailed=La suspension du gestionnaire de protocole a échouée
|
||||
coyoteConnector.protocolHandlerResumeFailed=Le redémarrage du gestionnaire de protocole a échoué
|
||||
coyoteConnector.protocolHandlerStartFailed=Le démarrage du gestionnaire de protocole a échoué
|
||||
coyoteConnector.protocolHandlerStopFailed=L'arrêt du gestionnaire de protocole a échoué
|
||||
|
||||
coyoteInputStream.nbNotready=En mode non-bloquant, vous ne pouvez pas lire du ServletInputStream tant que la lecture précédente n'est pas terminée et isReady() renvoie "true"
|
||||
|
||||
coyoteOutputStream.nbNotready=En mode non bloquant, vous ne devez pas écrire sur la ServletOutputStream avant que l'écriture précédente ne soit terminée et que isReady() ne renvoie true
|
||||
|
||||
coyoteRequest.alreadyAuthenticated=Cette requête a déjà été authentifiée
|
||||
coyoteRequest.attributeEvent=Une exception a été lancée par l'instance d'écoute pour l'évènement attributs (attributes)
|
||||
coyoteRequest.authenticate.ise=Impossible d'appeler authenticate() après le début de l'envoi de la réponse
|
||||
coyoteRequest.changeSessionId=Impossible de changer l'id de la session, il n'y a pas de session associée à cette requête
|
||||
coyoteRequest.chunkedPostTooLarge=Les paramètres n'ont pas été traités parce que la taille des données du POST étaient trop grandes; comme cette requête utilisait le découpage par morceaux (chunking), le traitement est arrêté; utiliser l'attribut maxPostSize du connecteur pour résoudre ce problème si l'application devrait accepter des tailles de POST plus importantes
|
||||
coyoteRequest.filterAsyncSupportUnknown=Incapacité de déterminer si un des filtres ne supporte pas le mode asynchrone
|
||||
coyoteRequest.getContextPath.ise=Impossible de trouver une correspondance entre le chemin canonique du contexte [{0}] et l''URI envoyée par l''agent de l''utilisateur [{1}]
|
||||
coyoteRequest.getInputStream.ise="getReader()" a déjà été appelé pour cette requête
|
||||
coyoteRequest.getReader.ise="getInputStream()" a déjà été appelé pour cette requête
|
||||
coyoteRequest.gssLifetimeFail=Echec d''obtention de la durée de vie restante pour le "user principal" [{0}]
|
||||
coyoteRequest.maxPostSizeExceeded=La requête multi part contenait des données de paramètres (en excluant les fichiers envoyés) dont la taille a excédé la limite maxPostSize fixée sur le connecteur associé
|
||||
coyoteRequest.noAsync=Impossible de démarrer le mode asynchrone car les classes [{0}] de la chaîne de traitement ne le supportent pas
|
||||
coyoteRequest.noMultipartConfig=Impossible de traiter des parties, parce qu'aucune configuration multi-parties n'a été fournie
|
||||
coyoteRequest.parseParameters=Exception lors du traitement des paramètres envoyés par POST
|
||||
coyoteRequest.postTooLarge=Les paramètres n'ont pas été évalués car la taille des données postées est trop important. Utilisez l'attribut maxPostSize du connecteur pour corriger ce problème si votre application doit accepter des POSTs importants.
|
||||
coyoteRequest.sendfileNotCanonical=Impossible d''obtenir le nom canonique du fichier [{0}] qui a été donné pour le sendfile
|
||||
coyoteRequest.sessionCreateCommitted=Impossible de créer une session après que la réponse ait été envoyée
|
||||
coyoteRequest.sessionEndAccessFail=Exception lancée durant l'arrêt de l'accès à la session durant le recyclage de la requête
|
||||
coyoteRequest.setAttribute.namenull=Impossible d'appeler "setAttribute" avec un nom nul
|
||||
coyoteRequest.uploadCreate=Un répertoire temporaire [{0}] pour les fichiers envoyés sera crée car il est requis par le Servlet [{1}]
|
||||
coyoteRequest.uploadCreateFail=Echec de création du répertoire [{0}] pour les fichiers envoyés
|
||||
coyoteRequest.uploadLocationInvalid=Le répertoire temporaire [{0}] pour les envois de fichier est invalide
|
||||
|
||||
coyoteResponse.encoding.invalid=L''encodage [{0}] n''est pas reconnu par le JRE
|
||||
coyoteResponse.getOutputStream.ise="getWriter()" a déjà été appelé pour cette réponse
|
||||
coyoteResponse.getWriter.ise="getOutputStream()" a déjà été appelé pour cette réponse
|
||||
coyoteResponse.reset.ise=Impossible d'appeler reset() après le début de l'envoi de la réponse
|
||||
coyoteResponse.resetBuffer.ise=Impossible de remettre à zéro le tampon après que la réponse ait été envoyée
|
||||
coyoteResponse.sendError.ise=Impossible d'appeler "sendError()" après que la réponse ait été envoyée
|
||||
coyoteResponse.sendRedirect.ise=Impossible d'appeler "sendRedirect()" après que la réponse ait été envoyée
|
||||
coyoteResponse.sendRedirect.note=<html><body><p>Redirection vers <a href="{0}">{0}</a></p></body></html>
|
||||
coyoteResponse.setBufferSize.ise=Impossible de changer la taille du tampon après que les données aient été écrites
|
||||
|
||||
inputBuffer.requiresNonBlocking=Pas disponible en mode non bloquant
|
||||
inputBuffer.streamClosed=Le flux a été fermé
|
||||
|
||||
outputBuffer.writeNull=L'argument String dans write(String, int, int) ne doit pas être null
|
||||
|
||||
request.asyncNotSupported=Un filtre ou un Servlet de la chaîne actuelle ne supporte pas le mode asynchrone
|
||||
request.fragmentInDispatchPath=Le fragment dans le chemin de dispatch [{0}] a été enlevé
|
||||
request.illegalWrap=L'enrobeur de la réponse doit enrober la requête obtenue à partir de getRequest()
|
||||
request.notAsync=Il est interdit d'appeler cette méthode si la requête actuelle n'est pas en mode asynchrone (isAsyncStarted() a renvoyé false)
|
||||
|
||||
requestFacade.nullRequest=L'objet requête a été recyclé et n'est plus associé à cette façade
|
||||
|
||||
response.illegalWrap=L'enrobeur de la réponse doit enrober la réponse obtenue à partir de getResponse()
|
||||
response.sendRedirectFail=Impossible d''envoyer une redirection vers [{0}]
|
||||
|
||||
responseFacade.nullResponse=L'objet réponse a été recyclé et n'est plus associé à cette façade
|
||||
@@ -0,0 +1,89 @@
|
||||
# Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
# contributor license agreements. See the NOTICE file distributed with
|
||||
# this work for additional information regarding copyright ownership.
|
||||
# The ASF licenses this file to You 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
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# 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.
|
||||
|
||||
coyoteAdapter.accesslogFail=アクセスログにエントリを追加する際の例外
|
||||
coyoteAdapter.asyncDispatch=非同期リクエストの処理中の例外
|
||||
coyoteAdapter.authenticate=コネクターから認証済みユーザー [{0}] を取得しました。
|
||||
coyoteAdapter.authorize=Tomcat のRealmでユーザー [{0}] を認証します。
|
||||
coyoteAdapter.checkRecycled.request=リサイクルされていないリクエストに遭遇しました。強制的にリサイクルしました。
|
||||
coyoteAdapter.checkRecycled.response=リサイクルされていないレスポンスが発生、強制的にリサイクルされました。
|
||||
coyoteAdapter.debug=変数[{0}]に値[{1}]があります
|
||||
coyoteAdapter.nullRequest=非同期ディスパッチは、既存のリクエストでのみ発生する可能性があります
|
||||
|
||||
coyoteConnector.invalidEncoding=[{0}] は JRE の理解できない符号化方式です。Connector は [{1}] で処理を続行します。
|
||||
coyoteConnector.invalidPort=[{0}]の指定されたポート値が無効であるため、コネクタを開始できません
|
||||
coyoteConnector.parseBodyMethodNoTrace=TRACE メソッドのリクエストはエンティティを含めることはできません (RFC 2616 の 9.6 節を参照)。
|
||||
coyoteConnector.protocolHandlerDestroyFailed=プロトコルハンドラの廃棄に失敗しました
|
||||
coyoteConnector.protocolHandlerInitializationFailed=プロトコルハンドラの初期化に失敗しました
|
||||
coyoteConnector.protocolHandlerInstantiationFailed=プロトコルハンドラのインスタンス化に失敗しました
|
||||
coyoteConnector.protocolHandlerNoAprLibrary=構成されたプロトコル[{0}]には使用できないAPR/nativeライブラリが必要です。
|
||||
coyoteConnector.protocolHandlerNoAprListener=構成されたプロトコル[{0}]には、使用できないAprLifecycleListenerが必要です。
|
||||
coyoteConnector.protocolHandlerPauseFailed=プロトコルハンドラの一時停止に失敗しました
|
||||
coyoteConnector.protocolHandlerResumeFailed=プロトコルハンドラの再開に失敗しました
|
||||
coyoteConnector.protocolHandlerStartFailed=プロトコルハンドラの起動に失敗しました
|
||||
coyoteConnector.protocolHandlerStopFailed=プロトコルハンドラの停止に失敗しました。
|
||||
|
||||
coyoteInputStream.nbNotready=ノンブロッキングモードでは、以前の読み取りが完了して isReady() が true を返すまで、ServletInputStream から読み取りできません。
|
||||
|
||||
coyoteOutputStream.nbNotready=ノンブロッキングモードでは直前の書き込みが完了し isReady() が true を返すまで ServletOutputStream への書き込みはできません。
|
||||
|
||||
coyoteRequest.alreadyAuthenticated=認証済みのリクエストです。
|
||||
coyoteRequest.attributeEvent=属性イベントリスナによって例外が投げられました
|
||||
coyoteRequest.authenticate.ise=レスポンスをコミットした後は authenticate() を呼び出すことはできません。
|
||||
coyoteRequest.changeSessionId=セッション ID は変更できません。リクエストに関連付けられたセッションがありません。
|
||||
coyoteRequest.chunkedPostTooLarge=POST データが大きすぎるためパラメーターを解析しませんでした。リクエストはチャンク化されているため、処理を継続できません。アプリケーションが大きな POST データを受信する必要があるなら、Connector 要素の maxPostSize 属性を変更してください。
|
||||
coyoteRequest.filterAsyncSupportUnknown=非同期処理をサポートしていないFilterがあるかどうかを判断できません
|
||||
coyoteRequest.getContextPath.ise=標準的なコンテキストパス[{0}]とユーザーエージェント[{1}]によって提示されたURIとの一致が見つかりません。
|
||||
coyoteRequest.getInputStream.ise=getReader()はこのリクエストに対して既に呼び出されています
|
||||
coyoteRequest.getReader.ise=getInputStream()はこのリクエストに対して既に呼び出されています
|
||||
coyoteRequest.gssLifetimeFail=ユーザープリンシパル [{0}] の残りの寿命(秒単位) を取得できません。
|
||||
coyoteRequest.maxPostSizeExceeded=マルチパートリクエストには、関連するコネクタで設定されたmaxPostSizeの制限を超えたパラメータデータ(アップロードされたファイルを除く)が含まれていました。
|
||||
coyoteRequest.noAsync=処理チェーン内の次のクラスが非同期をサポートしていないため、非同期を開始できません。[{0}]
|
||||
coyoteRequest.noMultipartConfig=multi-part 構成が提供されていないため、partを処理することができません
|
||||
coyoteRequest.parseParameters=POST パラメーターの処理中に例外を投げました。
|
||||
coyoteRequest.postTooLarge=POSTされたデータが大きすぎたので、パラメータが構文解析できませんでした。そのアプリケーションが巨大なPOSTを受け付けねばならない場合には、これを解決するためにコネクタのmaxPostSize属性を使用してください。
|
||||
coyoteRequest.sendfileNotCanonical=sendfile に指定されたファイル [{0}] の正式名を取得できません。
|
||||
coyoteRequest.sessionCreateCommitted=レスポンスをコミットした後でセッションを作成できません
|
||||
coyoteRequest.sessionEndAccessFail=リクエストの再利用中に行ったセッションへのアクセス終了処理で例外が送出されました。
|
||||
coyoteRequest.setAttribute.namenull=setAttributeを名前を指定せずに呼び出すことはできません
|
||||
coyoteRequest.uploadCreate=サーブレット[{1}]に必要な一時アップロード場所[{0}]を作成します。
|
||||
coyoteRequest.uploadCreateFail=アップロード場所[{0}]の作成に失敗しました。
|
||||
coyoteRequest.uploadLocationInvalid=一時的なアップロード場所[{0}]は無効です
|
||||
|
||||
coyoteResponse.encoding.invalid=JRE は文字エンコーディング [{0}] を理解しません。
|
||||
coyoteResponse.getOutputStream.ise=getWriter()はこのレスポンスに対して既に呼び出されています
|
||||
coyoteResponse.getWriter.ise=getOutputStream()はこのレスポンスに対して既に呼び出されています
|
||||
coyoteResponse.reset.ise=レスポンスがコミットされた後でreset()を呼び出すことができません。
|
||||
coyoteResponse.resetBuffer.ise=レスポンスがコミットされた後でバッファをリセットすることはできません
|
||||
coyoteResponse.sendError.ise=レスポンスがコミットされた後でsendError()を呼び出すことはできません
|
||||
coyoteResponse.sendRedirect.ise=レスポンスがコミットされた後でsendRedirect()を呼び出すことはできません
|
||||
coyoteResponse.sendRedirect.note=<html> <body> <p> <a href="{0}"> {0} </a>へのリダイレクト</ p> </ body> </ html>
|
||||
coyoteResponse.setBufferSize.ise=データが既に書き込まれた後でバッファサイズを変更することはできません
|
||||
|
||||
inputBuffer.requiresNonBlocking=ノンブロッキングモードでは利用できません。
|
||||
inputBuffer.streamClosed=ストリームはクローズしています
|
||||
|
||||
outputBuffer.writeNull=write(String, int, int) メソッドの String 型の引数に null を指定できません。
|
||||
|
||||
request.asyncNotSupported=現在のチェーンのフィルタまたはサーブレットは非同期操作をサポートしていません。
|
||||
request.illegalWrap=リクエストラッパーは getRequest() で取得したリクエストをラップしなければなりません。
|
||||
request.notAsync=非同期モードではないリクエストでこのメソッドを呼び出すことはできません。(例えば isAsyncStarted() が false を返す場合)
|
||||
|
||||
requestFacade.nullRequest=リクエストオブジェクトはリサイクルされこのファサードに関連付けられなくなりました。
|
||||
|
||||
response.illegalWrap=レスポンスラッパーは、getResponse()から取得したレスポンスをラップする必要があります。
|
||||
response.sendRedirectFail=[{0}] へのリダイレクトが失敗しました。
|
||||
|
||||
responseFacade.nullResponse=レスポンスオブジェクトはすでに回収されたためこのファサードとは関連付けがありません。
|
||||
@@ -0,0 +1,90 @@
|
||||
# Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
# contributor license agreements. See the NOTICE file distributed with
|
||||
# this work for additional information regarding copyright ownership.
|
||||
# The ASF licenses this file to You 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
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# 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.
|
||||
|
||||
coyoteAdapter.accesslogFail=접근 로그에 엔트리를 추가하기 위한 시도 중 예외 발생
|
||||
coyoteAdapter.asyncDispatch=비동기 요청을 처리하는 중 예외 발생
|
||||
coyoteAdapter.authenticate=Connector에 의해 제공된 사용자 [{0}]을(를) 인증했습니다.
|
||||
coyoteAdapter.authorize=Tomcat의 Realm을 사용하여 사용자 [{0}]을(를) 승인 중
|
||||
coyoteAdapter.checkRecycled.request=참조 해제 되지않은 요청을 발견하여 강제로 참조 해제했습니다.
|
||||
coyoteAdapter.checkRecycled.response=참조 해제되지 않은 응답이 발견되어 강제로 참조 해제합니다.
|
||||
coyoteAdapter.debug=변수 [{0}]이(가) 값 [{1}]을(를) 가지고 있습니다.
|
||||
coyoteAdapter.nullRequest=비동기 디스패치는, 기존 요청에 대해 오직 한번만 일어나야 합니다.
|
||||
|
||||
coyoteConnector.invalidEncoding=인코딩 [{0}]은(는) JRE에 의해 인식되지 않습니다. Connector는 [{1}]을(를) 계속 사용할 것입니다.
|
||||
coyoteConnector.invalidPort=지정된 포트 번호, [{0}]이(가) 유효하지 않기 때문에, Connector가 시작될 수 없습니다.
|
||||
coyoteConnector.parseBodyMethodNoTrace=TRACE 메소드는 엔티티를 포함해서는 안됩니다. (RFC 2616 Section 9.6 참조)
|
||||
coyoteConnector.protocolHandlerDestroyFailed=프로토콜 핸들러 소멸 중 실패
|
||||
coyoteConnector.protocolHandlerInitializationFailed=프로토콜 핸들러 초기화가 실패했습니다.
|
||||
coyoteConnector.protocolHandlerInstantiationFailed=프로토콜 핸들러 인스턴스 생성에 실패했습니다.
|
||||
coyoteConnector.protocolHandlerNoAprLibrary=설정된 프로토콜 [{0}]이(가), 가용하지 않은 APR/native 라이브러리를 요구합니다.
|
||||
coyoteConnector.protocolHandlerNoAprListener=설정된 프로토콜 [{0}]이(가), 가용하지 않은 AprLifecycleListener를 요구합니다.
|
||||
coyoteConnector.protocolHandlerPauseFailed=프로토콜 핸들러에 대한 일시 정지가 실패했습니다.
|
||||
coyoteConnector.protocolHandlerResumeFailed=프로토콜 핸들러를 재개하지 못했습니다.
|
||||
coyoteConnector.protocolHandlerStartFailed=프로토콜 핸들러 시작 실패
|
||||
coyoteConnector.protocolHandlerStopFailed=프로토콜 핸들러를 중지시키지 못했습니다.
|
||||
|
||||
coyoteInputStream.nbNotready=Non-blocking 모드에서는, 이전의 데이터 읽기가 완료되고 isReady()가 true를 반환하기 전까지는, ServletInputStream으로부터 데이터를 읽을 수 없습니다.
|
||||
|
||||
coyoteOutputStream.nbNotready=Non-blocking 모드에서는, 이전의 쓰기가 완료되고 isReady()가 true를 반환할 때까지는, ServletOutputStream에 쓸 수 없습니다.
|
||||
|
||||
coyoteRequest.alreadyAuthenticated=해당 요청은 이미 인증되었습니다.
|
||||
coyoteRequest.attributeEvent=속성 이벤트 리스너에 의해 예외 발생
|
||||
coyoteRequest.authenticate.ise=응답이 커밋된 후에는 authenticate()를 호출할 수 없습니다.
|
||||
coyoteRequest.changeSessionId=세션 ID를 변경할 수 없습니다. 이 요청과 연관된 세션이 없습니다.
|
||||
coyoteRequest.chunkedPostTooLarge=포스트된 데이터의 크기가 너무 커서 파라미터들이 파싱되지 않았습니다. 이 요청은 chunked request였기 때문에 더 이상 처리될 수 없었습니다. 만일 애플리케이션이 매우 큰 포스트 데이터를 받아들여야 한다면, Connector의 maxPostSize 속성을 사용하여 이 문제를 해결하십시오.
|
||||
coyoteRequest.filterAsyncSupportUnknown=어떤 필터들이 비동기 처리를 지원하지 않는지 여부를 결정할 수 없습니다.
|
||||
coyoteRequest.getContextPath.ise=Canonical 컨텍스트 경로 [{0}]이(가), User Agent [{1}]에 의해 표시된 URI와 부합되지 않습니다.
|
||||
coyoteRequest.getInputStream.ise=이 요청에 대해 getReader()가 이미 호출되었습니다.
|
||||
coyoteRequest.getReader.ise=getInputStream()이 이미 이 요청을 위해 호출되었습니다.
|
||||
coyoteRequest.gssLifetimeFail=사용자 principal [{0}]의 남아있는 lifetime을 구하지 못했습니다.
|
||||
coyoteRequest.maxPostSizeExceeded=Multi-part 요청이, 연관된 connector에 설정된 maxPostSize의 한계치를 초과하는 파라미터 데이터(업로드된 파일들은 제외)를 포함했습니다.
|
||||
coyoteRequest.noAsync=요청 처리 체인 내의 다음 클래스들이 비동기 모드를 지원하지 않기 때문에, 비동기 모드를 시작할 수 없습니다: [{0}]
|
||||
coyoteRequest.noMultipartConfig=어떤 multi-part 설정도 제공되지 않았기 때문에, part들을 처리할 수 없습니다.
|
||||
coyoteRequest.parseParameters=포스트된 파라미터들을 처리하는 중 예외 발생
|
||||
coyoteRequest.postTooLarge=포스트된 데이터의 크기가 너무 커서, 파라미터들이 파싱되지 않았습니다. 만일 애플리케이션이 대량의 포스트 데이터를 받아들여야 하는 경우, Connector의 maxPostSize 속성을 설정하여 문제를 해결하십시오.
|
||||
coyoteRequest.sendfileNotCanonical=sendfile과 사용되도록 지정된 파일 [{0}]의 canonical 이름을 결정할 수 없습니다.
|
||||
coyoteRequest.sessionCreateCommitted=응답이 이미 커밋된 후에는, 세션을 생성할 수 없습니다.
|
||||
coyoteRequest.sessionEndAccessFail=요청을 참조 해제하는 과정에서, 세션에 대한 접근을 종료시키려 개시하는 중 예외 발생
|
||||
coyoteRequest.setAttribute.namenull=널인 이름을 사용하여 setAttribute를 호출할 수 없습니다.
|
||||
coyoteRequest.uploadCreate=서블릿 [{1}]에 의해 요구되는, 임시 업로드 폴더를 [{0}] 위치에 생성합니다.
|
||||
coyoteRequest.uploadCreateFail=[{0}]에 업로드 폴더를 생성하지 못했습니다.
|
||||
coyoteRequest.uploadLocationInvalid=임시 파일 업로드 위치 [{0}]은(는) 유효하지 않습니다.
|
||||
|
||||
coyoteResponse.encoding.invalid=인코딩 [{0}]은(는) JRE에 의해 인식되지 않는 것입니다.
|
||||
coyoteResponse.getOutputStream.ise=이 응답에 대해 getWriter()가 이미 호출되었습니다.
|
||||
coyoteResponse.getWriter.ise=이 응답을 위해 getOutputStream()이 이미 호출되었습니다.
|
||||
coyoteResponse.reset.ise=응답이 이미 커밋된 후에는, reset()을 호출할 수 없습니다.
|
||||
coyoteResponse.resetBuffer.ise=응답이 이미 커밋된 후에는, 버퍼를 재설정(reset)할 수 없습니다.
|
||||
coyoteResponse.sendError.ise=응답이 이미 커밋된 후에는 sendError()를 호출할 수 없습니다.
|
||||
coyoteResponse.sendRedirect.ise=응답이 이미 커밋된 후에는, sendRedirect()를 호출할 수 없습니다.
|
||||
coyoteResponse.sendRedirect.note=<html><body><p>Redirecting to <a href="{0}">{0}</a></p></body></html>
|
||||
coyoteResponse.setBufferSize.ise=데이터가 이미 쓰여진 후에는, 버퍼 크기를 변경할 수 없습니다.
|
||||
|
||||
inputBuffer.requiresNonBlocking=Non blocking 모드에서는 가용하지 않습니다.
|
||||
inputBuffer.streamClosed=스트림이 닫혔습니다.
|
||||
|
||||
outputBuffer.writeNull=write(String,int,int) 메소드에 전달되는 String 아규먼트는 널일 수 없습니다.
|
||||
|
||||
request.asyncNotSupported=현재 체인의 필터 또는 서블릿이, 비동기 오퍼레이션들을 지원하지 않습니다.
|
||||
request.fragmentInDispatchPath=디스패치 경로 [{0}](으)로부터 URI fragment를 제거했습니다.
|
||||
request.illegalWrap=요청 wrapper는 반드시 getRequest()로부터 얻어진 요청을 wrap해야 합니다.
|
||||
request.notAsync=만일 현재의 쓰레드가 비동기 모드에 있지 않다면, 이 메소드를 호출하는 것은 불허됩니다. (즉, isAsyncStarted()가 false를 반환하는 경우)
|
||||
|
||||
requestFacade.nullRequest=요청 객체가 이미 참조 해제 되었고, 더 이상 이 facade와 연관되지 않습니다.
|
||||
|
||||
response.illegalWrap=응답 wrapper는, 반드시 getResponse()로부터 얻어진 응답 객체를 wrap한 것이어야 합니다.
|
||||
response.sendRedirectFail=[{0}](으)로 redirect하지 못했습니다.
|
||||
|
||||
responseFacade.nullResponse=해당 응답 객체가 이미 참조 해제되었으며, 더 이상 이 ResponseFacade 객체와 연관이 없습니다.
|
||||
@@ -0,0 +1,16 @@
|
||||
# Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
# contributor license agreements. See the NOTICE file distributed with
|
||||
# this work for additional information regarding copyright ownership.
|
||||
# The ASF licenses this file to You 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
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# 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.
|
||||
|
||||
coyoteAdapter.debug=Переменная [{0}] имеет значение [{1}]
|
||||
@@ -0,0 +1,56 @@
|
||||
# Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
# contributor license agreements. See the NOTICE file distributed with
|
||||
# this work for additional information regarding copyright ownership.
|
||||
# The ASF licenses this file to You 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
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# 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.
|
||||
|
||||
coyoteAdapter.authorize=(:使用Tomcat的领域授权用户[{0}]
|
||||
coyoteAdapter.checkRecycled.response=遇到非回收的相应并强行回收。
|
||||
coyoteAdapter.debug=变量[{0}]的值为[{1}]。
|
||||
|
||||
coyoteConnector.invalidEncoding=编码 [{0}] 不能被 JRE 识别,Connector 将继续使用 [{1}]
|
||||
coyoteConnector.invalidPort=连接器不能启动,因为指定的端口 [{0}]无效
|
||||
coyoteConnector.parseBodyMethodNoTrace=方法TRACE禁止包含实体(详情查看RFC 2616 章节 9.6)
|
||||
coyoteConnector.protocolHandlerInstantiationFailed=协议处理程序实例化失败
|
||||
coyoteConnector.protocolHandlerNoAprLibrary=配置的协议[{0}]需要不可用的APR/本机库
|
||||
coyoteConnector.protocolHandlerNoAprListener=配置的协议[{0}]需要不可用的aprlifecycleListener
|
||||
coyoteConnector.protocolHandlerPauseFailed=协议处理程序暂停失败
|
||||
coyoteConnector.protocolHandlerStartFailed=协议处理器启动失败
|
||||
coyoteConnector.protocolHandlerStopFailed=协议处理程序.停止失败
|
||||
|
||||
coyoteInputStream.nbNotready=在非阻塞模式下,只有之前的读数据完成,并且isReady()方法返回true,你才可以使用 ServletInputStream 读取数据
|
||||
|
||||
coyoteRequest.attributeEvent=属性事件侦听器引发的异常
|
||||
coyoteRequest.authenticate.ise=):提交响应后无法调用authenticate()
|
||||
coyoteRequest.changeSessionId=无法更改 session ID。 没有与此请求关联的 session。
|
||||
coyoteRequest.chunkedPostTooLarge=由于请求参数数据太大,导致参数不能解析。因为当前请求是块状请求,后续也不会处理。如果应用程序需要接收大的POST请求,可以使用连接器的maxPostSize解决它。
|
||||
coyoteRequest.filterAsyncSupportUnknown=无法确定是否有任何过滤器不支持异步处理
|
||||
coyoteRequest.gssLifetimeFail=为用户主体 [{0}] 获取剩余生命期失败
|
||||
coyoteRequest.maxPostSizeExceeded=):大多部分请求包含的参数数据(不包括上载的文件)超过了关联连接器上设置的maxPostSize 的限制
|
||||
coyoteRequest.noMultipartConfig=由于没有提供multi-part配置,无法处理parts
|
||||
coyoteRequest.sendfileNotCanonical=无法确定指定用于sendfile的文件[{0}]的规范名称
|
||||
coyoteRequest.sessionCreateCommitted=提交响应后无法创建会话
|
||||
coyoteRequest.sessionEndAccessFail=在回收请求时,异常触发了对会话的结束访问。
|
||||
coyoteRequest.setAttribute.namenull=不能在一个空的名字上调用setAttribute
|
||||
coyoteRequest.uploadLocationInvalid=临时上传路径[{0}]无效
|
||||
|
||||
coyoteResponse.encoding.invalid=JRE无法识别编码[{0}]
|
||||
coyoteResponse.getWriter.ise=当前响应已经调用了方法getOutputStream()
|
||||
coyoteResponse.reset.ise=已经提交响应后无法调用reset()
|
||||
coyoteResponse.sendError.ise=响应提交后无法调用sendError()
|
||||
coyoteResponse.sendRedirect.note=<html><body><p>重定向到<a href="{0}">{0}</a></p></body></html>
|
||||
|
||||
request.asyncNotSupported=当前链的筛选器或servlet不支持异步操作。
|
||||
|
||||
requestFacade.nullRequest=请求对象已被回收,不再与此facade关联
|
||||
|
||||
responseFacade.nullResponse=响应对象已被回收,不再与此外观关联
|
||||
922
java/org/apache/catalina/connector/OutputBuffer.java
Normal file
922
java/org/apache/catalina/connector/OutputBuffer.java
Normal file
@@ -0,0 +1,922 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You 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
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
package org.apache.catalina.connector;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
import java.nio.Buffer;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.CharBuffer;
|
||||
import java.nio.charset.Charset;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedActionException;
|
||||
import java.security.PrivilegedExceptionAction;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.WriteListener;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.catalina.Globals;
|
||||
import org.apache.coyote.ActionCode;
|
||||
import org.apache.coyote.CloseNowException;
|
||||
import org.apache.coyote.Response;
|
||||
import org.apache.tomcat.util.buf.B2CConverter;
|
||||
import org.apache.tomcat.util.buf.C2BConverter;
|
||||
import org.apache.tomcat.util.res.StringManager;
|
||||
|
||||
/**
|
||||
* The buffer used by Tomcat response. This is a derivative of the Tomcat 3.3
|
||||
* OutputBuffer, with the removal of some of the state handling (which in
|
||||
* Coyote is mostly the Processor's responsibility).
|
||||
*
|
||||
* @author Costin Manolache
|
||||
* @author Remy Maucherat
|
||||
*/
|
||||
public class OutputBuffer extends Writer {
|
||||
|
||||
private static final StringManager sm = StringManager.getManager(OutputBuffer.class);
|
||||
|
||||
public static final int DEFAULT_BUFFER_SIZE = 8 * 1024;
|
||||
|
||||
/**
|
||||
* Encoder cache.
|
||||
*/
|
||||
private final Map<Charset, C2BConverter> encoders = new HashMap<>();
|
||||
|
||||
|
||||
/**
|
||||
* Default buffer size.
|
||||
*/
|
||||
private final int defaultBufferSize;
|
||||
|
||||
// ----------------------------------------------------- Instance Variables
|
||||
|
||||
/**
|
||||
* The byte buffer.
|
||||
*/
|
||||
private ByteBuffer bb;
|
||||
|
||||
|
||||
/**
|
||||
* The char buffer.
|
||||
*/
|
||||
private final CharBuffer cb;
|
||||
|
||||
|
||||
/**
|
||||
* State of the output buffer.
|
||||
*/
|
||||
private boolean initial = true;
|
||||
|
||||
|
||||
/**
|
||||
* Number of bytes written.
|
||||
*/
|
||||
private long bytesWritten = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Number of chars written.
|
||||
*/
|
||||
private long charsWritten = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Flag which indicates if the output buffer is closed.
|
||||
*/
|
||||
private volatile boolean closed = false;
|
||||
|
||||
|
||||
/**
|
||||
* Do a flush on the next operation.
|
||||
*/
|
||||
private boolean doFlush = false;
|
||||
|
||||
|
||||
/**
|
||||
* Encoding to use.
|
||||
*/
|
||||
private String enc;
|
||||
|
||||
|
||||
/**
|
||||
* Current char to byte converter.
|
||||
*/
|
||||
protected C2BConverter conv;
|
||||
|
||||
|
||||
/**
|
||||
* Associated Coyote response.
|
||||
*/
|
||||
private Response coyoteResponse;
|
||||
|
||||
|
||||
/**
|
||||
* Suspended flag. All output bytes will be swallowed if this is true.
|
||||
*/
|
||||
private volatile boolean suspended = false;
|
||||
|
||||
|
||||
// ----------------------------------------------------------- Constructors
|
||||
|
||||
|
||||
/**
|
||||
* Default constructor. Allocate the buffer with the default buffer size.
|
||||
*/
|
||||
public OutputBuffer() {
|
||||
|
||||
this(DEFAULT_BUFFER_SIZE);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Alternate constructor which allows specifying the initial buffer size.
|
||||
*
|
||||
* @param size Buffer size to use
|
||||
*/
|
||||
public OutputBuffer(int size) {
|
||||
defaultBufferSize = size;
|
||||
bb = ByteBuffer.allocate(size);
|
||||
clear(bb);
|
||||
cb = CharBuffer.allocate(size);
|
||||
clear(cb);
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------------------- Properties
|
||||
|
||||
|
||||
/**
|
||||
* Associated Coyote response.
|
||||
*
|
||||
* @param coyoteResponse Associated Coyote response
|
||||
*/
|
||||
public void setResponse(Response coyoteResponse) {
|
||||
this.coyoteResponse = coyoteResponse;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Is the response output suspended ?
|
||||
*
|
||||
* @return suspended flag value
|
||||
*/
|
||||
public boolean isSuspended() {
|
||||
return this.suspended;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the suspended flag.
|
||||
*
|
||||
* @param suspended New suspended flag value
|
||||
*/
|
||||
public void setSuspended(boolean suspended) {
|
||||
this.suspended = suspended;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Is the response output closed ?
|
||||
*
|
||||
* @return closed flag value
|
||||
*/
|
||||
public boolean isClosed() {
|
||||
return this.closed;
|
||||
}
|
||||
|
||||
|
||||
// --------------------------------------------------------- Public Methods
|
||||
|
||||
/**
|
||||
* Recycle the output buffer.
|
||||
*/
|
||||
public void recycle() {
|
||||
|
||||
initial = true;
|
||||
bytesWritten = 0;
|
||||
charsWritten = 0;
|
||||
|
||||
if (bb.capacity() > 16 * defaultBufferSize) {
|
||||
// Discard buffers which are too large
|
||||
bb = ByteBuffer.allocate(defaultBufferSize);
|
||||
}
|
||||
clear(bb);
|
||||
clear(cb);
|
||||
closed = false;
|
||||
suspended = false;
|
||||
doFlush = false;
|
||||
|
||||
if (conv != null) {
|
||||
conv.recycle();
|
||||
conv = null;
|
||||
}
|
||||
|
||||
enc = null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Close the output buffer. This tries to calculate the response size if
|
||||
* the response has not been committed yet.
|
||||
*
|
||||
* @throws IOException An underlying IOException occurred
|
||||
*/
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
|
||||
if (closed) {
|
||||
return;
|
||||
}
|
||||
if (suspended) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If there are chars, flush all of them to the byte buffer now as bytes are used to
|
||||
// calculate the content-length (if everything fits into the byte buffer, of course).
|
||||
if (cb.remaining() > 0) {
|
||||
flushCharBuffer();
|
||||
}
|
||||
|
||||
if ((!coyoteResponse.isCommitted()) && (coyoteResponse.getContentLengthLong() == -1)
|
||||
&& !coyoteResponse.getRequest().method().equals("HEAD")) {
|
||||
// If this didn't cause a commit of the response, the final content
|
||||
// length can be calculated. Only do this if this is not a HEAD
|
||||
// request since in that case no body should have been written and
|
||||
// setting a value of zero here will result in an explicit content
|
||||
// length of zero being set on the response.
|
||||
if (!coyoteResponse.isCommitted()) {
|
||||
coyoteResponse.setContentLength(bb.remaining());
|
||||
}
|
||||
}
|
||||
|
||||
if (coyoteResponse.getStatus() == HttpServletResponse.SC_SWITCHING_PROTOCOLS) {
|
||||
doFlush(true);
|
||||
} else {
|
||||
doFlush(false);
|
||||
}
|
||||
closed = true;
|
||||
|
||||
// The request should have been completely read by the time the response
|
||||
// is closed. Further reads of the input a) are pointless and b) really
|
||||
// confuse AJP (bug 50189) so close the input buffer to prevent them.
|
||||
Request req = (Request) coyoteResponse.getRequest().getNote(CoyoteAdapter.ADAPTER_NOTES);
|
||||
req.inputBuffer.close();
|
||||
|
||||
coyoteResponse.action(ActionCode.CLOSE, null);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Flush bytes or chars contained in the buffer.
|
||||
*
|
||||
* @throws IOException An underlying IOException occurred
|
||||
*/
|
||||
@Override
|
||||
public void flush() throws IOException {
|
||||
doFlush(true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Flush bytes or chars contained in the buffer.
|
||||
*
|
||||
* @param realFlush <code>true</code> if this should also cause a real network flush
|
||||
* @throws IOException An underlying IOException occurred
|
||||
*/
|
||||
protected void doFlush(boolean realFlush) throws IOException {
|
||||
|
||||
if (suspended) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
doFlush = true;
|
||||
if (initial) {
|
||||
coyoteResponse.sendHeaders();
|
||||
initial = false;
|
||||
}
|
||||
if (cb.remaining() > 0) {
|
||||
flushCharBuffer();
|
||||
}
|
||||
if (bb.remaining() > 0) {
|
||||
flushByteBuffer();
|
||||
}
|
||||
} finally {
|
||||
doFlush = false;
|
||||
}
|
||||
|
||||
if (realFlush) {
|
||||
coyoteResponse.action(ActionCode.CLIENT_FLUSH, null);
|
||||
// If some exception occurred earlier, or if some IOE occurred
|
||||
// here, notify the servlet with an IOE
|
||||
if (coyoteResponse.isExceptionPresent()) {
|
||||
throw new ClientAbortException(coyoteResponse.getErrorException());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------- Bytes Handling Methods
|
||||
|
||||
/**
|
||||
* Sends the buffer data to the client output, checking the
|
||||
* state of Response and calling the right interceptors.
|
||||
*
|
||||
* @param buf the ByteBuffer to be written to the response
|
||||
*
|
||||
* @throws IOException An underlying IOException occurred
|
||||
*/
|
||||
public void realWriteBytes(ByteBuffer buf) throws IOException {
|
||||
|
||||
if (closed) {
|
||||
return;
|
||||
}
|
||||
if (coyoteResponse == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If we really have something to write
|
||||
if (buf.remaining() > 0) {
|
||||
// real write to the adapter
|
||||
try {
|
||||
coyoteResponse.doWrite(buf);
|
||||
} catch (CloseNowException e) {
|
||||
// Catch this sub-class as it requires specific handling.
|
||||
// Examples where this exception is thrown:
|
||||
// - HTTP/2 stream timeout
|
||||
// Prevent further output for this response
|
||||
closed = true;
|
||||
throw e;
|
||||
} catch (IOException e) {
|
||||
// An IOException on a write is almost always due to
|
||||
// the remote client aborting the request. Wrap this
|
||||
// so that it can be handled better by the error dispatcher.
|
||||
throw new ClientAbortException(e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void write(byte b[], int off, int len) throws IOException {
|
||||
|
||||
if (suspended) {
|
||||
return;
|
||||
}
|
||||
|
||||
writeBytes(b, off, len);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void write(ByteBuffer from) throws IOException {
|
||||
|
||||
if (suspended) {
|
||||
return;
|
||||
}
|
||||
|
||||
writeBytes(from);
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void writeBytes(byte b[], int off, int len) throws IOException {
|
||||
|
||||
if (closed) {
|
||||
return;
|
||||
}
|
||||
|
||||
append(b, off, len);
|
||||
bytesWritten += len;
|
||||
|
||||
// if called from within flush(), then immediately flush
|
||||
// remaining bytes
|
||||
if (doFlush) {
|
||||
flushByteBuffer();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void writeBytes(ByteBuffer from) throws IOException {
|
||||
|
||||
if (closed) {
|
||||
return;
|
||||
}
|
||||
|
||||
append(from);
|
||||
bytesWritten += from.remaining();
|
||||
|
||||
// if called from within flush(), then immediately flush
|
||||
// remaining bytes
|
||||
if (doFlush) {
|
||||
flushByteBuffer();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void writeByte(int b) throws IOException {
|
||||
|
||||
if (suspended) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (isFull(bb)) {
|
||||
flushByteBuffer();
|
||||
}
|
||||
|
||||
transfer((byte) b, bb);
|
||||
bytesWritten++;
|
||||
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------- Chars Handling Methods
|
||||
|
||||
|
||||
/**
|
||||
* Convert the chars to bytes, then send the data to the client.
|
||||
*
|
||||
* @param from Char buffer to be written to the response
|
||||
*
|
||||
* @throws IOException An underlying IOException occurred
|
||||
*/
|
||||
public void realWriteChars(CharBuffer from) throws IOException {
|
||||
|
||||
while (from.remaining() > 0) {
|
||||
conv.convert(from, bb);
|
||||
if (bb.remaining() == 0) {
|
||||
// Break out of the loop if more chars are needed to produce any output
|
||||
break;
|
||||
}
|
||||
if (from.remaining() > 0) {
|
||||
flushByteBuffer();
|
||||
} else if (conv.isUndeflow() && bb.limit() > bb.capacity() - 4) {
|
||||
// Handle an edge case. There are no more chars to write at the
|
||||
// moment but there is a leftover character in the converter
|
||||
// which must be part of a surrogate pair. The byte buffer does
|
||||
// not have enough space left to output the bytes for this pair
|
||||
// once it is complete )it will require 4 bytes) so flush now to
|
||||
// prevent the bytes for the leftover char and the rest of the
|
||||
// surrogate pair yet to be written from being lost.
|
||||
// See TestOutputBuffer#testUtf8SurrogateBody()
|
||||
flushByteBuffer();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(int c) throws IOException {
|
||||
|
||||
if (suspended) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (isFull(cb)) {
|
||||
flushCharBuffer();
|
||||
}
|
||||
|
||||
transfer((char) c, cb);
|
||||
charsWritten++;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void write(char c[]) throws IOException {
|
||||
|
||||
if (suspended) {
|
||||
return;
|
||||
}
|
||||
|
||||
write(c, 0, c.length);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void write(char c[], int off, int len) throws IOException {
|
||||
|
||||
if (suspended) {
|
||||
return;
|
||||
}
|
||||
|
||||
append(c, off, len);
|
||||
charsWritten += len;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Append a string to the buffer
|
||||
*/
|
||||
@Override
|
||||
public void write(String s, int off, int len) throws IOException {
|
||||
|
||||
if (suspended) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (s == null) {
|
||||
throw new NullPointerException(sm.getString("outputBuffer.writeNull"));
|
||||
}
|
||||
|
||||
int sOff = off;
|
||||
int sEnd = off + len;
|
||||
while (sOff < sEnd) {
|
||||
int n = transfer(s, sOff, sEnd - sOff, cb);
|
||||
sOff += n;
|
||||
if (isFull(cb)) {
|
||||
flushCharBuffer();
|
||||
}
|
||||
}
|
||||
|
||||
charsWritten += len;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void write(String s) throws IOException {
|
||||
|
||||
if (suspended) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (s == null) {
|
||||
s = "null";
|
||||
}
|
||||
write(s, 0, s.length());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param s New encoding value
|
||||
*
|
||||
* @deprecated This method will be removed in Tomcat 9.0.x
|
||||
*/
|
||||
@Deprecated
|
||||
public void setEncoding(String s) {
|
||||
enc = s;
|
||||
}
|
||||
|
||||
|
||||
public void checkConverter() throws IOException {
|
||||
if (conv != null) {
|
||||
return;
|
||||
}
|
||||
|
||||
Charset charset = null;
|
||||
|
||||
if (coyoteResponse != null) {
|
||||
charset = coyoteResponse.getCharset();
|
||||
}
|
||||
|
||||
if (charset == null) {
|
||||
if (enc == null) {
|
||||
charset = org.apache.coyote.Constants.DEFAULT_BODY_CHARSET;
|
||||
} else {
|
||||
charset = getCharset(enc);
|
||||
}
|
||||
}
|
||||
|
||||
conv = encoders.get(charset);
|
||||
|
||||
if (conv == null) {
|
||||
conv = createConverter(charset);
|
||||
encoders.put(charset, conv);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static Charset getCharset(final String encoding) throws IOException {
|
||||
if (Globals.IS_SECURITY_ENABLED) {
|
||||
try {
|
||||
return AccessController.doPrivileged(new PrivilegedExceptionAction<Charset>() {
|
||||
@Override
|
||||
public Charset run() throws IOException {
|
||||
return B2CConverter.getCharset(encoding);
|
||||
}
|
||||
});
|
||||
} catch (PrivilegedActionException ex) {
|
||||
Exception e = ex.getException();
|
||||
if (e instanceof IOException) {
|
||||
throw (IOException) e;
|
||||
} else {
|
||||
throw new IOException(ex);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return B2CConverter.getCharset(encoding);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static C2BConverter createConverter(final Charset charset) throws IOException {
|
||||
if (Globals.IS_SECURITY_ENABLED) {
|
||||
try {
|
||||
return AccessController.doPrivileged(new PrivilegedExceptionAction<C2BConverter>() {
|
||||
@Override
|
||||
public C2BConverter run() throws IOException {
|
||||
return new C2BConverter(charset);
|
||||
}
|
||||
});
|
||||
} catch (PrivilegedActionException ex) {
|
||||
Exception e = ex.getException();
|
||||
if (e instanceof IOException) {
|
||||
throw (IOException) e;
|
||||
} else {
|
||||
throw new IOException(ex);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return new C2BConverter(charset);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// -------------------- BufferedOutputStream compatibility
|
||||
|
||||
public long getContentWritten() {
|
||||
return bytesWritten + charsWritten;
|
||||
}
|
||||
|
||||
/**
|
||||
* Has this buffer been used at all?
|
||||
*
|
||||
* @return true if no chars or bytes have been added to the buffer since the
|
||||
* last call to {@link #recycle()}
|
||||
*/
|
||||
public boolean isNew() {
|
||||
return (bytesWritten == 0) && (charsWritten == 0);
|
||||
}
|
||||
|
||||
|
||||
public void setBufferSize(int size) {
|
||||
if (size > bb.capacity()) {
|
||||
bb = ByteBuffer.allocate(size);
|
||||
clear(bb);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void reset() {
|
||||
reset(false);
|
||||
}
|
||||
|
||||
public void reset(boolean resetWriterStreamFlags) {
|
||||
clear(bb);
|
||||
clear(cb);
|
||||
bytesWritten = 0;
|
||||
charsWritten = 0;
|
||||
if (resetWriterStreamFlags) {
|
||||
if (conv != null) {
|
||||
conv.recycle();
|
||||
}
|
||||
conv = null;
|
||||
enc = null;
|
||||
}
|
||||
initial = true;
|
||||
}
|
||||
|
||||
|
||||
public int getBufferSize() {
|
||||
return bb.capacity();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* All the non-blocking write state information is held in the Response so
|
||||
* it is visible / accessible to all the code that needs it.
|
||||
*/
|
||||
|
||||
public boolean isReady() {
|
||||
return coyoteResponse.isReady();
|
||||
}
|
||||
|
||||
|
||||
public void setWriteListener(WriteListener listener) {
|
||||
coyoteResponse.setWriteListener(listener);
|
||||
}
|
||||
|
||||
|
||||
public boolean isBlocking() {
|
||||
return coyoteResponse.getWriteListener() == null;
|
||||
}
|
||||
|
||||
public void checkRegisterForWrite() {
|
||||
coyoteResponse.checkRegisterForWrite();
|
||||
}
|
||||
|
||||
/**
|
||||
* Add data to the buffer.
|
||||
*
|
||||
* @param src Bytes array
|
||||
* @param off Offset
|
||||
* @param len Length
|
||||
* @throws IOException Writing overflow data to the output channel failed
|
||||
*/
|
||||
public void append(byte src[], int off, int len) throws IOException {
|
||||
if (bb.remaining() == 0) {
|
||||
appendByteArray(src, off, len);
|
||||
} else {
|
||||
int n = transfer(src, off, len, bb);
|
||||
len = len - n;
|
||||
off = off + n;
|
||||
if (isFull(bb)) {
|
||||
flushByteBuffer();
|
||||
appendByteArray(src, off, len);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add data to the buffer.
|
||||
* @param src Char array
|
||||
* @param off Offset
|
||||
* @param len Length
|
||||
* @throws IOException Writing overflow data to the output channel failed
|
||||
*/
|
||||
public void append(char src[], int off, int len) throws IOException {
|
||||
// if we have limit and we're below
|
||||
if(len <= cb.capacity() - cb.limit()) {
|
||||
transfer(src, off, len, cb);
|
||||
return;
|
||||
}
|
||||
|
||||
// Optimization:
|
||||
// If len-avail < length ( i.e. after we fill the buffer with
|
||||
// what we can, the remaining will fit in the buffer ) we'll just
|
||||
// copy the first part, flush, then copy the second part - 1 write
|
||||
// and still have some space for more. We'll still have 2 writes, but
|
||||
// we write more on the first.
|
||||
if(len + cb.limit() < 2 * cb.capacity()) {
|
||||
/* If the request length exceeds the size of the output buffer,
|
||||
flush the output buffer and then write the data directly.
|
||||
We can't avoid 2 writes, but we can write more on the second
|
||||
*/
|
||||
int n = transfer(src, off, len, cb);
|
||||
|
||||
flushCharBuffer();
|
||||
|
||||
transfer(src, off + n, len - n, cb);
|
||||
} else {
|
||||
// long write - flush the buffer and write the rest
|
||||
// directly from source
|
||||
flushCharBuffer();
|
||||
|
||||
realWriteChars(CharBuffer.wrap(src, off, len));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void append(ByteBuffer from) throws IOException {
|
||||
if (bb.remaining() == 0) {
|
||||
appendByteBuffer(from);
|
||||
} else {
|
||||
transfer(from, bb);
|
||||
if (isFull(bb)) {
|
||||
flushByteBuffer();
|
||||
appendByteBuffer(from);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void appendByteArray(byte src[], int off, int len) throws IOException {
|
||||
if (len == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
int limit = bb.capacity();
|
||||
while (len >= limit) {
|
||||
realWriteBytes(ByteBuffer.wrap(src, off, limit));
|
||||
len = len - limit;
|
||||
off = off + limit;
|
||||
}
|
||||
|
||||
if (len > 0) {
|
||||
transfer(src, off, len, bb);
|
||||
}
|
||||
}
|
||||
|
||||
private void appendByteBuffer(ByteBuffer from) throws IOException {
|
||||
if (from.remaining() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
int limit = bb.capacity();
|
||||
int fromLimit = from.limit();
|
||||
while (from.remaining() >= limit) {
|
||||
from.limit(from.position() + limit);
|
||||
realWriteBytes(from.slice());
|
||||
from.position(from.limit());
|
||||
from.limit(fromLimit);
|
||||
}
|
||||
|
||||
if (from.remaining() > 0) {
|
||||
transfer(from, bb);
|
||||
}
|
||||
}
|
||||
|
||||
private void flushByteBuffer() throws IOException {
|
||||
realWriteBytes(bb.slice());
|
||||
clear(bb);
|
||||
}
|
||||
|
||||
private void flushCharBuffer() throws IOException {
|
||||
realWriteChars(cb.slice());
|
||||
clear(cb);
|
||||
}
|
||||
|
||||
private void transfer(byte b, ByteBuffer to) {
|
||||
toWriteMode(to);
|
||||
to.put(b);
|
||||
toReadMode(to);
|
||||
}
|
||||
|
||||
private void transfer(char b, CharBuffer to) {
|
||||
toWriteMode(to);
|
||||
to.put(b);
|
||||
toReadMode(to);
|
||||
}
|
||||
|
||||
private int transfer(byte[] buf, int off, int len, ByteBuffer to) {
|
||||
toWriteMode(to);
|
||||
int max = Math.min(len, to.remaining());
|
||||
if (max > 0) {
|
||||
to.put(buf, off, max);
|
||||
}
|
||||
toReadMode(to);
|
||||
return max;
|
||||
}
|
||||
|
||||
private int transfer(char[] buf, int off, int len, CharBuffer to) {
|
||||
toWriteMode(to);
|
||||
int max = Math.min(len, to.remaining());
|
||||
if (max > 0) {
|
||||
to.put(buf, off, max);
|
||||
}
|
||||
toReadMode(to);
|
||||
return max;
|
||||
}
|
||||
|
||||
private int transfer(String s, int off, int len, CharBuffer to) {
|
||||
toWriteMode(to);
|
||||
int max = Math.min(len, to.remaining());
|
||||
if (max > 0) {
|
||||
to.put(s, off, off + max);
|
||||
}
|
||||
toReadMode(to);
|
||||
return max;
|
||||
}
|
||||
|
||||
private void transfer(ByteBuffer from, ByteBuffer to) {
|
||||
toWriteMode(to);
|
||||
int max = Math.min(from.remaining(), to.remaining());
|
||||
if (max > 0) {
|
||||
int fromLimit = from.limit();
|
||||
from.limit(from.position() + max);
|
||||
to.put(from);
|
||||
from.limit(fromLimit);
|
||||
}
|
||||
toReadMode(to);
|
||||
}
|
||||
|
||||
private void clear(Buffer buffer) {
|
||||
buffer.rewind().limit(0);
|
||||
}
|
||||
|
||||
private boolean isFull(Buffer buffer) {
|
||||
return buffer.limit() == buffer.capacity();
|
||||
}
|
||||
|
||||
private void toReadMode(Buffer buffer) {
|
||||
buffer.limit(buffer.position())
|
||||
.reset();
|
||||
}
|
||||
|
||||
private void toWriteMode(Buffer buffer) {
|
||||
buffer.mark()
|
||||
.position(buffer.limit())
|
||||
.limit(buffer.capacity());
|
||||
}
|
||||
}
|
||||
3578
java/org/apache/catalina/connector/Request.java
Normal file
3578
java/org/apache/catalina/connector/Request.java
Normal file
File diff suppressed because it is too large
Load Diff
1146
java/org/apache/catalina/connector/RequestFacade.java
Normal file
1146
java/org/apache/catalina/connector/RequestFacade.java
Normal file
File diff suppressed because it is too large
Load Diff
1833
java/org/apache/catalina/connector/Response.java
Normal file
1833
java/org/apache/catalina/connector/Response.java
Normal file
File diff suppressed because it is too large
Load Diff
646
java/org/apache/catalina/connector/ResponseFacade.java
Normal file
646
java/org/apache/catalina/connector/ResponseFacade.java
Normal file
@@ -0,0 +1,646 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You 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
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
package org.apache.catalina.connector;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
import java.security.PrivilegedActionException;
|
||||
import java.security.PrivilegedExceptionAction;
|
||||
import java.util.Collection;
|
||||
import java.util.Locale;
|
||||
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.http.Cookie;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.catalina.Globals;
|
||||
import org.apache.catalina.security.SecurityUtil;
|
||||
import org.apache.tomcat.util.res.StringManager;
|
||||
|
||||
/**
|
||||
* Facade class that wraps a Coyote response object.
|
||||
* All methods are delegated to the wrapped response.
|
||||
*
|
||||
* @author Remy Maucherat
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public class ResponseFacade
|
||||
implements HttpServletResponse {
|
||||
|
||||
|
||||
// ----------------------------------------------------------- DoPrivileged
|
||||
|
||||
private final class SetContentTypePrivilegedAction
|
||||
implements PrivilegedAction<Void> {
|
||||
|
||||
private final String contentType;
|
||||
|
||||
public SetContentTypePrivilegedAction(String contentType){
|
||||
this.contentType = contentType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Void run() {
|
||||
response.setContentType(contentType);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private final class DateHeaderPrivilegedAction
|
||||
implements PrivilegedAction<Void> {
|
||||
|
||||
private final String name;
|
||||
private final long value;
|
||||
private final boolean add;
|
||||
|
||||
DateHeaderPrivilegedAction(String name, long value, boolean add) {
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
this.add = add;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Void run() {
|
||||
if(add) {
|
||||
response.addDateHeader(name, value);
|
||||
} else {
|
||||
response.setDateHeader(name, value);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------- Constructors
|
||||
|
||||
|
||||
/**
|
||||
* Construct a wrapper for the specified response.
|
||||
*
|
||||
* @param response The response to be wrapped
|
||||
*/
|
||||
public ResponseFacade(Response response) {
|
||||
|
||||
this.response = response;
|
||||
}
|
||||
|
||||
|
||||
// ----------------------------------------------- Class/Instance Variables
|
||||
|
||||
|
||||
/**
|
||||
* The string manager for this package.
|
||||
*/
|
||||
protected static final StringManager sm = StringManager.getManager(ResponseFacade.class);
|
||||
|
||||
|
||||
/**
|
||||
* The wrapped response.
|
||||
*/
|
||||
protected Response response = null;
|
||||
|
||||
|
||||
// --------------------------------------------------------- Public Methods
|
||||
|
||||
|
||||
/**
|
||||
* Clear facade.
|
||||
*/
|
||||
public void clear() {
|
||||
response = null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Prevent cloning the facade.
|
||||
*/
|
||||
@Override
|
||||
protected Object clone()
|
||||
throws CloneNotSupportedException {
|
||||
throw new CloneNotSupportedException();
|
||||
}
|
||||
|
||||
|
||||
public void finish() {
|
||||
|
||||
if (response == null) {
|
||||
throw new IllegalStateException(
|
||||
sm.getString("responseFacade.nullResponse"));
|
||||
}
|
||||
|
||||
response.setSuspended(true);
|
||||
}
|
||||
|
||||
|
||||
public boolean isFinished() {
|
||||
|
||||
if (response == null) {
|
||||
throw new IllegalStateException(
|
||||
sm.getString("responseFacade.nullResponse"));
|
||||
}
|
||||
|
||||
return response.isSuspended();
|
||||
}
|
||||
|
||||
|
||||
public long getContentWritten() {
|
||||
|
||||
if (response == null) {
|
||||
throw new IllegalStateException(
|
||||
sm.getString("responseFacade.nullResponse"));
|
||||
}
|
||||
|
||||
return response.getContentWritten();
|
||||
}
|
||||
|
||||
// ------------------------------------------------ ServletResponse Methods
|
||||
|
||||
|
||||
@Override
|
||||
public String getCharacterEncoding() {
|
||||
|
||||
if (response == null) {
|
||||
throw new IllegalStateException(
|
||||
sm.getString("responseFacade.nullResponse"));
|
||||
}
|
||||
|
||||
return response.getCharacterEncoding();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ServletOutputStream getOutputStream()
|
||||
throws IOException {
|
||||
|
||||
// if (isFinished())
|
||||
// throw new IllegalStateException
|
||||
// (/*sm.getString("responseFacade.finished")*/);
|
||||
|
||||
ServletOutputStream sos = response.getOutputStream();
|
||||
if (isFinished()) {
|
||||
response.setSuspended(true);
|
||||
}
|
||||
return sos;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public PrintWriter getWriter()
|
||||
throws IOException {
|
||||
|
||||
// if (isFinished())
|
||||
// throw new IllegalStateException
|
||||
// (/*sm.getString("responseFacade.finished")*/);
|
||||
|
||||
PrintWriter writer = response.getWriter();
|
||||
if (isFinished()) {
|
||||
response.setSuspended(true);
|
||||
}
|
||||
return writer;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setContentLength(int len) {
|
||||
|
||||
if (isCommitted()) {
|
||||
return;
|
||||
}
|
||||
|
||||
response.setContentLength(len);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setContentLengthLong(long length) {
|
||||
if (isCommitted()) {
|
||||
return;
|
||||
}
|
||||
response.setContentLengthLong(length);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setContentType(String type) {
|
||||
|
||||
if (isCommitted()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (SecurityUtil.isPackageProtectionEnabled()){
|
||||
AccessController.doPrivileged(new SetContentTypePrivilegedAction(type));
|
||||
} else {
|
||||
response.setContentType(type);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setBufferSize(int size) {
|
||||
|
||||
if (isCommitted()) {
|
||||
throw new IllegalStateException
|
||||
(sm.getString("coyoteResponse.setBufferSize.ise"));
|
||||
}
|
||||
|
||||
response.setBufferSize(size);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getBufferSize() {
|
||||
|
||||
if (response == null) {
|
||||
throw new IllegalStateException(
|
||||
sm.getString("responseFacade.nullResponse"));
|
||||
}
|
||||
|
||||
return response.getBufferSize();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void flushBuffer()
|
||||
throws IOException {
|
||||
|
||||
if (isFinished()) {
|
||||
// throw new IllegalStateException
|
||||
// (/*sm.getString("responseFacade.finished")*/);
|
||||
return;
|
||||
}
|
||||
|
||||
if (SecurityUtil.isPackageProtectionEnabled()){
|
||||
try{
|
||||
AccessController.doPrivileged(
|
||||
new PrivilegedExceptionAction<Void>(){
|
||||
|
||||
@Override
|
||||
public Void run() throws IOException{
|
||||
response.setAppCommitted(true);
|
||||
|
||||
response.flushBuffer();
|
||||
return null;
|
||||
}
|
||||
});
|
||||
} catch(PrivilegedActionException e){
|
||||
Exception ex = e.getException();
|
||||
if (ex instanceof IOException){
|
||||
throw (IOException)ex;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
response.setAppCommitted(true);
|
||||
|
||||
response.flushBuffer();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void resetBuffer() {
|
||||
|
||||
if (isCommitted()) {
|
||||
throw new IllegalStateException
|
||||
(sm.getString("coyoteResponse.resetBuffer.ise"));
|
||||
}
|
||||
|
||||
response.resetBuffer();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isCommitted() {
|
||||
|
||||
if (response == null) {
|
||||
throw new IllegalStateException(
|
||||
sm.getString("responseFacade.nullResponse"));
|
||||
}
|
||||
|
||||
return response.isAppCommitted();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
|
||||
if (isCommitted()) {
|
||||
throw new IllegalStateException
|
||||
(sm.getString("coyoteResponse.reset.ise"));
|
||||
}
|
||||
|
||||
response.reset();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setLocale(Locale loc) {
|
||||
|
||||
if (isCommitted()) {
|
||||
return;
|
||||
}
|
||||
|
||||
response.setLocale(loc);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Locale getLocale() {
|
||||
|
||||
if (response == null) {
|
||||
throw new IllegalStateException(
|
||||
sm.getString("responseFacade.nullResponse"));
|
||||
}
|
||||
|
||||
return response.getLocale();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void addCookie(Cookie cookie) {
|
||||
|
||||
if (isCommitted()) {
|
||||
return;
|
||||
}
|
||||
|
||||
response.addCookie(cookie);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean containsHeader(String name) {
|
||||
|
||||
if (response == null) {
|
||||
throw new IllegalStateException(
|
||||
sm.getString("responseFacade.nullResponse"));
|
||||
}
|
||||
|
||||
return response.containsHeader(name);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String encodeURL(String url) {
|
||||
|
||||
if (response == null) {
|
||||
throw new IllegalStateException(
|
||||
sm.getString("responseFacade.nullResponse"));
|
||||
}
|
||||
|
||||
return response.encodeURL(url);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String encodeRedirectURL(String url) {
|
||||
|
||||
if (response == null) {
|
||||
throw new IllegalStateException(
|
||||
sm.getString("responseFacade.nullResponse"));
|
||||
}
|
||||
|
||||
return response.encodeRedirectURL(url);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String encodeUrl(String url) {
|
||||
|
||||
if (response == null) {
|
||||
throw new IllegalStateException(
|
||||
sm.getString("responseFacade.nullResponse"));
|
||||
}
|
||||
|
||||
return response.encodeURL(url);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String encodeRedirectUrl(String url) {
|
||||
|
||||
if (response == null) {
|
||||
throw new IllegalStateException(
|
||||
sm.getString("responseFacade.nullResponse"));
|
||||
}
|
||||
|
||||
return response.encodeRedirectURL(url);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void sendError(int sc, String msg)
|
||||
throws IOException {
|
||||
|
||||
if (isCommitted()) {
|
||||
throw new IllegalStateException
|
||||
(sm.getString("coyoteResponse.sendError.ise"));
|
||||
}
|
||||
|
||||
response.setAppCommitted(true);
|
||||
|
||||
response.sendError(sc, msg);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void sendError(int sc)
|
||||
throws IOException {
|
||||
|
||||
if (isCommitted()) {
|
||||
throw new IllegalStateException
|
||||
(sm.getString("coyoteResponse.sendError.ise"));
|
||||
}
|
||||
|
||||
response.setAppCommitted(true);
|
||||
|
||||
response.sendError(sc);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void sendRedirect(String location)
|
||||
throws IOException {
|
||||
|
||||
if (isCommitted()) {
|
||||
throw new IllegalStateException
|
||||
(sm.getString("coyoteResponse.sendRedirect.ise"));
|
||||
}
|
||||
|
||||
response.setAppCommitted(true);
|
||||
|
||||
response.sendRedirect(location);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setDateHeader(String name, long date) {
|
||||
|
||||
if (isCommitted()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(Globals.IS_SECURITY_ENABLED) {
|
||||
AccessController.doPrivileged(new DateHeaderPrivilegedAction
|
||||
(name, date, false));
|
||||
} else {
|
||||
response.setDateHeader(name, date);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void addDateHeader(String name, long date) {
|
||||
|
||||
if (isCommitted()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(Globals.IS_SECURITY_ENABLED) {
|
||||
AccessController.doPrivileged(new DateHeaderPrivilegedAction
|
||||
(name, date, true));
|
||||
} else {
|
||||
response.addDateHeader(name, date);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setHeader(String name, String value) {
|
||||
|
||||
if (isCommitted()) {
|
||||
return;
|
||||
}
|
||||
|
||||
response.setHeader(name, value);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void addHeader(String name, String value) {
|
||||
|
||||
if (isCommitted()) {
|
||||
return;
|
||||
}
|
||||
|
||||
response.addHeader(name, value);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setIntHeader(String name, int value) {
|
||||
|
||||
if (isCommitted()) {
|
||||
return;
|
||||
}
|
||||
|
||||
response.setIntHeader(name, value);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void addIntHeader(String name, int value) {
|
||||
|
||||
if (isCommitted()) {
|
||||
return;
|
||||
}
|
||||
|
||||
response.addIntHeader(name, value);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setStatus(int sc) {
|
||||
|
||||
if (isCommitted()) {
|
||||
return;
|
||||
}
|
||||
|
||||
response.setStatus(sc);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setStatus(int sc, String sm) {
|
||||
|
||||
if (isCommitted()) {
|
||||
return;
|
||||
}
|
||||
|
||||
response.setStatus(sc, sm);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getContentType() {
|
||||
|
||||
if (response == null) {
|
||||
throw new IllegalStateException(
|
||||
sm.getString("responseFacade.nullResponse"));
|
||||
}
|
||||
|
||||
return response.getContentType();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setCharacterEncoding(String arg0) {
|
||||
|
||||
if (response == null) {
|
||||
throw new IllegalStateException(
|
||||
sm.getString("responseFacade.nullResponse"));
|
||||
}
|
||||
|
||||
response.setCharacterEncoding(arg0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStatus() {
|
||||
return response.getStatus();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHeader(String name) {
|
||||
return response.getHeader(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<String> getHeaderNames() {
|
||||
return response.getHeaderNames();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<String> getHeaders(String name) {
|
||||
return response.getHeaders(name);
|
||||
}
|
||||
}
|
||||
226
java/org/apache/catalina/connector/mbeans-descriptors.xml
Normal file
226
java/org/apache/catalina/connector/mbeans-descriptors.xml
Normal file
@@ -0,0 +1,226 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You 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
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
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.
|
||||
-->
|
||||
<mbeans-descriptors>
|
||||
|
||||
<!-- This MBean contains Connector attributes and some common attributes of
|
||||
associated ProtocolHandler instances. Common attributes extracted out
|
||||
from all ProtocolHandler implementations are denoted by a comment
|
||||
'common' above their description. Each attribute particular to given
|
||||
ProtocolHandler implementation can be found in relevant ProtocolHandler
|
||||
MBean. -->
|
||||
<mbean name="CoyoteConnector"
|
||||
className="org.apache.catalina.mbeans.ConnectorMBean"
|
||||
description="Implementation of a Coyote connector"
|
||||
domain="Catalina"
|
||||
group="Connector"
|
||||
type="org.apache.catalina.connector.Connector">
|
||||
|
||||
<!-- Common -->
|
||||
<attribute name="acceptCount"
|
||||
description="The accept count for this Connector"
|
||||
type="int"/>
|
||||
|
||||
<!-- Common -->
|
||||
<attribute name="address"
|
||||
description="The IP address on which to bind"
|
||||
type="java.lang.String"/>
|
||||
|
||||
<attribute name="ajpFlush"
|
||||
description="Send AJP flush package for each explicit flush"
|
||||
type="boolean"/>
|
||||
|
||||
<attribute name="allowedRequestAttributesPattern"
|
||||
description="Regular expression that any custom request attributes muct match else the request will be rejected"
|
||||
type="java.lang.String"/>
|
||||
|
||||
<attribute name="allowTrace"
|
||||
description="Allow disabling TRACE method"
|
||||
type="boolean"/>
|
||||
|
||||
<attribute name="ciphers"
|
||||
description="Comma-separated list of requested cipher suites"
|
||||
type="java.lang.String"/>
|
||||
|
||||
<attribute name="ciphersUsed"
|
||||
description="Array of ciphers suites in use"
|
||||
type="[Ljava.lang.String;"
|
||||
writeable="false"/>
|
||||
|
||||
<attribute name="className"
|
||||
description="Fully qualified class name of the managed object"
|
||||
type="java.lang.String"
|
||||
writeable="false"/>
|
||||
|
||||
<!-- Common -->
|
||||
<attribute name="connectionLinger"
|
||||
description="Linger value on the incoming connection"
|
||||
type="int"/>
|
||||
|
||||
<!-- Common -->
|
||||
<attribute name="connectionTimeout"
|
||||
description="Timeout value on the incoming connection"
|
||||
type="int"/>
|
||||
|
||||
<attribute name="enableLookups"
|
||||
description="The 'enable DNS lookups' flag for this Connector"
|
||||
type="boolean"/>
|
||||
|
||||
<attribute name="executorName"
|
||||
description="The name of the executor - if any - associated with this Connector"
|
||||
type="java.lang.String"
|
||||
writeable="false"/>
|
||||
|
||||
<!-- Common -->
|
||||
<attribute name="keepAliveTimeout"
|
||||
description="The number of milliseconds Tomcat will wait for a subsequent request before closing the connection"
|
||||
type="int"/>
|
||||
|
||||
<attribute name="localPort"
|
||||
description="The port number on which this connector is listening to requests. If the special value for port of zero is used then this method will report the actual port bound."
|
||||
type="int"
|
||||
writeable="false"/>
|
||||
|
||||
<attribute name="maxHeaderCount"
|
||||
description="The maximum number of headers that are allowed by the container. 100 by default. A value of less than 0 means no limit."
|
||||
type="int"/>
|
||||
|
||||
<attribute name="maxKeepAliveRequests"
|
||||
description="Maximum number of Keep-Alive requests to honor per connection"
|
||||
type="int"/>
|
||||
|
||||
<attribute name="maxParameterCount"
|
||||
description="The maximum number of parameters (GET plus POST) which will be automatically parsed by the container. 10000 by default. A value of less than 0 means no limit."
|
||||
type="int"/>
|
||||
|
||||
<attribute name="maxPostSize"
|
||||
description="Maximum size in bytes of a POST which will be handled by the servlet API provided features"
|
||||
type="int"/>
|
||||
|
||||
<attribute name="maxSavePostSize"
|
||||
description="Maximum size of a POST which will be saved by the container during authentication"
|
||||
type="int"/>
|
||||
|
||||
<attribute name="maxSwallowSize"
|
||||
description="The maximum number of request body bytes to be swallowed by Tomcat for an aborted upload"
|
||||
type="int"/>
|
||||
|
||||
<!-- Common -->
|
||||
<attribute name="maxThreads"
|
||||
description="The maximum number of request processing threads to be created for the internal Executor. -1 indicates an external Executor is being used."
|
||||
type="int"/>
|
||||
|
||||
<attribute name="minSpareThreads"
|
||||
description="The number of request processing threads that will be created for the internal Executor. -1 indicates an external Executor is being used."
|
||||
type="int"/>
|
||||
|
||||
<!-- Common -->
|
||||
<attribute name="packetSize"
|
||||
description="The ajp packet size."
|
||||
type="int"/>
|
||||
|
||||
<attribute name="port"
|
||||
description="The port number on which this connector is configured to listen for requests. The special value of 0 means select a random free port when the socket is bound."
|
||||
type="int"/>
|
||||
|
||||
<!-- Common -->
|
||||
<attribute name="processorCache"
|
||||
description="The processor cache size."
|
||||
type="int"/>
|
||||
|
||||
<attribute name="protocol"
|
||||
description="Coyote protocol handler in use"
|
||||
type="java.lang.String"/>
|
||||
|
||||
<attribute name="protocolHandlerClassName"
|
||||
description="Coyote Protocol handler class name"
|
||||
type="java.lang.String"
|
||||
writeable="false"/>
|
||||
|
||||
<attribute name="proxyName"
|
||||
description="The Server name to which we should pretend requests to this Connector"
|
||||
type="java.lang.String"/>
|
||||
|
||||
<attribute name="proxyPort"
|
||||
description="The Server port to which we should pretend requests to this Connector"
|
||||
type="int"/>
|
||||
|
||||
<attribute name="redirectPort"
|
||||
description="The redirect port for non-SSL to SSL redirects"
|
||||
type="int"/>
|
||||
|
||||
<attribute name="scheme"
|
||||
description="Protocol name for this Connector (http, https)"
|
||||
type="java.lang.String"/>
|
||||
|
||||
<attribute name="secret"
|
||||
description="Authentication secret"
|
||||
readable = "false"
|
||||
type="java.lang.String"/>
|
||||
|
||||
<attribute name="secretRequired"
|
||||
description="Must secret be set to a non-null, non-zero-length String?"
|
||||
type="boolean"/>
|
||||
|
||||
<attribute name="secure"
|
||||
description="Is this a secure (SSL) Connector?"
|
||||
type="boolean"/>
|
||||
|
||||
<attribute name="sslProtocols"
|
||||
description="Comma-separated list of SSL protocol variants to be enabled"
|
||||
type="java.lang.String"/>
|
||||
|
||||
<attribute name="stateName"
|
||||
description="The name of the LifecycleState that this component is currently in"
|
||||
type="java.lang.String"
|
||||
writeable="false"/>
|
||||
|
||||
<!-- Common -->
|
||||
<attribute name="tcpNoDelay"
|
||||
description="Should we use TCP no delay?"
|
||||
type="boolean"/>
|
||||
|
||||
<!-- Common -->
|
||||
<attribute name="threadPriority"
|
||||
description="The thread priority for processors using the internal Executor. -1 indicates an external Executor is being used."
|
||||
type="int"/>
|
||||
|
||||
<attribute name="URIEncoding"
|
||||
description="Character encoding used to decode the URI"
|
||||
type="java.lang.String"/>
|
||||
|
||||
<attribute name="useBodyEncodingForURI"
|
||||
description="Should the body encoding be used for URI query parameters"
|
||||
type="boolean"/>
|
||||
|
||||
<attribute name="useIPVHosts"
|
||||
description="Should IP-based virtual hosting be used? "
|
||||
type="boolean"/>
|
||||
|
||||
<attribute name="xpoweredBy"
|
||||
description="Is generation of X-Powered-By response header enabled/disabled?"
|
||||
type="boolean"/>
|
||||
|
||||
<operation name="start" description="Start" impact="ACTION" returnType="void" />
|
||||
<operation name="stop" description="Stop" impact="ACTION" returnType="void" />
|
||||
<operation name="pause" description="Start" impact="ACTION" returnType="void" />
|
||||
<operation name="resume" description="Stop" impact="ACTION" returnType="void" />
|
||||
<operation name="init" description="Init" impact="ACTION" returnType="void" />
|
||||
<operation name="destroy" description="Destroy" impact="ACTION" returnType="void" />
|
||||
|
||||
</mbean>
|
||||
</mbeans-descriptors>
|
||||
Reference in New Issue
Block a user