You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commons-dev@ws.apache.org by ve...@apache.org on 2009/06/01 15:47:29 UTC
svn commit: r780651 - in
/webservices/commons/trunk/modules/tcpmon/modules/tcpmon-core/src/main/java/org/apache/ws/commons/tcpmon/core:
filter/mime/ ui/
Author: veithen
Date: Mon Jun 1 13:47:28 2009
New Revision: 780651
URL: http://svn.apache.org/viewvc?rev=780651&view=rev
Log:
Moved some UI specific code to the right package.
Added:
webservices/commons/trunk/modules/tcpmon/modules/tcpmon-core/src/main/java/org/apache/ws/commons/tcpmon/core/filter/mime/MultipartAwareContentFilterFactory.java (with props)
webservices/commons/trunk/modules/tcpmon/modules/tcpmon-core/src/main/java/org/apache/ws/commons/tcpmon/core/ui/DefaultContentFilterFactory.java
- copied, changed from r780638, webservices/commons/trunk/modules/tcpmon/modules/tcpmon-core/src/main/java/org/apache/ws/commons/tcpmon/core/filter/mime/DefaultContentFilterFactory.java
Removed:
webservices/commons/trunk/modules/tcpmon/modules/tcpmon-core/src/main/java/org/apache/ws/commons/tcpmon/core/filter/mime/DefaultContentFilterFactory.java
Modified:
webservices/commons/trunk/modules/tcpmon/modules/tcpmon-core/src/main/java/org/apache/ws/commons/tcpmon/core/ui/AbstractRequestResponse.java
Added: webservices/commons/trunk/modules/tcpmon/modules/tcpmon-core/src/main/java/org/apache/ws/commons/tcpmon/core/filter/mime/MultipartAwareContentFilterFactory.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/tcpmon/modules/tcpmon-core/src/main/java/org/apache/ws/commons/tcpmon/core/filter/mime/MultipartAwareContentFilterFactory.java?rev=780651&view=auto
==============================================================================
--- webservices/commons/trunk/modules/tcpmon/modules/tcpmon-core/src/main/java/org/apache/ws/commons/tcpmon/core/filter/mime/MultipartAwareContentFilterFactory.java (added)
+++ webservices/commons/trunk/modules/tcpmon/modules/tcpmon-core/src/main/java/org/apache/ws/commons/tcpmon/core/filter/mime/MultipartAwareContentFilterFactory.java Mon Jun 1 13:47:28 2009
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * 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 org.apache.ws.commons.tcpmon.core.filter.mime;
+
+import javax.activation.MimeType;
+import javax.activation.MimeTypeParseException;
+
+import org.apache.ws.commons.tcpmon.core.filter.StreamFilter;
+
+/**
+ * Partial {@link ContentFilterFactory} implementation that handles <tt>multipart/related</tt>.
+ */
+public abstract class MultipartAwareContentFilterFactory implements ContentFilterFactory {
+ public StreamFilter[] getContentFilterChain(String contentType) {
+ MimeType ctype;
+ try {
+ ctype = new MimeType(contentType);
+ } catch (MimeTypeParseException ex) {
+ return null;
+ }
+ if (ctype.getBaseType().equalsIgnoreCase("multipart/related")) {
+ return new StreamFilter[] { new MultipartFilter(this, contentType) };
+ } else {
+ return getContentFilterChainForMimePart(ctype);
+ }
+ }
+
+ protected abstract StreamFilter[] getContentFilterChainForMimePart(MimeType contentType);
+}
Propchange: webservices/commons/trunk/modules/tcpmon/modules/tcpmon-core/src/main/java/org/apache/ws/commons/tcpmon/core/filter/mime/MultipartAwareContentFilterFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/commons/trunk/modules/tcpmon/modules/tcpmon-core/src/main/java/org/apache/ws/commons/tcpmon/core/ui/AbstractRequestResponse.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/tcpmon/modules/tcpmon-core/src/main/java/org/apache/ws/commons/tcpmon/core/ui/AbstractRequestResponse.java?rev=780651&r1=780650&r2=780651&view=diff
==============================================================================
--- webservices/commons/trunk/modules/tcpmon/modules/tcpmon-core/src/main/java/org/apache/ws/commons/tcpmon/core/ui/AbstractRequestResponse.java (original)
+++ webservices/commons/trunk/modules/tcpmon/modules/tcpmon-core/src/main/java/org/apache/ws/commons/tcpmon/core/ui/AbstractRequestResponse.java Mon Jun 1 13:47:28 2009
@@ -33,7 +33,6 @@
import org.apache.ws.commons.tcpmon.core.filter.RequestLineExtractor;
import org.apache.ws.commons.tcpmon.core.filter.http.HttpRequestFilter;
import org.apache.ws.commons.tcpmon.core.filter.http.HttpResponseFilter;
-import org.apache.ws.commons.tcpmon.core.filter.mime.DefaultContentFilterFactory;
public abstract class AbstractRequestResponse implements RequestResponseListener {
private static final String[] states = new String[] {
Copied: webservices/commons/trunk/modules/tcpmon/modules/tcpmon-core/src/main/java/org/apache/ws/commons/tcpmon/core/ui/DefaultContentFilterFactory.java (from r780638, webservices/commons/trunk/modules/tcpmon/modules/tcpmon-core/src/main/java/org/apache/ws/commons/tcpmon/core/filter/mime/DefaultContentFilterFactory.java)
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/tcpmon/modules/tcpmon-core/src/main/java/org/apache/ws/commons/tcpmon/core/ui/DefaultContentFilterFactory.java?p2=webservices/commons/trunk/modules/tcpmon/modules/tcpmon-core/src/main/java/org/apache/ws/commons/tcpmon/core/ui/DefaultContentFilterFactory.java&p1=webservices/commons/trunk/modules/tcpmon/modules/tcpmon-core/src/main/java/org/apache/ws/commons/tcpmon/core/filter/mime/DefaultContentFilterFactory.java&r1=780638&r2=780651&rev=780651&view=diff
==============================================================================
--- webservices/commons/trunk/modules/tcpmon/modules/tcpmon-core/src/main/java/org/apache/ws/commons/tcpmon/core/filter/mime/DefaultContentFilterFactory.java (original)
+++ webservices/commons/trunk/modules/tcpmon/modules/tcpmon-core/src/main/java/org/apache/ws/commons/tcpmon/core/ui/DefaultContentFilterFactory.java Mon Jun 1 13:47:28 2009
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.apache.ws.commons.tcpmon.core.filter.mime;
+package org.apache.ws.commons.tcpmon.core.ui;
import java.nio.charset.Charset;
import java.util.ArrayList;
@@ -24,32 +24,27 @@
import java.util.Set;
import javax.activation.MimeType;
-import javax.activation.MimeTypeParseException;
import org.apache.ws.commons.tcpmon.core.filter.CharsetRecoderFilter;
import org.apache.ws.commons.tcpmon.core.filter.StreamFilter;
import org.apache.ws.commons.tcpmon.core.filter.XmlFormatFilter;
+import org.apache.ws.commons.tcpmon.core.filter.mime.ContentFilterFactory;
+import org.apache.ws.commons.tcpmon.core.filter.mime.MultipartAwareContentFilterFactory;
/**
* Default {@link ContentFilterFactory} implementation.
*/
-public class DefaultContentFilterFactory implements ContentFilterFactory {
+public class DefaultContentFilterFactory extends MultipartAwareContentFilterFactory {
private static final Set xmlContentTypes = new HashSet(Arrays.asList(new String[] {
"text/xml", "application/xml", "application/soap+xml", "application/xop+xml" }));
private static final Charset UTF8 = Charset.forName("utf-8");
- public StreamFilter[] getContentFilterChain(String contentType) {
- MimeType ctype;
- try {
- ctype = new MimeType(contentType);
- } catch (MimeTypeParseException ex) {
- return null;
- }
- String baseType = ctype.getBaseType().toLowerCase();
+ protected StreamFilter[] getContentFilterChainForMimePart(MimeType contentType) {
+ String baseType = contentType.getBaseType().toLowerCase();
boolean isXml = xmlContentTypes.contains(baseType);
List filters = new ArrayList(2);
- if (isXml || ctype.getPrimaryType().equalsIgnoreCase("text")) {
- String charsetName = ctype.getParameter("charset");
+ if (isXml || contentType.getPrimaryType().equalsIgnoreCase("text")) {
+ String charsetName = contentType.getParameter("charset");
if (charsetName != null) {
Charset charset = Charset.forName(charsetName);
if (!charset.equals(UTF8)) {
@@ -59,8 +54,6 @@
}
if (isXml) {
filters.add(new XmlFormatFilter(3));
- } else if (baseType.equals("multipart/related")) {
- filters.add(new MultipartFilter(this, contentType));
}
return filters.isEmpty() ? null : (StreamFilter[])filters.toArray(new StreamFilter[filters.size()]);
}