Author: lindner
Date: Thu May 13 23:57:40 2010
New Revision: 944062

URL: http://svn.apache.org/viewvc?rev=944062&view=rev
Log:
2.0 Prep -- Remove deprecated code and features

Removed:
    
shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/spi/SocialSpiException.java
Modified:
    shindig/trunk/UPGRADING
    shindig/trunk/java/common/conf/shindig.properties
    
shindig/trunk/java/common/src/main/java/org/apache/shindig/protocol/ApiServlet.java
    
shindig/trunk/java/common/src/main/java/org/apache/shindig/protocol/ContentTypes.java
    
shindig/trunk/java/common/src/main/java/org/apache/shindig/protocol/RestfulCollection.java
    
shindig/trunk/java/common/src/main/java/org/apache/shindig/protocol/conversion/xstream/GuiceBeanConverter.java
    
shindig/trunk/java/common/src/test/java/org/apache/shindig/protocol/ContentTypesTest.java
    
shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/http/BasicHttpFetcher.java
    
shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/oauth/OAuthAuthenticationHandler.java
    
shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/core/oauth/OAuthAuthenticationHanderTest.java

Modified: shindig/trunk/UPGRADING
URL: 
http://svn.apache.org/viewvc/shindig/trunk/UPGRADING?rev=944062&r1=944061&r2=944062&view=diff
==============================================================================
--- shindig/trunk/UPGRADING (original)
+++ shindig/trunk/UPGRADING Thu May 13 23:57:40 2010
@@ -44,6 +44,15 @@ with the new SecurityTokenCodec interfac
 You will need to adjust any custom SecurityToken decoders to 
 encode tokens as well as decode them.
 
+* SocialSpiException class is removed, use ProtocolException instead
+
+* GuiceBeanConverter.DuplicateFieldException class is removed 
+
+* RestfulCollection
+
+The constructor RestfulCollection(List<T> entry, int startIndex, int 
totalResults) is removed.  
+Use the constructor with an items-per-page parameter instead.
+
 
 == Java Guice Changes ==
 

Modified: shindig/trunk/java/common/conf/shindig.properties
URL: 
http://svn.apache.org/viewvc/shindig/trunk/java/common/conf/shindig.properties?rev=944062&r1=944061&r2=944062&view=diff
==============================================================================
--- shindig/trunk/java/common/conf/shindig.properties (original)
+++ shindig/trunk/java/common/conf/shindig.properties Thu May 13 23:57:40 2010
@@ -28,7 +28,6 @@ shindig.blacklist.file=
 # The URL base to use for full OAuth support (three-legged)
 shindig.oauth.base-url=/oauth/
 shindig.oauth.authorize-action=/WEB-INF/authorize.jsp
-shindig.oauth.legacy-body-signing=true
 
 ### Outbound OAuth support
 shindig.signing.state-key=
@@ -116,10 +115,6 @@ shindig.http.client.connection-timeout-m
 # Maximum size, in bytes, of the object we fetched, 0 == no limit
 shindig.http.client.max-object-size-bytes=0
 
-# true to force strict content type checking for requests made to API 
endpoints.
-# E.g. require application/json for JSON-RPC
-shindig.api.disallow-unknown-content-types=true
-
 # Strict-mode parsing for proxy and concat URIs ensures that the 
authority/host and path
 # for the URIs match precisely what is found in the container config for it. 
This is
 # useful where statistics and traffic routing patterns, typically in large 
installations,

Modified: 
shindig/trunk/java/common/src/main/java/org/apache/shindig/protocol/ApiServlet.java
URL: 
http://svn.apache.org/viewvc/shindig/trunk/java/common/src/main/java/org/apache/shindig/protocol/ApiServlet.java?rev=944062&r1=944061&r2=944062&view=diff
==============================================================================
--- 
shindig/trunk/java/common/src/main/java/org/apache/shindig/protocol/ApiServlet.java
 (original)
+++ 
shindig/trunk/java/common/src/main/java/org/apache/shindig/protocol/ApiServlet.java
 Thu May 13 23:57:40 2010
