publish/logging.properties | ●●●●● patch | view | raw | blame | history | |
publish/start | ●●●●● patch | view | raw | blame | history | |
src/de/uhilger/mediaz/App.java | ●●●●● patch | view | raw | blame | history | |
src/de/uhilger/mediaz/api/FileHandler.java | ●●●●● patch | view | raw | blame | history | |
src/de/uhilger/mediaz/api/StorageHandler.java | ●●●●● patch | view | raw | blame | history | |
src/de/uhilger/mediaz/store/FileStorage.java | ●●●●● patch | view | raw | blame | history | |
www/ui/js/app.js | ●●●●● patch | view | raw | blame | history |
publish/logging.properties
New file @@ -0,0 +1,72 @@ ############################################################ # Default Logging Configuration File # # You can use a different file by specifying a filename # with the java.util.logging.config.file system property. # For example java -Djava.util.logging.config.file=myfile ############################################################ ############################################################ # Global properties ############################################################ # "handlers" specifies a comma separated list of log Handler # classes. These handlers will be installed during VM startup. # Note that these classes must be on the system classpath. # By default we only configure a ConsoleHandler, which will only # show messages at the INFO and above levels. # handlers= java.util.logging.ConsoleHandler # To also add the FileHandler, use the following line instead. # handlers= java.util.logging.FileHandler, java.util.logging.ConsoleHandler # Default global logging level. # This specifies which kinds of events are logged across # all loggers. For any given facility this global level # can be overriden by a facility specific level # Note that the ConsoleHandler also has a separate level # setting to limit messages printed to the console. .level= FINEST # .level = NONE ############################################################ # Handler specific properties. # Describes specific configuration info for Handlers. ############################################################ # default file output is in user's home directory. java.util.logging.FileHandler.pattern = %h/mediaz-%u.log # java.util.logging.FileHandler.pattern = /media/extmirror/tomcat747/logs/tv_%u.log # java.util.logging.FileHandler.pattern = ${catalina.base}/logs/file-cms_%u.log # java.util.logging.FileHandler.limit = 50000 # java.util.logging.FileHandler.count = 1 # java.util.logging.FileHandler.count = 2 # java.util.logging.FileHandler.formatter = java.util.logging.XMLFormatter java.util.logging.FileHandler.formatter = java.util.logging.SimpleFormatter # java.util.logging.FileHandler.level = FINER # Limit the message that are printed on the console to INFO and above. # java.util.logging.ConsoleHandler.level = INFO # java.util.logging.ConsoleHandler.level = FINER # java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter # Example to customize the SimpleFormatter output format # to print one-line log message like this: # <level>: <log message> [<date/time>] # # java.util.logging.SimpleFormatter.format=%4$s: %5$s [%1$tc]%n ############################################################ # Facility specific properties. # Provides extra control for each logger. ############################################################ # For example, set the com.xyz.foo logger to only log SEVERE # messages: # com.xyz.foo.level = SEVERE # de.uhilger.filecms.handlers = java.util.logging.FileHandler, java.util.logging.ConsoleHandler # de.uhilger.filecms.level = FINEST # de.uhilger.wbx.handlers = java.util.logging.ConsoleHandler # de.uhilger.wbx.level = FINEST de.uhilger.mediaz.handlers = java.util.logging.FileHandler, java.util.logging.ConsoleHandler de.uhilger.mediaz.level = FINEST publish/start
New file @@ -0,0 +1,3 @@ #!/bin/sh java -Djava.util.logging.config.file=logging.properties -jar mediaz.jar port=9090 ctx=/mz www-data=./www conf=conf src/de/uhilger/mediaz/App.java
@@ -55,7 +55,7 @@ */ public static void main(String[] args) throws ClassNotFoundException { rb = ResourceBundle.getBundle(RB_NAME); logger.info(new File(".").getAbsolutePath()); logger.fine(new File(".").getAbsolutePath()); initParams = new HashMap(); for (String arg : args) { src/de/uhilger/mediaz/api/FileHandler.java
@@ -133,7 +133,7 @@ protected String getFileName(HttpExchange e) { String ctxPath = e.getHttpContext().getPath(); String uriPath = e.getRequestURI().getPath(); logger.info(uriPath); logger.fine(uriPath); return uriPath.substring(ctxPath.length()); } src/de/uhilger/mediaz/api/StorageHandler.java
@@ -120,7 +120,7 @@ } break; } logger.info(response); logger.fine(response); e.sendResponseHeaders(code, response.length()); OutputStream os = e.getResponseBody(); os.write(response.getBytes()); @@ -143,13 +143,13 @@ String filename = ""; FileStorage fs = new FileStorage(App.getInitParameter(App.getRs(App.RB_AP_CONF))); Gson gson = new Gson(); logger.log(Level.INFO, "type: {0}", type); logger.log(Level.FINE, "type: {0}", type); Object o = gson.fromJson(body, fs.typeFromName(type).getType()); if(o instanceof Entity) { Object antwortObjekt = fs.write((Entity) o, overwrite); if(antwortObjekt instanceof File) { File file = (File) antwortObjekt; logger.log(Level.INFO, "Datei {0} geschrieben.", file.getAbsolutePath()); logger.log(Level.FINE, "Datei {0} geschrieben.", file.getAbsolutePath()); filename = file.getName(); return type + FileHandler.STR_BLANK + filename; } @@ -178,7 +178,7 @@ FileStorage fs = new FileStorage(App.getInitParameter(App.getRs(App.RB_AP_CONF))); if(path.endsWith(App.getRs(RB_SLASH))) { String type = elems[elems.length - 1]; logger.info(type); logger.fine(type); List list = fs.list(type); return jsonWithEnclosingType(list); } else { @@ -210,7 +210,7 @@ } r.close(); String json = sb.toString(); logger.log(Level.INFO, "json: {0}", json); logger.log(Level.FINE, "json: {0}", json); return json; } } src/de/uhilger/mediaz/store/FileStorage.java
@@ -148,12 +148,14 @@ public List<String> list(String typ) { File base = new File(fileBase); File dir = new File(base, typ); File[] files = dir.listFiles(); List<String> list = new ArrayList(); for(File file : files) { //NamedItem n = new NamedItem(); //n.setLabel(file.getName()); list.add(file.getName()); File[] files = dir.listFiles(); if(files != null) { for(File file : files) { //NamedItem n = new NamedItem(); //n.setLabel(file.getName()); list.add(file.getName()); } } return list; } www/ui/js/app.js
@@ -60,11 +60,11 @@ // hier die Antwort verarbeiten }); } document.querySelector(".zentraler-inhalt").innerHTML = ''; //document.querySelector(".zentraler-inhalt").innerHTML = ''; self.ablageort_liste(); }); self.addEvtListener('#cancel-btn', 'click', function () { document.querySelector(".zentraler-inhalt").innerHTML = ''; //document.querySelector(".zentraler-inhalt").innerHTML = ''; self.ablageort_liste(); }); self.addEvtListener('#loeschen-btn', 'click', function() { @@ -76,7 +76,7 @@ self.http_delete('../api/store/Ablageort/' + aoname, '', function (responseText) { // hier die Antwort verarbeiten self.dialog_schliessen(); document.querySelector(".zentraler-inhalt").innerHTML = ''; //document.querySelector(".zentraler-inhalt").innerHTML = ''; self.ablageort_liste(); }); });