commit be694d137777a3dd463260dd79ea042f91038cf8 Author: VogelT Date: Fri Sep 6 06:59:54 2024 +0200 web_shared start diff --git a/.ccproject b/.ccproject new file mode 100644 index 0000000..39b6138 --- /dev/null +++ b/.ccproject @@ -0,0 +1,16 @@ + + + + diff --git a/.classpath b/.classpath new file mode 100644 index 0000000..400589f --- /dev/null +++ b/.classpath @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.externalToolBuilders/build.xml [Builder].launch b/.externalToolBuilders/build.xml [Builder].launch new file mode 100644 index 0000000..55629c1 --- /dev/null +++ b/.externalToolBuilders/build.xml [Builder].launch @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b83d222 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/target/ diff --git a/.metadata/src/main/webapp/WEB-INF/faces-config.pageflow b/.metadata/src/main/webapp/WEB-INF/faces-config.pageflow new file mode 100644 index 0000000..85fa365 --- /dev/null +++ b/.metadata/src/main/webapp/WEB-INF/faces-config.pageflow @@ -0,0 +1,2 @@ + + diff --git a/.project b/.project new file mode 100644 index 0000000..129f616 --- /dev/null +++ b/.project @@ -0,0 +1,47 @@ + + + web_shared + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.wst.common.project.facet.core.builder + + + + + org.eclipse.wst.validation.validationbuilder + + + + + org.eclipse.ui.externaltools.ExternalToolBuilder + auto,full,incremental, + + + LaunchConfigHandle + <project>/.externalToolBuilders/build.xml [Builder].launch + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.jem.workbench.JavaEMFNature + org.eclipse.wst.common.modulecore.ModuleCoreNature + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + org.eclipse.wst.common.project.facet.core.nature + org.eclipse.wst.jsdt.core.jsNature + + diff --git a/.settings/.jsdtscope b/.settings/.jsdtscope new file mode 100644 index 0000000..1ef54ab --- /dev/null +++ b/.settings/.jsdtscope @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..e27eab0 --- /dev/null +++ b/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,11 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=21 +org.eclipse.jdt.core.compiler.compliance=21 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=disabled +org.eclipse.jdt.core.compiler.source=21 diff --git a/.settings/org.eclipse.m2e.core.prefs b/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..f897a7f --- /dev/null +++ b/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component new file mode 100644 index 0000000..1c95674 --- /dev/null +++ b/.settings/org.eclipse.wst.common.component @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml b/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml new file mode 100644 index 0000000..c32233e --- /dev/null +++ b/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/.settings/org.eclipse.wst.common.project.facet.core.xml b/.settings/org.eclipse.wst.common.project.facet.core.xml new file mode 100644 index 0000000..02570a5 --- /dev/null +++ b/.settings/org.eclipse.wst.common.project.facet.core.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/.settings/org.eclipse.wst.jsdt.ui.superType.container b/.settings/org.eclipse.wst.jsdt.ui.superType.container new file mode 100644 index 0000000..3bd5d0a --- /dev/null +++ b/.settings/org.eclipse.wst.jsdt.ui.superType.container @@ -0,0 +1 @@ +org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/.settings/org.eclipse.wst.jsdt.ui.superType.name b/.settings/org.eclipse.wst.jsdt.ui.superType.name new file mode 100644 index 0000000..05bd71b --- /dev/null +++ b/.settings/org.eclipse.wst.jsdt.ui.superType.name @@ -0,0 +1 @@ +Window \ No newline at end of file diff --git a/.settings/org.eclipse.wst.validation.prefs b/.settings/org.eclipse.wst.validation.prefs new file mode 100644 index 0000000..04cad8c --- /dev/null +++ b/.settings/org.eclipse.wst.validation.prefs @@ -0,0 +1,2 @@ +disabled=06target +eclipse.preferences.version=1 diff --git a/build.xml b/build.xml new file mode 100644 index 0000000..a25b4ec --- /dev/null +++ b/build.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + ${time.stamp} + + + + + + + + + + + + + + + + + + + diff --git a/launch/web_shared_deploy.launch b/launch/web_shared_deploy.launch new file mode 100644 index 0000000..64c182d --- /dev/null +++ b/launch/web_shared_deploy.launch @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..570af36 --- /dev/null +++ b/pom.xml @@ -0,0 +1,139 @@ + + 4.0.0 + de.tvo + web_shared + war + 0.0.1 + web_shared Maven Webapp + http://maven.apache.org + + + + org.eclnt + https://www.captaincasa.com/mavenrepository + + + + mvnrepository.com + https://mvnrepository.com/repos/central + + + org.outerj + https://maven.atlassian.com/3rdparty/ + + + + + + + 20240820_2 + + + + + org.eclnt + eclntjsfserverRISC_jakarta + ${cc.version} + + + + + + + ${project.artifactId} + + + src/main/java + + **/*.xml + **/*.jpg + **/*.png + **/*.html + **/*.icc + **/*.pdf + **/*.adoc + + + + src/main/resources + + + + + org.apache.maven.plugins + maven-deploy-plugin + 3.1.1 + + true + + + + org.apache.maven.plugins + maven-war-plugin + 3.3.2 + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + 21 + 21 + + + + + + + diff --git a/src/main/java/de/tvo/tools/StringUtil.java b/src/main/java/de/tvo/tools/StringUtil.java new file mode 100644 index 0000000..be4700f --- /dev/null +++ b/src/main/java/de/tvo/tools/StringUtil.java @@ -0,0 +1,449 @@ +package de.tvo.tools; + +import java.nio.charset.Charset; +import java.util.ArrayList; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +public class StringUtil { + + public StringUtil() { + + } + + /* + * TODO Grundsätzlich könnten alle StringÜbergabe Parameter durch Object + * ersetzt werden. Das hätte den Grundsätzlichen Vorteil das keine Doppelten + * Funktionen notwendig wären sondern immer die Selbe Funktion aufgerufen + * wird, egal ob String oder nicht + */ + + public static void main(String[] args) { + // TEST + } + + /** + * Function to return whether the source contains the search string or not. + * + * @param source Source to be searched + * @param search Searchstring + * @param ignoreCase Caseinsensitive or not + * @return true : Source contains search - False : Source does not contain search + */ + public static boolean searchToString(String source, String search, boolean ignoreCase) { + if (source != null && !source.isEmpty() && search != null && !search.isEmpty()) { + if (ignoreCase) { + return source.toLowerCase().contains(search.toLowerCase()); + } else { + return source.contains(search); + } + } else { + return false; + } + } + + public static int getPositionSearchString(String value, char search, int countSearchString) { + int position = -1; + int startPosition = 0; + int count = getCountLetter(value, search); + + if (count >= countSearchString) { + + for (int p = 0; p < countSearchString; p++) { + startPosition = value.indexOf(search+"", startPosition); + startPosition++; + } + position = startPosition; + } + return position; + } + + + public static int getCountLetter(String str, char letter) { + str = str.toLowerCase(); + letter = Character.toLowerCase(letter); + int count = 0; + + for (int i = 0; i < str.length(); i++) { + char currentLetter = str.charAt(i); + if (currentLetter == letter) + count++; + } + return count; + } + + /** + * Cuts source by lenght + * + * @param source source to be cut + * @param length lenght to be cut + * @return + */ + public static String subStringMaxLength(String source, int length) { + source = safeTrimWithReplace(source); + if (source.length() > length) { + return source.substring(0, length); + } + return source; + } + + /** + * Returns whether source is equal to search or not + * + * @param source Source to be searched + * @param search Searchstring + * @return true if equals, false if not comparable or not equals + */ + public static boolean safeEquals(String source, String search) { + if (source != null) { + return source.equals(search); + } + return false; + } + + /** + * Returns whether trimmed source is equal to search or not + * + * @param source Source to be searched + * @param search Searchstring + * @return true if equals, false if not comparable or not equals + */ + public static boolean safeEqualsWithTrim(String source, String search) { + if (source != null) { + return source.trim().equals(safeTrimWithReplace(search)); + } + return false; + } + + // TODO fragwürdig Grundsätzlich identisch mit safeIsBlankObj, Obj + // funktioniert aber auch bei String + + /** + * Returns whether the source is blank or not + * + * @param source Source to be searched + * @return true if blank or null, false not blank + */ + public static boolean safeIsBlank(String source) { + if (source != null) { + return source.trim().isEmpty(); + } + return true; + } + + // TODO fragwürdig Grundsätzlich identisch mit safeTrimObj, Obj funktioniert + // aber auch bei String + + /** + * Function for a safe trim, nullsafe + * + * @param source Source to be trimmed + * @return trimmed String or null + */ + public static String safeTrim(String source) { + if (source != null) { + return source.trim(); + } + return null; + } + + /** + * Returns whether the source is blank or not + * + * @param source Source to be searched + * @return true if blank or null, false not blank + */ + public static boolean safeIsBlankObj(Object source) { + return source == null || "".equals(source.toString()); + } + + /** + * Function for a safe trim, nullsafe + * + * @param source Source to be trimmed + * @return trimmed String or null + */ + public static String safeTrimObj(Object source) { + if (source != null) { + return source.toString().trim(); + } else { + return null; + } + } + + /** + * Function for a safe trim, nullsafe, which replaces null with emptystring + * + * @param source Source to be trimmed + * @return trimmed String or empty String + */ + public static String safeTrimWithReplace(String source) { + if (source != null) { + return source.trim(); + } else { + return ""; + } + } + + /** + * Replaces every occurance of search in source by replace. Any Regexpatterns will be escaped + * + * @param source Source to be searched + * @param search Searchstring + * @param replace Replacement of Searchstring + * @return String with replacement of search by replace or emptyString if null + */ + public static String replaceAllWithReplace(String source, String search, String replace) { + if (source == null || source.length() == 0) { + return new String(""); + } + return source.replaceAll(Pattern.quote(search), replace); + } + + /** + * Function that returns the Stacktrace as a String + * + * @param excep Thrown exception + * @return Stacktrace of exception or Emptrystring if null + */ + public static String getExceptionToStringWithReplace(Exception excep) { + if (excep == null) + return ""; + StackTraceElement[] trace = excep.getStackTrace(); + StringBuffer logBuffer = new StringBuffer(); + + logBuffer.append(excep + "\n"); + for (int i = 0; i < trace.length; i++) { + logBuffer.append("\tat " + trace[i] + "\n"); + } + + return logBuffer.toString(); + } + + /** + * Old function that only keeps being here for transfering reason. Use fillString with Boolean! + * + * @param data The data that should be filled + * @param totaleLenght total length the String should get + * @param fillWith what is the filling character supposed to be + * @param isRight Is the data supposed to be right of the filling + * @return Filled Data + */ + static public String fillString(Object data, int totaleLenght, String fillWith, String rechtslinks) { + return fillString(data, totaleLenght, fillWith, rechtslinks, false); + } + + /** + * Old function that only keeps being here for transfering reason. Use fillString with Boolean! + * + * @param data The data that should be filled + * @param totaleLenght total length the String should get + * @param fillWith what is the filling character supposed to be + * @param isRight Is the data supposed to be right of the filling + * @return Filled Data + */ + static public String fillString(Object data, int totaleLenght, String fillWith, String rechtslinks, boolean sendError) { + if (rechtslinks.equalsIgnoreCase("left")||rechtslinks.equalsIgnoreCase("links")) { + return fillString(data, totaleLenght, fillWith, false); + } else if (rechtslinks.equalsIgnoreCase("right")||rechtslinks.equalsIgnoreCase("rechts")) { + return fillString(data, totaleLenght, fillWith, true); + } + if (sendError) { + System.out.println("Ausrichtungsfehler: " + rechtslinks); + } + if (data != null) { + return data.toString(); + } + return ""; + } + + + /** + * Function to fill up a String with a given Character to either the right + * or the left + * + * @param data The data that should be filled + * @param totaleLenght total length the String should get + * @param fillWith what is the filling character supposed to be + * @param isRight Is the data supposed to be right of the filling + * @return Filled Data + */ + static public String fillString(Object data, int totaleLenght, String fillWith, boolean isRight) { + StringBuffer stringFueller = new StringBuffer(); + if (data == null) { + data = ""; + } + for (int i = 0; i < totaleLenght - data.toString().length(); ++i) { + stringFueller.append(fillWith); + } + return isRight ? stringFueller.toString() + data : data + stringFueller.toString(); + } + + static final private Pattern specialCharFinder = Pattern.compile("[a-zA-Z0-9]+"); + /** + * Function to return wheter given String has invalid Characters or not + * + * @return true if there is no Special char, false if there is a special char + */ + static public boolean noSpecialChars(String checkString){ + return specialCharFinder.matcher(checkString).matches(); + } + + public static String safeTrimObjWithReplace(Object text){ + if (text != null) { + return text.toString().trim(); + } else { + return ""; + } + } + + /** + * Check E-Mail Adresse with RFC Standard Pattern + * @param emails One E-Mail or E-Mails seperated with Semikolon + * @return True = valid; or False = not valid + */ + public static boolean checkEmailRFC(String emails) { + boolean result = false; + if (emails == null) { + return false; + } + + //RFC E-Mail Adress Pattern + Pattern ptr = Pattern.compile("(?:(?:\\r\\n)?[ \\t])*(?:(?:(?:[^()<>@,;:\\\\\".\\[\\] \\000-\\031]+(?:(?:(?:\\r\\n)?[ \\t])+|\\Z|(?=[\\[\"()<>@,;:\\\\\".\\[\\]]))|\"(?:[^\\\"\\r\\\\]|\\\\.|(?:(?:\\r\\n)?[ \\t]))*\"(?:(?:\\r\\n)?[ \\t])*)(?:\\.(?:(?:\\r\\n)?[ \\t])*(?:[^()<>@,;:\\\\\".\\[\\] \\000-\\031]+(?:(?:(?:\\r\\n)?[ \\t])+|\\Z|(?=[\\[\"()<>@,;:\\\\\".\\[\\]]))|\"(?:[^\\\"\\r\\\\]|\\\\.|(?:(?:\\r\\n)?[ \\t]))*\"(?:(?:\\r\\n)?[ \\t])*))*@(?:(?:\\r\\n)?[ \\t])*(?:[^()<>@,;:\\\\\".\\[\\] \\000-\\031]+(?:(?:(?:\\r\\n)?[ \\t])+|\\Z|(?=[\\[\"()<>@,;:\\\\\".\\[\\]]))|\\[([^\\[\\]\\r\\\\]|\\\\.)*\\](?:(?:\\r\\n)?[ \\t])*)(?:\\.(?:(?:\\r\\n)?[ \\t])*(?:[^()<>@,;:\\\\\".\\[\\] \\000-\\031]+(?:(?:(?:\\r\\n)?[ \\t])+|\\Z|(?=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t])*))*@(?:(?:\\r\\n)?[ \\t])*(?:[^()<>@,;:\\\\\".\\[\\] \\000-\\031]+(?:(?:(?:\\r\\n)?[ \\t])+|\\Z|(?=[\\[\"()<>@,;:\\\\\".\\[\\]]))|\\[([^\\[\\]\\r\\\\]|\\\\.)*\\](?:(?:\\r\\n)?[ \\t])*)(?:\\.(?:(?:\\r\\n)?[ \\t])*(?:[^()<>@,;:\\\\\".\\[\\] \\000-\\031]+(?:(?:(?:\\r\\n)?[ \\t])+|\\Z|(?=[\\[\"()<>@,;:\\\\\".\\[\\]]))|\\[([^\\[\\]\\r\\\\]|\\\\.)*\\](?:(?:\\r\\n)?[ \\t])*))*\\>(?:(?:\\r\\n)?[ \\t])*))*)?;\\s*)"); + + if (emails.contains(";")) { + String[] s = emails.split(";"); + for (int j = 0; j < s.length; j++) { + if (!ptr.matcher(s[j].trim()).matches()) { + return false; + } else { + result = true; + } + } + } else { + if (!ptr.matcher(emails.trim()).matches()) { + return false; + } else { + result = true; + } + } + + return result; + } + + + public static List checkIfTextContainsMails(String text) { + List correctEmails = new ArrayList<>(); + + Matcher m = Pattern.compile("[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\\.[a-zA-Z0-9-.]+").matcher(text); + + while (m.find()) { + correctEmails.add(m.group()); + } + + return correctEmails; + } + + + + /** + * Tool to convert Umlauts into the english kind + * @param forconvert contains the string for convertion + * @return + */ + public static String convertUmlauts(final String forconvert){ + if (forconvert != null && !forconvert.isEmpty()){ + return forconvert.replace("ö", "oe").replace("ä", "ae").replace("ü", "ue").replace("Ö", "Oe").replace("Ä", "Ae").replace("Ü", "Ue").replace("ß", "ss"); + } + return forconvert; + } + + + /** + * Replace umlaut's and some sonderzeichen's to HTML conform equivalents, e. g. 'Ö' gets 'Ö' + * @param source - the html source to be converted + * @return returns converted string or null if source was null + */ + public static String escapeHtml(String source) { + if (source == null) { + return null; + } + String s = source.replace("Ä", "Ä").replace("ä", "ä").replace("Ö", "Ö").replace("ö", "ö") + .replace("Ü", "Ü").replace("ü", "ü").replace("€", "€").replace("ß", "ß") + .replace("§", "§"); + return s; + } + + /** + * Convert String to HTML (replace \n with
and so on) + * Source: https://stackoverflow.com/a/42854032 + * @param string + * @return + */ + public static String stringToHTMLString(String string) { + StringBuffer sb = new StringBuffer(string.length()); + // true if last char was blank + boolean lastWasBlankChar = false; + int len = string.length(); + char c; + + for (int i = 0; i < len; i++) { + c = string.charAt(i); + if (c == ' ') { + // blank gets extra work, + // this solves the problem you get if you replace all + // blanks with  , if you do that you loss + // word breaking + if (lastWasBlankChar) { + lastWasBlankChar = false; + sb.append(" "); + } else { + lastWasBlankChar = true; + sb.append(' '); + } + } else { + lastWasBlankChar = false; + // + // HTML Special Chars + if (c == '"') + sb.append("""); + else if (c == '&') + sb.append("&"); + else if (c == '<') + sb.append("<"); + else if (c == '>') + sb.append(">"); + else if (c == '\n') + // Handle Newline + sb.append("
"); + else { + int ci = 0xffff & c; + if (ci < 160) + // nothing special only 7 Bit + sb.append(c); + else { + // Not 7 Bit use the unicode system + sb.append("&#"); + sb.append(Integer.valueOf(ci).toString()); + sb.append(';'); + } + } + } + } + return sb.toString(); + } + + + + /** + * Check if the AS/400 can handle the string + * @param str + * @return if the string is valid in CP273 + */ + public static boolean checkIfStringIsCP273(final String str) { + return Charset.forName("IBM01141").newEncoder().canEncode(str); + } + + +} diff --git a/src/main/java/managedbeans/Dispatcher.java b/src/main/java/managedbeans/Dispatcher.java new file mode 100644 index 0000000..fdd850e --- /dev/null +++ b/src/main/java/managedbeans/Dispatcher.java @@ -0,0 +1,51 @@ +package managedbeans; + +import org.eclnt.workplace.IWorkpageContainer; +import org.eclnt.workplace.WorkpageDispatcher; + +/* + * The dispatcher is referenced in faces-config.xml. When changing the package + * of the dispatcher, then also update the faces-config.xml link! + */ +public class Dispatcher extends WorkpageDispatcher +{ + // ------------------------------------------------------------------------ + // constructors + // ------------------------------------------------------------------------ + + /** + * Constructor that is used for the root dispatcher, e.g. "#{d}". + */ + public Dispatcher() + { + // add any implementation... + } + + /** + * Dispatcher that is used for the sub dispatcher objects, e.g. "#{d.d_1}". + */ + public Dispatcher(IWorkpageContainer workpageContainer) + { + super(workpageContainer); + // add any implementation... + } + + // ------------------------------------------------------------------------ + // public usage + // ------------------------------------------------------------------------ + + /** + * This method needs to be implemented if you want to extend the information + * within the page bean browser tool. Otherwise leave unchanged. + */ + public static DispatcherInfo getStaticDispatcherInfo() { return new DispatcherInfo(Dispatcher.class); } + + /** + * Convenience access to access the root dispatcher in the current dialog session. + */ + public static Dispatcher getDialogSessionInstance() + { + // correctly casting the generic dispatcher into this class + return (Dispatcher)WorkpageDispatcher.getDialogSessionInstance(); + } +} diff --git a/src/main/webapp/WEB-INF/faces-config.xml b/src/main/webapp/WEB-INF/faces-config.xml new file mode 100644 index 0000000..1af2463 --- /dev/null +++ b/src/main/webapp/WEB-INF/faces-config.xml @@ -0,0 +1,14 @@ + + + + + + d + managedbeans.Dispatcher + session + + + diff --git a/src/main/webapp/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000..d81636b --- /dev/null +++ b/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,61 @@ + + + + + + + CaptainCasa based application + + index.html + index.htm + index.jsp + default.html + default.htm + default.jsp + + + + + + + org.jboss.jbossfaces.WAR_BUNDLES_JSF_IMPL + true + + + + + org.eclnt.jsfserver.util.CCServletContextListener + + + + + + + + 60 + COOKIE + + true + true + + + + diff --git a/src/main/webapp/eclntjsfserver/config/hotdeploy.xml b/src/main/webapp/eclntjsfserver/config/hotdeploy.xml new file mode 100644 index 0000000..b2c3612 --- /dev/null +++ b/src/main/webapp/eclntjsfserver/config/hotdeploy.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/src/main/webapp/eclntjsfserver/config/sessiondefaults.xml b/src/main/webapp/eclntjsfserver/config/sessiondefaults.xml new file mode 100644 index 0000000..eef0a76 --- /dev/null +++ b/src/main/webapp/eclntjsfserver/config/sessiondefaults.xml @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/src/main/webapp/eclntjsfserver/config/system.xml b/src/main/webapp/eclntjsfserver/config/system.xml new file mode 100644 index 0000000..46e5c3c --- /dev/null +++ b/src/main/webapp/eclntjsfserver/config/system.xml @@ -0,0 +1,3 @@ + + +