@@ -70,9 +70,6 @@ public abstract class ApiServlet extends
   protected BeanConverter xmlConverter;
   protected BeanConverter atomConverter;
 
-  @Deprecated
-  protected boolean disallowUnknownContentTypes = true;
-
   @Override
   public void init(ServletConfig config) throws ServletException {
     super.init(config);
@@ -103,12 +100,6 @@ public abstract class ApiServlet extends
   }
 
 
-  @Inject(optional = true)
-  public void setDisallowUnknownContentTypes(
-      @Named("shindig.api.disallow-unknown-content-types") boolean 
disallowUnknownContentTypes) {
-    this.disallowUnknownContentTypes = disallowUnknownContentTypes;
-  }
-
   @Inject
   public void setBeanConverters(
       @Named("shindig.bean.converter.json") BeanConverter jsonConverter,
@@ -167,6 +158,6 @@ public abstract class ApiServlet extends
 
   public void checkContentTypes(Set<String> allowedContentTypes,
       String contentType) throws ContentTypes.InvalidContentTypeException {
-    ContentTypes.checkContentTypes(allowedContentTypes, contentType, 
disallowUnknownContentTypes);
+    ContentTypes.checkContentTypes(allowedContentTypes, contentType);
   }
 }

Modified: 
shindig/trunk/java/common/src/main/java/org/apache/shindig/protocol/ContentTypes.java
URL: 
http://svn.apache.org/viewvc/shindig/trunk/java/common/src/main/java/org/apache/shindig/protocol/ContentTypes.java?rev=944062&r1=944061&r2=944062&view=diff
==============================================================================
--- 
shindig/trunk/java/common/src/main/java/org/apache/shindig/protocol/ContentTypes.java
 (original)
+++ 
shindig/trunk/java/common/src/main/java/org/apache/shindig/protocol/ContentTypes.java
 Thu May 13 23:57:40 2010
