From ac059cdc92b9b9cbfc47850dded547dd2f206325 Mon Sep 17 00:00:00 2001 From: ulrich <ulrich@uhilger.de> Date: Sun, 16 Nov 2014 19:03:13 +0000 Subject: [PATCH] RechteDb entfernt --- src/de/uhilger/transit/web/TransitServletRS.java | 62 ++++--------------------------- 1 files changed, 8 insertions(+), 54 deletions(-) diff --git a/src/de/uhilger/transit/web/TransitServletRS.java b/src/de/uhilger/transit/web/TransitServletRS.java index c272c38..cadcac9 100644 --- a/src/de/uhilger/transit/web/TransitServletRS.java +++ b/src/de/uhilger/transit/web/TransitServletRS.java @@ -48,26 +48,13 @@ * * @version 1, September 16, 2012 */ -public class TransitServletRS extends HttpServlet { +public class TransitServletRS extends AbstractServlet { /** Proforma Konstante fuer Schnittstelle Serializable */ public static final long serialVersionUID = 42L; private static final Logger logger = Logger.getLogger(TransitServletRS.class.getName()); - - public static final String MIME_JSON = "application/json"; - public static final String MIME_XML = "text/xml"; - - private static final String[] specialChars = {new String("\u00c4"), new String("\u00d6"), - new String("\u00dc"), new String("\u00e4"), new String("\u00f6"), new String("\u00fc"), new String("\u00df")}; - - private String klassen; - - public void init(ServletConfig servletConfig) throws ServletException{ - this.klassen = servletConfig.getInitParameter("klassen"); - super.init(servletConfig); - } - + /** * Eine Anfrage via HTTP GET verarbeiten * @@ -128,44 +115,21 @@ JavaServer server = null; try { /* - String klassenName = null; - String methodenName = null; - List parameterListe = new ArrayList(); - String formatName = null; - Enumeration en = req.getParameterNames(); - 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]); - } - } - } - */ - - /* http://server:port/contextpfad/servletpfad/de.irgend.eine.Klasse/methode/format/param1/param2/../paramN wird zu elemente[0] = / elemente[1] = de.irgend.eine.Klasse elemente[2] = methode elemente[3] = format - elemente[4]-[n] = param1 + elemente[4]-[n] = param1 - paramn */ String pathInfo = req.getPathInfo(); - logger.info("pathInfo: " + pathInfo); + logger.log(Level.INFO, "pathInfo: {0}", pathInfo); String[] elemente = pathInfo.split("/"); String klassenName = elemente[1]; - StringBuffer buf = new StringBuffer(); - if(this.klassen.contains(klassenName)) { + StringBuilder buf = new StringBuilder(); + if(istErlaubt(klassenName)) { String methodenName = elemente[2]; String formatName = elemente[3]; List parameterListe = new ArrayList(); @@ -184,7 +148,7 @@ Object o = cls.newInstance(); if(o != null) { if(o instanceof NutzerKontext) { - ((NutzerKontext) o).setNutzerId(Waechter.getUserName(req)); + ((NutzerKontext) o).setNutzerId(getUserName(req)); } if(o instanceof WebKontext) { ((WebKontext) o).setServletContext(getServletContext()); @@ -235,15 +199,5 @@ } } } - - public String escapeHtml(String text) { - text = text.replace(specialChars[0], "Ä"); - text = text.replace(specialChars[1], "Ö"); - text = text.replace(specialChars[2], "Ü"); - text = text.replace(specialChars[3], "ä"); - text = text.replace(specialChars[4], "ö"); - text = text.replace(specialChars[5], "ü"); - text = text.replace(specialChars[6], "ß"); - return text; - } + } \ No newline at end of file -- Gitblit v1.9.3