* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-
package org.apache.catalina.connector;
-
/**
* Static constants for this package.
*/
-
public final class Constants {
-
- // -------------------------------------------------------------- Constants
-
-
public static final String Package = "org.apache.catalina.connector";
public static final int DEFAULT_CONNECTION_LINGER = -1;
public static final int PROCESSOR_IDLE = 0;
public static final int PROCESSOR_ACTIVE = 1;
-
-
}
* @author Remy Maucherat
* @version $Id$
*/
-
public class CoyoteAdapter implements Adapter {
private static final Log log = LogFactory.getLog(CoyoteAdapter.class);
* Service method.
*/
public void service(org.apache.coyote.Request req,
- org.apache.coyote.Response res)
+ org.apache.coyote.Response res)
throws Exception {
Request request = (Request) req.getNote(ADAPTER_NOTES);
*/
protected boolean postParseRequest(org.apache.coyote.Request req,
Request request,
- org.apache.coyote.Response res,
+ org.apache.coyote.Response res,
Response response)
throws Exception {
@Override
public void write(char buf[]) {
- write(buf, 0, buf.length);
+ write(buf, 0, buf.length);
}
* @param coyoteRequest Associated Coyote request
*/
public void setRequest(Request coyoteRequest) {
- this.coyoteRequest = coyoteRequest;
+ this.coyoteRequest = coyoteRequest;
}
* @throws IOException An underlying IOException occurred
*/
public int realReadBytes(byte cbuf[], int off, int len)
- throws IOException {
+ throws IOException {
if (closed)
return -1;
* @param coyoteResponse Associated Coyote response
*/
public void setResponse(Response coyoteResponse) {
- this.coyoteResponse = coyoteResponse;
+ this.coyoteResponse = coyoteResponse;
}
* @throws IOException An underlying IOException occurred
*/
public void realWriteBytes(byte buf[], int off, int cnt)
- throws IOException {
+ throws IOException {
if (closed)
return;
* @param value The associated value
*/
public void setAttribute(String name, Object value) {
-
+
// Name cannot be null
if (name == null)
throw new IllegalArgumentException
}
public String[] getDispatcherNames() {
- ArrayList<String> result = new ArrayList<String>();
- if ((dispatcherMapping & FORWARD) > 0) {
- result.add(DispatcherType.FORWARD.name());
- }
- if ((dispatcherMapping & INCLUDE) > 0) {
- result.add(DispatcherType.INCLUDE.name());
- }
- if ((dispatcherMapping & REQUEST) > 0) {
- result.add(DispatcherType.REQUEST.name());
- }
- if ((dispatcherMapping & ERROR) > 0) {
- result.add(DispatcherType.ERROR.name());
- }
- if ((dispatcherMapping & ASYNC) > 0) {
- result.add(DispatcherType.ASYNC.name());
- }
- return result.toArray(new String[result.size()]);
+ ArrayList<String> result = new ArrayList<String>();
+ if ((dispatcherMapping & FORWARD) > 0) {
+ result.add(DispatcherType.FORWARD.name());
+ }
+ if ((dispatcherMapping & INCLUDE) > 0) {
+ result.add(DispatcherType.INCLUDE.name());
+ }
+ if ((dispatcherMapping & REQUEST) > 0) {
+ result.add(DispatcherType.REQUEST.name());
+ }
+ if ((dispatcherMapping & ERROR) > 0) {
+ result.add(DispatcherType.ERROR.name());
+ }
+ if ((dispatcherMapping & ASYNC) > 0) {
+ result.add(DispatcherType.ASYNC.name());
+ }
+ return result.toArray(new String[result.size()]);
}
// --------------------------------------------------------- Public Methods
import java.util.List;
public interface Injectable {
- public String getName();
+ public String getName();
public void addInjectionTarget(String injectionTargetName, String jndiName);
public List<InjectionTarget> getInjectionTargets();
}
doLog("END TIME ", getTimestamp());
doLog("==================",
"============================================");
- }
+ }
private void doLog(String attribute, String value) {
StringBuilder sb = new StringBuilder(80);
// NOOP
}
- public void destroy() {
- // NOOP
- }
+ public void destroy() {
+ // NOOP
+ }
/**
* Check for the broken MS WebDAV client and if detected issue a re-direct
* that hopefully will cause the non-broken client to be used.
*/
- public void doFilter(ServletRequest request, ServletResponse response,
- FilterChain chain) throws IOException, ServletException {
- if (!(request instanceof HttpServletRequest) ||
- !(response instanceof HttpServletResponse)) {
+ public void doFilter(ServletRequest request, ServletResponse response,
+ FilterChain chain) throws IOException, ServletException {
+ if (!(request instanceof HttpServletRequest) ||
+ !(response instanceof HttpServletResponse)) {
chain.doFilter(request, response);
return;
}
- HttpServletRequest httpRequest = ((HttpServletRequest) request);
- HttpServletResponse httpResponse = ((HttpServletResponse) response);
- String ua = httpRequest.getHeader("User-Agent");
-
- if (ua == null || ua.length() == 0 ||
- !ua.startsWith(UA_MINIDIR_START)) {
- // No UA or starts with non MS value
- // Hope everything just works...
- chain.doFilter(request, response);
- } else if (ua.startsWith(UA_MINIDIR_5_1_2600)) {
- // XP 32-bit SP3 - needs redirect with explicit port
- httpResponse.sendRedirect(buildRedirect(httpRequest));
- } else if (ua.startsWith(UA_MINIDIR_5_2_3790)) {
- // XP 64-bit SP2
- if (!"".equals(httpRequest.getContextPath())) {
- log(request,
- "XP-x64-SP2 clients only work with the root context");
- }
- // Namespace issue maybe
- // see http://greenbytes.de/tech/webdav/webdav-redirector-list.html
- log(request, "XP-x64-SP2 is known not to work with WebDAV Servlet");
-
- chain.doFilter(request, response);
- } else {
- // Don't know which MS client it is - try the redirect with an
- // explicit port in the hope that it moves the client to a different
- // WebDAV implementation that works
- httpResponse.sendRedirect(buildRedirect(httpRequest));
- }
- }
+ HttpServletRequest httpRequest = ((HttpServletRequest) request);
+ HttpServletResponse httpResponse = ((HttpServletResponse) response);
+ String ua = httpRequest.getHeader("User-Agent");
+
+ if (ua == null || ua.length() == 0 ||
+ !ua.startsWith(UA_MINIDIR_START)) {
+ // No UA or starts with non MS value
+ // Hope everything just works...
+ chain.doFilter(request, response);
+ } else if (ua.startsWith(UA_MINIDIR_5_1_2600)) {
+ // XP 32-bit SP3 - needs redirect with explicit port
+ httpResponse.sendRedirect(buildRedirect(httpRequest));
+ } else if (ua.startsWith(UA_MINIDIR_5_2_3790)) {
+ // XP 64-bit SP2
+ if (!"".equals(httpRequest.getContextPath())) {
+ log(request,
+ "XP-x64-SP2 clients only work with the root context");
+ }
+ // Namespace issue maybe
+ // see http://greenbytes.de/tech/webdav/webdav-redirector-list.html
+ log(request, "XP-x64-SP2 is known not to work with WebDAV Servlet");
+
+ chain.doFilter(request, response);
+ } else {
+ // Don't know which MS client it is - try the redirect with an
+ // explicit port in the hope that it moves the client to a different
+ // WebDAV implementation that works
+ httpResponse.sendRedirect(buildRedirect(httpRequest));
+ }
+ }
private String buildRedirect(HttpServletRequest request) {
StringBuilder location =
extends URLClassLoader
implements StandardClassLoaderMBean {
- public StandardClassLoader(URL repositories[]) {
+ public StandardClassLoader(URL repositories[]) {
super(repositories);
}
* @exception Exception if an MBean cannot be created or registered
*/
public String createHttpConnector(String parent, String address, int port)
- throws Exception {
- return createConnector(parent, address, port, false, false);
+ throws Exception {
+ return createConnector(parent, address, port, false, false);
}
/**
* @exception Exception if an MBean cannot be created or registered
*/
public String createJDBCRealm(String parent, String driverName,
- String connectionName, String connectionPassword, String connectionURL)
+ String connectionName, String connectionPassword, String connectionURL)
throws Exception {
// Create a new JDBCRealm instance
host.setDeployOnStartup(deployOnStartup);
host.setDeployXML(deployXML);
host.setUnpackWARs(unpackWARs);
-
+
// add HostConfig for active reloading
HostConfig hostConfig = new HostConfig();
host.addLifecycleListener(hostConfig);
}
public void addSafeCharacter( char c ) {
- safeCharacters.set( c );
+ safeCharacters.set( c );
}
public String encode( String path ) {