Fwd: [ANN-pmcs] Registration for ApacheCon Europe 2009 is now open!

2009-01-28 Thread sebb
 ApacheCon EU 2009 registration is now open!
  23-27 March -- Mövenpick Hotel, Amsterdam, Netherlands
  http://www.eu.apachecon.com/
  

  Registration for ApacheCon Europe 2009 is now open - act before early
  bird prices expire 6 February.  Remember to book a room at the Mövenpick
  and use the Registration Code: Special package attendees for the
  conference registration, and get 150 Euros off your full conference
  registration.

  Lower Costs - Thanks to new VAT tax laws, our prices this year are 19%
  lower than last year in Europe!  We've also negotiated a Mövenpick rate
  of a maximum of 155 Euros per night for attendees in our room block.

  Quick Links:

   http://xrl.us/aceu09sp  See the schedule
   http://xrl.us/aceu09hp  Get your hotel room
   http://xrl.us/aceu09rp  Register for the conference

  Other important notes:

  - Geeks for Geeks is a new mini-track where we can feature advanced
  technical content from project committers.  And our Hackathon on Monday
  and Tuesday is open to all attendees - be sure to check it off in your
  registration.

  - The Call for Papers for ApacheCon US 2009, held 2-6 November
  2009 in Oakland, CA, is open through 28 February, so get your
  submissions in now.  This ApacheCon will feature special events with
  some of the ASF's original founders in celebration of the 10th
  anniversary of The Apache Software Foundation.

   http://www.us.apachecon.com/c/acus2009/

  - Interested in sponsoring the ApacheCon conferences?  There are plenty
  of sponsor packages available - please contact Delia Frees at
  de...@apachecon.com for further information.

  ==
  ApacheCon EU 2008: A week of Open Source at it's best!

  Hackathon - open to all! | Geeks for Geeks | Lunchtime Sessions
  In-Depth Trainings | Multi-Track Sessions | BOFs | Business Panel
  Lightning Talks | Receptions | Fast Feather Track | Expo... and more!

  - Shane Curcuru, on behalf of
  Noirin Shirley, Conference Lead,
  and the whole ApacheCon Europe 2009 Team
  http://www.eu.apachecon.com/  23-27 March -- Amsterdam, Netherlands

-
To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org
For additional commands, e-mail: httpclient-users-h...@hc.apache.org



TRANSLATING CODE FROM HTTPCLIENT3 TO HTTPCLIENT4

2009-01-28 Thread Joan Balagueró
Hello,

 

I’m migrating code from httpclient3 to httpcllient4, and there are some
things I do with httpclient3 that I’m not sure how to do with httpclient4. I
think my problems are in how to enable/disable cookies at connection manager
level, and how to manage idle connections (IdleConnectionHanfdler) at
connection manager level too.

 

 

 The code for httpclient3 is:

--

 

this.objHttp = new HttpClient(new MultiThreadedHttpConnectionManager());

this.objHttp.getHttpConnectionManager().getParams().setMaxTotalConnections(m
axConnections);  // maxConnections

this.objHttp.getHttpConnectionManager().getParams().setConnectionTimeout(con
nectionTimeout);  // connectionTimeout

this.objHttp.getParams().setSoTimeout(responseTimeout);//
responseTimeout

  

// Manage ‘idle’ connections.

if (idleTimeout  0) 

{

 this.ictt = new IdleConnectionsHandler();

 this.ictt.addConnectionManager(this.objHttp.getHttpConnectionManager());

 this.ictt.setTimeoutInterval(idleInterval);

 this.ictt.setConnectionTimeout(idleTimeout);

 this.ictt.start();

}

   

// Timeout for taking connections from pool (1 ms -- we don’t wait)

this.objHttp.getParams().setConnectionManagerTimeout(1);

   

// stale connections and enable/disable cookies.

this.objHttp.getHttpConnectionManager().getParams().setStaleCheckingEnabled(
true);

this.objHttp.getParams().setCookiePolicy(useCookies ? CookiePolicy.RFC_2109
: CookiePolicy.IGNORE_COOKIES); 

 

 

 Now the code for httpclient4:

--

 

this.objHttpParams = new BasicHttpParams();

HttpProtocolParams.setVersion(this.objHttpParams, HttpVersion.HTTP_1_1);

  

SchemeRegistry schemeRegistry = new SchemeRegistry();

schemeRegistry.register(new Scheme(http,
PlainSocketFactory.getSocketFactory(), 80));

schemeRegistry.register(new Scheme(https,
SSLSocketFactory.getSocketFactory(), 443));

  

ConnManagerParams.setMaxTotalConnections(this.objHttpParams,
maxConnections); // maxConnections

HttpConnectionParams.setConnectionTimeout(this.objHttpParams,
connectionTimeout); // connectionTimeout

HttpConnectionParams.setSoTimeout(this.objHttpParams, responseTimeout);
// responseTimeout

   

// Manage ‘idle’ connections.

if (idleTimeout  0)

{

 NO IDEA. I could see ‘IdleConnectionHandler’ and the method ‘add’, but at
connection level and not at connection manager level.

}   

 

// Timeout for taking connections from pool (1 ms -- we don’t wait)

ConnManagerParams.setTimeout(this.objHttpParams, 1);

   

// stale connections and cookies.

HttpConnectionParams.setStaleCheckingEnabled(true);

