Skip to content

Commit

Permalink
Refactoring
Browse files Browse the repository at this point in the history
Signed-off-by: Arjan Tijms <arjan.tijms@gmail.com>
  • Loading branch information
arjantijms committed Apr 10, 2022
1 parent ba9cf4b commit 286a1b6
Show file tree
Hide file tree
Showing 6 changed files with 321 additions and 527 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/*
* Copyright (c) 2022, 2022 Contributors to the Eclipse Foundation
* Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved.
* Copyright 2004 The Apache Software Foundation
*
Expand All @@ -25,68 +26,49 @@
import org.glassfish.grizzly.http.server.HttpHandler;

/**
* Abstract the protocol implementation, including threading, etc.
* Processor is single threaded and specific to stream-based protocols,
* will not fit Jk protocols like JNI.
* Abstract the protocol implementation, including threading, etc. Processor is single threaded and specific to
* stream-based protocols, will not fit Jk protocols like JNI.
*
* @author Remy Maucherat
* @author Costin Manolache
*/
public class CoyoteConnectorLauncher implements ProtocolHandler
{
// START SJSAS 6439313
protected boolean blocking = false;
// END SJSAS 6439313
public class CoyoteConnectorLauncher implements ProtocolHandler {
protected boolean blocking;

/**
* The <code>SelectorThread</code> implementation class. Not used when
* Coyote is used.
* The <code>SelectorThread</code> implementation class. Not used when Coyote is used.
*/
protected String selectorThreadImpl = null;

protected String selectorThreadImpl;

public CoyoteConnectorLauncher() {
// START SJSAS 6439313
this(false,false,null);
this(false, false, null);
}


public CoyoteConnectorLauncher(boolean secure, boolean blocking,
String selectorThreadImpl) {
public CoyoteConnectorLauncher(boolean secure, boolean blocking, String selectorThreadImpl) {
this.secure = secure;
this.blocking = blocking;
this.selectorThreadImpl = selectorThreadImpl;
}


public int getMaxHttpHeaderSize() {
return maxHttpHeaderSize;
}


public void setMaxHttpHeaderSize(int valueI) {
maxHttpHeaderSize = valueI;
setAttribute("maxHttpHeaderSize", "" + valueI);
}


/** Pass config info
/**
* Pass config info
*/
@Override
public void setAttribute( String name, Object value ) {

public void setAttribute(String name, Object value) {
attributes.put(name, value);
/*
if ("maxKeepAliveRequests".equals(name)) {
maxKeepAliveRequests = Integer.parseInt((String) value.toString());
} else if ("port".equals(name)) {
setPort(Integer.parseInt((String) value.toString()));
}
*/
}

@Override
public Object getAttribute( String key ) {
public Object getAttribute(String key) {
return attributes.get(key);
}

Expand All @@ -101,23 +83,24 @@ public void setProperty(String name, String value) {
* Get a property
*/
public String getProperty(String name) {
return (String)getAttribute(name);
return (String) getAttribute(name);
}

/** The adapter, used to call the connector
/**
* The adapter, used to call the connector
*/
@Override
public void setHandler(HttpHandler adapter) {
this.adapter=adapter;
this.adapter = adapter;
}

@Override
public HttpHandler getHandler() {
return adapter;
}


/** Start the protocol
/**
* Start the protocol
*/
@Override
public void init() throws Exception {
Expand All @@ -138,24 +121,22 @@ public void destroy() throws Exception {

// socket factory attributes ( XXX replace with normal setters )
protected Map<String, Object> attributes = new HashMap<>();
protected String socketFactoryName=null;
protected String sslImplementationName=null;
protected String socketFactoryName = null;
protected String sslImplementationName = null;

private int maxKeepAliveRequests=100; // as in Apache HTTPD server
protected int timeout = 300000; // 5 minutes as in Apache HTTPD server
private int maxKeepAliveRequests = 100; // as in Apache HTTPD server
protected int timeout = 300000; // 5 minutes as in Apache HTTPD server
protected int maxPostSize = 2 * 1024 * 1024;
protected int maxHttpHeaderSize = 4 * 1024;
private String reportedname;
protected int socketCloseDelay=-1;
protected int socketCloseDelay = -1;
protected boolean disableUploadTimeout = true;
protected HttpHandler adapter;

// START OF SJSAS PE 8.1 6172948
/**
* The input request buffer size.
*/
protected int requestBufferSize = 4096;
// END OF SJSAS PE 8.1 6172948

/**
* Compression value.
Expand All @@ -164,12 +145,11 @@ public void destroy() throws Exception {

// -------------------- Pool setup --------------------


public String getSocketFactory() {
return socketFactoryName;
}

public void setSocketFactory( String valueS ) {
public void setSocketFactory(String valueS) {
socketFactoryName = valueS;
setAttribute("socketFactory", valueS);
}
Expand All @@ -178,8 +158,8 @@ public String getSSLImplementation() {
return sslImplementationName;
}

public void setSSLImplementation( String valueS) {
sslImplementationName=valueS;
public void setSSLImplementation(String valueS) {
sslImplementationName = valueS;
setAttribute("sslImplementation", valueS);
}

Expand Down Expand Up @@ -213,50 +193,47 @@ public String getKeystore() {
return getProperty("keystore");
}

public void setKeystore( String k ) {
public void setKeystore(String k) {
setAttribute("keystore", k);
}

public String getKeypass() {
return getProperty("keypass");
}

public void setKeypass( String k ) {
public void setKeypass(String k) {
attributes.put("keypass", k);
//setAttribute("keypass", k);
}

public String getKeytype() {
return getProperty("keystoreType");
}

public void setKeytype( String k ) {
public void setKeytype(String k) {
setAttribute("keystoreType", k);
}

// START GlassFish Issue 657
public void setTruststore(String truststore) {
setAttribute("truststore", truststore);
}

public void setTruststoreType(String truststoreType) {
setAttribute("truststoreType", truststoreType);
}
// END GlassFish Issue 657

public String getClientauth() {
return getProperty("clientauth");
}

public void setClientauth( String k ) {
public void setClientauth(String k) {
setAttribute("clientauth", k);
}

public String getProtocol() {
return getProperty("protocol");
}

public void setProtocol( String k ) {
public void setProtocol(String k) {
setAttribute("protocol", k);
}

Expand All @@ -272,29 +249,27 @@ public String getAlgorithm() {
return getProperty("algorithm");
}

public void setAlgorithm( String k ) {
public void setAlgorithm(String k) {
setAttribute("algorithm", k);
}

public boolean getSecure() {
return secure;
}

public void setSecure( boolean b ) {
secure=b;
public void setSecure(boolean b) {
secure = b;
setAttribute("secure", "" + b);
}

// START SJSAS 6439313
public boolean getBlocking() {
return blocking;
}

public void setBlocking( boolean b ) {
blocking=b;
public void setBlocking(boolean b) {
blocking = b;
setAttribute("blocking", "" + b);
}
// END SJSAS 6439313

public String getCiphers() {
return getProperty("ciphers");
Expand All @@ -316,7 +291,8 @@ public int getMaxKeepAliveRequests() {
return maxKeepAliveRequests;
}

/** Set the maximum number of Keep-Alive requests that we will honor.
/**
* Set the maximum number of Keep-Alive requests that we will honor.
*/
public void setMaxKeepAliveRequests(int mkar) {
maxKeepAliveRequests = mkar;
Expand All @@ -327,15 +303,13 @@ public int getSocketCloseDelay() {
return socketCloseDelay;
}

public void setSocketCloseDelay( int d ) {
socketCloseDelay=d;
public void setSocketCloseDelay(int d) {
socketCloseDelay = d;
setAttribute("socketCloseDelay", "" + d);
}

protected static ServerSocketFactory string2SocketFactory(String val)
throws ClassNotFoundException, IllegalAccessException, InstantiationException {
Class chC = Class.forName(val);
return (ServerSocketFactory) chC.newInstance();
protected static ServerSocketFactory string2SocketFactory(String val) throws ReflectiveOperationException, IllegalArgumentException, SecurityException {
return (ServerSocketFactory) Class.forName(val).getDeclaredConstructor().newInstance();
}

public int getTimeout() {
Expand All @@ -355,20 +329,17 @@ public void setReportedname(String reportedName) {
reportedname = reportedName;
}

// START OF SJSAS PE 8.1 6172948
/**
* Set the request input buffer size
*/
public void setBufferSize(int requestBufferSize) {
this.requestBufferSize = requestBufferSize;
}


/**
* Return the request input buffer size
*/
public int getBufferSize(){
public int getBufferSize() {
return requestBufferSize;
}
// END OF SJSAS PE 8.1 6172948
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/*
* Copyright (c) 2022, 2022 Contributors to the Eclipse Foundation
* Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved.
* Copyright 2004 The Apache Software Foundation
*
Expand All @@ -18,18 +19,16 @@
package com.sun.enterprise.web.connector.grizzly;

/**
* Dummy Connector Launcher that doesn't start any listener like Grizzly
* or Coyote.
* Dummy Connector Launcher that doesn't start any listener like Grizzly or Coyote.
*
* @author Jean-Francois Arcand
*/
public class DummyConnectorLauncher extends CoyoteConnectorLauncher {

// ------------------------------------------------------- Constructor --//

public DummyConnectorLauncher(boolean secure, boolean blocking,
String selectorThreadImpl) {
super(secure,blocking,selectorThreadImpl);
public DummyConnectorLauncher(boolean secure, boolean blocking, String selectorThreadImpl) {
super(secure, blocking, selectorThreadImpl);
}

/**
Expand All @@ -39,17 +38,12 @@ public DummyConnectorLauncher(boolean secure, boolean blocking,
public void init() throws Exception {
}


@Override
public void start() throws Exception {
}


@Override
public void destroy() throws Exception {
}



}

0 comments on commit 286a1b6

Please sign in to comment.