From 87f8e99e48cc032148f7bb63d0f29c18d04c78a5 Mon Sep 17 00:00:00 2001 From: ulrich <ulrich@uhilger.de> Date: Wed, 10 Dec 2014 06:11:58 +0000 Subject: [PATCH] JSONNICE Wandler hinzugefĆ¼gt --- src/de/uhilger/transit/web/TransitServlet.java | 32 +++++++++++++++++++++----------- 1 files changed, 21 insertions(+), 11 deletions(-) diff --git a/src/de/uhilger/transit/web/TransitServlet.java b/src/de/uhilger/transit/web/TransitServlet.java index 55f7660..a4d22ff 100644 --- a/src/de/uhilger/transit/web/TransitServlet.java +++ b/src/de/uhilger/transit/web/TransitServlet.java @@ -17,6 +17,12 @@ */ package de.uhilger.transit.web; +import de.uhilger.transit.JavaServer; +import de.uhilger.transit.JsonFlatWandler; +import de.uhilger.transit.JsonNiceWandler; +import de.uhilger.transit.JsonWandler; +import de.uhilger.transit.NutzerKontext; +import de.uhilger.transit.XmlWandler; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; @@ -29,7 +35,6 @@ import java.util.ArrayList; import java.util.List; -import de.uhilger.transit.*; /** * Das TransitServlet macht beliebige Klassen und Methoden ueber HTTP @@ -156,16 +161,20 @@ while (en.hasMoreElements()) { String pName = en.nextElement().toString(); String[] pWerte = req.getParameterValues(pName); - if (pName.equals(CLASS_NAME)) { - klassenName = pWerte[0]; - } else if (pName.equals(METHOD_NAME)) { - methodenName = pWerte[0]; - } else if (pName.equals(FORMAT_NAME)) { - formatName = pWerte[0]; - } else { - for (int i = 0; i < pWerte.length; i++) { - parameterListe.add(pWerte[i]); - } + switch (pName) { + case CLASS_NAME: + klassenName = pWerte[0]; + break; + case METHOD_NAME: + methodenName = pWerte[0]; + break; + case FORMAT_NAME: + formatName = pWerte[0]; + break; + default: + for (String pWerte1 : pWerte) { + parameterListe.add(pWerte1); + } break; } } Object[] parameter = parameterListe.toArray(new Object[0]); @@ -174,6 +183,7 @@ server = new JavaServer(); server.wandlerHinzufuegen(new JsonWandler()); server.wandlerHinzufuegen(new JsonFlatWandler()); + server.wandlerHinzufuegen(new JsonNiceWandler()); server.wandlerHinzufuegen(new XmlWandler()); Class cls = server.klasseFinden(klassenName); if (cls != null) { -- Gitblit v1.9.3