Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

V.9-09/04/2012

  • Loading branch information...
commit 13ac6182007f46b73e7eecfb067255cbb27b6363 2 parents befe7f4 + 81b81b0
ngasiproj authored
Showing with 5,399 additions and 223 deletions.
  1. +4 −0 bin/deamon.sh
  2. +8 −1 bin/derby.log
  3. +19 −0 conf/server.xml
  4. +34 −0 logs/catalina.2012-06-16.log
  5. 0  logs/host-manager.2012-06-16.log
  6. +32 −0 logs/localhost.2012-06-16.log
  7. +8 −0 logs/localhost_access_log.2012-06-16.txt
  8. 0  logs/manager.2012-06-16.log
  9. +4 −0 source/ngasi/caimito/CaimitoConfig.java
  10. 0  source/ngasi/caimito/CaimitoDefaultServlet.java
  11. 0  source/ngasi/caimito/CaimitoException.java
  12. 0  source/ngasi/caimito/CaimitoUtil.java
  13. +3,460 −0 source/ngasi/caimito/CaimitoWebdavServlet.java
  14. 0  source/ngasi/caimito/resource/CacheMgr.java
  15. 0  source/ngasi/caimito/resource/CloudResourceObj.java
  16. 0  source/ngasi/caimito/resource/FileResourceObj.java
  17. +794 −0 source/ngasi/caimito/resource/OpenStackResourceObj.java
  18. 0  source/ngasi/caimito/resource/ResourceObj.java
  19. +789 −0 source/ngasi/caimito/resource/ResourceStore.java
  20. 0  source/ngasi/caimito/resource/ShaftAppMgr.java
  21. 0  source/ngasi/caimito/resource/ShaftResourceObj.java
  22. +6 −0 webapps/WEB-INF/caimito/config.properties.sample
  23. +19 −0 webapps/WEB-INF/web.xml
  24. +222 −222 webapps/index.jsp
