]> git.argeo.org Git - lgpl/argeo-commons.git/blobdiff - server/runtime/org.argeo.server.json/src/main/java/org/argeo/server/json/JsonServerSerializer.java
Move to the root the bundles which will be part of v1.4 and v2.2
[lgpl/argeo-commons.git] / server / runtime / org.argeo.server.json / src / main / java / org / argeo / server / json / JsonServerSerializer.java
index 3d7361396dcb65f5bbebc503060b758407f5bf21..696cdf8b63644b040504c132f29b74d582e87f92 100644 (file)
@@ -1,3 +1,18 @@
+/*
+ * Copyright (C) 2007-2012 Argeo GmbH
+ *
+ * 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.argeo.server.json;
 
 import java.io.IOException;
@@ -43,6 +58,7 @@ public class JsonServerSerializer implements ServerSerializer, Serializer {
                objectMapper.setSerializerProvider(serializerProvider);
        }
 
+       @SuppressWarnings("restriction")
        public void serialize(Object obj, HttpServletRequest request,
                        HttpServletResponse response) {
                if (asHtml)
@@ -55,7 +71,7 @@ public class JsonServerSerializer implements ServerSerializer, Serializer {
                        if (asHtml)
                                response.getWriter().append("<pre>");
 
-                       serialize(response.getWriter(), obj);
+                       serialize(obj, response.getWriter());
 
                        if (asHtml)
                                response.getWriter().append("</pre>");
@@ -65,7 +81,7 @@ public class JsonServerSerializer implements ServerSerializer, Serializer {
                }
        }
 
-       public void serialize(Writer writer, Object obj) {
+       public void serialize(Object obj, Writer writer) {
                serializeAndLog(obj);
 
                JsonGenerator jsonGenerator = null;
@@ -90,6 +106,11 @@ public class JsonServerSerializer implements ServerSerializer, Serializer {
                }
        }
 
+       @Deprecated
+       public void serialize(Writer writer, Object obj) {
+               serialize(obj, writer);
+       }
+
        protected void serializeAndLog(Object obj) {
                if (!log.isTraceEnabled())
                        return;