@@ -83,17 +83,12 @@ public class ContentTypes {
   }
 
   public static void checkContentTypes(Set<String> allowedContentTypes,
-      String contentType, boolean disallowUnknownContentTypes) throws 
InvalidContentTypeException {
+      String contentType) throws InvalidContentTypeException {
 
     if (StringUtils.isEmpty(contentType)) {
-       if (disallowUnknownContentTypes) {
-        throw new InvalidContentTypeException(
-            "No Content-Type specified. One of "
-                + StringUtils.join(allowedContentTypes, ", ") + " is 
required");
-       } else {
-         // No content type specified, we can fail in other ways later.
-         return;
-       }
+      throw new InvalidContentTypeException(
+          "No Content-Type specified. One of "
+              + StringUtils.join(allowedContentTypes, ", ") + " is required");
     }
 
     contentType = ContentTypes.extractMimePart(contentType);
@@ -105,20 +100,12 @@ public class ContentTypes {
     if (allowedContentTypes.contains(contentType)) {
       return;
     }
-    if (disallowUnknownContentTypes) {
-      throw new InvalidContentTypeException(
-          "Unsupported Content-Type "
-              + contentType
-              + ". One of "
-              + StringUtils.join(allowedContentTypes, ", ")
-              + " is required");
-    } else {
-      logger.warning("Unsupported Content-Type "
-          + contentType
-          + ". One of "
-          + StringUtils.join(allowedContentTypes, ", ")
-          + " is expected");
-    }
+    throw new InvalidContentTypeException(
+        "Unsupported Content-Type "
+            + contentType
+            + ". One of "
+            + StringUtils.join(allowedContentTypes, ", ")
+            + " is required");
   }
 
   public static class InvalidContentTypeException extends Exception {

Modified: 
shindig/trunk/java/common/src/main/java/org/apache/shindig/protocol/RestfulCollection.java
URL: 
http://svn.apache.org/viewvc/shindig/trunk/java/common/src/main/java/org/apache/shindig/protocol/RestfulCollection.java?rev=944062&r1=944061&r2=944062&view=diff
==============================================================================
--- 
shindig/trunk/java/common/src/main/java/org/apache/shindig/protocol/RestfulCollection.java
 (original)
+++ 
shindig/trunk/java/common/src/main/java/org/apache/shindig/protocol/RestfulCollection.java
 Thu May 13 23:57:40 2010
@@ -44,15 +44,6 @@ public class RestfulCollection<T> {
   }
 
   /**
-   * @deprecated As of 1.1-BETA4 use {...@link 
#RestfulCollection(java.util.List, int, int, int)} with the extra itemsPerPage 
Argument
-   * This contructor will be removed in 1.1 RC1
-   */
-  @Deprecated
-  public RestfulCollection(List<T> entry, int startIndex, int totalResults) {
-    this(entry, startIndex, totalResults, entry.size());
-  }
-
-  /**
    * Create a paginated collection response.
    *
    * @param entry paginated entries

Modified: 
shindig/trunk/java/common/src/main/java/org/apache/shindig/protocol/conversion/xstream/GuiceBeanConverter.java
URL: 
http://svn.apache.org/viewvc/shindig/trunk/java/common/src/main/java/org/apache/shindig/protocol/conversion/xstream/GuiceBeanConverter.java?rev=944062&r1=944061&r2=944062&view=diff
==============================================================================
--- 
shindig/trunk/java/common/src/main/java/org/apache/shindig/protocol/conversion/xstream/GuiceBeanConverter.java
 (original)
+++ 
shindig/trunk/java/common/src/main/java/org/apache/shindig/protocol/conversion/xstream/GuiceBeanConverter.java
 Thu May 13 23:57:40 2010
@@ -162,15 +162,4 @@ public class GuiceBeanConverter implemen
           result, fieldName));
     }
   }
-
-  /**
-   * @deprecated since 1.3
-   */
-  @Deprecated
-  public static class DuplicateFieldException extends ConversionException {
-    public DuplicateFieldException(String msg) {
-      super(msg);
-    }
-  }
-
 }

Modified: 
shindig/trunk/java/common/src/test/java/org/apache/shindig/protocol/ContentTypesTest.java
URL: 
http://svn.apache.org/viewvc/shindig/trunk/java/common/src/test/java/org/apache/shindig/protocol/ContentTypesTest.java?rev=944062&r1=944061&r2=944062&view=diff
==============================================================================
--- 
shindig/trunk/java/common/src/test/java/org/apache/shindig/protocol/ContentTypesTest.java
 (original)
+++ 
shindig/trunk/java/common/src/test/java/org/apache/shindig/protocol/ContentTypesTest.java
 Thu May 13 23:57:40 2010
@@ -29,53 +29,47 @@ public class ContentTypesTest extends As
   @Test
   public void testAllowJson() throws Exception {
     ContentTypes.checkContentTypes(ContentTypes.ALLOWED_JSON_CONTENT_TYPES,
-        ContentTypes.OUTPUT_JSON_CONTENT_TYPE, true);
+        ContentTypes.OUTPUT_JSON_CONTENT_TYPE);
   }
 
   @Test
   public void testAllowJsonRpc() throws Exception {
     ContentTypes.checkContentTypes(ContentTypes.ALLOWED_JSON_CONTENT_TYPES,
-        "application/json-rpc", true);
+        "application/json-rpc");
   }
 
   @Test
   public void testAllowAtom() throws Exception {
     ContentTypes.checkContentTypes(ContentTypes.ALLOWED_ATOM_CONTENT_TYPES,
-        ContentTypes.OUTPUT_ATOM_CONTENT_TYPE, true);
+        ContentTypes.OUTPUT_ATOM_CONTENT_TYPE);
   }
 
   @Test
   public void testAllowXml() throws Exception {
     ContentTypes.checkContentTypes(ContentTypes.ALLOWED_XML_CONTENT_TYPES,
-        ContentTypes.OUTPUT_XML_CONTENT_TYPE, true);
+        ContentTypes.OUTPUT_XML_CONTENT_TYPE);
   }
 
   @Test
   public void testAllowMultipart() throws Exception {
     
ContentTypes.checkContentTypes(ContentTypes.ALLOWED_MULTIPART_CONTENT_TYPES,
-        ContentTypes.MULTIPART_FORM_CONTENT_TYPE, true);
+        ContentTypes.MULTIPART_FORM_CONTENT_TYPE);
   }
 
   @Test(expected=ContentTypes.InvalidContentTypeException.class)
   public void testForbidden() throws Exception {
     ContentTypes.checkContentTypes(ContentTypes.ALLOWED_JSON_CONTENT_TYPES,
-        "application/x-www-form-urlencoded", false);
+        "application/x-www-form-urlencoded");
   }
 
   @Test(expected=ContentTypes.InvalidContentTypeException.class)
   public void testStrictDisallowUnknown() throws Exception {
     ContentTypes.checkContentTypes(ContentTypes.ALLOWED_JSON_CONTENT_TYPES,
-        "text/plain", true);
-  }
-
-  @Test
-  public void testNonStrictAllowUnknown() throws Exception {
-    ContentTypes.checkContentTypes(ContentTypes.ALLOWED_JSON_CONTENT_TYPES,
-        "text/plain", false);
+        "text/plain");
   }
 
   @Test
   public void textExtractMimePart() throws Exception {
     assertEquals("text/xml", ContentTypes.extractMimePart("Text/Xml ; charset 
= ISO-8859-1;x=y"));
   }
-}
\ No newline at end of file
+}

