// Path: src/main/java/de/jeha/s3srv/common/http/Headers.java
// public class Headers {
// 
//     public static String AUTHORIZATION = "Authorization";
//     public static String CONNECTION = "Connection";
//     public static String CONTENT_MD5 = "Content-MD5";
//     public static String CONTENT_LENGTH = "Content-Length";
//     public static String CONTENT_TYPE = "Content-Type";
//     public static String DATE = "Date";
//     public static String ETAG = "ETag";
//     public static String HOST = "Host";
//     public static String LAST_MODIFIED = "Last-Modified";
//     public static String LOCATION = "Location";
// 
//     // a-amz
//     public static String X_AMZ_ACL = "x-amz-acl";
// 
// }


import de.jeha.s3srv.common.http.Headers;
import org.apache.commons.lang3.StringUtils;
import javax.servlet.http.HttpServletRequest;
package de.jeha.s3srv.common.s3;



/**
 * @author jenshadlich@googlemail.com
 */
public class RequestContext {

    private final boolean pathStyle;
    private final String bucket;
    private final String key;

    private RequestContext(boolean pathStyle, String bucket, String key) {
        this.pathStyle = pathStyle;
        this.bucket = bucket;
        this.key = key;
    }

    public static RequestContext build(HttpServletRequest request) {
        final String requestUri = request.getRequestURI();
// Path: src/main/java/de/jeha/s3srv/common/http/Headers.java
// public class Headers {
// 
//     public static String AUTHORIZATION = "Authorization";
//     public static String CONNECTION = "Connection";
//     public static String CONTENT_MD5 = "Content-MD5";
//     public static String CONTENT_LENGTH = "Content-Length";
//     public static String CONTENT_TYPE = "Content-Type";
//     public static String DATE = "Date";
//     public static String ETAG = "ETag";
//     public static String HOST = "Host";
//     public static String LAST_MODIFIED = "Last-Modified";
//     public static String LOCATION = "Location";
// 
//     // a-amz
//     public static String X_AMZ_ACL = "x-amz-acl";
// 
// }


// Path: src/main/java/de/jeha/s3srv/common/s3/RequestContext.java
import de.jeha.s3srv.common.http.Headers;
import org.apache.commons.lang3.StringUtils;
import javax.servlet.http.HttpServletRequest;

package de.jeha.s3srv.common.s3;



/**
 * @author jenshadlich@googlemail.com
 */
public class RequestContext {

    private final boolean pathStyle;
    private final String bucket;
    private final String key;

    private RequestContext(boolean pathStyle, String bucket, String key) {
        this.pathStyle = pathStyle;
        this.bucket = bucket;
        this.key = key;
    }

    public static RequestContext build(HttpServletRequest request) {
        final String requestUri = request.getRequestURI();
        final String hostHeader = request.getHeader(Headers.HOST);