Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Resolve PIVOT-640.

git-svn-id: https://svn.apache.org/repos/asf/pivot/branches/1.5.x@998094 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information...
commit 7dd3a522a66abc528c0b3cdf2c74d4dad7dec768 1 parent cfa80ff
Gregory K. Brown authored
View
2  demos-server/src/org/apache/pivot/demos/rest/server/RESTDemoServlet.java
@@ -134,7 +134,7 @@ protected void doDelete(Path path) throws QueryException {
}
@Override
- protected Serializer<?> createSerializer(Path path) throws QueryException {
+ protected Serializer<?> createSerializer(Query.Method method, Path path) throws QueryException {
return new JSONSerializer();
}
}
View
2  tutorials-server/src/org/apache/pivot/tutorials/webqueries/server/ExpenseServlet.java
@@ -168,7 +168,7 @@ protected void doDelete(Path path) throws QueryException {
}
@Override
- protected Serializer<?> createSerializer(Path path) throws QueryException {
+ protected Serializer<?> createSerializer(Query.Method method, Path path) throws QueryException {
return new JSONSerializer(Expense.class);
}
}
View
23 web-server/src/org/apache/pivot/web/server/QueryServlet.java
@@ -234,6 +234,7 @@ public QueryDictionary getResponseHeaders() {
* @throws ServletException
*/
protected void prepare() throws ServletException {
+ // No-op
}
/**
@@ -245,6 +246,7 @@ protected void prepare() throws ServletException {
* @throws ServletException
*/
protected void dispose() throws ServletException {
+ // No-op
}
/**
@@ -253,11 +255,13 @@ protected void dispose() throws ServletException {
* <p>
* The default implementation is a no-op.
*
+ * @param method
* @param path
*
* @throws QueryException
*/
- protected void validate(Path path) throws QueryException {
+ protected void validate(Query.Method method, Path path) throws QueryException {
+ // No-op
}
/**
@@ -328,7 +332,8 @@ protected void doDelete(Path path) throws QueryException {
*
* @throws ServletException
*/
- protected abstract Serializer<?> createSerializer(Path path) throws QueryException;
+ protected abstract Serializer<?> createSerializer(Query.Method method, Path path)
+ throws QueryException;
@Override
@SuppressWarnings("unchecked")
@@ -413,9 +418,9 @@ protected final void doGet(HttpServletRequest request, HttpServletResponse respo
Serializer<Object> serializer = null;
try {
- validate(path);
+ validate(Query.Method.GET, path);
result = doGet(path);
- serializer = (Serializer<Object>)createSerializer(path);
+ serializer = (Serializer<Object>)createSerializer(Query.Method.GET, path);
} catch (QueryException exception) {
response.setStatus(exception.getStatus());
response.flushBuffer();
@@ -479,11 +484,11 @@ protected final void doPost(HttpServletRequest request, HttpServletResponse resp
URL location = null;
try {
- validate(path);
+ validate(Query.Method.POST, path);
Object value = null;
if (request.getContentLength() > 0) {
- Serializer<?> serializer = createSerializer(path);
+ Serializer<?> serializer = createSerializer(Query.Method.POST, path);
value = serializer.readObject(request.getInputStream());
}
@@ -515,11 +520,11 @@ protected final void doPut(HttpServletRequest request, HttpServletResponse respo
boolean created = false;
try {
- validate(path);
+ validate(Query.Method.PUT, path);
Object value = null;
if (request.getContentLength() > 0) {
- Serializer<?> serializer = createSerializer(path);
+ Serializer<?> serializer = createSerializer(Query.Method.PUT, path);
value = serializer.readObject(request.getInputStream());
}
@@ -544,7 +549,7 @@ protected final void doDelete(HttpServletRequest request, HttpServletResponse re
throws IOException, ServletException {
try {
Path path = getPath(request);
- validate(path);
+ validate(Query.Method.DELETE, path);
doDelete(path);
} catch (QueryException exception) {
response.setStatus(exception.getStatus());
Please sign in to comment.
Something went wrong with that request. Please try again.