List of usage examples for org.apache.http.params CoreConnectionPNames STALE_CONNECTION_CHECK
String STALE_CONNECTION_CHECK
To view the source code for org.apache.http.params CoreConnectionPNames STALE_CONNECTION_CHECK.
Click Source Link
From source file:org.frameworkset.spi.remote.http.HttpServer.java
public void start() { serverParams = new BasicHttpParams(); int so_timeout = this.params.getInt("http.socket.timeout", 30);//?? int SOCKET_BUFFER_SIZE = this.params.getInt("http.socket.buffer-size", 8 * 1024); boolean STALE_CONNECTION_CHECK = this.params.getBoolean("http.connection.stalecheck", false); boolean TCP_NODELAY = this.params.getBoolean("TCP_NODELAY", true); String ORIGIN_SERVER = this.params.getString("http.origin-server", "RPC-SERVER/1.1"); int CONNECTION_TIMEOUT = this.params.getInt("http.connection.timeout", 30); int httpsoLinger = this.params.getInt("http.soLinger", -1); serverParams.setIntParameter(CoreConnectionPNames.SO_TIMEOUT, so_timeout * 1000) .setIntParameter(CoreConnectionPNames.SOCKET_BUFFER_SIZE, SOCKET_BUFFER_SIZE) .setBooleanParameter(CoreConnectionPNames.STALE_CONNECTION_CHECK, STALE_CONNECTION_CHECK) .setBooleanParameter(CoreConnectionPNames.TCP_NODELAY, TCP_NODELAY) .setParameter(CoreProtocolPNames.ORIGIN_SERVER, ORIGIN_SERVER) .setIntParameter(CoreConnectionPNames.CONNECTION_TIMEOUT, CONNECTION_TIMEOUT * 1000) .setIntParameter(CoreConnectionPNames.SO_LINGER, httpsoLinger); if (!enablessl) { try {//from w w w . ja va2 s .co m this.startHttp(); System.out.println("Http server is listenig at port " + port + ",ip is " + this.ip); System.out.println("Http server started."); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } else { try { this.startHttps(); System.out.println("Https server is listenig at port " + port + ",ip is " + this.ip); System.out.println("Https server started."); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } if (this.started) ApplicationContext.addShutdownHook(new ShutDownHttpServer(this)); }
From source file:com.sangupta.jerry.http.WebRequest.java
/** * Specifies if stale connection check needs to be performed before making a * connection.//from ww w .jav a 2 s . c o m * * @param perform * <code>true</code>if stale connection checks needs to be * performed, <code>false</code> otherwise * * @return this very {@link WebRequest} */ public WebRequest staleConnectionCheck(boolean perform) { return config(CoreConnectionPNames.STALE_CONNECTION_CHECK, perform); }