001package org.apache.maven.wagon.shared.http; 002 003/* 004 * Licensed to the Apache Software Foundation (ASF) under one 005 * or more contributor license agreements. See the NOTICE file 006 * distributed with this work for additional information 007 * regarding copyright ownership. The ASF licenses this file 008 * to you under the Apache License, Version 2.0 (the 009 * "License"); you may not use this file except in compliance 010 * with the License. You may obtain a copy of the License at 011 * 012 * http://www.apache.org/licenses/LICENSE-2.0 013 * 014 * Unless required by applicable law or agreed to in writing, 015 * software distributed under the License is distributed on an 016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 017 * KIND, either express or implied. See the License for the 018 * specific language governing permissions and limitations 019 * under the License. 020 */ 021 022import org.apache.http.client.methods.HttpUriRequest; 023 024/** 025 * 026 */ 027public class HttpConfiguration 028{ 029 030 private HttpMethodConfiguration all; 031 032 private HttpMethodConfiguration get; 033 034 private HttpMethodConfiguration put; 035 036 private HttpMethodConfiguration head; 037 038 private HttpMethodConfiguration mkcol; 039 040 public HttpMethodConfiguration getAll() 041 { 042 return all; 043 } 044 045 public HttpConfiguration setAll( HttpMethodConfiguration all ) 046 { 047 this.all = all; 048 return this; 049 } 050 051 public HttpMethodConfiguration getGet() 052 { 053 return get; 054 } 055 056 public HttpConfiguration setGet( HttpMethodConfiguration get ) 057 { 058 this.get = get; 059 return this; 060 } 061 062 public HttpMethodConfiguration getPut() 063 { 064 return put; 065 } 066 067 public HttpConfiguration setPut( HttpMethodConfiguration put ) 068 { 069 this.put = put; 070 return this; 071 } 072 073 public HttpMethodConfiguration getHead() 074 { 075 return head; 076 } 077 078 public HttpConfiguration setHead( HttpMethodConfiguration head ) 079 { 080 this.head = head; 081 return this; 082 } 083 084 public HttpMethodConfiguration getMkcol() 085 { 086 return mkcol; 087 } 088 089 public HttpConfiguration setMkcol( HttpMethodConfiguration mkcol ) 090 { 091 this.mkcol = mkcol; 092 return this; 093 } 094 095 public HttpMethodConfiguration getMethodConfiguration( HttpUriRequest method ) 096 { 097 switch ( method.getMethod() ) 098 { 099 case "GET": 100 return ConfigurationUtils.merge( all, get ); 101 case "PUT": 102 return ConfigurationUtils.merge( all, put ); 103 case "HEAD": 104 return ConfigurationUtils.merge( all, head ); 105 case "MKCOL": 106 return ConfigurationUtils.merge( all, mkcol ); 107 default: 108 return all; 109 } 110 } 111 112}