diff --git a/datatables-parent/datatables-examples/src/main/java/org/wicketstuff/datatables/demo/infiniteScroll/VirtualScrollDemoResourceReference.java b/datatables-parent/datatables-examples/src/main/java/org/wicketstuff/datatables/demo/infiniteScroll/VirtualScrollDemoResourceReference.java index b5c617269a..854ed63bc8 100644 --- a/datatables-parent/datatables-examples/src/main/java/org/wicketstuff/datatables/demo/infiniteScroll/VirtualScrollDemoResourceReference.java +++ b/datatables-parent/datatables-examples/src/main/java/org/wicketstuff/datatables/demo/infiniteScroll/VirtualScrollDemoResourceReference.java @@ -1,6 +1,6 @@ package org.wicketstuff.datatables.demo.infiniteScroll; -import org.apache.wicket.ajax.json.JSONObject; +import org.json.JSONObject; import org.apache.wicket.markup.repeater.data.IDataProvider; import org.apache.wicket.request.mapper.parameter.PageParameters; import org.wicketstuff.datatables.demo.PeopleDataProvider; diff --git a/datatables-parent/datatables/src/main/java/org/wicketstuff/datatables/virtualscroll/AbstractVirtualScrollResourceReference.java b/datatables-parent/datatables/src/main/java/org/wicketstuff/datatables/virtualscroll/AbstractVirtualScrollResourceReference.java index 73b266281f..ebcadaa6eb 100644 --- a/datatables-parent/datatables/src/main/java/org/wicketstuff/datatables/virtualscroll/AbstractVirtualScrollResourceReference.java +++ b/datatables-parent/datatables/src/main/java/org/wicketstuff/datatables/virtualscroll/AbstractVirtualScrollResourceReference.java @@ -1,7 +1,7 @@ package org.wicketstuff.datatables.virtualscroll; -import org.apache.wicket.ajax.json.JSONArray; -import org.apache.wicket.ajax.json.JSONObject; +import org.json.JSONArray; +import org.json.JSONObject; import org.apache.wicket.markup.repeater.data.IDataProvider; import org.apache.wicket.request.http.WebResponse; import org.apache.wicket.request.mapper.parameter.PageParameters; diff --git a/gmap3-parent/gmap3/src/main/java/org/wicketstuff/gmap/geocoder/Geocoder.java b/gmap3-parent/gmap3/src/main/java/org/wicketstuff/gmap/geocoder/Geocoder.java index aa07f7a9c2..ef64e80c57 100644 --- a/gmap3-parent/gmap3/src/main/java/org/wicketstuff/gmap/geocoder/Geocoder.java +++ b/gmap3-parent/gmap3/src/main/java/org/wicketstuff/gmap/geocoder/Geocoder.java @@ -22,7 +22,7 @@ import java.net.URL; import java.net.URLEncoder; -import org.apache.wicket.ajax.json.JSONException; +import org.json.JSONException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.wicketstuff.gmap.GMap; diff --git a/offline-mode-parent/offline-mode/src/main/java/org/wicketstuff/offline/mode/ServiceWorker.java b/offline-mode-parent/offline-mode/src/main/java/org/wicketstuff/offline/mode/ServiceWorker.java index 0a2452ae12..3f8bec6b69 100644 --- a/offline-mode-parent/offline-mode/src/main/java/org/wicketstuff/offline/mode/ServiceWorker.java +++ b/offline-mode-parent/offline-mode/src/main/java/org/wicketstuff/offline/mode/ServiceWorker.java @@ -21,8 +21,8 @@ import org.apache.wicket.Page; import org.apache.wicket.WicketRuntimeException; -import org.apache.wicket.ajax.json.JSONArray; -import org.apache.wicket.ajax.json.JSONObject; +import org.json.JSONArray; +import org.json.JSONObject; import org.apache.wicket.markup.head.HeaderItem; import org.apache.wicket.markup.head.JavaScriptHeaderItem; import org.apache.wicket.request.IRequestHandler; diff --git a/pom.xml b/pom.xml index 867b2f2376..0090d43717 100644 --- a/pom.xml +++ b/pom.xml @@ -698,7 +698,12 @@ com.google.code.gson gson - 2.2.4 + 2.8.0 + + + com.fasterxml.jackson.core + jackson-databind + 2.8.5 de.agilecoders.wicket diff --git a/select2-parent/select2/src/main/java/org/wicketstuff/select2/AbstractSelect2Choice.java b/select2-parent/select2/src/main/java/org/wicketstuff/select2/AbstractSelect2Choice.java index 4dfead9d7b..6152d5f9a0 100755 --- a/select2-parent/select2/src/main/java/org/wicketstuff/select2/AbstractSelect2Choice.java +++ b/select2-parent/select2/src/main/java/org/wicketstuff/select2/AbstractSelect2Choice.java @@ -22,8 +22,6 @@ import org.apache.wicket.Component; import org.apache.wicket.IRequestListener; import org.apache.wicket.ajax.AjaxRequestTarget; -import org.apache.wicket.ajax.json.JSONException; -import org.apache.wicket.ajax.json.JSONWriter; import org.apache.wicket.event.IEvent; import org.apache.wicket.markup.ComponentTag; import org.apache.wicket.markup.MarkupStream; @@ -40,6 +38,8 @@ import org.apache.wicket.request.http.WebResponse; import org.apache.wicket.util.string.AppendingStringBuffer; import org.apache.wicket.util.string.Strings; +import org.json.JSONException; +import org.json.JSONStringer; /** * Base class for Select2 components @@ -369,7 +369,7 @@ public static void generateJSON(String queryParam, ChoiceProvider provide // jsonize and write out the choices to the response OutputStreamWriter out = new OutputStreamWriter(outputStream, request.getCharset()); - JSONWriter json = new JSONWriter(out); + JSONStringer json = new JSONStringer(); try { @@ -383,8 +383,10 @@ public static void generateJSON(String queryParam, ChoiceProvider provide } json.endArray(); json.key("more").value(response.getHasMore()).endObject(); + + out.write(json.toString()); } - catch (JSONException e) + catch (JSONException | IOException e) { throw new RuntimeException("Could not write Json response", e); } diff --git a/select2-parent/select2/src/main/java/org/wicketstuff/select2/AjaxSettings.java b/select2-parent/select2/src/main/java/org/wicketstuff/select2/AjaxSettings.java index ecbb5ccbe1..6353dd700a 100755 --- a/select2-parent/select2/src/main/java/org/wicketstuff/select2/AjaxSettings.java +++ b/select2-parent/select2/src/main/java/org/wicketstuff/select2/AjaxSettings.java @@ -14,8 +14,8 @@ import java.io.Serializable; -import org.apache.wicket.ajax.json.JSONException; -import org.apache.wicket.ajax.json.JSONWriter; +import org.json.JSONException; +import org.json.JSONStringer; import org.wicketstuff.select2.json.Json; /** @@ -34,16 +34,16 @@ public final class AjaxSettings implements Serializable /** whether or not to use traditional parameter encoding. */ private boolean cache; - public void toJson(JSONWriter writer) throws JSONException + public void toJson(JSONStringer stringer) throws JSONException { - writer.object(); - Json.writeFunction(writer, "data", data); - Json.writeObject(writer, "dataType", dataType); - Json.writeObject(writer, "delay", delay); - Json.writeFunction(writer, "processResults", processResults); - Json.writeObject(writer, "url", url); - Json.writeObject(writer, "cache", cache); - writer.endObject(); + stringer.object(); + Json.writeFunction(stringer, "data", data); + Json.writeObject(stringer, "dataType", dataType); + Json.writeObject(stringer, "delay", delay); + Json.writeFunction(stringer, "processResults", processResults); + Json.writeObject(stringer, "url", url); + Json.writeObject(stringer, "cache", cache); + stringer.endObject(); } public void setUrl(CharSequence url) diff --git a/select2-parent/select2/src/main/java/org/wicketstuff/select2/ChoiceProvider.java b/select2-parent/select2/src/main/java/org/wicketstuff/select2/ChoiceProvider.java index 17b274fc73..71fdf402ea 100755 --- a/select2-parent/select2/src/main/java/org/wicketstuff/select2/ChoiceProvider.java +++ b/select2-parent/select2/src/main/java/org/wicketstuff/select2/ChoiceProvider.java @@ -14,9 +14,9 @@ import java.util.Collection; -import org.apache.wicket.ajax.json.JSONException; -import org.apache.wicket.ajax.json.JSONWriter; import org.apache.wicket.model.IDetachable; +import org.json.JSONException; +import org.json.JSONStringer; /** *

@@ -105,12 +105,12 @@ public abstract class ChoiceProvider implements IDetachable * * @param choice * choice to convert - * @param writer + * @param stringer * Json writer that should be used to covnert the choice * @throws JSONException */ - protected void toJson(T choice, JSONWriter writer) throws JSONException { - writer.key("id").value(getIdValue(choice)).key("text").value(getDisplayValue(choice)); + protected void toJson(T choice, JSONStringer stringer) throws JSONException { + stringer.key("id").value(getIdValue(choice)).key("text").value(getDisplayValue(choice)); } /** diff --git a/select2-parent/select2/src/main/java/org/wicketstuff/select2/Settings.java b/select2-parent/select2/src/main/java/org/wicketstuff/select2/Settings.java index 59124b40ff..2e213a1eba 100755 --- a/select2-parent/select2/src/main/java/org/wicketstuff/select2/Settings.java +++ b/select2-parent/select2/src/main/java/org/wicketstuff/select2/Settings.java @@ -12,19 +12,19 @@ */ package org.wicketstuff.select2; +import static org.apache.wicket.util.string.Strings.defaultIfEmpty; + import java.io.Serializable; import org.apache.wicket.Component; import org.apache.wicket.Session; import org.apache.wicket.WicketRuntimeException; -import org.apache.wicket.ajax.json.JSONException; -import org.apache.wicket.ajax.json.JSONStringer; import org.apache.wicket.markup.head.IHeaderResponse; import org.apache.wicket.util.string.Strings; +import org.json.JSONException; +import org.json.JSONStringer; import org.wicketstuff.select2.json.Json; -import static org.apache.wicket.util.string.Strings.defaultIfEmpty; - /** * Select2 settings. Refer to the Select2 documentation for what these options mean. * diff --git a/select2-parent/select2/src/main/java/org/wicketstuff/select2/json/Json.java b/select2-parent/select2/src/main/java/org/wicketstuff/select2/json/Json.java index cdecd943f2..9ecd1be6fb 100755 --- a/select2-parent/select2/src/main/java/org/wicketstuff/select2/json/Json.java +++ b/select2-parent/select2/src/main/java/org/wicketstuff/select2/json/Json.java @@ -12,8 +12,9 @@ */ package org.wicketstuff.select2.json; -import org.apache.wicket.ajax.json.JSONException; -import org.apache.wicket.ajax.json.JSONWriter; +import org.apache.wicket.ajax.json.JSONFunction; +import org.json.JSONException; +import org.json.JSONStringer; /** * Json utilities @@ -27,7 +28,7 @@ private Json() /** * Writes a key/value pair into the {@code writer} if the value is not {@code null} * - * @param writer + * @param stringer * json writer * @param key * key @@ -35,13 +36,13 @@ private Json() * value * @throws JSONException */ - public static void writeObject(JSONWriter writer, String key, Object value) + public static void writeObject(JSONStringer stringer, String key, Object value) throws JSONException { if (value != null) { - writer.key(key); - writer.value(value); + stringer.key(key); + stringer.value(value); } } @@ -49,7 +50,7 @@ public static void writeObject(JSONWriter writer, String key, Object value) * Writes a key/value pair into the {@code writer} where {@code value} represents a javascript * function and should be written out unencoded if the value is not {@code null} * - * @param writer + * @param stringer * json writer * @param key * key @@ -57,12 +58,12 @@ public static void writeObject(JSONWriter writer, String key, Object value) * value * @throws JSONException */ - public static void writeFunction(JSONWriter writer, String key, String value) + public static void writeFunction(JSONStringer stringer, String key, String value) throws JSONException { if (value != null) { - writer.key(key).value(new JsonFunction(value)); + stringer.key(key).value(new JSONFunction(value)); } } diff --git a/select2-parent/select2/src/main/java/org/wicketstuff/select2/json/JsonBuilder.java b/select2-parent/select2/src/main/java/org/wicketstuff/select2/json/JsonBuilder.java deleted file mode 100755 index e02b63121c..0000000000 --- a/select2-parent/select2/src/main/java/org/wicketstuff/select2/json/JsonBuilder.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2012 Igor Vaynberg - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work except in compliance with - * the License. You may obtain a copy of the License in the LICENSE file, or 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.wicketstuff.select2.json; - -import org.apache.wicket.ajax.json.JSONWriter; - -/** - * A JSONWriter that writes and allows access to the underlying {@link StringBuilder}. One of the - * advantages of this class is that it can expose Json as a {@link CharSequence} instead of a - * {@link String} so no extra memory allocations are necessary for code that can use a - * {@link CharSequence} . - * - * @author igor - * - */ -public class JsonBuilder extends JSONWriter -{ - - /** - * Constructs a builder with a new {@link StringBuilder}. - */ - public JsonBuilder() - { - this(new StringBuilder()); - } - - /** - * Constructs a builder with an existing {@link StringBuilder}. - * - * @param builder - */ - public JsonBuilder(StringBuilder builder) - { - super(new StringBuilderWriter(builder)); - } - - /** - * @return underlying {@link StringBuilder} as a {@link CharSequence}. - */ - public CharSequence toJson() - { - return ((StringBuilderWriter)writer).getBuilder(); - } - -} diff --git a/select2-parent/select2/src/main/java/org/wicketstuff/select2/json/JsonFunction.java b/select2-parent/select2/src/main/java/org/wicketstuff/select2/json/JsonFunction.java deleted file mode 100755 index f33c771539..0000000000 --- a/select2-parent/select2/src/main/java/org/wicketstuff/select2/json/JsonFunction.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2012 Igor Vaynberg - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work except in compliance with - * the License. You may obtain a copy of the License in the LICENSE file, or 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.wicketstuff.select2.json; - -import org.apache.wicket.ajax.json.JSONString; - -/** - * Represents a Json function. When written out these values are not escaped so its possible to - * write out raw JavaScript. - */ -public class JsonFunction implements JSONString -{ - private final String value; - - public JsonFunction(String value) - { - this.value = value; - } - - @Override - public String toJSONString() - { - return value; - } - -} diff --git a/tinymce3-parent/tinymce3/src/main/java/wicket/contrib/tinymce/settings/JazzySpellChecker.java b/tinymce3-parent/tinymce3/src/main/java/wicket/contrib/tinymce/settings/JazzySpellChecker.java index 4bab31507e..4294e106e1 100644 --- a/tinymce3-parent/tinymce3/src/main/java/wicket/contrib/tinymce/settings/JazzySpellChecker.java +++ b/tinymce3-parent/tinymce3/src/main/java/wicket/contrib/tinymce/settings/JazzySpellChecker.java @@ -30,10 +30,10 @@ import javax.servlet.ServletInputStream; import javax.servlet.http.HttpServletRequest; -import org.apache.wicket.ajax.json.JSONArray; -import org.apache.wicket.ajax.json.JSONException; -import org.apache.wicket.ajax.json.JSONObject; -import org.apache.wicket.ajax.json.JSONTokener; +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; +import org.json.JSONTokener; import org.apache.wicket.protocol.http.servlet.ServletWebRequest; import org.apache.wicket.request.cycle.RequestCycle; import org.apache.wicket.request.http.WebResponse; diff --git a/tinymce4-parent/tinymce4/src/main/java/wicket/contrib/tinymce4/settings/JazzySpellChecker.java b/tinymce4-parent/tinymce4/src/main/java/wicket/contrib/tinymce4/settings/JazzySpellChecker.java index 09ec3e1181..7c20e4ad83 100644 --- a/tinymce4-parent/tinymce4/src/main/java/wicket/contrib/tinymce4/settings/JazzySpellChecker.java +++ b/tinymce4-parent/tinymce4/src/main/java/wicket/contrib/tinymce4/settings/JazzySpellChecker.java @@ -34,10 +34,10 @@ import java.util.Set; import javax.servlet.ServletInputStream; import javax.servlet.http.HttpServletRequest; -import org.apache.wicket.ajax.json.JSONArray; -import org.apache.wicket.ajax.json.JSONException; -import org.apache.wicket.ajax.json.JSONObject; -import org.apache.wicket.ajax.json.JSONTokener; +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; +import org.json.JSONTokener; import org.apache.wicket.protocol.http.servlet.ServletWebRequest; import org.apache.wicket.request.cycle.RequestCycle; import org.apache.wicket.request.http.WebResponse; diff --git a/urlfragment-parent/urlfragment/src/main/java/org/wicketstuff/urlfragment/UrlParametersReceivingBehavior.java b/urlfragment-parent/urlfragment/src/main/java/org/wicketstuff/urlfragment/UrlParametersReceivingBehavior.java index bf52cc8576..ac20d391f6 100644 --- a/urlfragment-parent/urlfragment/src/main/java/org/wicketstuff/urlfragment/UrlParametersReceivingBehavior.java +++ b/urlfragment-parent/urlfragment/src/main/java/org/wicketstuff/urlfragment/UrlParametersReceivingBehavior.java @@ -21,9 +21,6 @@ import org.apache.wicket.ajax.AbstractDefaultAjaxBehavior; import org.apache.wicket.ajax.AjaxRequestTarget; import org.apache.wicket.ajax.attributes.AjaxRequestAttributes; -import org.apache.wicket.ajax.json.JSONException; -import org.apache.wicket.ajax.json.JSONStringer; -import org.apache.wicket.ajax.json.JSONWriter; import org.apache.wicket.behavior.Behavior; import org.apache.wicket.markup.head.HeaderItem; import org.apache.wicket.markup.head.IHeaderResponse; @@ -32,6 +29,8 @@ import org.apache.wicket.request.IRequestParameters; import org.apache.wicket.request.cycle.RequestCycle; import org.apache.wicket.request.resource.PackageResourceReference; +import org.json.JSONException; +import org.json.JSONStringer; /** * Reads URL fragment parameters. This {@link Behavior} will execute an AJAX call to itself with the @@ -98,7 +97,7 @@ private String optionsJsonString() String optionsJsonString = ""; try { - JSONWriter writer = new JSONStringer().object(); + JSONStringer writer = new JSONStringer().object(); for (String key : options.keySet()) { writer.key(key).value(options.get(key)); diff --git a/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/Background.java b/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/Background.java index 64ec71c091..58fec0337d 100644 --- a/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/Background.java +++ b/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/Background.java @@ -16,8 +16,8 @@ */ package org.wicketstuff.whiteboard; -import org.apache.wicket.ajax.json.JSONException; -import org.apache.wicket.ajax.json.JSONObject; +import org.json.JSONException; +import org.json.JSONObject; /** * This class represent the background image of the whiteboard diff --git a/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/WhiteboardBehavior.java b/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/WhiteboardBehavior.java index a667ecdfd6..ef284966a1 100644 --- a/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/WhiteboardBehavior.java +++ b/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/WhiteboardBehavior.java @@ -16,14 +16,34 @@ */ package org.wicketstuff.whiteboard; +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Date; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.TreeMap; +import java.util.concurrent.BlockingDeque; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.LinkedBlockingDeque; + +import javax.servlet.ServletContext; +import javax.servlet.http.HttpServletRequest; + import org.apache.wicket.Application; import org.apache.wicket.Component; import org.apache.wicket.ajax.AbstractDefaultAjaxBehavior; import org.apache.wicket.ajax.AjaxRequestTarget; -import org.apache.wicket.ajax.json.JSONArray; -import org.apache.wicket.ajax.json.JSONException; -import org.apache.wicket.ajax.json.JSONObject; -import org.apache.wicket.markup.head.*; +import org.apache.wicket.markup.head.CssHeaderItem; +import org.apache.wicket.markup.head.IHeaderResponse; +import org.apache.wicket.markup.head.JavaScriptHeaderItem; +import org.apache.wicket.markup.head.OnDomReadyHeaderItem; +import org.apache.wicket.markup.head.PriorityHeaderItem; import org.apache.wicket.protocol.http.WebApplication; import org.apache.wicket.protocol.ws.WebSocketSettings; import org.apache.wicket.protocol.ws.api.IWebSocketConnection; @@ -31,26 +51,41 @@ import org.apache.wicket.request.Url; import org.apache.wicket.request.cycle.RequestCycle; import org.apache.wicket.request.http.WebRequest; +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.wicketstuff.whiteboard.elements.*; +import org.wicketstuff.whiteboard.elements.CircleGeneral; +import org.wicketstuff.whiteboard.elements.Circle_3p; +import org.wicketstuff.whiteboard.elements.ClipArt; +import org.wicketstuff.whiteboard.elements.Element; import org.wicketstuff.whiteboard.elements.Element.Type; -import org.wicketstuff.whiteboard.resource.*; +import org.wicketstuff.whiteboard.elements.LineGeneral; +import org.wicketstuff.whiteboard.elements.Line_2p; +import org.wicketstuff.whiteboard.elements.PencilArrow; +import org.wicketstuff.whiteboard.elements.PencilCircle; +import org.wicketstuff.whiteboard.elements.PencilCurve; +import org.wicketstuff.whiteboard.elements.PencilFreeLine; +import org.wicketstuff.whiteboard.elements.PencilPointAtRect; +import org.wicketstuff.whiteboard.elements.PencilPointer; +import org.wicketstuff.whiteboard.elements.PencilRect; +import org.wicketstuff.whiteboard.elements.PencilUnderline; +import org.wicketstuff.whiteboard.elements.PointAtCircle; +import org.wicketstuff.whiteboard.elements.PointAtLine; +import org.wicketstuff.whiteboard.elements.PointFree; +import org.wicketstuff.whiteboard.elements.Point_2c; +import org.wicketstuff.whiteboard.elements.Point_2l; +import org.wicketstuff.whiteboard.elements.Point_lc; +import org.wicketstuff.whiteboard.elements.Segment; +import org.wicketstuff.whiteboard.elements.Text; +import org.wicketstuff.whiteboard.resource.GoogStyleSheetResourceReference; +import org.wicketstuff.whiteboard.resource.TranslateJavaScriptResourceReference; +import org.wicketstuff.whiteboard.resource.WhiteboardHelperJavaScriptResourceReference; +import org.wicketstuff.whiteboard.resource.WhiteboardJavaScriptResourceReference; +import org.wicketstuff.whiteboard.resource.WhiteboardStyleSheetResourceReference; import org.wicketstuff.whiteboard.settings.WhiteboardLibrarySettings; -import javax.servlet.ServletContext; -import javax.servlet.http.HttpServletRequest; - -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; -import java.text.DateFormat; -import java.text.SimpleDateFormat; -import java.util.*; -import java.util.concurrent.BlockingDeque; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.LinkedBlockingDeque; - /** * This class is the behaviour handler of the whiteboard. All the server-side functionality of whiteboard is handled * here @@ -917,7 +952,7 @@ private void loadDocuments() { * @return */ private boolean isEqual(JSONObject element1, JSONObject element2) { - for (String key : JSONObject.getNames(element1)) { + for (String key : element1.keySet()) { Object value = null; try { value = element2.get(key); diff --git a/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/elements/CircleGeneral.java b/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/elements/CircleGeneral.java index 2278318c7c..4eaa457eb7 100644 --- a/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/elements/CircleGeneral.java +++ b/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/elements/CircleGeneral.java @@ -16,8 +16,8 @@ */ package org.wicketstuff.whiteboard.elements; -import org.apache.wicket.ajax.json.JSONException; -import org.apache.wicket.ajax.json.JSONObject; +import org.json.JSONException; +import org.json.JSONObject; /** * This class represent a line element on Whiteboard which is represented by three coordinates diff --git a/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/elements/Circle_3p.java b/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/elements/Circle_3p.java index 38fa360616..9fceb8de5e 100644 --- a/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/elements/Circle_3p.java +++ b/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/elements/Circle_3p.java @@ -16,8 +16,8 @@ */ package org.wicketstuff.whiteboard.elements; -import org.apache.wicket.ajax.json.JSONException; -import org.apache.wicket.ajax.json.JSONObject; +import org.json.JSONException; +import org.json.JSONObject; /** * This class rep Hold common fields for each element diff --git a/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/elements/ClipArt.java b/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/elements/ClipArt.java index acc27de50e..4435d34415 100644 --- a/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/elements/ClipArt.java +++ b/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/elements/ClipArt.java @@ -16,8 +16,8 @@ */ package org.wicketstuff.whiteboard.elements; -import org.apache.wicket.ajax.json.JSONException; -import org.apache.wicket.ajax.json.JSONObject; +import org.json.JSONException; +import org.json.JSONObject; /** * This class represent a clipArt picture element on Whiteboard diff --git a/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/elements/Element.java b/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/elements/Element.java index 1b5c2a7311..5c69efc710 100644 --- a/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/elements/Element.java +++ b/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/elements/Element.java @@ -16,8 +16,8 @@ */ package org.wicketstuff.whiteboard.elements; -import org.apache.wicket.ajax.json.JSONException; -import org.apache.wicket.ajax.json.JSONObject; +import org.json.JSONException; +import org.json.JSONObject; import java.io.Serializable; diff --git a/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/elements/LineGeneral.java b/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/elements/LineGeneral.java index be5a5673c6..624b2bf0e2 100644 --- a/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/elements/LineGeneral.java +++ b/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/elements/LineGeneral.java @@ -16,8 +16,8 @@ */ package org.wicketstuff.whiteboard.elements; -import org.apache.wicket.ajax.json.JSONException; -import org.apache.wicket.ajax.json.JSONObject; +import org.json.JSONException; +import org.json.JSONObject; /** * This class represent a line element on Whiteboard which is represented by three coordinates diff --git a/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/elements/Line_2p.java b/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/elements/Line_2p.java index a2ecf8f10e..1d0669736a 100644 --- a/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/elements/Line_2p.java +++ b/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/elements/Line_2p.java @@ -16,8 +16,8 @@ */ package org.wicketstuff.whiteboard.elements; -import org.apache.wicket.ajax.json.JSONException; -import org.apache.wicket.ajax.json.JSONObject; +import org.json.JSONException; +import org.json.JSONObject; /** * This class represent a line element on Whiteboard which is represented by two coordinates diff --git a/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/elements/PencilArrow.java b/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/elements/PencilArrow.java index 59e16cf037..b1e0a2b916 100644 --- a/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/elements/PencilArrow.java +++ b/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/elements/PencilArrow.java @@ -16,8 +16,8 @@ */ package org.wicketstuff.whiteboard.elements; -import org.apache.wicket.ajax.json.JSONException; -import org.apache.wicket.ajax.json.JSONObject; +import org.json.JSONException; +import org.json.JSONObject; /** * This class represent a arrow element on Whiteboard which is represented by starting point of the arrow , ending point diff --git a/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/elements/PencilCircle.java b/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/elements/PencilCircle.java index 7fa8a6aa2c..40a2a42902 100644 --- a/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/elements/PencilCircle.java +++ b/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/elements/PencilCircle.java @@ -16,8 +16,8 @@ */ package org.wicketstuff.whiteboard.elements; -import org.apache.wicket.ajax.json.JSONException; -import org.apache.wicket.ajax.json.JSONObject; +import org.json.JSONException; +import org.json.JSONObject; /** * This class represent a circle element on Whiteboard which is represented by center coordinate and a coordinate on diff --git a/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/elements/PencilCurve.java b/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/elements/PencilCurve.java index e3b12c614b..04765c105c 100644 --- a/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/elements/PencilCurve.java +++ b/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/elements/PencilCurve.java @@ -16,8 +16,8 @@ */ package org.wicketstuff.whiteboard.elements; -import org.apache.wicket.ajax.json.JSONException; -import org.apache.wicket.ajax.json.JSONObject; +import org.json.JSONException; +import org.json.JSONObject; import java.util.ArrayList; import java.util.List; diff --git a/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/elements/PencilFreeLine.java b/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/elements/PencilFreeLine.java index 487355bd33..f9f9222493 100644 --- a/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/elements/PencilFreeLine.java +++ b/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/elements/PencilFreeLine.java @@ -16,8 +16,8 @@ */ package org.wicketstuff.whiteboard.elements; -import org.apache.wicket.ajax.json.JSONException; -import org.apache.wicket.ajax.json.JSONObject; +import org.json.JSONException; +import org.json.JSONObject; /** * This class represent a line element on Whiteboard which is represented by two coordinate and drawn using pencil tool diff --git a/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/elements/PencilPointAtRect.java b/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/elements/PencilPointAtRect.java index e9fc8bb8c2..d4e3774dae 100644 --- a/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/elements/PencilPointAtRect.java +++ b/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/elements/PencilPointAtRect.java @@ -16,8 +16,8 @@ */ package org.wicketstuff.whiteboard.elements; -import org.apache.wicket.ajax.json.JSONException; -import org.apache.wicket.ajax.json.JSONObject; +import org.json.JSONException; +import org.json.JSONObject; /** * This class represent a point element on Whiteboard which is on a rectangle diff --git a/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/elements/PencilPointer.java b/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/elements/PencilPointer.java index 7a002cb2f5..4f0087ad6b 100644 --- a/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/elements/PencilPointer.java +++ b/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/elements/PencilPointer.java @@ -16,8 +16,8 @@ */ package org.wicketstuff.whiteboard.elements; -import org.apache.wicket.ajax.json.JSONException; -import org.apache.wicket.ajax.json.JSONObject; +import org.json.JSONException; +import org.json.JSONObject; /** * This class represent a pointer element on Whiteboard which is represented by a coordinate and a blinking time diff --git a/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/elements/PencilRect.java b/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/elements/PencilRect.java index e17f1b1ba3..023937c7c7 100644 --- a/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/elements/PencilRect.java +++ b/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/elements/PencilRect.java @@ -16,8 +16,8 @@ */ package org.wicketstuff.whiteboard.elements; -import org.apache.wicket.ajax.json.JSONException; -import org.apache.wicket.ajax.json.JSONObject; +import org.json.JSONException; +import org.json.JSONObject; /** * This class represent a rectangle element on Whiteboard which is represented by two vertices point on a diagonal diff --git a/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/elements/PencilUnderline.java b/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/elements/PencilUnderline.java index 5c1fbd36f0..8658bf7d80 100644 --- a/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/elements/PencilUnderline.java +++ b/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/elements/PencilUnderline.java @@ -16,8 +16,8 @@ */ package org.wicketstuff.whiteboard.elements; -import org.apache.wicket.ajax.json.JSONException; -import org.apache.wicket.ajax.json.JSONObject; +import org.json.JSONException; +import org.json.JSONObject; /** * This class represent a underline element on Whiteboard which is represented by starting point of the underline , diff --git a/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/elements/PointAtCircle.java b/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/elements/PointAtCircle.java index 97f04279fe..1ccbeae18a 100644 --- a/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/elements/PointAtCircle.java +++ b/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/elements/PointAtCircle.java @@ -16,8 +16,8 @@ */ package org.wicketstuff.whiteboard.elements; -import org.apache.wicket.ajax.json.JSONException; -import org.apache.wicket.ajax.json.JSONObject; +import org.json.JSONException; +import org.json.JSONObject; /** * This class represent a point element on Whiteboard which is on a circle element diff --git a/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/elements/PointAtLine.java b/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/elements/PointAtLine.java index d5a75fe0fa..ffc60cb00c 100644 --- a/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/elements/PointAtLine.java +++ b/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/elements/PointAtLine.java @@ -16,8 +16,8 @@ */ package org.wicketstuff.whiteboard.elements; -import org.apache.wicket.ajax.json.JSONException; -import org.apache.wicket.ajax.json.JSONObject; +import org.json.JSONException; +import org.json.JSONObject; /** * This class represent a point element on Whiteboard which is on a line element diff --git a/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/elements/PointFree.java b/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/elements/PointFree.java index cf28b81c1a..0869239639 100644 --- a/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/elements/PointFree.java +++ b/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/elements/PointFree.java @@ -16,8 +16,8 @@ */ package org.wicketstuff.whiteboard.elements; -import org.apache.wicket.ajax.json.JSONException; -import org.apache.wicket.ajax.json.JSONObject; +import org.json.JSONException; +import org.json.JSONObject; /** * This class represent a point element on Whiteboard diff --git a/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/elements/Point_2c.java b/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/elements/Point_2c.java index d77a83479e..50a4b3a6f2 100644 --- a/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/elements/Point_2c.java +++ b/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/elements/Point_2c.java @@ -16,8 +16,8 @@ */ package org.wicketstuff.whiteboard.elements; -import org.apache.wicket.ajax.json.JSONException; -import org.apache.wicket.ajax.json.JSONObject; +import org.json.JSONException; +import org.json.JSONObject; /** * This class represent a point element on Whiteboard diff --git a/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/elements/Point_2l.java b/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/elements/Point_2l.java index f915234ac9..50311802d6 100644 --- a/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/elements/Point_2l.java +++ b/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/elements/Point_2l.java @@ -16,8 +16,8 @@ */ package org.wicketstuff.whiteboard.elements; -import org.apache.wicket.ajax.json.JSONException; -import org.apache.wicket.ajax.json.JSONObject; +import org.json.JSONException; +import org.json.JSONObject; /** * This class represent a point element on Whiteboard diff --git a/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/elements/Point_lc.java b/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/elements/Point_lc.java index aaa547d8e4..e6906c2e93 100644 --- a/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/elements/Point_lc.java +++ b/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/elements/Point_lc.java @@ -16,8 +16,8 @@ */ package org.wicketstuff.whiteboard.elements; -import org.apache.wicket.ajax.json.JSONException; -import org.apache.wicket.ajax.json.JSONObject; +import org.json.JSONException; +import org.json.JSONObject; /** * This class represent a point element on Whiteboard diff --git a/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/elements/Segment.java b/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/elements/Segment.java index 3bcd218922..485ac2b348 100644 --- a/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/elements/Segment.java +++ b/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/elements/Segment.java @@ -16,8 +16,8 @@ */ package org.wicketstuff.whiteboard.elements; -import org.apache.wicket.ajax.json.JSONException; -import org.apache.wicket.ajax.json.JSONObject; +import org.json.JSONException; +import org.json.JSONObject; /** * This class represent a line segment element on Whiteboard diff --git a/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/elements/Text.java b/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/elements/Text.java index eb7bc346ca..4b0eacdbfa 100644 --- a/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/elements/Text.java +++ b/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/elements/Text.java @@ -16,8 +16,8 @@ */ package org.wicketstuff.whiteboard.elements; -import org.apache.wicket.ajax.json.JSONException; -import org.apache.wicket.ajax.json.JSONObject; +import org.json.JSONException; +import org.json.JSONObject; /** * This class represent a text element on Whiteboard diff --git a/wicketstuff-rest-lambda/src/test/java/org/wicketstuff/rest/lambda/mounter/LambdaRestApplicationTest.java b/wicketstuff-rest-lambda/src/test/java/org/wicketstuff/rest/lambda/mounter/LambdaRestApplicationTest.java index fbf1aa8fbc..15c93cf2ae 100644 --- a/wicketstuff-rest-lambda/src/test/java/org/wicketstuff/rest/lambda/mounter/LambdaRestApplicationTest.java +++ b/wicketstuff-rest-lambda/src/test/java/org/wicketstuff/rest/lambda/mounter/LambdaRestApplicationTest.java @@ -16,7 +16,6 @@ */ package org.wicketstuff.rest.lambda.mounter; -import org.apache.wicket.ajax.json.JSONObject; import org.apache.wicket.protocol.http.WebApplication; import org.junit.Test; import org.wicketstuff.rest.utils.http.HttpMethod; @@ -35,7 +34,7 @@ public void testResources() throws Exception { assertUrlResponse("./testget", HttpMethod.POST, ""); assertUrlResponse("./testget", HttpMethod.GET, "hello!"); - assertUrlResponse("./testjson", HttpMethod.POST, JSONObject.valueToString(TestApplication.map)); + assertUrlResponse("./testjson", HttpMethod.POST, TestApplication.toJson(TestApplication.map)); assertUrlResponse("./testparam/45", HttpMethod.OPTIONS, "45"); assertUrlResponse("./deleteit", HttpMethod.DELETE, "deleted"); } diff --git a/wicketstuff-rest-lambda/src/test/java/org/wicketstuff/rest/lambda/mounter/TestApplication.java b/wicketstuff-rest-lambda/src/test/java/org/wicketstuff/rest/lambda/mounter/TestApplication.java index c9836b4423..6a25ae41ae 100644 --- a/wicketstuff-rest-lambda/src/test/java/org/wicketstuff/rest/lambda/mounter/TestApplication.java +++ b/wicketstuff-rest-lambda/src/test/java/org/wicketstuff/rest/lambda/mounter/TestApplication.java @@ -16,13 +16,15 @@ */ package org.wicketstuff.rest.lambda.mounter; +import java.beans.IntrospectionException; +import java.lang.reflect.InvocationTargetException; import java.util.HashMap; import java.util.Map; import org.apache.wicket.Page; -import org.apache.wicket.ajax.json.JSONObject; import org.apache.wicket.protocol.http.WebApplication; import org.apache.wicket.request.mapper.parameter.PageParameters; +import org.json.JSONObject; public class TestApplication extends WebApplication { @@ -47,7 +49,7 @@ protected void init() LambdaRestMounter restMounter = new LambdaRestMounter(this); restMounter.get("/testget", (attributes) -> "hello!", Object::toString); - restMounter.post("/testjson", (attributes) -> TestApplication.map, JSONObject::valueToString); + restMounter.post("/testjson", (attributes) -> TestApplication.map, TestApplication::toJson); restMounter.options("/testparam/${id}", (attributes) -> { PageParameters pageParameters = attributes.getPageParameters(); @@ -58,4 +60,13 @@ protected void init() restMounter.delete("/deleteit", (attributes) -> attributes.getWebResponse().write("deleted")); } + + public static String toJson(Object object) + { + try { + return new JSONObject(object).toString(); + } catch (InvocationTargetException | IllegalAccessException | IntrospectionException e) { + throw new RuntimeException(e); + } + } } diff --git a/wicketstuff-restannotations-parent/restannotations-json/pom.xml b/wicketstuff-restannotations-parent/restannotations-json/pom.xml index 53f09fa9f0..32e2021ba0 100644 --- a/wicketstuff-restannotations-parent/restannotations-json/pom.xml +++ b/wicketstuff-restannotations-parent/restannotations-json/pom.xml @@ -51,12 +51,10 @@ com.fasterxml.jackson.core jackson-databind - 2.6.3 com.google.code.gson gson - 2.4 junit diff --git a/wicketstuff-restannotations-parent/restannotations/pom.xml b/wicketstuff-restannotations-parent/restannotations/pom.xml index 40425d6fa4..f35cfe03fb 100644 --- a/wicketstuff-restannotations-parent/restannotations/pom.xml +++ b/wicketstuff-restannotations-parent/restannotations/pom.xml @@ -54,7 +54,11 @@ junit junit - + + com.fasterxml.jackson.core + jackson-databind + test + org.slf4j slf4j-api @@ -70,7 +74,6 @@ javax.servlet javax.servlet-api - 3.0.1 diff --git a/wicketstuff-restannotations-parent/restannotations/src/test/java/org/wicketstuff/rest/RestResourcesTest.java b/wicketstuff-restannotations-parent/restannotations/src/test/java/org/wicketstuff/rest/RestResourcesTest.java index 035d055435..555cf7cdd3 100644 --- a/wicketstuff-restannotations-parent/restannotations/src/test/java/org/wicketstuff/rest/RestResourcesTest.java +++ b/wicketstuff-restannotations-parent/restannotations/src/test/java/org/wicketstuff/rest/RestResourcesTest.java @@ -23,11 +23,15 @@ import java.io.StringWriter; import java.util.Collections; +import javax.servlet.http.Cookie; +import javax.xml.bind.JAXB; +import javax.xml.transform.stream.StreamResult; + import org.apache.wicket.Session; import org.apache.wicket.WicketRuntimeException; -import org.apache.wicket.ajax.json.JSONObject; import org.apache.wicket.authroles.authorization.strategies.role.Roles; import org.apache.wicket.util.tester.WicketTester; +import org.json.JSONObject; import org.junit.After; import org.junit.Assert; import org.junit.Before; @@ -42,10 +46,6 @@ import org.wicketstuff.rest.utils.test.BufferedMockRequest; import org.wicketstuff.rest.utils.wicket.bundle.DefaultBundleResolver; -import javax.servlet.http.Cookie; -import javax.xml.bind.JAXB; -import javax.xml.transform.stream.StreamResult; - /** * Simple test using the WicketTester diff --git a/wicketstuff-restannotations-parent/restannotations/src/test/java/org/wicketstuff/rest/contenthandling/objserialdeserial/TestJsonDesSer.java b/wicketstuff-restannotations-parent/restannotations/src/test/java/org/wicketstuff/rest/contenthandling/objserialdeserial/TestJsonDesSer.java index aa07947219..041e7bc792 100644 --- a/wicketstuff-restannotations-parent/restannotations/src/test/java/org/wicketstuff/rest/contenthandling/objserialdeserial/TestJsonDesSer.java +++ b/wicketstuff-restannotations-parent/restannotations/src/test/java/org/wicketstuff/rest/contenthandling/objserialdeserial/TestJsonDesSer.java @@ -16,12 +16,16 @@ */ package org.wicketstuff.rest.contenthandling.objserialdeserial; -import org.apache.wicket.ajax.json.JSONObject; import org.wicketstuff.rest.contenthandling.IObjectSerialDeserial; import org.wicketstuff.rest.resource.RestResourceFullAnnotated; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; + public class TestJsonDesSer implements IObjectSerialDeserial { + final ObjectMapper mapper = new ObjectMapper(); + static public Object getObject() { return RestResourceFullAnnotated.createTestPerson(); @@ -35,9 +39,14 @@ static public String getJSON() @Override public String serializeObject(Object targetObject, String mimeType) { - JSONObject jsonObject = new JSONObject(targetObject); - - return jsonObject.toString(); + try + { + return mapper.writeValueAsString(targetObject); + } + catch (JsonProcessingException e) + { + throw new RuntimeException(e); + } } @Override diff --git a/wicketstuff-selectize-parent/wicketstuff-selectize/src/main/java/org/wicketstuff/selectize/Selectize.java b/wicketstuff-selectize-parent/wicketstuff-selectize/src/main/java/org/wicketstuff/selectize/Selectize.java index dfcbc85f6e..b183f1cc4b 100644 --- a/wicketstuff-selectize-parent/wicketstuff-selectize/src/main/java/org/wicketstuff/selectize/Selectize.java +++ b/wicketstuff-selectize-parent/wicketstuff-selectize/src/main/java/org/wicketstuff/selectize/Selectize.java @@ -23,11 +23,12 @@ import java.util.Map; import org.apache.wicket.Component; +import org.apache.wicket.MarkupContainer; import org.apache.wicket.WicketRuntimeException; import org.apache.wicket.ajax.AbstractDefaultAjaxBehavior; import org.apache.wicket.ajax.AjaxRequestTarget; -import org.apache.wicket.ajax.json.JSONArray; -import org.apache.wicket.ajax.json.JSONObject; +import org.json.JSONArray; +import org.json.JSONObject; import org.apache.wicket.core.util.string.ComponentRenderer; import org.apache.wicket.markup.ComponentTag; import org.apache.wicket.markup.head.CssHeaderItem; @@ -405,4 +406,10 @@ public void setCreateAvailable(boolean createAvailable) { this.createAvailable = createAvailable; } + + @Override + public MarkupContainer setDefaultModel(IModel model) { + super.setDefaultModel(model); + return this; + } } diff --git a/wicketstuff-selectize-parent/wicketstuff-selectize/src/main/java/org/wicketstuff/selectize/SelectizeOption.java b/wicketstuff-selectize-parent/wicketstuff-selectize/src/main/java/org/wicketstuff/selectize/SelectizeOption.java index 9e92f3da5d..973fa1d6f8 100644 --- a/wicketstuff-selectize-parent/wicketstuff-selectize/src/main/java/org/wicketstuff/selectize/SelectizeOption.java +++ b/wicketstuff-selectize-parent/wicketstuff-selectize/src/main/java/org/wicketstuff/selectize/SelectizeOption.java @@ -22,7 +22,7 @@ import java.io.Serializable; import java.util.Iterator; -import org.apache.wicket.ajax.json.JSONObject; +import org.json.JSONObject; /** * Provides the model of the selectize component and can be customize by invoking diff --git a/wicketstuff-selectize-parent/wicketstuff-selectize/src/main/java/org/wicketstuff/selectize/SelectizeOptionGroup.java b/wicketstuff-selectize-parent/wicketstuff-selectize/src/main/java/org/wicketstuff/selectize/SelectizeOptionGroup.java index 139fb91c4b..45d214695b 100644 --- a/wicketstuff-selectize-parent/wicketstuff-selectize/src/main/java/org/wicketstuff/selectize/SelectizeOptionGroup.java +++ b/wicketstuff-selectize-parent/wicketstuff-selectize/src/main/java/org/wicketstuff/selectize/SelectizeOptionGroup.java @@ -22,7 +22,7 @@ import java.io.Serializable; import java.util.Iterator; -import org.apache.wicket.ajax.json.JSONObject; +import org.json.JSONObject; /** * Used to provide the model for the groups to the selectize component. If the groupId of this model diff --git a/wicketstuff-selectize-parent/wicketstuff-selectize/src/main/java/org/wicketstuff/selectize/SelectizeResponse.java b/wicketstuff-selectize-parent/wicketstuff-selectize/src/main/java/org/wicketstuff/selectize/SelectizeResponse.java index c67abceb26..adfe80bbbe 100644 --- a/wicketstuff-selectize-parent/wicketstuff-selectize/src/main/java/org/wicketstuff/selectize/SelectizeResponse.java +++ b/wicketstuff-selectize-parent/wicketstuff-selectize/src/main/java/org/wicketstuff/selectize/SelectizeResponse.java @@ -22,7 +22,8 @@ import java.util.Iterator; import java.util.List; -import org.apache.wicket.ajax.json.JSONObject; +import org.json.JSONArray; +import org.json.JSONObject; /** * The SelectizeResponse is the actual model object for ajax requests of the selectize component. @@ -35,7 +36,7 @@ public class SelectizeResponse extends JSONObject public SelectizeResponse(List options) { - put("options", options); + put("options", new JSONArray(options)); } private void writeObject(ObjectOutputStream out) throws IOException