// Path: idobata4j-core/src/main/java/com/uphyca/idobata/http/Client.java
// public interface Client {
// 
//     /**
//      * Synchronously execute an HTTP represented by {@code request} and encapsulate all response data
//      * into a {@link Response} instance.
//      */
//     Response execute(Request request) throws IOException;
// }
// 
// Path: idobata4j-core/src/main/java/com/uphyca/idobata/http/Request.java
// public class Request {
// 
//     private final String method;
//     private final String url;
//     private final List<Header> headers;
//     private final TypedOutput body;
// 
//     public Request(String method, String url, List<Header> headers, TypedOutput body) {
//         this.method = method;
//         this.url = url;
//         this.headers = headers;
//         this.body = body;
//     }
// 
//     /** HTTP method verb. */
//     public String getMethod() {
//         return method;
//     }
// 
//     /** Target URL. */
//     public String getUrl() {
//         return url;
//     }
// 
//     /** Returns an unmodifiable list of headers, never {@code null}. */
//     public List<Header> getHeaders() {
//         return headers;
//     }
// 
//     /** Returns the request body or {@code null}. */
//     public TypedOutput getBody() {
//         return body;
//     }
// }
// 
// Path: idobata4j-core/src/main/java/com/uphyca/idobata/http/Response.java
// public class Response {
// 
//     private final String url;
//     private final int status;
//     private final String reason;
//     private final List<Header> headers;
//     private final TypedInput body;
// 
//     public Response(String url, int status, String reason, List<Header> headers, TypedInput body) {
//         this.url = url;
//         this.status = status;
//         this.reason = reason;
//         this.headers = headers;
//         this.body = body;
//     }
// 
//     /** Request URL. */
//     public String getUrl() {
//         return url;
//     }
// 
//     /** Status line code. */
//     public int getStatus() {
//         return status;
//     }
// 
//     /** Status line reason phrase. */
//     public String getReason() {
//         return reason;
//     }
// 
//     /** An unmodifiable collection of headers. */
//     public List<Header> getHeaders() {
//         return headers;
//     }
// 
//     /** Response body. May be {@code null}. */
//     public TypedInput getBody() {
//         return body;
//     }
// }


import com.uphyca.idobata.http.Client;
import com.uphyca.idobata.http.Request;
import com.uphyca.idobata.http.Response;
import java.io.IOException;
/*
 * Copyright (C) 2014 uPhyca Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.uphyca.idobata;



/**
 * Represents cookie authentication.
 * 
 * @author Sosuke Masui (masui@uphyca.com)
 */
public class CookieAuthenticator implements RequestInterceptor {

    @Override
    public Response execute(Client client, Request request) throws IdobataError {
        try {
            return client.execute(request);
// Path: idobata4j-core/src/main/java/com/uphyca/idobata/http/Client.java
// public interface Client {
// 
//     /**
//      * Synchronously execute an HTTP represented by {@code request} and encapsulate all response data
//      * into a {@link Response} instance.
//      */
//     Response execute(Request request) throws IOException;
// }
// 
// Path: idobata4j-core/src/main/java/com/uphyca/idobata/http/Request.java
// public class Request {
// 
//     private final String method;
//     private final String url;
//     private final List<Header> headers;
//     private final TypedOutput body;
// 
//     public Request(String method, String url, List<Header> headers, TypedOutput body) {
//         this.method = method;
//         this.url = url;
//         this.headers = headers;
//         this.body = body;
//     }
// 
//     /** HTTP method verb. */
//     public String getMethod() {
//         return method;
//     }
// 
//     /** Target URL. */
//     public String getUrl() {
//         return url;
//     }
// 
//     /** Returns an unmodifiable list of headers, never {@code null}. */
//     public List<Header> getHeaders() {
//         return headers;
//     }
// 
//     /** Returns the request body or {@code null}. */
//     public TypedOutput getBody() {
//         return body;
//     }
// }
// 
// Path: idobata4j-core/src/main/java/com/uphyca/idobata/http/Response.java
// public class Response {
// 
//     private final String url;
//     private final int status;
//     private final String reason;
//     private final List<Header> headers;
//     private final TypedInput body;
// 
//     public Response(String url, int status, String reason, List<Header> headers, TypedInput body) {
//         this.url = url;
//         this.status = status;
//         this.reason = reason;
//         this.headers = headers;
//         this.body = body;
//     }
// 
//     /** Request URL. */
//     public String getUrl() {
//         return url;
//     }
// 
//     /** Status line code. */
//     public int getStatus() {
//         return status;
//     }
// 
//     /** Status line reason phrase. */
//     public String getReason() {
//         return reason;
//     }
// 
//     /** An unmodifiable collection of headers. */
//     public List<Header> getHeaders() {
//         return headers;
//     }
// 
//     /** Response body. May be {@code null}. */
//     public TypedInput getBody() {
//         return body;
//     }
// }


// Path: idobata4j-core/src/main/java/com/uphyca/idobata/CookieAuthenticator.java
import com.uphyca.idobata.http.Client;
import com.uphyca.idobata.http.Request;
import com.uphyca.idobata.http.Response;
import java.io.IOException;

/*
 * Copyright (C) 2014 uPhyca Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.uphyca.idobata;



/**
 * Represents cookie authentication.
 * 
 * @author Sosuke Masui (masui@uphyca.com)
 */
public class CookieAuthenticator implements RequestInterceptor {

    @Override
    public Response execute(Client client, Request request) throws IdobataError {
        try {
            return client.execute(request);
        } catch (IOException e) {