You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by aj...@apache.org on 2005/02/17 04:32:09 UTC

svn commit: r154114 - in webservices/axis/trunk/java/dev/scratch/prototype2/src/html: HappyAxis.jsp css/ css/axis-style.css images/ images/axis.jpg include/ include/footer.inc include/header.inc include/link-footer.inc index.html index.jsp upload.jsp

Author: ajith
Date: Wed Feb 16 19:32:07 2005
New Revision: 154114

URL: http://svn.apache.org/viewcvs?view=rev&rev=154114
Log:
Streamlined the Axis2 web app. Now the web pages look nice 
and there is a upload utility as well.

Added:
    webservices/axis/trunk/java/dev/scratch/prototype2/src/html/css/
    webservices/axis/trunk/java/dev/scratch/prototype2/src/html/css/axis-style.css
    webservices/axis/trunk/java/dev/scratch/prototype2/src/html/images/
    webservices/axis/trunk/java/dev/scratch/prototype2/src/html/images/axis.jpg   (with props)
    webservices/axis/trunk/java/dev/scratch/prototype2/src/html/include/
    webservices/axis/trunk/java/dev/scratch/prototype2/src/html/include/footer.inc
    webservices/axis/trunk/java/dev/scratch/prototype2/src/html/include/header.inc
    webservices/axis/trunk/java/dev/scratch/prototype2/src/html/include/link-footer.inc
    webservices/axis/trunk/java/dev/scratch/prototype2/src/html/index.jsp
      - copied, changed from r154000, webservices/axis/trunk/java/dev/scratch/prototype2/src/html/index.html
    webservices/axis/trunk/java/dev/scratch/prototype2/src/html/upload.jsp
Removed:
    webservices/axis/trunk/java/dev/scratch/prototype2/src/html/index.html