Modified: 
shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/http/BasicHttpFetcher.java
URL: 
http://svn.apache.org/viewvc/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/http/BasicHttpFetcher.java?rev=944062&r1=944061&r2=944062&view=diff
==============================================================================
--- 
shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/http/BasicHttpFetcher.java
 (original)
+++ 
shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/http/BasicHttpFetcher.java
 Thu May 13 23:57:40 2010
@@ -118,11 +118,6 @@ public class BasicHttpFetcher implements
     this(DEFAULT_MAX_OBJECT_SIZE, DEFAULT_CONNECT_TIMEOUT_MS, 
DEFAULT_READ_TIMEOUT_MS);
   }
 
-  @Deprecated
-  public BasicHttpFetcher(int maxObjSize, int connectionTimeoutMs) {
-    this(maxObjSize, connectionTimeoutMs, DEFAULT_READ_TIMEOUT_MS);
-  }
-
   /**
    * Creates a new fetcher for fetching HTTP objects.  Not really suitable
    * for production use. Use of an HTTP proxy for security is also necessary

Modified: 
shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/oauth/OAuthAuthenticationHandler.java
URL: 
http://svn.apache.org/viewvc/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/oauth/OAuthAuthenticationHandler.java?rev=944062&r1=944061&r2=944062&view=diff
==============================================================================
--- 
shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/oauth/OAuthAuthenticationHandler.java
 (original)
+++ 
shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/oauth/OAuthAuthenticationHandler.java
 Thu May 13 23:57:40 2010
@@ -56,14 +56,9 @@ public class OAuthAuthenticationHandler 
 
   private final OAuthDataStore store;
 
-  @Deprecated
-  private final boolean allowLegacyBodySigning;
-
   @Inject
-  public OAuthAuthenticationHandler(OAuthDataStore store,
-      @Named("shindig.oauth.legacy-body-signing") boolean 
allowLegacyBodySigning) {
+  public OAuthAuthenticationHandler(OAuthDataStore store) {
     this.store = store;
-    this.allowLegacyBodySigning = allowLegacyBodySigning;
   }
 
   public String getName() {
@@ -88,27 +83,6 @@ public class OAuthAuthenticationHandler 
     try {
       return verifyMessage(message);
     } catch (OAuthProblemException oauthException) {
-      // Legacy body signing is intended for backwards compatability with 
opensocial clients
-      // that assumed they could use the raw request body as a pseudo query 
param to get
-      // body signing. This assumption was born out of the limitations of the 
OAuth 1.0 spec which
-      // states that request bodies are only signed if they are form-encoded. 
This lead many clients
-      // to force a content type of application/x-www-form-urlencoded for 
xml/json bodies and then
-      // hope that receiver decoding of the body didnt have encoding issues. 
This didn't work out
-      // to well so now these clients are required to specify the correct 
content type. This code
-      // lets clients which sign using the old technique to work if they 
specify the correct content
-      // type. This support is deprecated and should be removed later.
-      if (allowLegacyBodySigning &&
-          (StringUtils.isEmpty(request.getContentType())  ||
-          !request.getContentType().contains(OAuth.FORM_ENCODED))) {
-        try {
-          message.addParameter(readBodyString(request), "");
-          return verifyMessage(message);
-        } catch (OAuthProblemException ioe) {
-          // ignore, let original exception be thrown
-        } catch (IOException e) {
-          // also ignore;
-        }
-      }
       throw new InvalidAuthenticationException("OAuth Authentication Failure", 
oauthException);
     }
   }

Modified: 
shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/core/oauth/OAuthAuthenticationHanderTest.java
URL: 
http://svn.apache.org/viewvc/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/core/oauth/OAuthAuthenticationHanderTest.java?rev=944062&r1=944061&r2=944062&view=diff
==============================================================================
--- 
shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/core/oauth/OAuthAuthenticationHanderTest.java
 (original)
+++ 
shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/core/oauth/OAuthAuthenticationHanderTest.java
 Thu May 13 23:57:40 2010
@@ -62,7 +62,7 @@ public class OAuthAuthenticationHanderTe
 
   @Before
   public void setUp() throws Exception {
-    reqHandler = new OAuthAuthenticationHandler(mockStore, true);
+    reqHandler = new OAuthAuthenticationHandler(mockStore);
     formEncodedPost = new FakeOAuthRequest("POST", TEST_URL, "a=b&c=d",
         OAuth.FORM_ENCODED);
     nonFormEncodedPost = new FakeOAuthRequest("POST", TEST_URL, "BODY",
@@ -324,32 +324,6 @@ public class OAuthAuthenticationHanderTe
   }
 
   @Test
-  public void testLegacyBodySigning() throws Exception {
-    expectConsumer();
-    expectSecurityToken();
-    replay();
-    FakeHttpServletRequest request = nonFormEncodedPost.sign(null,
-        FakeOAuthRequest.OAuthParamLocation.URI_QUERY, 
FakeOAuthRequest.BodySigning.LEGACY);
-    assertNotNull(reqHandler.getSecurityTokenFromRequest(request));
-  }
-
-  @Test
-  public void testLegacyBodySigningNotEnabled() throws Exception {
-    reqHandler = new OAuthAuthenticationHandler(mockStore, false);
-    expectConsumer();
-    expectSecurityToken();
-    replay();
-    FakeHttpServletRequest request = nonFormEncodedPost.sign(null,
-        FakeOAuthRequest.OAuthParamLocation.URI_QUERY, 
FakeOAuthRequest.BodySigning.LEGACY);
-    try {
-      reqHandler.getSecurityTokenFromRequest(request);
-      fail("Legacy signing not enabled");
-    } catch (AuthenticationHandler.InvalidAuthenticationException iae) {
-      // Pass
-    }
-  }
-
-  @Test
   public void testConsumerFailBodyHashSigningWithFormEncoding() throws 
Exception {
     replay();
     FakeOAuthRequest bodyHashPost =
@@ -367,20 +341,6 @@ public class OAuthAuthenticationHanderTe
   }
 
   @Test
-  public void testLegacyBodySigningJson() throws Exception {
-    expectConsumer();
-    expectSecurityToken();
-    replay();
-    FakeOAuthRequest jsonPost =
-        new FakeOAuthRequest("POST", TEST_URL,
-        "{a:b,b:'c=d&d==f&&g=y'}",
-        "application/json");
-    FakeHttpServletRequest request = jsonPost.sign(null,
-        FakeOAuthRequest.OAuthParamLocation.URI_QUERY, 
FakeOAuthRequest.BodySigning.LEGACY);
-    assertNotNull(reqHandler.getSecurityTokenFromRequest(request));
-  }
-
-  @Test
   public void testStashBody() throws Exception {
     FakeHttpServletRequest req = new FakeHttpServletRequest();
     String body = "BODY";


Reply via email to