*
* @param request
* The request to copy.
*/
public Request(Request request) {
this(request.getMethod(), new Reference(request.getResourceRef()),
request.getEntity());
challengeResponse = request.getChallengeResponse();
// Copy client info
ClientInfo rci = request.getClientInfo();
clientInfo = new ClientInfo();
for (Preference<CharacterSet> o : rci.getAcceptedCharacterSets()) {
clientInfo.getAcceptedCharacterSets().add(o);
}
for (Preference<Encoding> o : rci.getAcceptedEncodings()) {
clientInfo.getAcceptedEncodings().add(o);
}
for (Preference<Language> o : rci.getAcceptedLanguages()) {
clientInfo.getAcceptedLanguages().add(o);
}
for (Preference<MediaType> o : rci.getAcceptedMediaTypes()) {
clientInfo.getAcceptedMediaTypes().add(o);
}
clientInfo.setAddress(rci.getAddress());
clientInfo.setAgent(rci.getAgent());
for (String o : rci.getForwardedAddresses()) {
clientInfo.getForwardedAddresses().add(o);
}
clientInfo.setFrom(rci.getFrom());
clientInfo.setPort(rci.getPort());
// Copy conditions
conditions = new Conditions();
for (Tag o : request.getConditions().getMatch()) {
conditions.getMatch().add(o);
}
conditions.setModifiedSince(request.getConditions().getModifiedSince());
for (Tag o : request.getConditions().getNoneMatch()) {
conditions.getNoneMatch().add(o);
}
conditions.setRangeDate(request.getConditions().getRangeDate());
conditions.setRangeTag(request.getConditions().getRangeTag());
conditions.setUnmodifiedSince(request.getConditions()
.getUnmodifiedSince());
for (Cookie o : request.getCookies()) {
getCookies().add(o);
}
this.hostRef = request.getHostRef();
this.maxForwards = request.getMaxForwards();
this.originalRef = (request.getOriginalRef() == null) ? null
: new Reference(request.getOriginalRef());
this.onResponse = request.getOnResponse();
this.protocol = request.getProtocol();
for (Range o : request.getRanges()) {
getRanges().add(o);
}
this.referrerRef = (request.getReferrerRef() == null) ? null
: new Reference(request.getReferrerRef());
this.rootRef = (request.getRootRef() == null) ? null : request
.getRootRef();
for (Entry<String, Object> e : request.getAttributes().entrySet()) {
getAttributes().put(e.getKey(), e.getValue());