Browse files

getting rid of HttpRequestBaseHandler by merging into RequestHandler

  • Loading branch information...
1 parent 4043e72 commit 3c605b3d345937e7b4f0475a9979dac74d9dc2c1 @maerzbow maerzbow committed May 8, 2011
View
2 src/main/java/com/woonoz/proxy/servlet/HttpDeleteRequestHandler.java
@@ -30,7 +30,7 @@
import org.apache.http.client.methods.HttpDelete;
import org.apache.http.client.methods.HttpRequestBase;
-public class HttpDeleteRequestHandler extends HttpRequestBaseHandler {
+public class HttpDeleteRequestHandler extends HttpRequestHandler {
public HttpDeleteRequestHandler(HttpServletRequest request, HttpServletResponse response, URL targetServer, HttpClient client) {
super(request, response, targetServer, client);
View
4 ...ttpEntityEnclosingRequestBaseHandler.java → ...et/HttpEntityEnclosingRequestHandler.java
@@ -45,9 +45,9 @@
import org.apache.http.entity.mime.content.InputStreamBody;
import org.apache.http.entity.mime.content.StringBody;
-public abstract class HttpEntityEnclosingRequestBaseHandler extends HttpRequestHandler {
+public abstract class HttpEntityEnclosingRequestHandler extends HttpRequestHandler {
- public HttpEntityEnclosingRequestBaseHandler(HttpServletRequest request, HttpServletResponse response, URL targetServer, HttpClient client) {
+ public HttpEntityEnclosingRequestHandler(HttpServletRequest request, HttpServletResponse response, URL targetServer, HttpClient client) {
super(request, response, targetServer, client);
}
View
2 src/main/java/com/woonoz/proxy/servlet/HttpGetRequestHandler.java
@@ -30,7 +30,7 @@
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpRequestBase;
-public class HttpGetRequestHandler extends HttpRequestBaseHandler {
+public class HttpGetRequestHandler extends HttpRequestHandler {
public HttpGetRequestHandler(HttpServletRequest request, HttpServletResponse response, URL targetServer, HttpClient client) {
super(request, response, targetServer, client);
View
2 src/main/java/com/woonoz/proxy/servlet/HttpHeadRequestHandler.java
@@ -30,7 +30,7 @@
import org.apache.http.client.methods.HttpHead;
import org.apache.http.client.methods.HttpRequestBase;
-public class HttpHeadRequestHandler extends HttpRequestBaseHandler {
+public class HttpHeadRequestHandler extends HttpRequestHandler {
public HttpHeadRequestHandler(HttpServletRequest request, HttpServletResponse response, URL targetServer, HttpClient client) {
super(request, response, targetServer, client);
View
2 src/main/java/com/woonoz/proxy/servlet/HttpOptionsRequestHandler.java
@@ -30,7 +30,7 @@
import org.apache.http.client.methods.HttpOptions;
import org.apache.http.client.methods.HttpRequestBase;
-public class HttpOptionsRequestHandler extends HttpRequestBaseHandler {
+public class HttpOptionsRequestHandler extends HttpRequestHandler {
public HttpOptionsRequestHandler(HttpServletRequest request, HttpServletResponse response, URL targetServer, HttpClient client) {
super(request, response, targetServer, client);
View
2 src/main/java/com/woonoz/proxy/servlet/HttpPostRequestHandler.java
@@ -30,7 +30,7 @@
import org.apache.http.client.methods.HttpEntityEnclosingRequestBase;
import org.apache.http.client.methods.HttpPost;
-public class HttpPostRequestHandler extends HttpEntityEnclosingRequestBaseHandler {
+public class HttpPostRequestHandler extends HttpEntityEnclosingRequestHandler {
public HttpPostRequestHandler(HttpServletRequest request, HttpServletResponse response, URL targetServer, HttpClient client) {
super(request, response, targetServer, client);
View
2 src/main/java/com/woonoz/proxy/servlet/HttpPutRequestHandler.java
@@ -30,7 +30,7 @@
import org.apache.http.client.methods.HttpEntityEnclosingRequestBase;
import org.apache.http.client.methods.HttpPut;
-public class HttpPutRequestHandler extends HttpEntityEnclosingRequestBaseHandler {
+public class HttpPutRequestHandler extends HttpEntityEnclosingRequestHandler {
public HttpPutRequestHandler(HttpServletRequest request, HttpServletResponse response, URL targetServer, HttpClient client) {
super(request, response, targetServer, client);
View
52 src/main/java/com/woonoz/proxy/servlet/HttpRequestBaseHandler.java
@@ -1,52 +0,0 @@
-/*
- * Copyright 2010 Woonoz S.A.S.
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.woonoz.proxy.servlet;
-
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.URL;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.apache.http.client.HttpClient;
-import org.apache.http.client.methods.HttpRequestBase;
-
-public abstract class HttpRequestBaseHandler extends HttpRequestHandler {
-
- public HttpRequestBaseHandler(HttpServletRequest request,
- HttpServletResponse response, URL targetServer, HttpClient client) {
- super(request, response, targetServer, client);
- }
-
- protected abstract HttpRequestBase createHttpRequestBase(URI targetUri);
-
- @Override
- protected HttpRequestBase createHttpCommand(final URI targetUri,
- ClientHeadersHandler clientHeadersHandler)
- throws URISyntaxException, InvalidCookieException,
- MalformedURLException {
- HttpRequestBase httpRequestBase = createHttpRequestBase(targetUri);
- copyHeaders(getRequest(), httpRequestBase, clientHeadersHandler);
- return httpRequestBase;
- }
-}
View
11 src/main/java/com/woonoz/proxy/servlet/HttpRequestHandler.java
@@ -55,9 +55,16 @@ public HttpRequestHandler(HttpServletRequest request, HttpServletResponse respon
this.client = client;
}
- protected abstract HttpRequestBase createHttpCommand(URI targetUri, ClientHeadersHandler clientHeadersHandler)
- throws InvalidCookieException, URISyntaxException, FileUploadException, IOException;
+ protected abstract HttpRequestBase createHttpRequestBase(URI targetUri);
+ protected HttpRequestBase createHttpCommand(final URI targetUri,
+ ClientHeadersHandler clientHeadersHandler)
+ throws URISyntaxException, InvalidCookieException,
+ MalformedURLException, FileUploadException, IOException {
+ HttpRequestBase httpRequestBase = createHttpRequestBase(targetUri);
+ copyHeaders(getRequest(), httpRequestBase, clientHeadersHandler);
+ return httpRequestBase;
+ }
protected ClientHeadersHandler createClientHeadersHandler(final UrlRewriter urlRewriter) {
return new ClientHeadersHandler(urlRewriter);
}
View
2 src/main/java/com/woonoz/proxy/servlet/HttpTraceRequestHandler.java
@@ -30,7 +30,7 @@
import org.apache.http.client.methods.HttpRequestBase;
import org.apache.http.client.methods.HttpTrace;
-public class HttpTraceRequestHandler extends HttpRequestBaseHandler {
+public class HttpTraceRequestHandler extends HttpRequestHandler {
public HttpTraceRequestHandler(HttpServletRequest request, HttpServletResponse response, URL targetServer, HttpClient client) {
super(request, response, targetServer, client);

0 comments on commit 3c605b3

Please sign in to comment.