You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by de...@apache.org on 2006/03/21 14:00:37 UTC
svn commit: r387517 - in /webservices/axis2/trunk/java/modules:
core/src/org/apache/axis2/deployment/
core/src/org/apache/axis2/transport/http/
core/src/org/apache/axis2/transport/http/server/
core/src/org/apache/axis2/util/threadpool/ webapp/
Author: deepal
Date: Tue Mar 21 05:00:30 2006
New Revision: 387517
URL: http://svn.apache.org/viewcvs?rev=387517&view=rev
Log:
-fixing 502
- removed kepp-alive setting by default
-removed keep-alive waiting in SimpleConnectionThread , since we are not anding that
-small refactoring
Modified:
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/FileSystemConfigurator.java
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/SOAPOverHTTPSender.java
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/server/SimpleConnectionThread.java
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/util/threadpool/ThreadPool.java
webservices/axis2/trunk/java/modules/webapp/upload.jsp
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/FileSystemConfigurator.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/FileSystemConfigurator.java?rev=387517&r1=387516&r2=387517&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/FileSystemConfigurator.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/FileSystemConfigurator.java Tue Mar 21 05:00:30 2006
@@ -55,8 +55,7 @@
* @return Axis Configuration
* @throws AxisFault
*/
- public AxisConfiguration getAxisConfiguration() throws AxisFault {
+ public synchronized AxisConfiguration getAxisConfiguration() throws AxisFault {
return new DeploymentEngine(repoLocation, axis2xml).load();
-
}
}
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/SOAPOverHTTPSender.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/SOAPOverHTTPSender.java?rev=387517&r1=387516&r2=387517&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/SOAPOverHTTPSender.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/SOAPOverHTTPSender.java Tue Mar 21 05:00:30 2006
@@ -66,13 +66,16 @@
postMethod.setRequestHeader(HTTPConstants.HEADER_SOAP_ACTION, soapActionString);
} else {
}
-
- //TODO : provide a way to enable and diable cookies
//setting the coolie in the out path
Object cookieString = msgContext.getProperty(Constants.COOKIE_STRING);
if (cookieString != null) {
- postMethod.setRequestHeader(HTTPConstants.HEADER_COOKIE, (String) cookieString);
- postMethod.setRequestHeader(HTTPConstants.HEADER_COOKIE2, (String) cookieString);
+ String cookie =(String) cookieString;
+ int index = cookie.indexOf(";");
+ if(index >0){
+ cookie = cookie.substring(0,index);
+ }
+ postMethod.setRequestHeader(HTTPConstants.HEADER_COOKIE,cookie);
+ postMethod.setRequestHeader(HTTPConstants.HEADER_COOKIE2, cookie);
}
postMethod.setRequestHeader(HTTPConstants.HEADER_HOST, url.getHost());
@@ -80,13 +83,13 @@
if (httpVersion != null) {
if (httpVersion.equals(HTTPConstants.HEADER_PROTOCOL_10)) {
httpClient.getParams().setVersion(HttpVersion.HTTP_1_0);
- postMethod.setRequestHeader(HTTPConstants.HEADER_CONNECTION,
- HTTPConstants.HEADER_CONNECTION_KEEPALIVE);
+// postMethod.setRequestHeader(HTTPConstants.HEADER_CONNECTION,
+// HTTPConstants.HEADER_CONNECTION_KEEPALIVE);
} else {
// allowing keep-alive for 1.1
- postMethod.setRequestHeader(HTTPConstants.HEADER_CONNECTION,
- HTTPConstants.HEADER_CONNECTION_KEEPALIVE);
+// postMethod.setRequestHeader(HTTPConstants.HEADER_CONNECTION,
+// HTTPConstants.HEADER_CONNECTION_KEEPALIVE);
postMethod.setRequestHeader(HTTPConstants.HEADER_EXPECT,
HTTPConstants.HEADER_EXPECT_100_Continue);
}
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/server/SimpleConnectionThread.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/server/SimpleConnectionThread.java?rev=387517&r1=387516&r2=387517&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/server/SimpleConnectionThread.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/server/SimpleConnectionThread.java Tue Mar 21 05:00:30 2006
@@ -86,15 +86,12 @@
public void run() {
try {
- do {
- this.conn.setKeepAlive(false);
-
- SimpleRequest request = this.conn.readRequest();
-
- if (request != null) {
- this.handler.processRequest(this.conn, request);
- }
- } while (this.conn.isKeepAlive());
+ //we do not support keep alive
+ this.conn.setKeepAlive(false);
+ SimpleRequest request = this.conn.readRequest();
+ if (request != null) {
+ this.handler.processRequest(this.conn, request);
+ }
} catch (InterruptedIOException e) {
log.error("Can not run SimpleConnectionThread ", e);
}
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/util/threadpool/ThreadPool.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/util/threadpool/ThreadPool.java?rev=387517&r1=387516&r2=387517&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/util/threadpool/ThreadPool.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/util/threadpool/ThreadPool.java Tue Mar 21 05:00:30 2006
@@ -82,8 +82,12 @@
executor.shutdown();
}
- protected ThreadPoolExecutor createDefaultExecutor(final String name, final int priority, final boolean daemon) {
- ThreadPoolExecutor rc = new ThreadPoolExecutor(5, Integer.MAX_VALUE, 10, TimeUnit.SECONDS, new SynchronousQueue(), new edu.emory.mathcs.backport.java.util.concurrent.ThreadFactory() {
+ protected ThreadPoolExecutor createDefaultExecutor(final String name,
+ final int priority,
+ final boolean daemon) {
+ ThreadPoolExecutor rc = new ThreadPoolExecutor(5, Integer.MAX_VALUE, 10,
+ TimeUnit.SECONDS, new SynchronousQueue(),
+ new edu.emory.mathcs.backport.java.util.concurrent.ThreadFactory() {
public Thread newThread(Runnable runnable) {
Thread thread = new Thread(runnable, name);
thread.setDaemon(daemon);
Modified: webservices/axis2/trunk/java/modules/webapp/upload.jsp
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/webapp/upload.jsp?rev=387517&r1=387516&r2=387517&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/webapp/upload.jsp (original)
+++ webservices/axis2/trunk/java/modules/webapp/upload.jsp Tue Mar 21 05:00:30 2006
@@ -1,36 +1,41 @@
-<%@ page import="org.apache.commons.fileupload.DiskFileUpload,
+<%@ page import="org.apache.axis2.context.ConfigurationContext,
+ org.apache.axis2.transport.http.AxisServlet,
+ org.apache.commons.fileupload.DiskFileUpload,
org.apache.commons.fileupload.FileItem,
- org.apache.commons.fileupload.FileUpload,
- javax.servlet.ServletContext, javax.servlet.jsp.JspWriter"%>
-<%@ page import="java.io.File"%>
-<%@ page import="java.io.IOException"%>
-<%@ page import="java.util.Iterator"%>
-<%@ page import="java.util.List"%>
+ org.apache.commons.fileupload.FileUpload" %>
+<%@ page import="javax.servlet.ServletContext" %>
+<%@ page import="javax.servlet.jsp.JspWriter" %>
+<%@ page import="java.io.File" %>
+<%@ page import="java.io.IOException" %>
+<%@ page import="java.util.Iterator" %>
+<%@ page import="java.util.List" %>
<%@ page contentType="text/html;charset=UTF-8" language="java"
- %>
+ %>
<%
-/*
-* 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.
-*/
+ /*
+ * 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(){
+ public void jspInit() {
ServletContext context = this.getServletConfig().getServletContext();
- File repoDir = new File(context.getRealPath("/WEB-INF"));
- File serviceDir = new File(repoDir,"services");
+ ConfigurationContext configctx =
+ (ConfigurationContext) context.getAttribute(AxisServlet.CONFIGURATION_CONTEXT);
+ File repoDir = new File(configctx.getAxisConfiguration().getRepository());
+ File serviceDir = new File(repoDir, "services");
if (!serviceDir.exists()) {
serviceDir.mkdir();
@@ -41,70 +46,78 @@
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 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 occurred <br/>" +message +
+ protected void writeUnsuccessMessage(String message, JspWriter out) throws IOException {
+ out.print("<font color=\"red\">The following error occurred <br/>" + message +
"</font><br/>"
);
}
%>
-<jsp:include page="include/adminheader.jsp"></jsp:include>
- <h2>Upload a axisService jar file</h2>
- <%
- boolean isMultipart = FileUpload.isMultipartContent(request);
- if (isMultipart){
- try {
- // Create a new file upload handler
- DiskFileUpload upload = new DiskFileUpload();
-
- List items = upload.parseRequest(request);
-
- // Process the uploaded items
- Iterator iter = items.iterator();
- while (iter.hasNext()) {
- FileItem item = (FileItem) iter.next();
-
- if (!item.isFormField()) {
-
- String fileName = item.getName();
- String fileExtesion =fileName;
- fileExtesion =fileExtesion.toLowerCase();
- if (!(fileExtesion.endsWith(".jar")||fileExtesion.endsWith(".aar"))){
- throw new Exception(" Wrong file type! ");
- }
-
- String fileNameOnly = "";
- if (fileName.indexOf("\\")<0){
- fileNameOnly= fileName.substring(fileName.lastIndexOf("/")+1,fileName.length());
- }else{
- fileNameOnly= fileName.substring(fileName.lastIndexOf("\\")+1,fileName.length());
- }
-
-
- File uploadedFile = new File(deploymentDirectory,fileNameOnly);
- item.write(uploadedFile);
- out.write("<font color=\"green\">File " + fileName + " successfully uploaded </font><br/><br/>");
+<jsp:include page="include/adminheader.jsp">
+</jsp:include>
+<h2>Upload a axisService jar file</h2>
+<%
+ boolean isMultipart = FileUpload.isMultipartContent(request);
+ if (isMultipart) {
+ try {
+ // Create a new file upload handler
+ DiskFileUpload upload = new DiskFileUpload();
+
+ List items = upload.parseRequest(request);
+
+ // Process the uploaded items
+ Iterator iter = items.iterator();
+ while (iter.hasNext()) {
+ FileItem item = (FileItem) iter.next();
+
+ if (!item.isFormField()) {
+
+ String fileName = item.getName();
+ String fileExtesion = fileName;
+ fileExtesion = fileExtesion.toLowerCase();
+ if (!(fileExtesion.endsWith(".jar") || fileExtesion.endsWith(".aar"))) {
+ throw new Exception(" Wrong file type! ");
+ }
- }
+ String fileNameOnly = "";
+ if (fileName.indexOf("\\") < 0) {
+ fileNameOnly = fileName.substring(fileName.lastIndexOf("/") + 1, fileName.length());
+ } else {
+ fileNameOnly = fileName.substring(fileName.lastIndexOf("\\") + 1, fileName.length());
}
- } catch (Exception e) {
- out.write(" <font color=\"red\">File upload failed! <br/>" + e.getMessage() + "</font><br/><br/>");
+
+
+ File uploadedFile = new File(deploymentDirectory, fileNameOnly);
+ item.write(uploadedFile);
+ out.write("<font color=\"green\">File " + fileName + " successfully uploaded </font><br/><br/>");
+
}
}
- %>
+ } catch (Exception e) {
+ out.write(" <font color=\"red\">File upload failed! <br/>" + e.getMessage() + "</font><br/><br/>");
+ }
+ }
+%>
- <p>You can upload a packaged Axis 2 axisService using this page with two small steps.</p>
- <ul><li>Browse to the location and select the axisService archive file you wish to upload</li>
- <li>Click Upload</li></ul>
- <p>Simple as that!</p>
-<form method="post" name="Axis2upload" action="upload.jsp" enctype="multipart/form-data">
- <table><tr><td>Service archive : </td><td>
+<p>You can upload a packaged Axis 2 axisService using this page with two small
+ steps.</p>
+<ul><li>Browse to the location and select the axisService archive file you wish
+ to upload</li>
+ <li>Click Upload</li></ul>
+
+<p>Simple as that!</p>
+
+<form method="post" name="Axis2upload" action="upload.jsp"
+ enctype="multipart/form-data">
+ <table><tr><td>Service archive : </td><td>
<input type="file" name="filename" size="50"/></td></tr>
- <tr><td> </td><td><input name="<%=SUBMIT_NAME%>" type="submit" value=" Upload "/></td></tr>
- </table>
+ <tr><td> </td><td><input name="<%=SUBMIT_NAME%>" type="submit"
+ value=" Upload "/></td></tr>
+ </table>
</form>
-<jsp:include page="include/adminfooter.jsp"></jsp:include>
+<jsp:include page="include/adminfooter.jsp">
+</jsp:include>