apache

How to access HTTP response headers after making an HTTP request with Apache HttpClient

This is an excerpt from the Scala Cookbook (partially modified for the internet). This is a very short recipe, Recipe 15.12, “How to access HTTP response headers after making an HTTP request with Apache HttpClient.”

Problem

You need to access the HTTP response headers after making an HTTP request in your Scala code.

Solution

Use the Apache HttpClient library, and get the headers from the HttpResponse object after making a request:

Drupal mobile website/multisite installation and robots.txt

As I’m working on getting a mobile version of this site working, I ran into a problem with having a robots.txt file on a Drupal multisite installation. The root of the problem is that you need to have a robots.txt file like this on your mobile site:

User-agent: *
Disallow: /

That’s to keep the search engines from scanning and storing that content, which will be a duplicate of your main website.

A Scala REST 'get content' client function using Apache HttpClient

As quick post here today, if you need a Scala REST client function, the following source code should be able to work for you, or at least be a good starting point. I’ve been using it in several applications today, and the only thing I think it needs is the ability to set a connection timeout and socket timeout, and I share the code for that down below.

Syndicate content