4 bin/deamon.sh
View
@@ -1,5 +1,9 @@
#!/bin/sh
+<<<<<<< HEAD
#cd $CAIMITO_HOME/bin
+=======
+cd $CAIMITO_HOME/bin
+>>>>>>> 81b81b090d652d7b3c1de4359597c4836eb617da
export JAVA_OPTS="-Dsun.net.inetaddr.ttl=0 -Dnetworkaddress.cache.ttl=0"
9 bin/derby.log
View
@@ -1,10 +1,17 @@
----------------------------------------------------------------
+<<<<<<< HEAD
Tue Sep 04 01:27:13 PDT 2012:
Booting Derby version The Apache Software Foundation - Apache Derby - 10.8.2.2 - (1181258): instance a816c00e-0139-9063-f3d7-000002bafa60
on database directory /home/idrive/caimito/bin/caimito_db with class loader org.apache.catalina.loader.StandardClassLoader@1df5a8f
Loaded from file:/home/idrive/caimito/lib/derby.jar
+=======
+Mon Jun 18 07:38:38 EDT 2012:
+Booting Derby version The Apache Software Foundation - Apache Derby - 10.8.2.2 - (1181258): instance a816c00e-0137-ff63-2b87-000002f69fb8
+on database directory /usr/caimito/bin/caimito_db with class loader org.apache.catalina.loader.StandardClassLoader@2a4983
+Loaded from file:/usr/caimito/lib/derby.jar
+>>>>>>> 81b81b090d652d7b3c1de4359597c4836eb617da
java.vendor=Sun Microsystems Inc.
java.runtime.version=1.6.0_24-b07
-user.dir=/home/idrive/caimito/bin
+user.dir=/usr/caimito/bin
derby.system.home=null
Database Class Loader started - derby.database.classpath=''
19 conf/server.xml
View
@@ -66,20 +66,33 @@
Java AJP Connector: /docs/config/ajp.html
APR (HTTP/AJP) Connector: /docs/apr.html
Define a non-SSL HTTP/1.1 Connector on port 8619
+<<<<<<< HEAD
--> <!--
<Connector port="8619" protocol="org.apache.coyote.http11.Http11NioProtocol"
connectionTimeout="20000"
redirectPort="8639" /> -->
<!-- A "Connector" using the shared thread pool
+=======
+ -->
+ <Connector port="8619" protocol="HTTP/1.1"
+ connectionTimeout="20000"
+ redirectPort="8639" />
+ <!-- A "Connector" using the shared thread pool-->
+ <!--
+>>>>>>> 81b81b090d652d7b3c1de4359597c4836eb617da
<Connector executor="tomcatThreadPool"
port="8619" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8639" />
+<<<<<<< HEAD
-->
<Connector port="8619" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8639" />
+=======
+ -->
+>>>>>>> 81b81b090d652d7b3c1de4359597c4836eb617da
<!-- Define a SSL HTTP/1.1 Connector on port 8639
This connector uses the JSSE configuration, when using APR, the
connector should be using the OpenSSL style configuration
@@ -90,9 +103,15 @@
clientAuth="false" sslProtocol="TLS" />
-->
+<<<<<<< HEAD
<!-- Define an AJP 1.3 Connector on port 8659
<Connector port="8659" protocol="AJP/1.3" redirectPort="8639" />
-->
+=======
+ <!-- Define an AJP 1.3 Connector on port 8659 -->
+ <Connector port="8659" protocol="AJP/1.3" redirectPort="8639" />
+
+>>>>>>> 81b81b090d652d7b3c1de4359597c4836eb617da
<!-- An Engine represents the entry point (within Catalina) that processes
every request. The Engine implementation for Tomcat stand alone
34 logs/catalina.2012-06-16.log
View
@@ -0,0 +1,34 @@
+Jun 16, 2012 10:41:13 AM org.apache.catalina.core.AprLifecycleListener init
+INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /usr/caimito/jdk/jre/lib/i386/server:/usr/caimito/jdk/jre/lib/i386:/usr/caimito/jdk/jre/../lib/i386:/usr/java/packages/lib/i386:/lib:/usr/lib
+Jun 16, 2012 10:41:14 AM org.apache.coyote.AbstractProtocol init
+INFO: Initializing ProtocolHandler ["http-bio-8619"]
+Jun 16, 2012 10:41:14 AM org.apache.coyote.AbstractProtocol init
+INFO: Initializing ProtocolHandler ["ajp-bio-8659"]
+Jun 16, 2012 10:41:14 AM org.apache.catalina.startup.Catalina load
+INFO: Initialization processed in 1438 ms
+Jun 16, 2012 10:41:14 AM org.apache.catalina.core.StandardService startInternal
+INFO: Starting service Catalina
+Jun 16, 2012 10:41:14 AM org.apache.catalina.core.StandardEngine startInternal
+INFO: Starting Servlet Engine: Apache Tomcat/7.0.27
+Jun 16, 2012 10:41:14 AM org.apache.catalina.startup.HostConfig deployDescriptor
+INFO: Deploying configuration descriptor /usr/caimito/conf/Catalina/localhost/ROOT.xml
+Jun 16, 2012 10:41:17 AM org.apache.coyote.AbstractProtocol start
+INFO: Starting ProtocolHandler ["http-bio-8619"]
+Jun 16, 2012 10:41:17 AM org.apache.coyote.AbstractProtocol start
+INFO: Starting ProtocolHandler ["ajp-bio-8659"]
+Jun 16, 2012 10:41:17 AM org.apache.catalina.startup.Catalina start
+INFO: Server startup in 2805 ms
+Jun 16, 2012 10:44:20 AM org.apache.coyote.AbstractProtocol pause
+INFO: Pausing ProtocolHandler ["http-bio-8619"]
+Jun 16, 2012 10:44:20 AM org.apache.coyote.AbstractProtocol pause
+INFO: Pausing ProtocolHandler ["ajp-bio-8659"]
+Jun 16, 2012 10:44:20 AM org.apache.catalina.core.StandardService stopInternal
+INFO: Stopping service Catalina
+Jun 16, 2012 10:44:20 AM org.apache.coyote.AbstractProtocol stop
+INFO: Stopping ProtocolHandler ["http-bio-8619"]
+Jun 16, 2012 10:44:20 AM org.apache.coyote.AbstractProtocol stop
+INFO: Stopping ProtocolHandler ["ajp-bio-8659"]
+Jun 16, 2012 10:44:20 AM org.apache.coyote.AbstractProtocol destroy
+INFO: Destroying ProtocolHandler ["http-bio-8619"]
+Jun 16, 2012 10:44:20 AM org.apache.coyote.AbstractProtocol destroy
+INFO: Destroying ProtocolHandler ["ajp-bio-8659"]
0  logs/host-manager.2012-06-16.log
View
No changes.
32 logs/localhost.2012-06-16.log
View
@@ -0,0 +1,32 @@
+Jun 16, 2012 10:41:22 AM org.apache.catalina.core.StandardWrapperValve invoke
+SEVERE: Servlet.service() for servlet [webdav] in context with path [] threw exception [Error accessing resource] with root cause
+ngasi.caimito.CaimitoException: java.lang.NullPointerException
+ at ngasi.caimito.CaimitoException.throwException(CaimitoException.java:56)
+ at ngasi.caimito.resource.OpenStackResourceObj.auth(OpenStackResourceObj.java:525)
+ at ngasi.caimito.resource.OpenStackResourceObj.doList(OpenStackResourceObj.java:535)
+ at ngasi.caimito.resource.ResourceObj.list(ResourceObj.java:117)
+ at ngasi.caimito.CaimitoDefaultServlet.renderHtml(CaimitoDefaultServlet.java:1543)
+ at ngasi.caimito.CaimitoDefaultServlet.render(CaimitoDefaultServlet.java:1338)
+ at ngasi.caimito.CaimitoDefaultServlet.serveResource(CaimitoDefaultServlet.java:1034)
+ at ngasi.caimito.CaimitoDefaultServlet.doGet(CaimitoDefaultServlet.java:477)
+ at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
+ at ngasi.caimito.CaimitoWebdavServlet.service(CaimitoWebdavServlet.java:413)
+ at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
+ at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
+ at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
+ at org.shaft.ShaftFilter.doFilter(ShaftFilter.java:204)
+ at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
+ at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
+ at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:225)
+ at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
+ at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
+ at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
+ at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
+ at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
+ at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
+ at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:999)
+ at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:565)
+ at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:307)
+ at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
+ at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
+ at java.lang.Thread.run(Thread.java:662)
8 logs/localhost_access_log.2012-06-16.txt
View
@@ -0,0 +1,8 @@
+127.0.0.1 - - [16/Jun/2012:10:41:22 -0400] "GET / HTTP/1.1" 500 762
+127.0.0.1 - - [16/Jun/2012:10:41:22 -0400] "GET /ca/js/libs/modernizr-2.5.3.min.js HTTP/1.1" 304 -
+127.0.0.1 - - [16/Jun/2012:10:41:22 -0400] "GET /ca/css/style.css HTTP/1.1" 304 -
+127.0.0.1 - - [16/Jun/2012:10:41:22 -0400] "GET /ca/js/plugins.js HTTP/1.1" 304 -
+127.0.0.1 - - [16/Jun/2012:10:41:22 -0400] "GET /ca/js/script.js HTTP/1.1" 304 -
+127.0.0.1 - - [16/Jun/2012:10:41:22 -0400] "GET /ca/logo.png HTTP/1.1" 304 -
+127.0.0.1 - - [16/Jun/2012:10:41:22 -0400] "GET /ca/assets/Molot.woff HTTP/1.1" 404 1196
+127.0.0.1 - - [16/Jun/2012:10:41:22 -0400] "GET /ca/assets/Molot.ttf HTTP/1.1" 404 1196
0  logs/manager.2012-06-16.log
View
No changes.
4 source/ngasi/caimito/CaimitoConfig.java 100755 → 100644
View
@@ -51,6 +51,7 @@
public static boolean cacheable = true;
public static String serverinfo = "Caimito";
public static String CAIMITO_CSS = null;
+<<<<<<< HEAD
public static String version = "0.8";
public static long requestTimeout = 30 * 60 * 1000;
public static int single_cloud_account_with_single_storage = 1;
@@ -58,6 +59,9 @@
public static int cloud_setup=single_cloud_account_with_single_storage;
+=======
+ public static String version = "0.4";
+>>>>>>> 81b81b090d652d7b3c1de4359597c4836eb617da
public static void init()throws CaimitoException{
if (! new File(getConfigFile()).exists())
{
0  source/ngasi/caimito/CaimitoDefaultServlet.java 100755 → 100644
View
File mode changed
0  source/ngasi/caimito/CaimitoException.java 100755 → 100644
View
File mode changed
0  source/ngasi/caimito/CaimitoUtil.java 100755 → 100644
View
File mode changed
3,460 source/ngasi/caimito/CaimitoWebdavServlet.java 100755 → 100644
View
3,460 additions, 0 deletions not shown
0  source/ngasi/caimito/resource/CacheMgr.java 100755 → 100644
View
File mode changed
0  source/ngasi/caimito/resource/CloudResourceObj.java 100755 → 100644
View
File mode changed
0  source/ngasi/caimito/resource/FileResourceObj.java 100755 → 100644
View
File mode changed
794 source/ngasi/caimito/resource/OpenStackResourceObj.java 100755 → 100644
View
@@ -1,3 +1,4 @@
+<<<<<<< HEAD
/*
Copyright (c) 2011-2012, the Caimito project (http://caimito.ngasi.com/). All rights reserved.
Apache Software License 2.0
@@ -997,3 +998,796 @@ public long lastModified()throws Exception{
}*/
+=======
+/*
+ Copyright (c) 2011-2012, the Caimito project (http://caimito.ngasi.com/). All rights reserved.
+Apache Software License 2.0
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the distribution.
+
+ 3. The names of the authors may not be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WebAppShowCase
+OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
+OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+
+
+
+package ngasi.caimito.resource;
+import ngasi.caimito.*;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.InputStream;
+
+import tools.util.*;
+import java.util.Vector;
+import java.util.Hashtable;
+import com.google.gson.*;
+import java.lang.reflect.*;
+import com.google.gson.reflect.*;
+import java.util.List;
+import java.text.*;
+import java.util.Locale;
+import java.util.Date;
+import java.util.Enumeration;
+import java.util.Map;
+import java.io.ByteArrayInputStream;
+import java.util.Iterator;
+
+public class OpenStackResourceObj extends CloudResourceObj
+ {
+ protected static final int BUFFER_SIZE = 2048;
+
+
+ static DateFormat dfm = null;
+
+ static long maxautint = 0;
+
+
+
+ static{
+ try{
+ maxautint = CaimitoConfig.getConfig().getLong("cloud.max_auth_interval") * 60* 1000L;
+ }catch (Exception e){
+ e.printStackTrace();
+ }
+ try{
+
+ dfm = new SimpleDateFormat(CaimitoConfig.getConfig().getString("cloud.obj.details.dateformat"));
+ }catch (Throwable e){
+ e.printStackTrace();
+ }
+ }
+
+
+ public void retrieveCloudFile(String path,String tf)throws CaimitoException{
+ try{
+ auth();
+ Hashtable<String,String> h = new Hashtable<String,String>();
+ h.put("X-Auth-Token",X_Auth_Token);
+
+
+ HttpClientUtil.trustGetToFile(h,X_Storage_Url + "/" + CaimitoConfig.getConfig().getString("cloud.store") + CaimitoUtil.urlEncode(path),tf);
+ }catch (Exception e){
+ e.printStackTrace();
+ CaimitoException.throwException(e);
+
+ }
+
+ }
+
+
+ public void doWrite(InputStream dest)throws CaimitoException{
+ try{
+ if (dest.available() < 0)return;
+
+
+ Hashtable<String,String> h = new Hashtable<String,String>();
+ h.put("X-Auth-Token",X_Auth_Token);
+ if (contentType != null)
+ h.put("Content-Type",contentType);
+
+ // if (contentLength > -1 )
+ // h.put("Content-Length",String.valueOf(contentLength));
+
+
+ String nv = null;
+
+
+ nv = HttpClientUtil.trustPut(h,X_Storage_Url + "/" + CaimitoConfig.getConfig().getString("cloud.store") + CaimitoUtil.urlEncode(path),dest);
+ //(path + " put me " + nv);
+
+ }catch (Exception e){
+ e.printStackTrace();
+ CaimitoException.throwException(e);
+
+ }
+ }
+
+
+
+
+public void doCopy(ResourceObj dest)throws CaimitoException
+ {
+ String fs = path;
+ String t = dest.path;
+// if (!isDirectory())
+// return;
+ if ( !t.endsWith("/"))
+ t = t + "/";
+
+// Vector<ResourceObj> flist = doList();
+
+ //-----------
+
+
+ auth();
+
+ Hashtable<String,String> h = new Hashtable<String,String>();
+ h.put("X-Auth-Token",X_Auth_Token);
+ if (isDirectory())
+ h.put("Content-Type","application/directory");
+ //h.put("Content-Length","0");
+
+ String tp = path;
+ if (tp.endsWith("/"))
+ tp = tp.substring(0,tp.length() -1);
+ h.put("X_COPY_FROM",CaimitoConfig.getConfig().getString("cloud.store") + tp);
+ String tp2 = dest.path;
+ if (tp2.endsWith("/"))
+ tp2 = tp2.substring(0,tp2.length() -1);
+try{
+
+ String nv = HttpClientUtil.trustPut(h,X_Storage_Url + "/" + CaimitoConfig.getConfig().getString("cloud.store") + tp2);
+ //(X_Storage_Url + "/" + CaimitoConfig.getConfig().getString("cloud.store") + tp + "-->" + h + " ******************X_COPY_FROM 1111 " + nv + ":" + tp2);
+ }catch (Exception e){
+ e.printStackTrace();
+ CaimitoException.throwException(e);
+
+ }
+
+ if (!isDirectory())
+ {
+
+ return;
+ }
+ Vector<ResourceObj> flist = doList();
+
+ if (flist == null || flist.size() < 1)
+ return;
+ for(int i = 0 ; i < flist.size() ; i++)
+{
+ OpenStackResourceObj nf = (OpenStackResourceObj)flist.elementAt(i);
+ String nt = t;
+ boolean isd = false;
+ if (nf.isDirectory())
+ {
+ nt = nt + nf.path.substring(path.length(),nf.path.length());
+ OpenStackResourceObj dr = new OpenStackResourceObj();
+ dr.path = nt;
+ dr.doMkdir();
+ isd = true;
+ nf.doCopy(dr);
+ }
+ else
+ try
+ {
+ ResourceObj dr = new OpenStackResourceObj();
+ dr.path = t + nf.getName();
+
+ nf.xCopy(dr);
+ }catch (Exception e){
+ e.printStackTrace();
+ CaimitoException.throwException(e);
+
+ }
+
+}
+
+
+ }
+
+ public void xCopy(ResourceObj dest)throws CaimitoException{
+ try{
+
+
+ auth();
+
+ Hashtable<String,String> h = new Hashtable<String,String>();
+ h.put("X-Auth-Token",X_Auth_Token);
+ if (isDirectory())
+ h.put("Content-Type","application/directory");
+ //h.put("Content-Length","0");
+
+ String tp = path;
+ if (tp.endsWith("/"))
+ tp = tp.substring(0,tp.length() -1);
+ h.put("X_COPY_FROM",CaimitoConfig.getConfig().getString("cloud.store") + tp);
+ String tp2 = dest.path;
+ if (tp2.endsWith("/"))
+ tp2 = tp2.substring(0,tp2.length() -1);
+
+ String nv = HttpClientUtil.trustPut(h,X_Storage_Url + "/" + CaimitoConfig.getConfig().getString("cloud.store") + tp2);
+ //(X_Storage_Url + "/" + CaimitoConfig.getConfig().getString("cloud.store") + tp + "-->" + h + " ******************X_COPY_FROM " + nv + ":" + tp2);
+
+
+
+ }catch (Exception e){
+ e.printStackTrace();
+ CaimitoException.throwException(e);
+
+ }
+ }
+
+
+ public void doMove(ResourceObj dest)throws CaimitoException{
+ try{
+
+ doCopy(dest);
+ doDelete();
+
+ }catch (Exception e){
+ e.printStackTrace();
+ CaimitoException.throwException(e);
+
+ }
+ }
+
+ public boolean doExists()throws CaimitoException{
+ if (path.equals("") || path.equals("/"))
+ return true;
+
+ //("OEXISTST " + path);
+ init();
+ return ex;
+ //return new File(root + path).exists();
+ }
+ public void deleteCloudFile()throws CaimitoException{
+
+
+try{
+
+ auth();
+
+
+
+ if (isDirectory())
+ {
+
+ Vector<ResourceObj> flist = doList();
+
+ if (flist != null && flist.size() > 0)
+ for(int i = 0 ; i < flist.size() ; i++)
+{
+ OpenStackResourceObj nf = (OpenStackResourceObj)flist.elementAt(i);
+ nf.doDelete();
+ /*String nt = t;
+ boolean isd = false;
+ if (nf.isDirectory())
+ {
+ nt = nt + nf.path.substring(path.length(),nf.path.length());
+ OpenStackResourceObj dr = new OpenStackResourceObj();
+ dr.path = nt;
+ dr.doMkdir();
+ isd = true;
+ nf.doCopy(dr);
+ }
+ else
+ try
+ {
+ ResourceObj dr = new OpenStackResourceObj();
+ dr.path = t + nf.getName();
+
+ nf.xCopy(dr);
+ }catch (Exception e){
+ e.printStackTrace();
+ CaimitoException.throwException(e);
+
+ }*/
+
+}
+ }
+
+
+
+
+ Hashtable<String,String> h = new Hashtable<String,String>();
+ h.put("X-Auth-Token",X_Auth_Token);
+ //( "DEO DELOET " + X_Storage_Url + "/" + CaimitoConfig.getConfig().getString("cloud.store") + CaimitoUtil.urlEncode(path) + "?format=json");
+
+ String nv = null;
+ String p2 = path;
+ if (p2.endsWith("/"))
+ p2 = p2.substring(0,p2.length() -1);
+
+ nv = HttpClientUtil.trustDelete(h,X_Storage_Url + "/" + CaimitoConfig.getConfig().getString("cloud.store") + CaimitoUtil.urlEncode(p2) );
+
+
+ //("DELETE OF he2 " + nv);
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ }catch (Exception e){
+ e.printStackTrace();
+ CaimitoException.throwException(e);
+ }
+ }
+
+ protected void init(){
+ if (init)return;
+try{
+ init = true;
+ if (path.equals("") || path.equals("/"))
+ return ;
+
+ auth();
+
+ Hashtable<String,String> h = new Hashtable<String,String>();
+ h.put("X-Auth-Token",X_Auth_Token);
+
+
+ String p2 = path;
+ if (p2.endsWith("/"))
+ p2 = p2.substring(0,p2.length() -1);
+ int nv = HttpClientUtil.trustHead(h,X_Storage_Url + "/" + CaimitoConfig.getConfig().getString("cloud.store") + CaimitoUtil.urlEncode(p2) + "?format=json");
+ if (nv == 404)return;
+
+
+ NameValuePairs nvp = new NameValuePairs(h);
+
+
+ cl = nvp.getLong("Content-Length");
+ lm = dfm.parse(nvp.getString("Last-Modified")).getTime();
+ if (nvp.getString("Content-Type").equals("application/directory"))
+ isd = true;
+
+ //init = true;
+ ex = true;
+}catch (Throwable e){
+ e.printStackTrace();
+
+ if (CaimitoConfig.cacheable){
+ String tf = CaimitoConfig.cachedir + path;
+ File ftf = new File(tf);
+
+ if (ftf.exists())
+ {
+ cl = ftf.length();
+ lm = ftf.lastModified();
+ if (ftf.isDirectory())
+ isd = true;
+ }
+ }
+
+
+
+}
+
+
+ }
+
+ protected boolean ex = false;
+ protected boolean init = false;
+ protected boolean isd = false;
+ protected long lm = 0;
+ protected long cl = 0;
+ //protected OSRAttribute attributes = null;
+
+ public void doMkdir()throws CaimitoException{
+ try{
+
+ //new File(root + path).mkdirs();
+
+
+
+ auth();
+
+ Hashtable<String,String> h = new Hashtable<String,String>();
+ h.put("X-Auth-Token",X_Auth_Token);
+ h.put("Content-Type","application/directory");
+ String tp = path;
+ if (tp.endsWith("/"))
+ //tp = tp + "/";
+ tp = tp.substring(0,tp.length() -1);
+ String nv = HttpClientUtil.trustPut(h,X_Storage_Url + "/" + CaimitoConfig.getConfig().getString("cloud.store") + tp);
+ //(X_Storage_Url + "/" + CaimitoConfig.getConfig().getString("cloud.store") + tp + "-->" + h + " THEY AUTHOiniyt " + nv);
+
+
+ }catch (Exception e){
+ e.printStackTrace();
+ CaimitoException.throwException(e);
+ }
+ }
+
+ public long getLastModified()throws CaimitoException{
+ //return new File(root + path).lastModified();
+ init();
+ return lm;
+ }
+
+ public boolean isDirectory()throws CaimitoException{
+ if (path.equals("") || path.equals("/"))
+ return true;
+ init();
+ return isd;
+ }
+ public long getContentLength()throws CaimitoException{
+ init();
+ return cl;
+ }
+
+ protected static String X_Auth_Token = null; //"5bba5c21-3c8c-4f6b-8b17-9adb7c2ad4ea";
+ protected static String X_Storage_Url = null; //"http://swift.rc.nectar.org.au:8888/v1/AUTH_793";
+ protected static long authtime = 0;
+ void auth()throws CaimitoException{
+ try{
+
+ if (X_Auth_Token != null && X_Storage_Url != null && !((System.currentTimeMillis() - authtime) > maxautint))return;
+ X_Auth_Token = null;
+ X_Storage_Url = null;
+ Hashtable<String,String> h = new Hashtable<String,String>();
+ //String curl = null;
+ String nv = null;
+ String curl = CaimitoConfig.getConfig().getString("cloud.url");
+ if (curl.endsWith("/"))
+ curl = curl.substring(0,curl.length() - 1);
+
+ if (CaimitoConfig.getConfig().get("cloud.api.version") == null || CaimitoConfig.getConfig().getString("cloud.api.version").startsWith("1."))
+ try{
+ h.put("X-Auth-User",CaimitoConfig.getConfig().getString("cloud.username"));
+ h.put("X-Auth-Key",CaimitoConfig.getConfig().getString("cloud.api.key_password"));
+ //curl = CaimitoConfig.getConfig().getString("cloud.url");
+ //if (curl.endsWith("/"))
+ // curl = curl.substring(0,curl.length() - 1);
+ nv = HttpClientUtil.trustGet(h,curl);
+
+ X_Storage_Url = h.get("X-Storage-Url");
+ X_Auth_Token = h.get("X-Auth-Token");
+ }catch (Exception e){
+ System.out.println(" Failed V1 Auth " + e.toString());
+ if (CaimitoConfig.getConfig().getString("cloud.api.version").startsWith("1."))
+ {
+ if (e instanceof CaimitoException)
+ throw (CaimitoException)e;
+ else
+ CaimitoException.throwException(e);
+
+ }
+ }
+
+
+ if (X_Storage_Url == null || X_Auth_Token == null){
+
+ if (!curl.endsWith("/tokens"))
+ curl = curl + "/tokens";
+ Hashtable<String,String> pc = new Hashtable<String,String>();
+ pc.put("username",CaimitoConfig.getConfig().getString("cloud.username"));
+ pc.put("password",CaimitoConfig.getConfig().getString("cloud.api.key_password"));
+
+ Hashtable<String,Hashtable<String,String>> auh = new Hashtable<String,Hashtable<String,String>>();
+ auh.put("passwordCredentials",pc);
+
+ Hashtable tl = new Hashtable();
+ tl.put("auth",auh);
+
+ h = new Hashtable<String,String>();
+ h.put("Content-type","application/json");
+
+ Gson gson = new Gson();
+ String json = gson.toJson(tl);
+ ByteArrayInputStream dest = new ByteArrayInputStream(json.getBytes());
+
+ nv = HttpClientUtil.trustPost(h,curl,dest);
+ //Gson gson = new Gson();
+ OSV2TokenResponse oa = gson.fromJson(nv, new TypeToken<OSV2TokenResponse>() {}.getType());
+ Map<String,String> eps = oa.getResponse();
+ if (CaimitoConfig.getConfig().getString("cloud.endpoint.access").equals("internal"))
+ X_Storage_Url = eps.get("internalURL");
+ else
+ X_Storage_Url = eps.get("publicURL");
+ X_Auth_Token = oa.access.token.id;
+ if (X_Storage_Url == null || X_Auth_Token == null)
+ CaimitoException.throwException("unable_to_auth");
+
+
+ }
+ authtime = System.currentTimeMillis();
+ }catch (Throwable e){
+ e.printStackTrace();
+ CaimitoException.throwException(e);
+ }
+ }
+
+ public Vector<ResourceObj> doList()throws CaimitoException{
+ //doDelete();
+ Vector<ResourceObj> l = new Vector<ResourceObj>();
+
+ try{
+
+ auth();
+
+ Hashtable<String,String> h = new Hashtable<String,String>();
+ h.put("X-Auth-Token",X_Auth_Token);
+ String p2 = path;
+ if (p2.endsWith("/"))
+ p2 = p2.substring(0,p2.length() -1);
+ //p2 = p2 + "/";
+ // ?prefix=photos/&delimiter=/
+ boolean isroot = (p2.equals("/") || p2.equals(""));
+ String pars = "?delimiter=/";
+ if (!isroot){
+ String p2b = p2;
+ if (p2b.startsWith("/"))
+ p2b = p2b.substring(1,p2b.length());
+ pars = pars + "&prefix=" + CaimitoUtil.urlEncode(p2b) + "/";
+ }
+ //pars = "";
+ //("***doList1 " + X_Storage_Url + "/" + CaimitoConfig.getConfig().getString("cloud.store") + CaimitoUtil.urlEncode(p2) + pars + " --> " + h + " h <-->nv ");
+//+ CaimitoUtil.urlEncode(p2)
+ String nv = HttpClientUtil.trustGet(h,X_Storage_Url + "/" + CaimitoConfig.getConfig().getString("cloud.store") + pars);
+
+ if (nv == null || nv.length() < 1)return l;
+ ByteArrayInputStream bin = new ByteArrayInputStream(nv.getBytes());
+ EZArrayList lblv = new EZArrayList(bin);
+ bin.close();
+ String oa = null;
+ OpenStackResourceObj ro = null;
+ String dn = "";
+ String ps = "";
+
+ if (!path.endsWith("/"))
+ ps = "/";
+ for (int ct = 0;ct < lblv.size();ct++)
+ {
+ dn = lblv.elementAt(ct).toString();
+ /*//("****************************DN= " + dn);
+ ro = new OpenStackResourceObj();
+
+ ro.path = "/" + dn;
+ ro.user = user;
+ ro.listing = listing;
+ ro.ex = true;
+ try{
+
+ ro.doDelete();
+ }catch (Exception e){
+ e.printStackTrace();
+ }*/
+ if (dn.equals(".")){
+ //("****************************DN= " + dn);
+
+ continue;
+ }
+ if (dn.endsWith("/"))
+ {
+ //("****************************DN= " + dn);
+
+ continue;
+
+ }
+ //(path + " OS LIST " + dn);
+ ro = new OpenStackResourceObj();
+
+ ro.path = "/" + dn;
+ ro.user = user;
+ ro.listing = listing;
+ ro.ex = true;
+
+
+ l.add(ro);
+
+
+ }
+
+
+
+ /* Gson gson = new Gson();
+
+ List<OSRAttribute> attrs = gson.fromJson(nv, new TypeToken<List<OSRAttribute>>() {}.getType());
+
+ Vector<OSRAttribute> lblv = new Vector<OSRAttribute>(attrs);
+ OSRAttribute oa = null;
+ OpenStackResourceObj ro = null;
+ String ps = "";
+ if (!path.endsWith("/"))
+ ps = "/";
+ String dn = null;
+ for (int ct = 0;ct < lblv.size();ct++)
+ {
+ oa = lblv.elementAt(ct);
+ //(path + " OS LIST " + oa);
+ ro = new OpenStackResourceObj();
+ dn = oa.name;
+ if (dn.endsWith("/"))
+ {
+ dn = dn.substring(0,dn.length() -1);
+ ro.isd = true;
+
+ }
+ ro.path = path + ps + dn;
+ ro.user = user;
+ ro.listing = listing;
+ ro.cl = oa.bytes;
+ ro.init = true;
+ ro.ex = true;
+ ro.lm = oa.lastModified();
+ l.add(ro);
+
+
+ }*/
+/*
+ String[] dl = new File(root + path).list();
+ String ps = "";
+ if (!path.endsWith("/"))
+ ps = "/";
+ if (dl != null){
+ FileResourceObj ro = null;
+ for (int ct = 0; ct < dl.length;ct++){
+ ro = new FileResourceObj();
+ ro.path = path + ps + dl[ct];
+ ro.user = user;
+ ro.listing = listing;
+ l.add(ro);
+ }
+ }*/
+
+ }catch (Throwable e){
+ e.printStackTrace();
+ CaimitoException.throwException(e);
+ }
+ return l;
+
+ }
+
+
+}
+
+class OSRAttribute{
+
+ static DateFormat dfm = null;
+ static boolean rmdend = false;
+ static{
+ try{
+ //("DATE FORMAT " + CaimitoConfig.getConfig().getString("cloud.dateformat"));
+ if (CaimitoConfig.getConfig().getBoolean("cloud.date.remove.end"))
+ {
+ rmdend = true;
+ }
+ dfm = new SimpleDateFormat(CaimitoConfig.getConfig().getString("cloud.dateformat"));
+ }catch (Throwable e){
+ e.printStackTrace();
+ }
+ }
+
+
+ String name = null;
+ String hash = null;
+ long bytes = 0;
+ String content_type = null;
+ String last_modified = null;
+ public long lastModified()throws Exception{
+ if (rmdend)
+ {
+ String lm = last_modified;
+ int i = lm.lastIndexOf(".");
+ if (i > 0){
+ lm = lm.substring(0,i);
+ return dfm.parse(lm).getTime();
+
+ }
+ }
+ return dfm.parse(last_modified).getTime();
+ }
+
+}
+class OSV2TokenResponse {
+ public TokenObj access = null;
+
+ //public Hashtable<String,Hashtable<String,String>> access = null;
+ public Map<String,String> getResponse(){
+ Hashtable<String,String> res = new Hashtable<String,String>();
+ Iterator<EndPoints> en = access.serviceCatalog.iterator();
+ //String n = null;
+ EndPoints v = null;
+ while(en.hasNext()){
+ v = en.next();
+ if (v.type.equals("object-store") && v.name.equals("swift")){
+ Iterator<Map<String,String>> enp = v.endpoints.iterator();
+
+ if(enp.hasNext())
+ return enp.next();
+ }
+ }
+ return res;
+ }
+
+}
+ class TokenObj{
+ public TokenObj2 token = null;
+ public List<EndPoints> serviceCatalog = null;
+
+ }
+ class EndPoints{
+ public List<Map<String,String>> endpoints = null;
+ public String type = null;
+ public String name = null;
+
+ }
+ class TokenObj2{
+ public String id = null;
+ }
+/*class OSRObjDetails{
+
+ static DateFormat dfm = null;
+ static boolean rmdend = false;
+ static{
+ try{
+ //("DATE FORMAT " + CaimitoConfig.getConfig().getString("cloud.dateformat"));
+ if (CaimitoConfig.getConfig().getBoolean("cloud.date.remove.end"))
+ {
+ rmdend = true;
+ }
+ dfm = new SimpleDateFormat(CaimitoConfig.getConfig().getString("cloud.dateformat"));
+ }catch (Throwable e){
+ e.printStackTrace();
+ }
+ }
+
+
+
+Last-Modified=Tue, 24 Apr 2012 00:05:15 GMT, Accept-Ranges=bytes, Content-Length=0, X-Trans-Id=txd7c65f16aa884af9a09266da2636daf5, Date=Tue, 24 Apr 2012 03:15:30 GMT, X-Auth-Token=AUTH_tke0c45f67d4fb47189ad41fc771b4b53f, Content-Type=application/x-www-form-urlencoded; charset=ISO-8859-1, Connection=keep-alive, Etag=d41d8cd98f00b204e9800998ecf8427e
+
+
+
+ public long lastModified()throws Exception{
+ if (rmdend)
+ {
+ String lm = last_modified;
+ int i = lm.lastIndexOf(".");
+ if (i > 0){
+ lm = lm.substring(0,i);
+ return dfm.parse(lm).getTime();
+
+ }
+ }
+ return dfm.parse(last_modified).getTime();
+ }
+
+}*/
+
+>>>>>>> 81b81b090d652d7b3c1de4359597c4836eb617da
0  source/ngasi/caimito/resource/ResourceObj.java 100755 → 100644
View
File mode changed
789 source/ngasi/caimito/resource/ResourceStore.java 100755 → 100644
View
@@ -1,3 +1,4 @@
+<<<<<<< HEAD
/*
Copyright (c) 2011-2012, the Caimito project (http://caimito.ngasi.com/). All rights reserved.
Apache Software License 2.0
@@ -789,3 +790,791 @@ public static void sendBasicError( HttpServletRequest request,HttpServletRespon
class CaimitoBooleanHolder{
public boolean value = false;
}
+=======
+/*
+ Copyright (c) 2011-2012, the Caimito project (http://caimito.ngasi.com/). All rights reserved.
+Apache Software License 2.0
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the distribution.
+
+ 3. The names of the authors may not be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WebAppShowCase
+OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
+OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+
+
+
+package ngasi.caimito.resource;
+import java.nio.charset.Charset;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import ngasi.caimito.*;
+import org.shaft.server.auth.*;
+import tools.util.*;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.util.Enumeration;
+import java.io.BufferedInputStream;
+import java.io.UnsupportedEncodingException;
+import org.shaft.server.utils.*;
+import tools.util.*;
+import java.sql.Connection;
+import java.sql.ResultSet;
+
+
+public class ResourceStore
+ {
+ public static int READ = 1;
+ public static int WRITE = 2;
+ protected static MessageDigest md5Helper = null;
+
+ static{
+
+ try {
+ md5Helper = MessageDigest.getInstance("MD5");
+ } catch (NoSuchAlgorithmException e) {
+ e.printStackTrace();
+ }
+ }
+
+ public static ResourceObj lookup(String path, HttpServletRequest request)
+ throws CaimitoException {
+ //("GET Z PAth " + path);
+ String u = (String)request.getAttribute(CaimitoConfig.caimitouserreqobj);
+ if (u == null)
+ u = login(request);
+ return lookup(path,u);
+ }
+
+ //public static ResourceObj lookup(String path, HttpServletRequest request,
+ // HttpServletResponse response)
+ //throws CaimitoException {
+ //
+ //}
+ protected static Connection getConnection()throws Exception{
+ return DBConMgr.getConnection(ShaftRestConfig.datasourceName);
+ }
+ public static boolean isPublicPath(String path,CaimitoBooleanHolder l,String u)
+ throws CaimitoException {
+ try{
+ //("PUBLIC PATHS " + path);
+ if (path.startsWith("/" + CaimitoConfig.shaftapp + "/") || path.equals("/favicon.ico"))
+ return true;
+ if (path.startsWith("/"))
+ path = path.substring(1,path.length());
+ if (path.endsWith("/"))
+ path = path.substring(0,path.length() -1);
+
+ return pathMatch(path,"publicpaths",l,u);
+ }catch (Exception e){
+ //e.printStackTrace();
+ //(path + " isPublicPath.error " + e.toString());
+ }
+ return false;
+ }
+
+
+ public static boolean pathMatch(String path,String table,CaimitoBooleanHolder l,String u)throws Exception
+ {
+
+ if (doPathMatch(path,table,l,u))
+ return true;
+
+ int i = path.lastIndexOf("/");
+ while (i > 0)
+ {
+ path = path.substring(0,i);
+ if (doPathMatch(path,table,l,u))
+ return true;
+ i = path.lastIndexOf("/");
+ }
+ if (i < 0)
+ return doPathMatch(path,table,l,u);
+
+ return false;
+ }
+
+ protected static boolean doPathMatch(String path,String table,CaimitoBooleanHolder l,String u)throws Exception
+ {
+ SPQueryAndUpdate spq = new SPQueryAndUpdate(getConnection());
+ try{
+ String sql = "SELECT path,shaftowner,listing from " + CaimitoConfig.shaftapp + "_" + table + " where path = ?";
+ spq.setTemplate(sql);
+ spq.addVariable(path);
+ ResultSet res = spq.query();
+ //(path + " doPathMatch 1 " + table);
+
+ if (res.next()){
+ String su = res.getString(2);
+ NameValuePairs nvp = getUserPriv(su);
+ //(path + ":" + res.getString(2) + " doPathMatch 2 " + nvp);
+ if (nvp == null || nvp.size() < 1)
+ return false;
+ if (!path.startsWith(nvp.getString("path") + "/") && !(path + "/").startsWith(nvp.getString("path") + "/"))
+ return false;
+ if (u == null || (!su.equals(u) && !UserMgr.getUserMgr(CaimitoConfig.shaftapp).isAdminOrOwnerOf(CaimitoConfig.shaftapp,u,su)))
+ l.value = (res.getBoolean(3));
+ else
+ l.value = CaimitoConfig.getConfig().getBoolean("resource.dir.listing");
+ return true;
+ }
+ }
+
+ finally{
+ if (spq != null)spq.close();
+ }
+ return false;
+ }
+
+
+
+ protected static NameValuePairs getUserPrivFromDB(String u)throws Exception
+ {
+ try{
+
+ SPQueryAndUpdate spq = new SPQueryAndUpdate(getConnection());
+ try{
+ String sql = "SELECT * from " + CaimitoConfig.shaftapp + "_pathprivileges where resourceuser = ? AND shaftowner = ?";
+
+ // username = UserMgr. (CaimitoConfig.shaftapp).getOwner(CaimitoConfig.shaftapp,username);
+ // if (username == null)
+ // break;
+ boolean isadmin = false;
+ if (RealmMgr.getRealmMgr(CaimitoConfig.shaftapp).isAdmin(CaimitoConfig.shaftapp,u)){
+sql = "SELECT * from " + CaimitoConfig.shaftapp + "_pathprivileges where resourceuser = ?";
+
+ isadmin = true;
+ }
+
+ spq.setTemplate(sql);
+ spq.addVariable(u);
+ if (!isadmin)
+ spq.addVariable(UserMgr.getUserMgr(CaimitoConfig.shaftapp).getOwner(CaimitoConfig.shaftapp,u));
+
+ return spq.getHash();
+ }
+
+ finally{
+ if (spq != null)spq.close();
+ }
+ }catch (Exception e){
+ //(u + " getUserPrivFromDB " + e.toString() + ":" );
+ e.printStackTrace();
+
+ }
+ return null;
+ }
+
+ protected static NameValuePairs getUserPriv(String u)throws Exception
+ {
+ try{
+
+
+
+ NameValuePairs nvp = getUserPrivFromDB(u);
+ if (nvp == null || nvp.size() < 1)
+ return nvp;
+ String path2 = null;
+ String username = u;
+ while (true){
+ username = UserMgr.getUserMgr(CaimitoConfig.shaftapp).getOwner(CaimitoConfig.shaftapp,username);
+ if (username == null)
+ break;
+ if (RealmMgr.getRealmMgr(CaimitoConfig.shaftapp).isAdmin(CaimitoConfig.shaftapp,username))
+ break;
+ if (path2 == null)path2 = "";
+ path2 = getUserPrivFromDB(username).getString("path") + "/" + path2;
+ }
+ if (path2 != null){
+ path2 = path2 + "/" + nvp.getString("path");
+ //("ZEPATH@ A " + path2);
+
+ path2 = CaimitoUtil.normalize(path2);
+ //("ZEPATH@ " + path2);
+
+ nvp.put("path",path2);
+
+
+ }
+ return nvp;
+
+
+
+ }catch (Exception e){
+ //(u + " getUserPriv.error " + e.toString() + ":" );
+ e.printStackTrace();
+
+ }
+ return null;
+ }
+
+
+ public static ResourceObj lookup(String path, HttpServletRequest request,
+ HttpServletResponse response,int action)
+ throws CaimitoException {
+ String u = null;
+ //("GET Z PAth 2 " + path);
+ if (path.equals("/") || path.equals(""))
+ {
+ if (CaimitoConfig.protectedRoot)
+ {
+
+ u = login(request,response);
+ if (u == null)return null;
+ }
+ }
+
+ if (u == null)
+ {
+ u = (String)request.getAttribute(CaimitoConfig.caimitouserreqobj);
+ if (u == null)
+ u = login(request);
+ }
+try{
+ //(action + ":" + path + " THE USER IS " + u);
+ if (RealmMgr.getRealmMgr(CaimitoConfig.shaftapp).isAdmin(CaimitoConfig.shaftapp,u))
+ return lookup(path,u);
+
+
+ if (action == READ){
+
+ CaimitoBooleanHolder l = new CaimitoBooleanHolder();
+ if (isPublicPath(path,l,u)){
+
+ ResourceObj ro = lookup(path,u);
+ if (ro != null)
+ ro.listing = l.value;
+ return ro;
+ }
+ }
+ if (u == null){
+
+ u = login(request,response);
+ if (u == null)return null;
+ }
+
+
+
+ NameValuePairs nvp = getUserPriv(u);
+ //(u + " PRIVILEGE GO " + nvp);
+ if (nvp == null || nvp.size() < 1)
+ {
+ response.sendError(HttpServletResponse.SC_FORBIDDEN);
+ return null;
+ }
+
+
+ if (action == WRITE && (nvp.getInt("privilege") != WRITE ||(path.startsWith("/" + CaimitoConfig.shaftapp + "/") || path.equals("/favicon.ico"))))
+ {
+ //(u + " PRIVILEGE GO 2 " + nvp);
+
+ response.sendError(HttpServletResponse.SC_FORBIDDEN);
+ return null;
+ }
+ if (!path.startsWith("/" + nvp.getString("path") + "/") && !(path + "/").startsWith("/" + nvp.getString("path") + "/"))
+ {
+ //(path + " PRIVILEGE GO 3 " + nvp);
+
+ response.sendError(HttpServletResponse.SC_FORBIDDEN);
+ return null;
+ }else lookup("/" + nvp.getString("path") + "/",u) .mkdir();
+ return lookup(path,u);
+
+ }catch (Exception e){
+
+ e.printStackTrace();
+ return null;
+ }
+ /*//(u + " WOWWW SD 1 " + CaimitoConfig.resource + ":" + path);
+ if (CaimitoConfig.resource.equals("file")){
+ ro = new FileResourceObj();
+ }
+ //(u + " WOWWW SD 2 " + ro);
+
+ if (ro != null){
+ ro.user = u;
+ ro.path = path;
+ }
+ return ro;*/
+// return null;
+ }
+
+
+ public static ResourceObj lookup(String path,String u)
+ throws CaimitoException {
+ ResourceObj ro = null;
+ //if (u == null)
+ // Thread.dumpStack();
+ //(u + " ***************WOWWW SD 1 " + CaimitoConfig.resource + ":" + path);
+ if (path.startsWith("/" + CaimitoConfig.shaftapp + "/"))// || path.equals("/favicon.ico"))
+ {
+ //if (path.equals("/favicon.ico"))
+ //path = "/" + CaimitoConfig.shaftapp + "/public/favicon.ico" ;
+ if (!path.startsWith("/" + CaimitoConfig.shaftapp + "/public/"))
+ path = "/" + CaimitoConfig.shaftapp + "/public/" + path.substring(CaimitoConfig.shaftapp.length() + 1,path.length());
+ //(" FAV NEW PATH " + path);
+ ro = new ShaftResourceObj();
+
+ }
+ else if (CaimitoConfig.resource.equals("file")){
+ ro = new FileResourceObj();
+ }
+ else if (CaimitoConfig.resource.equals("openstack")){
+ //(u + " WOWWW SD 2 " + CaimitoConfig.resource + ":" + path);
+
+ ro = new OpenStackResourceObj();
+ }
+ //(u + " WOWWW SD 2 " + ro);
+
+ if (ro != null){
+ ro.user = u;
+ ro.path = path;
+ ro.listing = CaimitoConfig.getConfig().getBoolean("resource.dir.listing");
+ }
+
+ if (path.equals("/favicon.ico") && !ro.exists()){
+ path = "/" + CaimitoConfig.shaftapp + "/public/favicon.ico" ;
+ ro = new ShaftResourceObj();
+ ro.user = u;
+ ro.path = path;
+ }
+
+
+ return ro;
+ }
+
+
+ public static String login( HttpServletRequest request )
+ throws CaimitoException {
+ return login(request,null);
+ }
+
+
+
+
+ protected static String getDigest(String username, String realmName)throws CaimitoException {
+
+try{
+
+ return UserMgr.getUserMgr(CaimitoConfig.shaftapp).getMD5Digest(CaimitoConfig.shaftapp,username);
+ /*String digestValue = username + ":" + realmName + ":"
+ + UserMgr. (CaimitoConfig.shaftapp).getPasswd(CaimitoConfig.shaftapp,username);
+
+ byte[] valueBytes = null;
+ valueBytes = digestValue.getBytes(Charset.defaultCharset());
+
+ byte[] digest = null;
+ synchronized(md5Helper) {
+ digest = md5Helper.digest(valueBytes);
+ }
+
+ return md5Encode(digest);*/
+}catch (Exception e){
+ e.printStackTrace();
+ CaimitoException.throwException(e);
+}
+return null;
+ }
+
+
+
+ protected static String authenticate(NameValuePairs nvp) throws CaimitoException{
+ // username="caimitoadmin", realm="Caimito", nonce="", uri="/", response="2fb52dbbcb7b25fd33840eac3027e9c5"
+
+String username = (String)nvp.get("username");
+ String clientDigest = (String)nvp.get("response");
+ String nonce = (String)nvp.get("nonce");
+ String nc = (String)nvp.get("nc");
+String cnonce = (String)nvp.get("cnonce");
+String qop = (String)nvp.get("qop");
+String realm = (String)nvp.get("realm");
+ String a2 = nvp.get("method") + ":" + nvp.get("uri");
+
+ byte[] buffer;
+ synchronized (md5Helper) {
+ buffer = md5Helper.digest(a2.getBytes(Charset.defaultCharset()));
+ }
+ String md5a2 = md5Encode(buffer);
+
+
+ String md5a1 = getDigest(username, realm);
+ if (md5a1 == null)
+ return null;
+ String serverDigestValue;
+ if (qop == null) {
+ serverDigestValue = md5a1 + ":" + nonce + ":" + md5a2;
+ } else {
+ serverDigestValue = md5a1 + ":" + nonce + ":" + nc + ":" +
+ cnonce + ":" + qop + ":" + md5a2;
+ }
+
+ byte[] valueBytes = null;
+ // try {
+ valueBytes = serverDigestValue.getBytes(Charset.defaultCharset());
+ // } catch (UnsupportedEncodingException uee) {
+ // log.error("Illegal digestEncoding: " + getDigestEncoding(), uee);
+ // throw new IllegalArgumentException(uee.getMessage());
+ //}
+
+ String serverDigest = null;
+ // Bugzilla 32137
+ synchronized(md5Helper) {
+ serverDigest = md5Encode(md5Helper.digest(valueBytes));
+ }
+
+ /*if (log.isDebugEnabled()) {
+ log.debug("Digest : " + clientDigest + " Username:" + username
+ + " ClientSigest:" + clientDigest + " nonce:" + nonce
+ + " nc:" + nc + " cnonce:" + cnonce + " qop:" + qop
+ + " realm:" + realm + "md5a2:" + md5a2
+ + " Server digest:" + serverDigest);
+ }*/
+
+ if (serverDigest.equals(clientDigest)) {
+ return (username);
+ }
+
+ return null;
+ }
+
+
+
+ public static String login( HttpServletRequest request,
+ HttpServletResponse response
+ )
+ throws CaimitoException {
+ String ua = request.getHeader("user-agent");
+
+ /*java.util.Enumeration hs = request.getHeaderNames();
+ while (hs.hasMoreElements())
+ {
+ String hn = (String)hs.nextElement();
+ String hv = request.getHeader(hn);
+ System.out.println(hn + " USER HEADER " + hv);
+
+ }
+
+
+ java.util.Enumeration hds = request.getParameterNames();
+ while (hds.hasMoreElements())
+ {
+ String hd = (String)hds.nextElement();
+ String hdv = request.getParameter(hd);
+ //(hd + " PAR " + hdv);
+ System.out.println(hd + " USER params " + hdv);
+ }
+
+ String ct = request.getContentType();
+ if (ct != null && ct.equals("application/xml"))
+ {
+ int cl = request.getContentLength();
+ if (cl > 0){
+ byte[] transferBuffer = new byte[cl];
+ try{
+ BufferedInputStream requestBufInStream = new BufferedInputStream(request.getInputStream(), cl);
+ requestBufInStream.read(transferBuffer);
+ System.out.println(" XML VAL " + new String(transferBuffer));
+ }catch (Exception e){
+ e.printStackTrace();
+ }
+ }
+ }
+
+ //if (ua.equals("Microsoft Data Access Internet Publishing Provider DAV") || ua.indexOf("davfs2") > -1 || CaimitoConfig.getConfig().getString(ua + ".auth").equals("basic"))
+ // return basicLogin(request,response);
+ System.out.println("USER AGAENT " + ua);*/
+ if (CaimitoConfig.getConfig().getString(ua + ".auth").equals("digest"))
+ return digestLogin(request,response);
+ return basicLogin(request,response);
+ }
+
+
+ public static String digestLogin( HttpServletRequest request,
+ HttpServletResponse response
+ )
+ throws CaimitoException {
+ //("DIGEST LOGIN 1");
+ NameValuePairs nvp = new NameValuePairs();
+ String hr = request.getHeader("Authorization");
+ if (hr != null)
+ {
+ if (hr.startsWith("Digest "))
+ {
+try{
+ //hr = SharedMethods.replaceSubstring(hr,"Digest ","");
+ hr = hr.trim();
+ hr = hr.substring(7,hr.length());
+ // username="caimitoadmin", realm="Caimito", nonce="", uri="/", response="2fb52dbbcb7b25fd33840eac3027e9c5"
+ NameValuePairs nvp1 = NameValuePairs.toNameValuePair(hr,"=",",");
+ Enumeration nvp1e = nvp1.keys();
+ String k = null;
+ String v = null;
+ while(nvp1e.hasMoreElements())
+ {
+ k = (String)nvp1e.nextElement();
+ v = nvp1.getString(k);
+ nvp.put(k.trim(),StringUtil.getTrimmedValue(v.trim()));
+ }
+ nvp.put("method",request.getMethod());
+ //(nvp + " DIGEST 1 " + hr);
+ //byte[] b = Base64Decoder.fromBase64(hr.getBytes());
+ //String auth = new String(b);
+ //String name = auth.substring(0,auth.indexOf(":"));
+ //String pass = auth.substring(auth.indexOf(":") + 1,auth.length());
+
+
+ String name = authenticate(nvp);
+ //if (UserMgr. (CaimitoConfig.shaftapp).login(CaimitoConfig.shaftapp,name,pass) != null)
+ if (name != null)
+ {
+ //request.setPrincipal(RealmEngine.get().getPrincipal(name));
+ //request.setAuthType("BASIC");
+ // request.getSession()
+ request.setAttribute(CaimitoConfig.caimitouserreqobj,name);
+ return name;
+ }
+ }catch (Exception e){
+ e.printStackTrace();
+ //return null;
+ }
+ }
+ }
+ if (response != null)
+ sendError(request,response,nvp.getString("nonce").trim());
+ return null;
+
+ }
+
+
+
+ protected static boolean isNonceStale(String nonce){
+
+
+ int i = nonce.indexOf(":");
+ if (i < 0 || (i + 1) == nonce.length()) {
+ return true;
+ }
+ long nonceTime;
+ try {
+ nonceTime = Long.parseLong(nonce.substring(0, i));
+ } catch (NumberFormatException nfe) {
+ return true;
+ }
+ //String md5clientIpTimeKey = nonce.substring(i + 1);
+ long currentTime = System.currentTimeMillis();
+ //(currentTime + ":" + nonceTime + ":" + CaimitoConfig.nonceValidity + ":IS NONE STALE ##########################");
+ if ((currentTime - nonceTime) > CaimitoConfig.nonceValidity) {
+ return true;
+ }
+ else return false;
+// return true;
+
+ }
+
+
+ public static void sendError( HttpServletRequest request,HttpServletResponse response,String nonce1)
+ {
+ try
+ {
+ String nonce = generateNonce(request);
+ boolean isn = isNonceStale(nonce1);
+ //(nonce1 + " IS NOT STALE " + isn);
+ setAuthenticateHeader(request, response, nonce,
+ isn);
+ response.sendError(HttpServletResponse.SC_UNAUTHORIZED);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+
+ }
+ }
+
+
+ protected static String generateNonce(HttpServletRequest request) {
+
+ long currentTime = System.currentTimeMillis();
+
+
+ String ipTimeKey =
+ request.getRemoteAddr() + ":" + currentTime + ":" + randomGenerate();
+
+ byte[] buffer;
+ synchronized (md5Helper) {
+ buffer = md5Helper.digest(
+ ipTimeKey.getBytes(Charset.defaultCharset()));
+ }
+
+ return currentTime + ":" + md5Encode(buffer);
+ }
+
+ private static final char[] hexadecimal =
+ {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
+ 'a', 'b', 'c', 'd', 'e', 'f'};
+
+
+ // --------------------------------------------------------- Public Methods
+
+
+ /**
+ * Encodes the 128 bit (16 bytes) MD5 into a 32 character String.
+ *
+ * @param binaryData Array containing the digest
+ * @return Encoded MD5, or null if encoding failed
+ */
+ protected static String md5Encode( byte[] binaryData ) {
+
+ if (binaryData.length != 16)
+ return null;
+
+ char[] buffer = new char[32];
+
+ for (int i=0; i<16; i++) {
+ int low = binaryData[i] & 0x0f;
+ int high = (binaryData[i] & 0xf0) >> 4;
+ buffer[i*2] = hexadecimal[high];
+ buffer[i*2 + 1] = hexadecimal[low];
+ }
+
+ return new String(buffer);
+
+ }
+
+
+
+ protected static String randomGenerate(){
+
+ String tid = AlphaNumeric.generateRandomAlphNumeric(CaimitoConfig.digestLength);
+String dig = CaimitoConfig.defaultDigest;
+if (dig != null)
+tid = Crypto.digest(tid,dig);
+ return tid;
+ }
+
+ protected static final String AUTH_HEADER_NAME = "WWW-Authenticate";
+ protected static final String QOP = "auth";
+
+ protected static void setAuthenticateHeader(HttpServletRequest request,
+ HttpServletResponse response,
+ String nonce,
+ boolean isNonceStale) {
+
+ // Get the realm name
+ String realmName = CaimitoConfig.SecurityRealmName;
+
+ String authenticateHeader;
+ if (isNonceStale) {
+ authenticateHeader = "Digest realm=\"" + realmName + "\", " +
+ "qop=\"" + QOP + "\", nonce=\"" + nonce + "\", " + "opaque=\"" +
+ randomGenerate() + "\", stale=true";
+ } else {
+ authenticateHeader = "Digest realm=\"" + realmName + "\", " +
+ "qop=\"" + QOP + "\", nonce=\"" + nonce + "\", " + "opaque=\"" +
+ randomGenerate() + "\"";
+ }
+
+
+//("authenticateHeader 1 " + authenticateHeader);
+ response.setHeader(AUTH_HEADER_NAME, authenticateHeader);
+
+ }
+
+
+
+ public static String basicLogin( HttpServletRequest request,
+ HttpServletResponse response
+ )
+ throws CaimitoException {
+
+ String hr = request.getHeader("Authorization");
+ if (hr != null)
+ {
+ if (hr.startsWith("Basic "))
+ {
+
+ //hr = SharedMethods.replaceSubstring(hr,"Digest ","");
+ hr = hr.trim();
+ hr = hr.substring(6,hr.length());
+ // username="caimitoadmin", realm="Caimito", nonce="", uri="/", response="2fb52dbbcb7b25fd33840eac3027e9c5"
+ NameValuePairs nvp = NameValuePairs.toNameValuePair(hr,"=",",");
+ //(nvp + " BASIC 1 " + hr);
+ byte[] b = Base64Decoder.fromBase64(hr.getBytes());
+ String auth = new String(b);
+ String name = auth.substring(0,auth.indexOf(":"));
+ String pass = auth.substring(auth.indexOf(":") + 1,auth.length());
+ try{
+
+ if (UserMgr.getUserMgr(CaimitoConfig.shaftapp).login(CaimitoConfig.shaftapp,name,pass,false) != null)
+ {
+ //request.setPrincipal(RealmEngine.get().getPrincipal(name));
+ //request.setAuthType("BASIC");
+ // request.getSession()
+ request.setAttribute(CaimitoConfig.caimitouserreqobj,name);
+ return name;
+ }
+ }catch (Exception e){
+ e.printStackTrace();
+ //return null;
+ }
+ }
+ }
+ if (response != null)
+ sendBasicError(request,response);
+ return null;
+
+ }
+
+ public static void sendBasicError( HttpServletRequest request,HttpServletResponse response)
+ {
+ try
+ {
+ /*
+ if (DeploymentDescriptor.isSecureLoginRequired() && !request.getScheme().equalsIgnoreCase("https"))
+ {
+ String fau = request.getTrimmedRequestURI();
+ if (request.getQueryString() != null)
+ fau = fau + "?" + request.getQueryString();
+ if (!fau.startsWith("/"))
+ fau = "/" + fau;
+ response.sendRedirect("https://" + request.getServerName() + fau);
+ return;
+ }*/
+ String rn = CaimitoConfig.SecurityRealmName;
+
+ //("BASIC ERROR SENT " + rn);
+ response.setHeader("Content-Type","text/html");
+ response.setHeader("WWW-Authenticate","Basic realm=\"" + rn + "\"");
+ response.sendError(401);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+
+ }
+ }
+}
+
+class CaimitoBooleanHolder{
+ public boolean value = false;
+}
+>>>>>>> 81b81b090d652d7b3c1de4359597c4836eb617da
0  source/ngasi/caimito/resource/ShaftAppMgr.java 100755 → 100644
View
File mode changed
0  source/ngasi/caimito/resource/ShaftResourceObj.java 100755 → 100644
View
File mode changed
6 webapps/WEB-INF/caimito/config.properties.sample
View
@@ -1,3 +1,4 @@
+<<<<<<< HEAD
#cloud_accounts_for_administration_only
cloud.setup=single_cloud_account_with_single_storage
#minutes
@@ -6,6 +7,11 @@ request.timeout=130
#cloud.api.version=
+=======
+#optional - 1.0,2.0
+#cloud.api.version=
+
+>>>>>>> 81b81b090d652d7b3c1de4359597c4836eb617da
#file,openstack
resource=file
#A Container or Bucket
19 webapps/WEB-INF/web.xml
View
@@ -29,6 +29,7 @@
</description>
<filter>
<filter-name>shf</filter-name>
+<<<<<<< HEAD
<filter-class>org.shaft.ShaftAsyncFilter</filter-class>
<async-supported>true</async-supported>
</filter>
@@ -38,6 +39,13 @@
<url-pattern>/WEB-INF/*</url-pattern>
<url-pattern>/shaftapps/*</url-pattern>
<url-pattern>/ca/*</url-pattern>
+=======
+ <filter-class>org.shaft.ShaftFilter</filter-class>
+ </filter>
+ <filter-mapping>
+ <filter-name>shf</filter-name>
+ <url-pattern>/*</url-pattern>
+>>>>>>> 81b81b090d652d7b3c1de4359597c4836eb617da
</filter-mapping>
@@ -52,15 +60,23 @@
</servlet>
<servlet-mapping>
<servlet-name>Jersey Web Application</servlet-name>
+<<<<<<< HEAD
<url-pattern>/ca/shaftrest1/*</url-pattern>
<url-pattern>/shaftrest1/*</url-pattern>
+=======
+ <url-pattern>/shaftrest/*</url-pattern>
+>>>>>>> 81b81b090d652d7b3c1de4359597c4836eb617da
</servlet-mapping>
<servlet>
<servlet-name>webdav</servlet-name>
+<<<<<<< HEAD
<servlet-class>ngasi.caimito.CaimitoAsyncWebdavServlet</servlet-class>
<async-supported>true</async-supported>
+=======
+ <servlet-class>ngasi.caimito.CaimitoWebdavServlet</servlet-class>
+>>>>>>> 81b81b090d652d7b3c1de4359597c4836eb617da
<init-param>
<param-name>debug</param-name>
<param-value>0</param-value>
@@ -88,10 +104,13 @@
<location>/ca/401.html</location>
</error-page>
<error-page>
+<<<<<<< HEAD
<error-code>403</error-code>
<location>/ca/403.html</location>
</error-page>
<error-page>
+=======
+>>>>>>> 81b81b090d652d7b3c1de4359597c4836eb617da
<error-code>500</error-code>
<location>/ca/500.html</location>
</error-page>
444 webapps/index.jsp
View
@@ -1,222 +1,222 @@
-<%--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to You under the Apache License, Version 2.0
-(the "License"); you may not use this file except in compliance with
-the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
---%>
-<!DOCTYPE html>
-<%@ page session="false" %>
-<%
-java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyy");
-request.setAttribute("year", sdf.format(new java.util.Date()));
-request.setAttribute("tomcat7Url", "http://tomcat.apache.org/");
-request.setAttribute("tomcat7DocUrl", "/docs/");
-request.setAttribute("tomcat7ExamplesUrl", "/examples/");
-%>
-<html lang="en">
- <head>
- <title><%=request.getServletContext().getServerInfo() %></title>
- <link href="favicon.ico" rel="icon" type="image/x-icon" />
- <link href="favicon.ico" rel="shortcut icon" type="image/x-icon" />
- <link href="tomcat.css" rel="stylesheet" type="text/css" />
- </head>
-
- <body>
- <div id="wrapper">
- <div id="navigation" class="curved container">
- <span id="nav-home"><a href="${tomcat7Url}">Home</a></span>
- <span id="nav-hosts"><a href="${tomcat7DocUrl}">Documentation</a></span>
- <span id="nav-config"><a href="${tomcat7DocUrl}config/">Configuration</a></span>
- <span id="nav-examples"><a href="${tomcat7ExamplesUrl}">Examples</a></span>
- <span id="nav-wiki"><a href="http://wiki.apache.org/tomcat/FrontPage">Wiki</a></span>
- <span id="nav-lists"><a href="${tomcat7Url}lists.html">Mailing Lists</a></span>
- <span id="nav-help"><a href="${tomcat7Url}findhelp.html">Find Help</a></span>
- <br class="separator" />
- </div>
- <div id="asf-box">
- <h1>${pageContext.servletContext.serverInfo}</h1>
- </div>
- <div id="upper" class="curved container">
- <div id="congrats" class="curved container">
- <h2>If you're seeing this, you've successfully installed Tomcat. Congratulations!</h2>
- </div>
- <div id="notice">
- <img src="tomcat.png" alt="[tomcat logo]" />
- <div id="tasks">
- <h3>Recommended Reading:</h3>
- <h4><a href="${tomcat7DocUrl}security-howto.html">Security Considerations HOW-TO</a></h4>
- <h4><a href="${tomcat7DocUrl}manager-howto.html">Manager Application HOW-TO</a></h4>
- <h4><a href="${tomcat7DocUrl}cluster-howto.html">Clustering/Session Replication HOW-TO</a></h4>
- </div>
- </div>
- <div id="actions">
- <div class="button">
- <a class="container shadow" href="/manager/status"><span>Server Status</span></a>
- </div>
- <div class="button">
- <a class="container shadow" href="/manager/html"><span>Manager App</span></a>
- </div>
- <div class="button">
- <a class="container shadow" href="/host-manager/html"><span>Host Manager</span></a>
- </div>
- </div>
- <!--
- <br class="separator" />
- -->
- <br class="separator" />
- </div>
- <div id="middle" class="curved container">
- <h3>Developer Quick Start</h3>
- <div class="col25">
- <div class="container">
- <p><a href="${tomcat7DocUrl}setup.html">Tomcat Setup</a></p>
- <p><a href="${tomcat7DocUrl}appdev/">First Web Application</a></p>
- </div>
- </div>
- <div class="col25">
- <div class="container">
- <p><a href="${tomcat7DocUrl}realm-howto.html">Realms &amp; AAA</a></p>
- <p><a href="${tomcat7DocUrl}jndi-datasource-examples-howto.html">JDBC DataSources</a></p>
- </div>
- </div>
- <div class="col25">
- <div class="container">
- <p><a href="${tomcat7ExamplesUrl}">Examples</a></p>
- </div>
- </div>
- <div class="col25">
- <div class="container">
- <p><a href="http://wiki.apache.org/tomcat/Specifications">Servlet Specifications</a></p>
- <p><a href="http://wiki.apache.org/tomcat/TomcatVersions">Tomcat Versions</a></p>
- </div>
- </div>
- <br class="separator" />
- </div>
- <div id="lower">
- <div id="low-manage" class="">
- <div class="curved container">
- <h3>Managing Tomcat</h3>
- <p>For security, access to the <a href="/manager/html">manager webapp</a> is restricted.
- Users are defined in:</p>
- <pre>$CATALINA_HOME/conf/tomcat-users.xml</pre>
- <p>In Tomcat 7.0 access to the manager application is split between
- different users. &nbsp; <a href="${tomcat7DocUrl}manager-howto.html">Read more...</a></p>
- <br />
- <h4><a href="${tomcat7DocUrl}RELEASE-NOTES.txt">Release Notes</a></h4>
- <h4><a href="${tomcat7DocUrl}changelog.html">Changelog</a></h4>
- <h4><a href="${tomcat7Url}migration.html">Migration Guide</a></h4>
- <h4><a href="${tomcat7Url}security.html">Security Notices</a></h4>
- </div>
- </div>
- <div id="low-docs" class="">
- <div class="curved container">
- <h3>Documentation</h3>
- <h4><a href="${tomcat7DocUrl}">Tomcat 7.0 Documentation</a></h4>
- <h4><a href="${tomcat7DocUrl}config/">Tomcat 7.0 Configuration</a></h4>
- <h4><a href="http://wiki.apache.org/tomcat/FrontPage">Tomcat Wiki</a></h4>
- <p>Find additional important configuration information in:</p>
- <pre>$CATALINA_HOME/RUNNING.txt</pre>
- <p>Developers may be interested in:</p>
- <ul>
- <li><a href="http://tomcat.apache.org/bugreport.html">Tomcat 7.0 Bug Database</a></li>
- <li><a href="${tomcat7DocUrl}api/index.html">Tomcat 7.0 JavaDocs</a></li>
- <li><a href="http://svn.apache.org/repos/asf/tomcat/tc7.0.x/">Tomcat 7.0 SVN Repository</a></li>
- </ul>
- </div>
- </div>
- <div id="low-help" class="">
- <div class="curved container">
- <h3>Getting Help</h3>
- <h4><a href="${tomcat7Url}faq/">FAQ</a> and <a href="${tomcat7Url}lists.html">Mailing Lists</a></h4>
- <p>The following mailing lists are available:</p>
- <ul>
- <li id="list-announce"><strong><a href="mailto:announce-subscribe@tomcat.apache.org">announce@tomcat.apache.org</a><br />
- Important announcements, releases, security vulnerability notifications. (Low volume).</strong>
- </li>
- <li><a href="mailto:users-subscribe@tomcat.apache.org">users@tomcat.apache.org</a><br />
- User support and discussion
- </li>
- <li><a href="mailto:taglibs-user-subscribe@tomcat.apache.org">taglibs-user@tomcat.apache.org</a><br />
- User support and discussion for <a href="${tomcat7Url}taglibs/">Apache Taglibs</a>
- </li>
- <li><a href="mailto:dev-subscribe@tomcat.apache.org">dev@tomcat.apache.org</a><br />
- Development mailing list, including commit messages
- </li>
- </ul>
- </div>
- </div>
- <br class="separator" />
- </div>
- <div id="footer" class="curved container">
- <div class="col20">
- <div class="container">
- <h4>Other Downloads</h4>
- <ul>
- <li><a href="${tomcat7Url}download-connectors.cgi">Tomcat Connectors</a></li>
- <li><a href="${tomcat7Url}download-native.cgi">Tomcat Native</a></li>
- <li><a href="${tomcat7Url}taglibs/">Taglibs</a></li>
- <li><a href="${tomcat7DocUrl}deployer-howto.html">Deployer</a></li>
- </ul>
- </div>
- </div>
- <div class="col20">
- <div class="container">
- <h4>Other Documentation</h4>
- <ul>
- <li><a href="${tomcat7Url}connectors-doc/">Tomcat Connectors</a></li>
- <li><a href="${tomcat7Url}connectors-doc/">mod_jk Documentation</a></li>
- <li><a href="${tomcat7Url}native-doc/">Tomcat Native</a></li>
- <li><a href="${tomcat7DocUrl}deployer-howto.html">Deployer</a></li>
- </ul>
- </div>
- </div>
- <div class="col20">
- <div class="container">
- <h4>Get Involved</h4>
- <ul>
- <li><a href="${tomcat7Url}getinvolved.html">Overview</a></li>
- <li><a href="${tomcat7Url}svn.html">SVN Repositories</a></li>
- <li><a href="${tomcat7Url}lists.html">Mailing Lists</a></li>
- <li><a href="http://wiki.apache.org/tomcat/FrontPage">Wiki</a></li>
- </ul>
- </div>
- </div>
- <div class="col20">
- <div class="container">
- <h4>Miscellaneous</h4>
- <ul>
- <li><a href="${tomcat7Url}contact.html">Contact</a></li>
- <li><a href="${tomcat7Url}legal.html">Legal</a></li>
- <li><a href="http://www.apache.org/foundation/sponsorship.html">Sponsorship</a></li>
- <li><a href="http://www.apache.org/foundation/thanks.html">Thanks</a></li>
- </ul>
- </div>
- </div>
- <div class="col20">
- <div class="container">
- <h4>Apache Software Foundation</h4>
- <ul>
- <li><a href="${tomcat7Url}whoweare.html">Who We Are</a></li>
- <li><a href="${tomcat7Url}heritage.html">Heritage</a></li>
- <li><a href="http://www.apache.org">Apache Home</a></li>
- <li><a href="${tomcat7Url}resources.html">Resources</a></li>
- </ul>
- </div>
- </div>
- <br class="separator" />
- </div>
- <p class="copyright">Copyright &copy;1999-${year} Apache Software Foundation. All Rights Reserved</p>
- </div>
- </body>
-
-</html>
+<%--
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements. See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+--%>
+<!DOCTYPE html>
+<%@ page session="false" %>
+<%
+java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyy");
+request.setAttribute("year", sdf.format(new java.util.Date()));
+request.setAttribute("tomcat7Url", "http://tomcat.apache.org/");
+request.setAttribute("tomcat7DocUrl", "/docs/");
+request.setAttribute("tomcat7ExamplesUrl", "/examples/");
+%>
+<html lang="en">
+ <head>
+ <title><%=request.getServletContext().getServerInfo() %></title>
+ <link href="favicon.ico" rel="icon" type="image/x-icon" />
+ <link href="favicon.ico" rel="shortcut icon" type="image/x-icon" />
+ <link href="tomcat.css" rel="stylesheet" type="text/css" />
+ </head>
+
+ <body>
+ <div id="wrapper">
+ <div id="navigation" class="curved container">
+ <span id="nav-home"><a href="${tomcat7Url}">Home</a></span>
+ <span id="nav-hosts"><a href="${tomcat7DocUrl}">Documentation</a></span>
+ <span id="nav-config"><a href="${tomcat7DocUrl}config/">Configuration</a></span>
+ <span id="nav-examples"><a href="${tomcat7ExamplesUrl}">Examples</a></span>
+ <span id="nav-wiki"><a href="http://wiki.apache.org/tomcat/FrontPage">Wiki</a></span>
+ <span id="nav-lists"><a href="${tomcat7Url}lists.html">Mailing Lists</a></span>
+ <span id="nav-help"><a href="${tomcat7Url}findhelp.html">Find Help</a></span>
+ <br class="separator" />
+ </div>
+ <div id="asf-box">
+ <h1>${pageContext.servletContext.serverInfo}</h1>
+ </div>
+ <div id="upper" class="curved container">
+ <div id="congrats" class="curved container">
+ <h2>If you're seeing this, you've successfully installed Tomcat. Congratulations!</h2>
+ </div>
+ <div id="notice">
+ <img src="tomcat.png" alt="[tomcat logo]" />
+ <div id="tasks">
+ <h3>Recommended Reading:</h3>
+ <h4><a href="${tomcat7DocUrl}security-howto.html">Security Considerations HOW-TO</a></h4>
+ <h4><a href="${tomcat7DocUrl}manager-howto.html">Manager Application HOW-TO</a></h4>
+ <h4><a href="${tomcat7DocUrl}cluster-howto.html">Clustering/Session Replication HOW-TO</a></h4>
+ </div>
+ </div>
+ <div id="actions">
+ <div class="button">
+ <a class="container shadow" href="/manager/status"><span>Server Status</span></a>
+ </div>
+ <div class="button">
+ <a class="container shadow" href="/manager/html"><span>Manager App</span></a>
+ </div>
+ <div class="button">
+ <a class="container shadow" href="/host-manager/html"><span>Host Manager</span></a>
+ </div>
+ </div>
+ <!--
+ <br class="separator" />
+ -->
+ <br class="separator" />
+ </div>
+ <div id="middle" class="curved container">
+ <h3>Developer Quick Start</h3>
+ <div class="col25">
+ <div class="container">
+ <p><a href="${tomcat7DocUrl}setup.html">Tomcat Setup</a></p>
+ <p><a href="${tomcat7DocUrl}appdev/">First Web Application</a></p>
+ </div>
+ </div>
+ <div class="col25">
+ <div class="container">
+ <p><a href="${tomcat7DocUrl}realm-howto.html">Realms &amp; AAA</a></p>
+ <p><a href="${tomcat7DocUrl}jndi-datasource-examples-howto.html">JDBC DataSources</a></p>
+ </div>
+ </div>
+ <div class="col25">
+ <div class="container">
+ <p><a href="${tomcat7ExamplesUrl}">Examples</a></p>
+ </div>
+ </div>
+ <div class="col25">
+ <div class="container">
+ <p><a href="http://wiki.apache.org/tomcat/Specifications">Servlet Specifications</a></p>
+ <p><a href="http://wiki.apache.org/tomcat/TomcatVersions">Tomcat Versions</a></p>
+ </div>
+ </div>
+ <br class="separator" />
+ </div>
+ <div id="lower">
+ <div id="low-manage" class="">
+ <div class="curved container">
+ <h3>Managing Tomcat</h3>
+ <p>For security, access to the <a href="/manager/html">manager webapp</a> is restricted.
+ Users are defined in:</p>
+ <pre>$CATALINA_HOME/conf/tomcat-users.xml</pre>
+ <p>In Tomcat 7.0 access to the manager application is split between
+ different users. &nbsp; <a href="${tomcat7DocUrl}manager-howto.html">Read more...</a></p>
+ <br />
+ <h4><a href="${tomcat7DocUrl}RELEASE-NOTES.txt">Release Notes</a></h4>
+ <h4><a href="${tomcat7DocUrl}changelog.html">Changelog</a></h4>
+ <h4><a href="${tomcat7Url}migration.html">Migration Guide</a></h4>
+ <h4><a href="${tomcat7Url}security.html">Security Notices</a></h4>
+ </div>
+ </div>
+ <div id="low-docs" class="">
+ <div class="curved container">
+ <h3>Documentation</h3>
+ <h4><a href="${tomcat7DocUrl}">Tomcat 7.0 Documentation</a></h4>
+ <h4><a href="${tomcat7DocUrl}config/">Tomcat 7.0 Configuration</a></h4>
+ <h4><a href="http://wiki.apache.org/tomcat/FrontPage">Tomcat Wiki</a></h4>
+ <p>Find additional important configuration information in:</p>
+ <pre>$CATALINA_HOME/RUNNING.txt</pre>
+ <p>Developers may be interested in:</p>
+ <ul>
+ <li><a href="http://tomcat.apache.org/bugreport.html">Tomcat 7.0 Bug Database</a></li>
+ <li><a href="${tomcat7DocUrl}api/index.html">Tomcat 7.0 JavaDocs</a></li>
+ <li><a href="http://svn.apache.org/repos/asf/tomcat/tc7.0.x/">Tomcat 7.0 SVN Repository</a></li>
+ </ul>
+ </div>
+ </div>
+ <div id="low-help" class="">
+ <div class="curved container">
+ <h3>Getting Help</h3>
+ <h4><a href="${tomcat7Url}faq/">FAQ</a> and <a href="${tomcat7Url}lists.html">Mailing Lists</a></h4>
+ <p>The following mailing lists are available:</p>
+ <ul>
+ <li id="list-announce"><strong><a href="mailto:announce-subscribe@tomcat.apache.org">announce@tomcat.apache.org</a><br />
+ Important announcements, releases, security vulnerability notifications. (Low volume).</strong>
+ </li>
+ <li><a href="mailto:users-subscribe@tomcat.apache.org">users@tomcat.apache.org</a><br />
+ User support and discussion
+ </li>
+ <li><a href="mailto:taglibs-user-subscribe@tomcat.apache.org">taglibs-user@tomcat.apache.org</a><br />
+ User support and discussion for <a href="${tomcat7Url}taglibs/">Apache Taglibs</a>
+ </li>
+ <li><a href="mailto:dev-subscribe@tomcat.apache.org">dev@tomcat.apache.org</a><br />
+ Development mailing list, including commit messages
+ </li>
+ </ul>
+ </div>
+ </div>
+ <br class="separator" />
+ </div>
+ <div id="footer" class="curved container">
+ <div class="col20">
+ <div class="container">
+ <h4>Other Downloads</h4>
+ <ul>
+ <li><a href="${tomcat7Url}download-connectors.cgi">Tomcat Connectors</a></li>
+ <li><a href="${tomcat7Url}download-native.cgi">Tomcat Native</a></li>
+ <li><a href="${tomcat7Url}taglibs/">Taglibs</a></li>
+ <li><a href="${tomcat7DocUrl}deployer-howto.html">Deployer</a></li>
+ </ul>
+ </div>
+ </div>
+ <div class="col20">
+ <div class="container">
+ <h4>Other Documentation</h4>
+ <ul>
+ <li><a href="${tomcat7Url}connectors-doc/">Tomcat Connectors</a></li>
+ <li><a href="${tomcat7Url}connectors-doc/">mod_jk Documentation</a></li>
+ <li><a href="${tomcat7Url}native-doc/">Tomcat Native</a></li>
+ <li><a href="${tomcat7DocUrl}deployer-howto.html">Deployer</a></li>
+ </ul>
+ </div>
+ </div>
+ <div class="col20">
+ <div class="container">
+ <h4>Get Involved</h4>
+ <ul>
+ <li><a href="${tomcat7Url}getinvolved.html">Overview</a></li>
+ <li><a href="${tomcat7Url}svn.html">SVN Repositories</a></li>
+ <li><a href="${tomcat7Url}lists.html">Mailing Lists</a></li>
+ <li><a href="http://wiki.apache.org/tomcat/FrontPage">Wiki</a></li>
+ </ul>
+ </div>
+ </div>
+ <div class="col20">
+ <div class="container">
+ <h4>Miscellaneous</h4>
+ <ul>
+ <li><a href="${tomcat7Url}contact.html">Contact</a></li>
+ <li><a href="${tomcat7Url}legal.html">Legal</a></li>
+ <li><a href="http://www.apache.org/foundation/sponsorship.html">Sponsorship</a></li>
+ <li><a href="http://www.apache.org/foundation/thanks.html">Thanks</a></li>
+ </ul>
+ </div>
+ </div>
+ <div class="col20">
+ <div class="container">
+ <h4>Apache Software Foundation</h4>
+ <ul>
+ <li><a href="${tomcat7Url}whoweare.html">Who We Are</a></li>
+ <li><a href="${tomcat7Url}heritage.html">Heritage</a></li>
+ <li><a href="http://www.apache.org">Apache Home</a></li>
+ <li><a href="${tomcat7Url}resources.html">Resources</a></li>
+ </ul>
+ </div>
+ </div>
+ <br class="separator" />
+ </div>
+ <p class="copyright">Copyright &copy;1999-${year} Apache Software Foundation. All Rights Reserved</p>
+ </div>
+ </body>
+
+</html>
Please sign in to comment.
Something went wrong with that request. Please try again.