if (useCookies) new RFC2109SpecFactory().newInstance(this.objHttpParams);
-- is this OK? And how to disable cookies??

 

// And create the 'HttpClient' with the 'ThreadSafeClientConnManager'.

ClientConnectionManager cm = new
ThreadSafeClientConnManager(this.objHttpParams, schemeRegistry);

this.objHttp = new DefaultHttpClient(cm, this.objHttpParams);

 

 

 

Thanks in advance,

 

Joan.

 



Re: TRANSLATING CODE FROM HTTPCLIENT3 TO HTTPCLIENT4

2009-01-28 Thread Oleg Kalnichevski

Joan Balagueró wrote:

Hello,

 


I’m migrating code from httpclient3 to httpcllient4, and there are some
things I do with httpclient3 that I’m not sure how to do with httpclient4. I
think my problems are in how to enable/disable cookies at connection manager
level, and how to manage idle connections (IdleConnectionHanfdler) at
connection manager level too.



Hi Joan

(1) You really do not have to do anything special anymore. You might 
want to run a watcher thread that cleans up expired connections once in 
a while but you no longer need to manage idle connections manually.


---
final ThreadSafeClientConnManager connman = new ThreadSafeClientConnManager(
objHttpParams, schemeRegistry);

class MyThread extends Thread {

private volatile boolean shutdown = false;

public void run() {
while (!shutdown) {
try {
// Sleep for a minute
this.wait(6L);
}
catch (InterruptedException e) {
break;
}
connman.closeExpiredConnections();
// optionally close connections that have been idle
// over 5 min
connman.closeIdleConnections(300, TimeUnit.SECONDS);
}
}

public void shutdown() {
shutdown = true;
this.notifyAll();
}

};

MyThread t = new MyThread();
t.start();

// Shutdown at the same time with the connection manager.
t.shutdown();
connman.shutdown();
---

(2) You also ought not mess around with cookie policies anymore. 
HttpClient employs a new cookie policy per default that automatically 
picks up a cookie spec that matches best the capabilities of the target 
server. If, nonetheless, you want to enforce a particular cookie spec, 
you can use the following parameter either at the client or request level.


---
DefaultHttpClient httpclient = new DefaultHttpClient();
httpclient.getParams().setParameter(
  ClientPNames.COOKIE_POLICY, CookiePolicy.RFC_2109);
---

Hope this helps

Oleg




 

 


 The code for httpclient3 is:

--

 


this.objHttp = new HttpClient(new MultiThreadedHttpConnectionManager());

this.objHttp.getHttpConnectionManager().getParams().setMaxTotalConnections(m
axConnections);  // maxConnections

this.objHttp.getHttpConnectionManager().getParams().setConnectionTimeout(con
nectionTimeout);  // connectionTimeout

this.objHttp.getParams().setSoTimeout(responseTimeout);//
responseTimeout

  


// Manage ‘idle’ connections.

if (idleTimeout  0) 


{

 this.ictt = new IdleConnectionsHandler();

 this.ictt.addConnectionManager(this.objHttp.getHttpConnectionManager());

 this.ictt.setTimeoutInterval(idleInterval);

 this.ictt.setConnectionTimeout(idleTimeout);

 this.ictt.start();

}

   


// Timeout for taking connections from pool (1 ms -- we don’t wait)

this.objHttp.getParams().setConnectionManagerTimeout(1);

   


// stale connections and enable/disable cookies.

this.objHttp.getHttpConnectionManager().getParams().setStaleCheckingEnabled(
true);

this.objHttp.getParams().setCookiePolicy(useCookies ? CookiePolicy.RFC_2109
: CookiePolicy.IGNORE_COOKIES); 

 

 


 Now the code for httpclient4:

--

 


this.objHttpParams = new BasicHttpParams();

HttpProtocolParams.setVersion(this.objHttpParams, HttpVersion.HTTP_1_1);

  


SchemeRegistry schemeRegistry = new SchemeRegistry();

schemeRegistry.register(new Scheme(http,
PlainSocketFactory.getSocketFactory(), 80));

schemeRegistry.register(new Scheme(https,
SSLSocketFactory.getSocketFactory(), 443));

  


ConnManagerParams.setMaxTotalConnections(this.objHttpParams,
maxConnections); // maxConnections

HttpConnectionParams.setConnectionTimeout(this.objHttpParams,
connectionTimeout); // connectionTimeout

HttpConnectionParams.setSoTimeout(this.objHttpParams, responseTimeout);
// responseTimeout

   


// Manage ‘idle’ connections.

if (idleTimeout  0)

{

 NO IDEA. I could see ‘IdleConnectionHandler’ and the method ‘add’, but at
connection level and not at connection manager level.

}   

 


// Timeout for taking connections from pool (1 ms -- we don’t wait)

ConnManagerParams.setTimeout(this.objHttpParams, 1);

   


// stale connections and cookies.

HttpConnectionParams.setStaleCheckingEnabled(true);

if (useCookies) new RFC2109SpecFactory().newInstance(this.objHttpParams);
-- is this OK? And how to disable cookies??

 


// And create the 'HttpClient' with the 'ThreadSafeClientConnManager'.

ClientConnectionManager cm = new
ThreadSafeClientConnManager(this.objHttpParams, schemeRegistry);

this.objHttp = new DefaultHttpClient(cm, this.objHttpParams);

 

 

 


Thanks in advance,

 


Joan.

 






-
To unsubscribe, e-mail: