Author: hsaputra
Date: Tue Jul 13 01:31:16 2010
New Revision: 963542
URL: http://svn.apache.org/viewvc?rev=963542&view=rev
Log:
Remove ApiServlet.checkContentTypes to use ContentTypes.checkContentTypes
instead (http://codereview.appspot.com/1820041/show).
Modified:
shindig/trunk/java/common/src/main/java/org/apache/shindig/protocol/ApiServlet.java
shindig/trunk/java/common/src/main/java/org/apache/shindig/protocol/DataServiceServlet.java
shindig/trunk/java/common/src/main/java/org/apache/shindig/protocol/JsonRpcServlet.java
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=963542&r1=963541&r2=963542&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
Tue Jul 13 01:31:16 2010
@@ -68,6 +68,7 @@ public abstract class ApiServlet extends
protected BeanJsonConverter jsonConverter;
protected BeanConverter xmlConverter;
protected BeanConverter atomConverter;
+ protected ContainerConfig containerConfig;
@Override
public void init(ServletConfig config) throws ServletException {
@@ -91,8 +92,6 @@ public abstract class ApiServlet extends
this.dispatcher = dispatcher;
}
- protected ContainerConfig containerConfig;
-
@Inject
public void setContainerConfig(ContainerConfig containerConfig) {
this.containerConfig = containerConfig;
@@ -154,9 +153,4 @@ public abstract class ApiServlet extends
}
servletResponse.setCharacterEncoding(DEFAULT_ENCODING);
}
-
- public void checkContentTypes(Set<String> allowedContentTypes,
- String contentType) throws ContentTypes.InvalidContentTypeException {
- ContentTypes.checkContentTypes(allowedContentTypes, contentType);
- }
}
Modified:
shindig/trunk/java/common/src/main/java/org/apache/shindig/protocol/DataServiceServlet.java
URL:
http://svn.apache.org/viewvc/shindig/trunk/java/common/src/main/java/org/apache/shindig/protocol/DataServiceServlet.java?rev=963542&r1=963541&r2=963542&view=diff
==============================================================================
---
shindig/trunk/java/common/src/main/java/org/apache/shindig/protocol/DataServiceServlet.java
(original)
+++
shindig/trunk/java/common/src/main/java/org/apache/shindig/protocol/DataServiceServlet.java
Tue Jul 13 01:31:16 2010
@@ -59,7 +59,7 @@ public class DataServiceServlet extends
HttpServletResponse servletResponse)
throws ServletException, IOException {
try {
- checkContentTypes(ALLOWED_CONTENT_TYPES,
servletRequest.getContentType());
+ ContentTypes.checkContentTypes(ALLOWED_CONTENT_TYPES,
servletRequest.getContentType());
executeRequest(servletRequest, servletResponse);
} catch (ContentTypes.InvalidContentTypeException icte) {
sendError(servletResponse,
@@ -79,7 +79,7 @@ public class DataServiceServlet extends
HttpServletResponse servletResponse)
throws ServletException, IOException {
try {
- checkContentTypes(ALLOWED_CONTENT_TYPES,
servletRequest.getContentType());
+ ContentTypes.checkContentTypes(ALLOWED_CONTENT_TYPES,
servletRequest.getContentType());
executeRequest(servletRequest, servletResponse);
} catch (ContentTypes.InvalidContentTypeException icte) {
sendError(servletResponse,
Modified:
shindig/trunk/java/common/src/main/java/org/apache/shindig/protocol/JsonRpcServlet.java
URL:
http://svn.apache.org/viewvc/shindig/trunk/java/common/src/main/java/org/apache/shindig/protocol/JsonRpcServlet.java?rev=963542&r1=963541&r2=963542&view=diff
==============================================================================
---
shindig/trunk/java/common/src/main/java/org/apache/shindig/protocol/JsonRpcServlet.java
(original)
+++
shindig/trunk/java/common/src/main/java/org/apache/shindig/protocol/JsonRpcServlet.java
Tue Jul 13 01:31:16 2010
@@ -147,7 +147,7 @@ public class JsonRpcServlet extends ApiS
throws ContentTypes.InvalidContentTypeException, IOException {
String content = null;
- checkContentTypes(ALLOWED_CONTENT_TYPES, request.getContentType());
+ ContentTypes.checkContentTypes(ALLOWED_CONTENT_TYPES,
request.getContentType());
if (formParser.isMultipartContent(request)) {
for (FormDataItem item : formParser.parse(request)) {
@@ -157,7 +157,7 @@ public class JsonRpcServlet extends ApiS
// field or file item will not be parsed out, but will be exposed
via getFormItem
// method of RequestItem.
if (!StringUtils.isEmpty(item.getContentType())) {
- checkContentTypes(ContentTypes.ALLOWED_JSON_CONTENT_TYPES,
item.getContentType());
+
ContentTypes.checkContentTypes(ContentTypes.ALLOWED_JSON_CONTENT_TYPES,
item.getContentType());
}
content = item.getAsString();
} else {