#!/bin/sh
#
# Tries to upgrade from V0.1 to V0.2
#
# Those methods that have changed their signature are marked with the
# comment /* NEEDS WORK */
#
# Usage: upgrade < OldCode.java > NewCode.java
#

sed -e '
    s/\.statusCode/\.getStatusCode()/g
    s/\.ReasonLine/\.getReasonLine()/g
    s/\.Version/\.getVersion()/g
    s/\.Server/\.getServer()/g
    s/\.EffectiveURL/\.getEffectiveURL()/g
    s/\.ContentType/\.getHeader("Content-type")/g
    s/\.ContentLength/\.getHeader("Content-length")/g
    s/\.ContentEncoding/\.getHeader("Content-encoding")/g
    s/\.ContentTransferEncoding/\.getHeader("Content-transfer-encoding")/g
    s/\.Date/\.getHeaderAsDate("Date")/g
    s/\.Expires/\.getHeaderAsDate("Expires")/g
    s/\.LastModified/\.getHeaderAsDate("Last-modified")/g
    s/\.Allowed/\.getHeader("Allowed")/g
    s/\.Public/\.getHeader("Public")/g
    s/\.WWWAuthenticate/\.getHeader("WWW-Authenticate")/g
    s/\.unparsed_headers/\.listHeaders() \/* NEEDS WORK *\/ /g
    s/\.Data/\.getData()/g
    s/HTTPConnection\.base64Encode/Codecs\.base64Encode/g
    s/HTTPConnection\.base64Decode/Codecs\.base64Decode/g
    s/HTTPConnection\.quotedPrintableEncode/Codecs\.quotedPrintableEncode/g
    s/HTTPConnection\.quotedPrintableDecode/Codecs\.quotedPrintableDecode/g
    s/AuthorizationStruct/AuthorizationInfo/g
    s/HTTPConnection\.setAuthHandler/AuthorizationInfo\.setAuthHandler \/* NEEDS WORK *\/ /g
'