Modified:
    webservices/axis/trunk/java/dev/scratch/prototype2/src/html/HappyAxis.jsp

Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/html/HappyAxis.jsp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/html/HappyAxis.jsp?view=diff&r1=154113&r2=154114
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/html/HappyAxis.jsp (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/html/HappyAxis.jsp Wed Feb 16 19:32:07 2005
@@ -34,6 +34,7 @@
 %>
 <head>
 <title>Axis2 Happiness Page</title>
+<link href="css/axis-style.css" rel="stylesheet" type="text/css">
 </head>
 <body bgcolor='#ffffff'>
 <%port =request.getServerPort();%>
@@ -467,8 +468,9 @@
    %>
        <p>
        <font color="blue" >
-       Found the echo service and Axis2 is working properly, and now you can drop any web service in
-       to axis2/WEB-INF/service and check it is working.and got the following result
+       Found the echo service and Axis2 is working properly, and now you can either drop any web service in
+       to axis2/WEB-INF/service or use the upload utility in this application to upload a service
+        and check whether it's working.
        <br>
        <%= error%> </font>
        </p>
@@ -478,7 +480,7 @@
     %>
      <p>
       <font color="red" >
-     Not found echo service or Axis2 is not working properly, check whether the echo.jar is in
+     Either the echo service not found or Axis2 is not working properly. Check whether the echo.jar is in
      webapps/axis2/WEB-INF/service if it is then report the following error to the mailing list.
       <br>
      <%= error%></font>
@@ -491,21 +493,12 @@
     <%
         String servletVersion=getServletVersion();
         String xmlParser=getParserName();
-        String xmlParserLocation = getParserLocation(out);
-
     %>
     <table>
         <tr><td>Servlet version</td><td><%= servletVersion %></td></tr>
         <tr><td>XML Parser</td><td><%= xmlParser %></td></tr>
-        <tr><td>XML ParserLocation</td><td><%= xmlParserLocation %></td></tr>
+        <tr><td>Platform</td><td><%= getServletConfig().getServletContext().getServerInfo()%></td></tr>
     </table>
-<% if(xmlParser.indexOf("crimson")>=0) { %>
-    <p>
-    <b>We recommend <a href="http://xml.apache.org/xerces2-j/">Xerces 2</a>
-        over Crimson as the XML parser for Axis</b>
-    </p>
-<%    } %>
-
     <h2>Examining System Properties</h2>
 <%
     /**
@@ -528,7 +521,10 @@
     }
 %>
     <hr>
-    Platform: <%= getServletConfig().getServletContext().getServerInfo()  %>
+
+
+    <jsp:include page="include/link-footer.inc"></jsp:include>
+    <jsp:include page="include/footer.inc"></jsp:include>
 </body>
 </html>
 

Added: webservices/axis/trunk/java/dev/scratch/prototype2/src/html/css/axis-style.css
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/html/css/axis-style.css?view=auto&rev=154114
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/html/css/axis-style.css (added)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/html/css/axis-style.css Wed Feb 16 19:32:07 2005
@@ -0,0 +1,5 @@
+body         {bgcolor="#FFFFFF";	leftmargin="0";	topmargin="0"; font-family:Arial; font-size:11pt}
+h1           { font-family: Arial; font-size: 18pt; font-weight: bold }
+h2           { font-family: Arial; font-size: 14pt; font-weight: bold }
+ul           { font-family: Arial; font-size: 11pt }input        { font-family: Arial; font-size: 8pt; font-weight: bold }
+td           { font-family: Arial; font-size: 10pt }

Added: webservices/axis/trunk/java/dev/scratch/prototype2/src/html/images/axis.jpg
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/html/images/axis.jpg?view=auto&rev=154114
==============================================================================
Binary file - no diff available.

Propchange: webservices/axis/trunk/java/dev/scratch/prototype2/src/html/images/axis.jpg
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: webservices/axis/trunk/java/dev/scratch/prototype2/src/html/include/footer.inc
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/html/include/footer.inc?view=auto&rev=154114
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/html/include/footer.inc (added)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/html/include/footer.inc Wed Feb 16 19:32:07 2005
@@ -0,0 +1,6 @@
+<hr/>
+<table width="100%">
+ <tr>
+   <td align="center">All rights reserved by Apache Software Foundation</td>
+   </tr>
+</table>

Added: webservices/axis/trunk/java/dev/scratch/prototype2/src/html/include/header.inc
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/html/include/header.inc?view=auto&rev=154114
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/html/include/header.inc (added)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/html/include/header.inc Wed Feb 16 19:32:07 2005
@@ -0,0 +1,6 @@
+<table width="100%">
+  <tr>
+    <td align="left"><h1>Apache Axis2</h1></td>
+    <td align="right"><img src="images/axis.jpg"/></td>
+    </tr>
+</table>

Added: webservices/axis/trunk/java/dev/scratch/prototype2/src/html/include/link-footer.inc
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/html/include/link-footer.inc?view=auto&rev=154114
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/html/include/link-footer.inc (added)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/html/include/link-footer.inc Wed Feb 16 19:32:07 2005
@@ -0,0 +1,5 @@
+<table width="100%">
+ <tr>
+   <td align="center"><a href="index.jsp">Back Home</a></td>
+   </tr>
+</table>
\ No newline at end of file

Copied: webservices/axis/trunk/java/dev/scratch/prototype2/src/html/index.jsp (from r154000, webservices/axis/trunk/java/dev/scratch/prototype2/src/html/index.html)
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/html/index.jsp?view=diff&rev=154114&p1=webservices/axis/trunk/java/dev/scratch/prototype2/src/html/index.html&r1=154000&p2=webservices/axis/trunk/java/dev/scratch/prototype2/src/html/index.jsp&r2=154114
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/html/index.html (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/html/index.jsp Wed Feb 16 19:32:07 2005
@@ -1,21 +1,49 @@
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
 <html>
+<%
+/*
+ * Copyright 2002,2004 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+ %>
 <head>
-
-<script language ="javascript">
-  function listServices(){
-     document.Axis2.submit();
-  }
-</script>
-
+    <title>Axis 2 - Home</title>
+    <link href="css/axis-style.css" rel="stylesheet" type="text/css">
 </head>
 	<body>
-       <form method="post" id="Axis2" name="Axis2" action="listServices">
+        <jsp:include page="include/header.inc"></jsp:include>
+       	<br/>
+       	    Welcome to the new generation of Axis. If you can see this it means you have
+       	    successfuly deployed the Axis 2 web application. However to ensure that Axis 2
+       	    is properly working, we encourage you to go to the validate link.
+       	<br/>
+       	<ul>
+         <li><a href="listServices">List Available services</a>
+            <br/>
+            Lists all the available services.
+         </li>
+         <li><a href="HappyAxis.jsp">Validate</a>
+         <br/>
+            This will probe the system to see whether all the required libraries are in place.
+            It will also provide the system information.
+         </li>
+         <li><a href="upload.jsp">Upload a service</a>
+         <br/>
+            Upload a service. you can upload a properly packaged service here
+         </li>
+        </ul>
 
-		<h1>Apache Axis2</h1>
-                <a href="#" onClick="javascript:listServices();"> List Available
-services</a>
-<br>
-<a href="HappyAxis.jsp">Validate</a>
-       </form>
+        <jsp:include page="include/footer.inc"></jsp:include>
 	</body>
 </html>

Added: webservices/axis/trunk/java/dev/scratch/prototype2/src/html/upload.jsp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/html/upload.jsp?view=auto&rev=154114
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/html/upload.jsp (added)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/html/upload.jsp Wed Feb 16 19:32:07 2005
@@ -0,0 +1,121 @@
+<%@ page import="java.io.DataInputStream,
+                 java.io.File,
+                 java.io.FileOutputStream,
+                 java.io.Writer,
+                 java.io.PrintWriter,
+                 java.io.IOException,
+                 org.apache.axis.deployment.DeploymentConstants"%>
+<%@ page contentType="text/html;charset=UTF-8" language="java"
+ %>
+<html>
+<%
+/*
+ * Copyright 2002,2004 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+%>
+
+<%!
+    public void jspInit(){
+        ServletContext context = this.getServletConfig().getServletContext();
+        String repoDir = context.getRealPath("/WEB-INF"+ DeploymentConstants.SERVICE_PATH);
+        deploymentDirectory = new File(repoDir);
+    }
+
+    protected static final String SUBMIT_NAME = "upload";
+    protected File deploymentDirectory = null;
+
+    protected void writeSuccessMessage(String fileName,JspWriter out) throws IOException {
+        out.print("File saved as " +fileName + "<br/>");
+    }
+
+    protected void writeUnsuccessMessage(String message,JspWriter out) throws IOException{
+        out.print("<font color=\"red\">The following error occured <br/>" +message +
+                "</font><br/>"
+        );
+
+    }
+%>
+<head>
+ <title> Upload a service </title>
+  <link href="css/axis-style.css" rel="stylesheet" type="text/css">
+</head>
+	<body>
+	    <jsp:include page="include/header.inc"></jsp:include>
+        <%
+            String contentType = request.getContentType();
+            if (contentType!=null && contentType.indexOf("multipart/form-data")>=0){
+
+                DataInputStream in = new DataInputStream(request.getInputStream());
+                int formDataLength = request.getContentLength();
+                File outputFile = null;
+                byte dataBytes[] = new byte[formDataLength];
+                int byteRead = 0;
+                int totalBytesRead = 0;
+
+                while (totalBytesRead < formDataLength) {
+                    byteRead = in.read(dataBytes, totalBytesRead, formDataLength);
+                    totalBytesRead += byteRead;
+                }
+
+                String file = new String(dataBytes);
+                String saveFile = file.substring(file.indexOf("filename=\"") + 10);
+                saveFile = saveFile.substring(0, saveFile.indexOf("\n"));
+                saveFile = saveFile.substring(saveFile.lastIndexOf("\\") + 1,saveFile.indexOf("\""));
+                saveFile = saveFile.toLowerCase();
+
+                if (!saveFile.endsWith(".jar")){
+                    writeUnsuccessMessage("Wrong file type!!",out);
+                    %>
+                    <jsp:include page="include/link-footer.inc"></jsp:include>
+                    <jsp:include page="include/footer.inc"></jsp:include><%
+                    return;
+                }
+
+                outputFile = new File(deploymentDirectory,saveFile);
+
+                int lastIndex = contentType.lastIndexOf("=");
+                String boundary = contentType.substring(lastIndex + 1,contentType.length());
+
+                int pos;
+                pos = file.indexOf("filename=\"");
+                pos = file.indexOf("\n", pos) + 1;
+                pos = file.indexOf("\n", pos) + 1;
+                pos = file.indexOf("\n", pos) + 1;
+
+                int boundaryLocation = file.indexOf(boundary, pos) - 4;
+                int startPos = ((file.substring(0, pos)).getBytes()).length;
+                int endPos = ((file.substring(0, boundaryLocation)).getBytes()).length;
+
+                FileOutputStream fileOutputStream = new FileOutputStream(outputFile);
+                //fileOutputStream.write(dataBytes);
+                fileOutputStream.write(dataBytes, startPos, (endPos - startPos));
+                fileOutputStream.flush();
+                fileOutputStream.close();
+
+                writeSuccessMessage(saveFile,out);
+
+            }else{
+        %>
+		<h2>Upload a service jar file</h2>
+		You can upload a properly packaged Axis 2 service by selecting the file and clicking upload
+       <form method="post"  name="Axis2upload" action="upload.jsp" enctype="multipart/form-data">
+         <input type="file" name="filename" chars="50"/><br/>
+         <input name="<%=SUBMIT_NAME%>" type="submit" value=" Upload "/>
+       </form>
+       <%}%>
+       <jsp:include page="include/link-footer.inc"></jsp:include>
+       <jsp:include page="include/footer.inc"></jsp:include>
+	</body>
+</html>
\ No newline at end of file