| | |
| | | /**
|
| | | *
|
| | | */
|
| | | public abstract class ApiBase implements WebKontext, RequestKontext {
|
| | | public abstract class ApiBase implements RequestKontext {
|
| | |
|
| | | private static final Logger logger = Logger.getLogger(ApiBase.class.getName());
|
| | | |
| | | /** Zeiger zum Servlet-Kontext dieser Anwendung */
|
| | | protected ServletContext ctx;
|
| | |
|
| | | /** Zeiger zum Request, der zur Ausfuehrung fuehrte */
|
| | | protected HttpServletRequest request;
|
| | |
| | | * Das Datenverzeichnis der WebBox ermitteln
|
| | | * @return Ordner $wbx/daten
|
| | | */
|
| | | protected File getFileBase() {
|
| | | protected File getFileBase(ServletContext ctx) {
|
| | | File file = null;
|
| | | Object o = getServletContext().getAttribute(Initialiser.FILE_BASE);
|
| | | Object o = ctx.getAttribute(Initialiser.FILE_BASE);
|
| | | if(o instanceof String) {
|
| | | String baseStr = (String) o;
|
| | | logger.fine(baseStr);
|
| | |
| | | * Tomcat-Doku als CATALINA_BASE der WebBox gilt
|
| | | * @return absoluter Pfad zu $wbx/sys/base
|
| | | */
|
| | | protected String getCatalinaBase() {
|
| | | String path = getServletContext().getRealPath("/");
|
| | | protected String getCatalinaBase(ServletContext ctx) {
|
| | | String path = ctx.getRealPath("/");
|
| | | logger.fine("getRealPath: " + path); // file-cms in webapps
|
| | | File file = new File(path);
|
| | | file = file.getParentFile().getParentFile();
|
| | |
| | | * Den absoluten Pfad zum Datenverzeichnis der WebBox ermitteln
|
| | | * @return absoluter Pfad zu $wbx/daten
|
| | | */
|
| | | protected String getWbxDataDir() {
|
| | | return getFileBase().getAbsolutePath();
|
| | | protected String getWbxDataDir(ServletContext ctx) {
|
| | | return getFileBase(ctx).getAbsolutePath();
|
| | | }
|
| | |
|
| | | /**
|
| | | * Das Verzeichnis ermitteln, in dem die WebBox laeuft
|
| | | * @return der Ordner $wbx
|
| | | */
|
| | | protected File getWbxDir() {
|
| | | String path = getServletContext().getRealPath("/");
|
| | | protected File getWbxDir(ServletContext ctx) {
|
| | | String path = ctx.getRealPath("/");
|
| | | logger.fine("getRealPath: " + path);
|
| | | File file = new File(path);
|
| | | file = file.getParentFile().getParentFile().getParentFile().getParentFile();
|
| | |
| | | return userName;
|
| | | }
|
| | |
|
| | | /* ------------- Implementierung WebKontext ------------- */
|
| | |
|
| | | @Override
|
| | | public ServletContext getServletContext() {
|
| | | return ctx;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void setServletContext(ServletContext servletContext) {
|
| | | this.ctx = servletContext;
|
| | | }
|
| | | |
| | | /* ------------- Implementierung RequestKontext ------------- */
|
| | |
|
| | | @Override
|