You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2014/09/01 20:25:01 UTC

svn commit: r1621861 - in /tomcat/trunk/java/org/apache/tomcat/util/http/parser: AcceptLanguage.java Authorization.java HttpParser.java MediaType.java SkipResult.java

Author: markt
Date: Mon Sep  1 18:25:01 2014
New Revision: 1621861

URL: http://svn.apache.org/r1621861
Log:
Extract SkipResult to a separate class.

Added:
    tomcat/trunk/java/org/apache/tomcat/util/http/parser/SkipResult.java   (with props)
Modified:
    tomcat/trunk/java/org/apache/tomcat/util/http/parser/AcceptLanguage.java
    tomcat/trunk/java/org/apache/tomcat/util/http/parser/Authorization.java
    tomcat/trunk/java/org/apache/tomcat/util/http/parser/HttpParser.java
    tomcat/trunk/java/org/apache/tomcat/util/http/parser/MediaType.java

Modified: tomcat/trunk/java/org/apache/tomcat/util/http/parser/AcceptLanguage.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/http/parser/AcceptLanguage.java?rev=1621861&r1=1621860&r2=1621861&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/http/parser/AcceptLanguage.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/http/parser/AcceptLanguage.java Mon Sep  1 18:25:01 2014
@@ -63,8 +63,8 @@ public class AcceptLanguage {
 
             // See if a quality has been provided
             double quality = 1;
-            HttpParser.SkipResult lookForSemiColon = HttpParser.skipConstant(input, ";");
-            if (lookForSemiColon == HttpParser.SkipResult.FOUND) {
+            SkipResult lookForSemiColon = HttpParser.skipConstant(input, ";");
+            if (lookForSemiColon == SkipResult.FOUND) {
                 quality = HttpParser.readWeight(input, ',');
             }
 

Modified: tomcat/trunk/java/org/apache/tomcat/util/http/parser/Authorization.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/http/parser/Authorization.java?rev=1621861&r1=1621860&r2=1621861&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/http/parser/Authorization.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/http/parser/Authorization.java Mon Sep  1 18:25:01 2014
@@ -78,7 +78,7 @@ public class Authorization {
 
         Map<String,String> result = new HashMap<>();
 
-        if (HttpParser.skipConstant(input, "Digest") != HttpParser.SkipResult.FOUND) {
+        if (HttpParser.skipConstant(input, "Digest") != SkipResult.FOUND) {
             return null;
         }
         // All field names are valid tokens
@@ -87,7 +87,7 @@ public class Authorization {
             return null;
         }
         while (!field.equals("")) {
-            if (HttpParser.skipConstant(input, "=") != HttpParser.SkipResult.FOUND) {
+            if (HttpParser.skipConstant(input, "=") != SkipResult.FOUND) {
                 return null;
             }
             String value;
@@ -127,7 +127,7 @@ public class Authorization {
             }
             result.put(field, value);
 
-            if (HttpParser.skipConstant(input, ",") == HttpParser.SkipResult.NOT_FOUND) {
+            if (HttpParser.skipConstant(input, ",") == SkipResult.NOT_FOUND) {
                 return null;
             }
             field = HttpParser.readToken(input);

Modified: tomcat/trunk/java/org/apache/tomcat/util/http/parser/HttpParser.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/http/parser/HttpParser.java?rev=1621861&r1=1621860&r2=1621861&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/http/parser/HttpParser.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/http/parser/HttpParser.java Mon Sep  1 18:25:01 2014
@@ -398,11 +398,4 @@ public class HttpParser {
             return SkipResult.FOUND;
         }
     }
-
-
-    static enum SkipResult {
-        FOUND,
-        NOT_FOUND,
-        EOF
-    }
 }

Modified: tomcat/trunk/java/org/apache/tomcat/util/http/parser/MediaType.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/http/parser/MediaType.java?rev=1621861&r1=1621860&r2=1621861&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/http/parser/MediaType.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/http/parser/MediaType.java Mon Sep  1 18:25:01 2014
@@ -138,7 +138,7 @@ public class MediaType {
             return null;
         }
 
-        if (HttpParser.skipConstant(input, "/") == HttpParser.SkipResult.NOT_FOUND) {
+        if (HttpParser.skipConstant(input, "/") == SkipResult.NOT_FOUND) {
             return null;
         }
 
@@ -150,15 +150,15 @@ public class MediaType {
 
         LinkedHashMap<String,String> parameters = new LinkedHashMap<>();
 
-        HttpParser.SkipResult lookForSemiColon = HttpParser.skipConstant(input, ";");
-        if (lookForSemiColon == HttpParser.SkipResult.NOT_FOUND) {
+        SkipResult lookForSemiColon = HttpParser.skipConstant(input, ";");
+        if (lookForSemiColon == SkipResult.NOT_FOUND) {
             return null;
         }
-        while (lookForSemiColon == HttpParser.SkipResult.FOUND) {
+        while (lookForSemiColon == SkipResult.FOUND) {
             String attribute = HttpParser.readToken(input);
 
             String value = "";
-            if (HttpParser.skipConstant(input, "=") == HttpParser.SkipResult.FOUND) {
+            if (HttpParser.skipConstant(input, "=") == SkipResult.FOUND) {
                 value = HttpParser.readTokenOrQuotedString(input, true);
             }
 
@@ -167,7 +167,7 @@ public class MediaType {
             }
 
             lookForSemiColon = HttpParser.skipConstant(input, ";");
-            if (lookForSemiColon == HttpParser.SkipResult.NOT_FOUND) {
+            if (lookForSemiColon == SkipResult.NOT_FOUND) {
                 return null;
             }
         }

Added: tomcat/trunk/java/org/apache/tomcat/util/http/parser/SkipResult.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/http/parser/SkipResult.java?rev=1621861&view=auto
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/http/parser/SkipResult.java (added)
+++ tomcat/trunk/java/org/apache/tomcat/util/http/parser/SkipResult.java Mon Sep  1 18:25:01 2014
@@ -0,0 +1,23 @@
+/*
+ * 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 org.apache.tomcat.util.http.parser;
+
+enum SkipResult {
+    FOUND,
+    NOT_FOUND,
+    EOF
+}
\ No newline at end of file

Propchange: tomcat/trunk/java/org/apache/tomcat/util/http/parser/SkipResult.java
------------------------------------------------------------------------------
    svn:eol-style = native



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org