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 di...@apache.org on 2005/02/20 18:57:02 UTC
svn commit: r154537 [4/6] - in webservices/axis/trunk/java/modules:
core/src/java/org/apache/axis/ core/src/java/org/apache/axis/addressing/
core/src/java/org/apache/axis/addressing/miheaders/
core/src/java/org/apache/axis/addressing/om/
core/src/java/org/apache/axis/clientapi/
core/src/java/org/apache/axis/context/
core/src/java/org/apache/axis/description/
core/src/java/org/apache/axis/engine/ core/src/java/org/apache/axis/handlers/
core/src/java/org/apache/axis/phaseresolver/
core/src/java/org/apache/axis/providers/
core/src/java/org/apache/axis/receivers/
core/src/java/org/apache/axis/transport/
core/src/java/org/apache/axis/transport/http/
core/src/java/org/apache/axis/util/
deployment/src/samples/deployment/service1/org/apache/axis/sample/echo/
samples/src/java/encoding/sample1/
samples/src/java/encoding/sample2/benchMark/
samples/src/java/org/apache/axis/testUtils/
Modified: webservices/axis/trunk/java/modules/core/src/java/org/apache/axis/phaseresolver/PhaseMetadata.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/java/org/apache/axis/phaseresolver/PhaseMetadata.java?view=diff&r1=154536&r2=154537
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/java/org/apache/axis/phaseresolver/PhaseMetadata.java (original)
+++ webservices/axis/trunk/java/modules/core/src/java/org/apache/axis/phaseresolver/PhaseMetadata.java Sun Feb 20 09:56:49 2005
@@ -1,12 +1,12 @@
/*
* Copyright 2004,2005 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.
@@ -19,24 +19,53 @@
import java.util.ArrayList;
+/**
+ * Class PhaseMetadata
+ */
public class PhaseMetadata {
+ /**
+ * Field BOTH_BEFORE_AFTER
+ */
private static final int BOTH_BEFORE_AFTER = 0;
+
+ /**
+ * Field BEORE
+ */
private static final int BEORE = 1;
+
+ /**
+ * Field AFTER
+ */
private static final int AFTER = 2;
+
+ /**
+ * Field ANYWHERE
+ */
private static final int ANYWHERE = 3;
+ /**
+ * Field name
+ */
private String name;
/**
* to keet info about phase first handler
*/
private HandlerMetadata phaseFirst;
+
+ /**
+ * Field phasefirstset
+ */
private boolean phasefirstset;
/**
* to keet info about phase last handler
*/
private HandlerMetadata phaseLast;
+
+ /**
+ * Field phaselastset
+ */
private boolean phaselastset;
/**
@@ -55,6 +84,11 @@
*/
private boolean isonehanlder;
+ /**
+ * Constructor PhaseMetadata
+ *
+ * @param name
+ */
public PhaseMetadata(String name) {
this.name = name;
this.phaseHandlers.clear();
@@ -63,88 +97,152 @@
this.isonehanlder = false;
}
+ /**
+ * Method getPhaseFirst
+ *
+ * @return
+ */
public HandlerMetadata getPhaseFirst() {
return phaseFirst;
}
- public void setPhaseFirst(HandlerMetadata phaseFirst) throws PhaseException {
+ /**
+ * Method setPhaseFirst
+ *
+ * @param phaseFirst
+ * @throws PhaseException
+ */
+ public void setPhaseFirst(HandlerMetadata phaseFirst)
+ throws PhaseException {
if (phasefirstset) {
- throw new PhaseException("PhaseFirst alredy has been set, cannot have two phaseFirst Hander for same phase " + this.name);
+ throw new PhaseException(
+ "PhaseFirst alredy has been set, cannot have two phaseFirst Hander for same phase "
+ + this.name);
} else {
- if (getBefoerAfter(phaseFirst) != ANYWHERE) {
- throw new PhaseException("Hander with PhaseFirst can not have any before or after proprty error in " + phaseFirst.getName());
- } else
+ if (getBeforeAfter(phaseFirst) != ANYWHERE) {
+ throw new PhaseException(
+ "Hander with PhaseFirst can not have any before or after proprty error in "
+ + phaseFirst.getName());
+ } else {
this.phaseFirst = phaseFirst;
+ }
phasefirstset = true;
}
}
+ /**
+ * Method getPhaseLast
+ *
+ * @return
+ */
public HandlerMetadata getPhaseLast() {
return phaseLast;
}
+ /**
+ * Method setPhaseLast
+ *
+ * @param phaseLast
+ * @throws PhaseException
+ */
public void setPhaseLast(HandlerMetadata phaseLast) throws PhaseException {
if (phaselastset) {
- throw new PhaseException("PhaseLast alredy has been set, cannot have two PhaseLast Hander for same phase " + this.name);
+ throw new PhaseException(
+ "PhaseLast already has been set, cannot have two PhaseLast Hander for same phase "
+ + this.name);
} else {
- if (getBefoerAfter(phaseLast) != ANYWHERE) {
- throw new PhaseException("Hander with PhaseLast property can not have any before or after proprty error in " + phaseLast.getName());
- } else
+ if (getBeforeAfter(phaseLast) != ANYWHERE) {
+ throw new PhaseException(
+ "Handler with PhaseLast property can not have any before or after property error in "
+ + phaseLast.getName());
+ } else {
this.phaseLast = phaseLast;
+ }
phaselastset = true;
}
}
+ /**
+ * Method addHandler
+ *
+ * @param handler
+ * @throws PhaseException
+ */
public void addHandler(HandlerMetadata handler) throws PhaseException {
+
/**
* for the M1 we are not going to care about phaseFirst , PhaseLast only thinh u can do it
* insert it to a pahse.
* todo if you uncomment this will work fine for phase Conditions :)
*/
- /*
- if (isonehanlder) {
- throw new PhaseException(this.getName() + "can only have one handler, since there is a handler with both phaseFirst and PhaseLast true ");
- } else {
- if (handler.getRules().isPhaseFirst() && handler.getRules().isPhaseLast()) {
- if (phaseHandlers.size() > 0) {
- throw new PhaseException(this.getName() + " PhaseMetaData already added a hander so this operation not allowed cannot add the handler " + handler.getName());
- } else {
- setPhaseFirst(handler);
- setPhaseLast(handler);
- isonehanlder = true;
- }
- } else if (handler.getRules().isPhaseFirst()) {
- setPhaseFirst(handler);
- } else if (handler.getRules().isPhaseLast()) {
- setPhaseLast(handler);
- } else
- phaseHandlers.add(handler);
- }
- */
+ /*
+ * if (isonehanlder) {
+ * throw new PhaseException(this.getName() + "can only have one handler, since there is a handler with both phaseFirst and PhaseLast true ");
+ * } else {
+ * if (handler.getRules().isPhaseFirst() && handler.getRules().isPhaseLast()) {
+ * if (phaseHandlers.size() > 0) {
+ * throw new PhaseException(this.getName() + " PhaseMetaData already added a hander so this operation not allowed cannot add the handler " + handler.getName());
+ * } else {
+ * setPhaseFirst(handler);
+ * setPhaseLast(handler);
+ * isonehanlder = true;
+ * }
+ * } else if (handler.getRules().isPhaseFirst()) {
+ * setPhaseFirst(handler);
+ * } else if (handler.getRules().isPhaseLast()) {
+ * setPhaseLast(handler);
+ * } else
+ * phaseHandlers.add(handler);
+ *
+ * }
+ */
phaseHandlers.add(handler);
-
}
+ /**
+ * Method getName
+ *
+ * @return
+ */
public String getName() {
return name;
}
+ /**
+ * Method getBeforeIndex
+ *
+ * @param beforeName
+ * @return
+ */
public int getBeforeIndex(String beforeName) {
return 0;
}
+ /**
+ * Method getAfterIndex
+ *
+ * @param afterName
+ * @return
+ */
public int getAfterIndex(String afterName) {
return 0;
}
+ /**
+ * Method getOrderedHandlers
+ *
+ * @return
+ * @throws PhaseException
+ */
public HandlerMetadata[] getOrderedHandlers() throws PhaseException {
int size = 0;
+
/**
* order the handlers
*/
orderHandlers();
- HandlerMetadata handler [];
+ HandlerMetadata handler[];
if (isonehanlder) {
size = 1;
handler = new HandlerMetadata[size];
@@ -154,8 +252,9 @@
if (phasefirstset) {
if (phaseHandlers.size() > 0) {
phaseHandlers.add(0, getPhaseFirst());
- } else
+ } else {
phaseHandlers.add(getPhaseFirst());
+ }
}
if (phaselastset) {
phaseHandlers.add(getPhaseLast());
@@ -168,6 +267,11 @@
return handler;
}
+ /**
+ * Method orderHandlers
+ *
+ * @throws PhaseException
+ */
private void orderHandlers() throws PhaseException {
validatebefore();
validateafter();
@@ -187,13 +291,18 @@
if (getPhaseFirst() != null) {
String phasFirstname = getPhaseFirst().getName().getLocalPart();
for (int i = 0; i < phaseHandlers.size(); i++) {
- HandlerMetadata handler = (HandlerMetadata) phaseHandlers.get(i);
+ HandlerMetadata handler =
+ (HandlerMetadata) phaseHandlers.get(i);
if (handler.getRules().getBefore().equals(phasFirstname)) {
- throw new PhaseException("Try to plase a Hander " + handler.getName() + " before phaseFirst " + phasFirstname);
+ throw new PhaseException("Try to plase a Hander "
+ + handler.getName()
+ + " before phaseFirst "
+ + phasFirstname);
}
}
- } else
+ } else {
return;
+ }
}
/**
@@ -206,14 +315,23 @@
if (getPhaseLast() != null) {
String phaseLastName = getPhaseLast().getName().getLocalPart();
for (int i = 0; i < phaseHandlers.size(); i++) {
- HandlerMetadata handler = (HandlerMetadata) phaseHandlers.get(i);
+ HandlerMetadata handler =
+ (HandlerMetadata) phaseHandlers.get(i);
if (handler.getName().equals(phaseLastName)) {
- throw new PhaseException("Try to plase a Hander " + handler.getName() + " after phaseLast " + phaseLastName);
+ throw new PhaseException("Try to plase a Hander "
+ + handler.getName()
+ + " after phaseLast "
+ + phaseLastName);
}
}
}
}
+ /**
+ * Method arrangeHanders
+ *
+ * @throws PhaseException
+ */
private void arrangeHanders() throws PhaseException {
int count = 0;
int before_after = 0;
@@ -222,13 +340,15 @@
while (phaseHandlers.size() > 0) {
if (status) {
handler = (HandlerMetadata) phaseHandlers.get(0);
- } else
+ } else {
handler = (HandlerMetadata) phaseHandlers.get(count);
+ }
status = false;
if (count > phaseHandlers.size()) {
- throw new PhaseException("Incorrect hander order for " + handler.getName());
+ throw new PhaseException("Incorrect hander order for "
+ + handler.getName());
}
- before_after = getBefoerAfter(handler);
+ before_after = getBeforeAfter(handler);
switch (before_after) {
case ANYWHERE:
{
@@ -270,20 +390,38 @@
}
}
- private int getBefoerAfter(HandlerMetadata handler) throws PhaseException {
- if ((!handler.getRules().getBefore().equals("")) && (!handler.getRules().getAfter().equals(""))) {
- if (handler.getRules().getBefore().equals(handler.getRules().getAfter())) {
- throw new PhaseException("Both before and after cannot be the same for this handler" + handler.getName());
+ /**
+ * Method getBeforeAfter
+ *
+ * @param handler
+ * @return
+ * @throws PhaseException
+ */
+ private int getBeforeAfter(HandlerMetadata handler) throws PhaseException {
+ if ((!handler.getRules().getBefore().equals(""))
+ && (!handler.getRules().getAfter().equals(""))) {
+ if (handler.getRules().getBefore().equals(
+ handler.getRules().getAfter())) {
+ throw new PhaseException(
+ "Both before and after cannot be the same for this handler"
+ + handler.getName());
}
return BOTH_BEFORE_AFTER;
} else if (!handler.getRules().getBefore().equals("")) {
return BEORE;
} else if (!handler.getRules().getAfter().equals("")) {
return AFTER;
- } else
+ } else {
return ANYWHERE;
+ }
}
+ /**
+ * Method insertBefore
+ *
+ * @param handler
+ * @return
+ */
private boolean insertBefore(HandlerMetadata handler) {
String beforename = handler.getRules().getBefore();
if (getPhaseLast() != null) {
@@ -302,6 +440,12 @@
return false;
}
+ /**
+ * Method insertAfter
+ *
+ * @param handler
+ * @return
+ */
private boolean insertAfter(HandlerMetadata handler) {
String afterName = handler.getRules().getAfter();
if (getPhaseFirst() != null) {
@@ -321,28 +465,32 @@
return true;
}
}
-
}
return false;
}
/**
- * This method assume that both the before and after cant be a same hander
- * that dose not check inside this , it should check befor calling this method
- *
- * @param handler
- * @return
- */
- private boolean insertBeforeandAfter(HandlerMetadata handler) throws PhaseException {
+ * This method assume that both the before and after cant be a same hander
+ * that dose not check inside this , it should check befor calling this method
+ *
+ * @param handler
+ * @return
+ * @throws PhaseException
+ */
+ private boolean insertBeforeandAfter(HandlerMetadata handler)
+ throws PhaseException {
int before = -1;
int after = -1;
+
/**
* if hander.after = PhaseFirts and hnder.before = phaselast then
* just add the entery to vector
*/
if ((getPhaseFirst() != null) && (getPhaseLast() != null)) {
- if ((getPhaseFirst().getName().equals(handler.getRules().getAfter())) &&
- (getPhaseLast().getName().equals(handler.getRules().getBefore()))) {
+ if ((getPhaseFirst().getName().equals(
+ handler.getRules().getAfter()))
+ && (getPhaseLast().getName().equals(
+ handler.getRules().getBefore()))) {
orderHanders.add(handler);
return true;
}
@@ -351,13 +499,15 @@
HandlerMetadata temphandler = (HandlerMetadata) orderHanders.get(i);
if (handler.getRules().getAfter().equals(temphandler.getName())) {
after = i;
- } else if (handler.getRules().getBefore().equals(temphandler.getName())) {
+ } else if (handler.getRules().getBefore().equals(
+ temphandler.getName())) {
before = i;
}
if ((after >= 0) && (before >= 0)) {
// no point of continue since both the before and after index has found
if (after > before) {
- throw new PhaseException("incorrect handler order for " + handler.getName());
+ throw new PhaseException("incorrect handler order for "
+ + handler.getName());
} else {
orderHanders.add(after + 1, handler);
return true;
@@ -366,6 +516,4 @@
}
return false;
}
-
-
}
Modified: webservices/axis/trunk/java/modules/core/src/java/org/apache/axis/phaseresolver/PhaseResolver.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/java/org/apache/axis/phaseresolver/PhaseResolver.java?view=diff&r1=154536&r2=154537
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/java/org/apache/axis/phaseresolver/PhaseResolver.java (original)
+++ webservices/axis/trunk/java/modules/core/src/java/org/apache/axis/phaseresolver/PhaseResolver.java Sun Feb 20 09:56:49 2005
@@ -1,12 +1,12 @@
/*
* Copyright 2004,2005 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.
@@ -31,29 +31,56 @@
import java.util.Iterator;
import java.util.List;
+/**
+ * Class PhaseResolver
+ */
public class PhaseResolver {
+ /**
+ * Field engineRegistry
+ */
private final EngineRegistry engineRegistry;
+
+ /**
+ * Field axisService
+ */
private AxisService axisService;
+
+ /**
+ * Field phaseHolder
+ */
private PhaseHolder phaseHolder;
/**
* default constructor , to obuild chains for AxisGlobal
+ *
+ * @param engineRegistry
*/
public PhaseResolver(EngineRegistry engineRegistry) {
this.engineRegistry = engineRegistry;
}
- public PhaseResolver(EngineRegistry engineRegistry, AxisService axisService) {
+ /**
+ * Constructor PhaseResolver
+ *
+ * @param engineRegistry
+ * @param axisService
+ */
+ public PhaseResolver(EngineRegistry engineRegistry,
+ AxisService axisService) {
this.engineRegistry = engineRegistry;
this.axisService = axisService;
}
+ /**
+ * Method buildchains
+ *
+ * @throws PhaseException
+ * @throws AxisFault
+ */
public void buildchains() throws PhaseException, AxisFault {
for (int i = 1; i < 4; i++) {
buildExcutionChains(i);
-
}
-
}
/**
@@ -65,52 +92,58 @@
*
* @param type
* @throws AxisFault
+ * @throws PhaseException
*/
- private void buildExcutionChains(int type) throws AxisFault, PhaseException {
+ private void buildExcutionChains(int type)
+ throws AxisFault, PhaseException {
int flowtype = type;
ArrayList allHandlers = new ArrayList();
+
// int count = server.getModuleCount();
- // QName moduleName;
+ // QName moduleName;
AxisModule module;
Flow flow = null;
+
/*
- //adding server specific handlers . global
- for(int intA=0 ; intA < count; intA ++){
- moduleName = server.getModule(intA);
- module = engineRegistry.getModule(moduleName);
- switch (flowtype){
- case 1 : {
- flow = module.getInFlow();
- break;
- }
- case 2 : {
- flow = module.getOutFlow();
- break;
- }
- case 3 : {
- flow = module.getFaultFlow();
- break;
- }
- }
- for(int j= 0 ; j < flow.getHandlerCount() ; j++ ){
- HandlerMetaData metadata = flow.getHandler(j);
- //todo change this in properway
- if (metadata.getRules().getPhaseName().equals("")){
- metadata.getRules().setPhaseName("global");
- }
- allHandlers.add(metadata);
- }
- }
- */
+ * //adding server specific handlers . global
+ * for(int intA=0 ; intA < count; intA ++){
+ * moduleName = server.getModule(intA);
+ * module = engineRegistry.getModule(moduleName);
+ * switch (flowtype){
+ * case 1 : {
+ * flow = module.getInFlow();
+ * break;
+ * }
+ * case 2 : {
+ * flow = module.getOutFlow();
+ * break;
+ * }
+ * case 3 : {
+ * flow = module.getFaultFlow();
+ * break;
+ * }
+ * }
+ * for(int j= 0 ; j < flow.getHandlerCount() ; j++ ){
+ * HandlerMetaData metadata = flow.getHandler(j);
+ * //todo change this in properway
+ * if (metadata.getRules().getPhaseName().equals("")){
+ * metadata.getRules().setPhaseName("global");
+ * }
+ * allHandlers.add(metadata);
+ * }
+ * }
+ */
+
// service module handlers
Collection collection = axisService.getModules();
Iterator itr = collection.iterator();
while (itr.hasNext()) {
QName moduleref = (QName) itr.next();
+
// }
// Vector modules = (Vector)axisService.getModules();
// for (int i = 0; i < modules.size(); i++) {
- // QName moduleref = (QName) modules.elementAt(i);
+ // QName moduleref = (QName) modules.elementAt(i);
module = engineRegistry.getModule(moduleref);
switch (flowtype) {
case 1:
@@ -132,7 +165,8 @@
if (flow != null) {
for (int j = 0; j < flow.getHandlerCount(); j++) {
HandlerMetadata metadata = flow.getHandler(j);
- //todo change this in properway
+
+ // todo change this in properway
if (metadata.getRules().getPhaseName().equals("")) {
metadata.getRules().setPhaseName("service");
}
@@ -160,7 +194,8 @@
if (flow != null) {
for (int j = 0; j < flow.getHandlerCount(); j++) {
HandlerMetadata metadata = flow.getHandler(j);
- //todo change this in properway
+
+ // todo change this in properway
if (metadata.getRules().getPhaseName().equals("")) {
metadata.getRules().setPhaseName("service");
}
@@ -169,28 +204,40 @@
}
phaseHolder = new PhaseHolder(engineRegistry, axisService);
for (int i = 0; i < allHandlers.size(); i++) {
- HandlerMetadata handlerMetaData = (HandlerMetadata) allHandlers.get(i);
+ HandlerMetadata handlerMetaData =
+ (HandlerMetadata) allHandlers.get(i);
phaseHolder.addHandler(handlerMetaData);
}
- phaseHolder.getOrderdHandlers(type);
-
+ phaseHolder.getOrderedHandlers(type);
}
+ /**
+ * Method buildTranspotsChains
+ *
+ * @throws PhaseException
+ */
public void buildTranspotsChains() throws PhaseException {
try {
HashMap transports = engineRegistry.getTransports();
Collection coltrnsport = transports.values();
- for (Iterator iterator = coltrnsport.iterator(); iterator.hasNext();) {
+ for (Iterator iterator = coltrnsport.iterator();
+ iterator.hasNext();) {
AxisTransport transport = (AxisTransport) iterator.next();
buildTransportChains(transport);
}
} catch (AxisFault axisFault) {
throw new PhaseException("AxisFault" + axisFault.getMessage());
}
-
}
- private void buildTransportChains(AxisTransport transport) throws PhaseException {
+ /**
+ * Method buildTransportChains
+ *
+ * @param transport
+ * @throws PhaseException
+ */
+ private void buildTransportChains(AxisTransport transport)
+ throws PhaseException {
Flow flow = null;
for (int type = 1; type < 4; type++) {
phaseHolder = new PhaseHolder(engineRegistry, null);
@@ -214,20 +261,27 @@
if (flow != null) {
for (int j = 0; j < flow.getHandlerCount(); j++) {
HandlerMetadata metadata = flow.getHandler(j);
- //todo change this in properway
+
+ // todo change this in properway
if (metadata.getRules().getPhaseName().equals("")) {
metadata.getRules().setPhaseName("transport");
}
phaseHolder.addHandler(metadata);
-
}
}
phaseHolder.buildTransportChain(transport, type);
}
-
}
- public void buildGlobalChains(AxisGlobal global) throws AxisFault, PhaseException {
+ /**
+ * Method buildGlobalChains
+ *
+ * @param global
+ * @throws AxisFault
+ * @throws PhaseException
+ */
+ public void buildGlobalChains(AxisGlobal global)
+ throws AxisFault, PhaseException {
List modules = (List) global.getModules();
int count = modules.size();
QName moduleName;
@@ -258,17 +312,16 @@
if (flow != null) {
for (int j = 0; j < flow.getHandlerCount(); j++) {
HandlerMetadata metadata = flow.getHandler(j);
- //todo change this in properway
+
+ // todo change this in properway
if (metadata.getRules().getPhaseName().equals("")) {
metadata.getRules().setPhaseName("global");
}
phaseHolder.addHandler(metadata);
-
}
}
}
phaseHolder.buildGlobalChain(global, type);
}
}
-
}
Modified: webservices/axis/trunk/java/modules/core/src/java/org/apache/axis/providers/AbstractProvider.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/java/org/apache/axis/providers/AbstractProvider.java?view=diff&r1=154536&r2=154537
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/java/org/apache/axis/providers/AbstractProvider.java (original)
+++ webservices/axis/trunk/java/modules/core/src/java/org/apache/axis/providers/AbstractProvider.java Sun Feb 20 09:56:49 2005
@@ -1,41 +1,58 @@
-/*
- * Copyright 2004,2005 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.
- */
-package org.apache.axis.providers;
-
-import org.apache.axis.context.MessageContext;
-import org.apache.axis.engine.Provider;
-
-import javax.xml.namespace.QName;
-
-/**
- * This is the Absract provider. It is just a another handler. the
- * protected abstract methods are only for the sake of breaking down the logic
- */
-public abstract class AbstractProvider implements Provider {
- protected QName name;
-
- public QName getName() {
- return name;
- }
-
- public void setName(QName name) {
- this.name = name;
- }
-
- public void revoke(MessageContext msgContext) {
- }
-
-}
+/*
+ * Copyright 2004,2005 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.
+ */
+package org.apache.axis.providers;
+
+import org.apache.axis.context.MessageContext;
+import org.apache.axis.engine.Provider;
+
+import javax.xml.namespace.QName;
+
+/**
+ * This is the Absract provider. It is just a another handler. the
+ * protected abstract methods are only for the sake of breaking down the logic
+ */
+public abstract class AbstractProvider implements Provider {
+ /**
+ * Field name
+ */
+ protected QName name;
+
+ /**
+ * Method getName
+ *
+ * @return
+ */
+ public QName getName() {
+ return name;
+ }
+
+ /**
+ * Method setName
+ *
+ * @param name
+ */
+ public void setName(QName name) {
+ this.name = name;
+ }
+
+ /**
+ * Method revoke
+ *
+ * @param msgContext
+ */
+ public void revoke(MessageContext msgContext) {
+ }
+}
Modified: webservices/axis/trunk/java/modules/core/src/java/org/apache/axis/providers/RawXMLProvider.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/java/org/apache/axis/providers/RawXMLProvider.java?view=diff&r1=154536&r2=154537
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/java/org/apache/axis/providers/RawXMLProvider.java (original)
+++ webservices/axis/trunk/java/modules/core/src/java/org/apache/axis/providers/RawXMLProvider.java Sun Feb 20 09:56:49 2005
@@ -1,12 +1,12 @@
/*
* Copyright 2004,2005 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.
@@ -34,16 +34,40 @@
* This is a Simple java Provider.
*/
public class RawXMLProvider extends AbstractProvider implements Provider {
+ /**
+ * Field log
+ */
protected Log log = LogFactory.getLog(getClass());
+
+ /**
+ * Field scope
+ */
private String scope;
+
+ /**
+ * Field method
+ */
private Method method;
+
+ /**
+ * Field classLoader
+ */
private ClassLoader classLoader;
+ /**
+ * Constructor RawXMLProvider
+ */
public RawXMLProvider() {
scope = Constants.APPLICATION_SCOPE;
-
}
+ /**
+ * Method makeNewServiceObject
+ *
+ * @param msgContext
+ * @return
+ * @throws AxisFault
+ */
protected Object makeNewServiceObject(MessageContext msgContext)
throws AxisFault {
try {
@@ -56,6 +80,13 @@
}
}
+ /**
+ * Method getTheImplementationObject
+ *
+ * @param msgContext
+ * @return
+ * @throws AxisFault
+ */
public Object getTheImplementationObject(MessageContext msgContext)
throws AxisFault {
AxisService service = msgContext.getService();
@@ -81,15 +112,22 @@
} else {
throw new AxisFault("unknown scope " + scope);
}
-
}
+ /**
+ * Method invoke
+ *
+ * @param msgContext
+ * @return
+ * @throws AxisFault
+ */
public MessageContext invoke(MessageContext msgContext) throws AxisFault {
try {
- //get the implementation class for the Web Service
+
+ // get the implementation class for the Web Service
Object obj = getTheImplementationObject(msgContext);
- //find the WebService method
+ // find the WebService method
Class ImplClass = obj.getClass();
String methodName =
msgContext.getOperation().getName().getLocalPart();
@@ -101,20 +139,20 @@
}
}
Class[] parameters = method.getParameterTypes();
- if (parameters != null
- && parameters.length == 1
- && OMElement.class.getName().equals(parameters[0].getName())) {
+ if ((parameters != null) && (parameters.length == 1)
+ && OMElement.class.getName().equals(
+ parameters[0].getName())) {
OMElement methodElement =
msgContext.getEnvelope().getBody().getFirstElement();
OMElement parmeter = methodElement.getFirstElement();
Object[] parms = new Object[]{parmeter};
- //invoke the WebService
- OMElement result = (OMElement) method.invoke(obj, parms);
- MessageContext msgContext1 =
- new MessageContext(
+
+ // invoke the WebService
+ OMElement result = (OMElement) method.invoke(obj,
+ parms);
+ MessageContext msgContext1 = new MessageContext(
msgContext.getGlobalContext().getRegistry(),
- msgContext.getProperties(),
- msgContext.getSessionContext());
+ msgContext.getProperties(), msgContext.getSessionContext());
SOAPEnvelope envelope =
OMFactory.newInstance().getDefaultEnvelope();
envelope.getBody().setFirstChild(result);
@@ -125,12 +163,16 @@
"Raw Xml provider supports only the methods bearing the signature public OMElement "
+ "<method-name>(OMElement) where the method name is anything");
}
-
} catch (Exception e) {
throw AxisFault.makeFault(e);
}
}
+ /**
+ * Method revoke
+ *
+ * @param msgContext
+ */
public void revoke(MessageContext msgContext) {
}
}
Modified: webservices/axis/trunk/java/modules/core/src/java/org/apache/axis/receivers/InOutAsyncReceiver.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/java/org/apache/axis/receivers/InOutAsyncReceiver.java?view=diff&r1=154536&r2=154537
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/java/org/apache/axis/receivers/InOutAsyncReceiver.java (original)
+++ webservices/axis/trunk/java/modules/core/src/java/org/apache/axis/receivers/InOutAsyncReceiver.java Sun Feb 20 09:56:49 2005
@@ -1,12 +1,12 @@
/*
* Copyright 2004,2005 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.
@@ -19,5 +19,4 @@
* This is takes care of the IN-OUT sync MEP in the server side
*/
public class InOutAsyncReceiver {
-
}
Modified: webservices/axis/trunk/java/modules/core/src/java/org/apache/axis/receivers/InOutSyncReceiver.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/java/org/apache/axis/receivers/InOutSyncReceiver.java?view=diff&r1=154536&r2=154537
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/java/org/apache/axis/receivers/InOutSyncReceiver.java (original)
+++ webservices/axis/trunk/java/modules/core/src/java/org/apache/axis/receivers/InOutSyncReceiver.java Sun Feb 20 09:56:49 2005
@@ -1,12 +1,12 @@
/*
* Copyright 2004,2005 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.
@@ -31,13 +31,30 @@
* This is takes care of the IN-OUT Async MEP in the server side
*/
public class InOutSyncReceiver extends AbstractHandler implements Receiver {
+ /**
+ * Field log
+ */
protected Log log = LogFactory.getLog(getClass());
- public static final QName NAME = new QName("http://axis.ws.apache.org", "InOutSyncReceiver");
+ /**
+ * Field NAME
+ */
+ public static final QName NAME = new QName("http://axis.ws.apache.org",
+ "InOutSyncReceiver");
+
+ /**
+ * Constructor InOutSyncReceiver
+ */
public InOutSyncReceiver() {
init(new HandlerMetadata(NAME));
}
+ /**
+ * Method invoke
+ *
+ * @param msgContext
+ * @throws AxisFault
+ */
public void invoke(final MessageContext msgContext) throws AxisFault {
if (msgContext.isNewThreadRequired()) {
Runnable runner = new Runnable() {
@@ -45,9 +62,10 @@
try {
invokeAndsend(msgContext);
} catch (AxisFault e) {
- log.error("Exception occured in new thread starting response", e);
+ log.error(
+ "Exception occured in new thread starting response",
+ e);
}
-
}
};
Thread thread = new Thread(runner);
@@ -57,15 +75,19 @@
}
}
+ /**
+ * Method invokeAndsend
+ *
+ * @param msgContext
+ * @throws AxisFault
+ */
public void invokeAndsend(MessageContext msgContext) throws AxisFault {
- //org.TimeRecorder.BEFORE_INVOKE = System.currentTimeMillis();
Provider provider = msgContext.getService().getProvider();
log.info("start invoke the web service impl");
MessageContext outMsgContext = provider.invoke(msgContext);
- //org.TimeRecorder.AFTER_INVOKE = System.currentTimeMillis();
+
log.info("Invoked the Web Servivces impl");
Sender sender = new Sender();
sender.send(msgContext);
}
-
}
Modified: webservices/axis/trunk/java/modules/core/src/java/org/apache/axis/transport/AbstractTransportSender.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/java/org/apache/axis/transport/AbstractTransportSender.java?view=diff&r1=154536&r2=154537
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/java/org/apache/axis/transport/AbstractTransportSender.java (original)
+++ webservices/axis/trunk/java/modules/core/src/java/org/apache/axis/transport/AbstractTransportSender.java Sun Feb 20 09:56:49 2005
@@ -1,12 +1,12 @@
/*
* Copyright 2004,2005 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.
@@ -32,28 +32,49 @@
/**
*/
-public abstract class AbstractTransportSender
- extends AbstractHandler
+public abstract class AbstractTransportSender extends AbstractHandler
implements TransportSender {
+ /**
+ * Field log
+ */
private Log log = LogFactory.getLog(getClass());
- public static final QName NAME =
- new QName("http://axis.ws.apache.org", "TransportSender");
+
+ /**
+ * Field NAME
+ */
+ public static final QName NAME = new QName("http://axis.ws.apache.org",
+ "TransportSender");
+
+ /**
+ * Field outS
+ */
protected OutputStream outS;
+ /**
+ * Constructor AbstractTransportSender
+ */
public AbstractTransportSender() {
init(new HandlerMetadata(NAME));
}
+ /**
+ * Method invoke
+ *
+ * @param msgContext
+ * @throws AxisFault
+ */
public void invoke(MessageContext msgContext) throws AxisFault {
Writer out = null;
if (msgContext.isProcessingFault()) {
- //Means we are processing fault
+
+ // Means we are processing fault
if (msgContext.getFaultTo() != null) {
log.info("Obtain the output stream to send the fault flow to "
+ msgContext.getFaultTo().getAddress());
out = obtainOutputStream(msgContext, msgContext.getFaultTo());
} else {
- log.info("Obtain the output stream to send the fault flow to ANONYMOUS");
+ log.info(
+ "Obtain the output stream to send the fault flow to ANONYMOUS");
out = obtainOutputStream(msgContext);
}
} else {
@@ -66,7 +87,8 @@
+ msgContext.getReplyTo().getAddress());
out = obtainOutputStream(msgContext, msgContext.getTo());
} else {
- log.info("Obtain the output stream to send the fault flow to ANONYMOUS");
+ log.info(
+ "Obtain the output stream to send the fault flow to ANONYMOUS");
out = obtainOutputStream(msgContext);
}
}
@@ -75,7 +97,6 @@
if (envelope != null) {
XMLStreamWriter outputWriter = null;
try {
- // org.TimeRecorder.BEFORE_SERIALIZE = System.currentTimeMillis();
outputWriter =
XMLOutputFactory.newInstance().createXMLStreamWriter(out);
envelope.serialize(outputWriter, false);
@@ -85,7 +106,6 @@
} else {
out.flush();
}
- // org.TimeRecorder.AFTER_SERIALIZE = System.currentTimeMillis();
} catch (Exception e) {
throw new AxisFault("Stream error", e);
}
@@ -94,16 +114,42 @@
log.info("Send the Response");
}
+ /**
+ * Method startSending
+ *
+ * @param msgContext
+ * @throws AxisFault
+ */
protected void startSending(MessageContext msgContext) throws AxisFault {
}
- protected abstract Writer obtainOutputStream(MessageContext msgContext,
- EndpointReference epr)
- throws AxisFault;
-
+ /**
+ * Method obtainOutputStream
+ *
+ * @param msgContext
+ * @param epr
+ * @return
+ * @throws AxisFault
+ */
+ protected abstract Writer obtainOutputStream(
+ MessageContext msgContext, EndpointReference epr) throws AxisFault;
+
+ /**
+ * Method obtainOutputStream
+ *
+ * @param msgContext
+ * @return
+ * @throws AxisFault
+ */
protected abstract Writer obtainOutputStream(MessageContext msgContext)
throws AxisFault;
+ /**
+ * Method finalizeSending
+ *
+ * @param msgContext
+ * @throws AxisFault
+ */
protected void finalizeSending(MessageContext msgContext)
throws AxisFault {
}
Modified: webservices/axis/trunk/java/modules/core/src/java/org/apache/axis/transport/TransportReceiver.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/java/org/apache/axis/transport/TransportReceiver.java?view=diff&r1=154536&r2=154537
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/java/org/apache/axis/transport/TransportReceiver.java (original)
+++ webservices/axis/trunk/java/modules/core/src/java/org/apache/axis/transport/TransportReceiver.java Sun Feb 20 09:56:49 2005
@@ -1,12 +1,12 @@
/*
* Copyright 2004,2005 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.
@@ -17,5 +17,8 @@
import org.apache.axis.handlers.AbstractHandler;
+/**
+ * Class TransportReceiver
+ */
public abstract class TransportReceiver extends AbstractHandler {
}
Modified: webservices/axis/trunk/java/modules/core/src/java/org/apache/axis/transport/TransportReceiverLocator.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/java/org/apache/axis/transport/TransportReceiverLocator.java?view=diff&r1=154536&r2=154537
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/java/org/apache/axis/transport/TransportReceiverLocator.java (original)
+++ webservices/axis/trunk/java/modules/core/src/java/org/apache/axis/transport/TransportReceiverLocator.java Sun Feb 20 09:56:49 2005
@@ -1,12 +1,12 @@
/*
* Copyright 2004,2005 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.
@@ -20,10 +20,21 @@
import org.apache.axis.engine.AxisFault;
import org.apache.axis.transport.http.HTTPTransportReceiver;
+/**
+ * Class TransportReceiverLocator
+ */
public class TransportReceiverLocator {
+ /**
+ * Method locate
+ *
+ * @param msgContext
+ * @return
+ * @throws AxisFault
+ */
public static TransportReceiver locate(MessageContext msgContext)
throws AxisFault {
- String type = (String) msgContext.getProperty(MessageContext.TRANSPORT_TYPE);
+ String type =
+ (String) msgContext.getProperty(MessageContext.TRANSPORT_TYPE);
if (Constants.TRANSPORT_HTTP.equals(type)) {
return new HTTPTransportReceiver();
} else {
Modified: webservices/axis/trunk/java/modules/core/src/java/org/apache/axis/transport/TransportSender.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/java/org/apache/axis/transport/TransportSender.java?view=diff&r1=154536&r2=154537
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/java/org/apache/axis/transport/TransportSender.java (original)
+++ webservices/axis/trunk/java/modules/core/src/java/org/apache/axis/transport/TransportSender.java Sun Feb 20 09:56:49 2005
@@ -1,12 +1,12 @@
/*
* Copyright 2004,2005 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.
@@ -17,5 +17,8 @@
import org.apache.axis.engine.Handler;
+/**
+ * Interface TransportSender
+ */
public interface TransportSender extends Handler {
}
Modified: webservices/axis/trunk/java/modules/core/src/java/org/apache/axis/transport/TransportSenderLocator.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/java/org/apache/axis/transport/TransportSenderLocator.java?view=diff&r1=154536&r2=154537
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/java/org/apache/axis/transport/TransportSenderLocator.java (original)
+++ webservices/axis/trunk/java/modules/core/src/java/org/apache/axis/transport/TransportSenderLocator.java Sun Feb 20 09:56:49 2005
@@ -1,12 +1,12 @@
/*
* Copyright 2004,2005 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.
@@ -20,9 +20,21 @@
import org.apache.axis.engine.AxisFault;
import org.apache.axis.transport.http.HTTPTransportSender;
+/**
+ * Class TransportSenderLocator
+ */
public class TransportSenderLocator {
- public static TransportSender locate(MessageContext msgContext) throws AxisFault {
- String type = (String) msgContext.getProperty(MessageContext.TRANSPORT_TYPE);
+ /**
+ * Method locate
+ *
+ * @param msgContext
+ * @return
+ * @throws AxisFault
+ */
+ public static TransportSender locate(MessageContext msgContext)
+ throws AxisFault {
+ String type =
+ (String) msgContext.getProperty(MessageContext.TRANSPORT_TYPE);
if (Constants.TRANSPORT_HTTP.equals(type)) {
return new HTTPTransportSender();
}
Modified: webservices/axis/trunk/java/modules/core/src/java/org/apache/axis/transport/http/AxisServlet.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/java/org/apache/axis/transport/http/AxisServlet.java?view=diff&r1=154536&r2=154537
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/java/org/apache/axis/transport/http/AxisServlet.java (original)
+++ webservices/axis/trunk/java/modules/core/src/java/org/apache/axis/transport/http/AxisServlet.java Sun Feb 20 09:56:49 2005
@@ -1,12 +1,12 @@
/*
* Copyright 2004,2005 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.
@@ -47,23 +47,48 @@
import java.io.InputStreamReader;
import java.util.HashMap;
+/**
+ * Class AxisServlet
+ */
public class AxisServlet extends HttpServlet {
+ /**
+ * Field engineRegistry
+ */
private EngineRegistry engineRegistry;
+ /**
+ * Field LIST_MULTIPLE_SERVICE_JSP_NAME
+ */
private static final String LIST_MULTIPLE_SERVICE_JSP_NAME =
"listServices.jsp";
+
+ /**
+ * Field LIST_SINGLE_SERVICE_JSP_NAME
+ */
private static final String LIST_SINGLE_SERVICE_JSP_NAME =
"listSingleService.jsp";
+ /**
+ * Field allowListServices
+ */
private final boolean allowListServices = true;
+
+ /**
+ * Field allowListSingleService
+ */
private final boolean allowListSingleService = true;
+ /**
+ * Method init
+ *
+ * @param config
+ * @throws ServletException
+ */
public void init(ServletConfig config) throws ServletException {
try {
ServletContext context = config.getServletContext();
String repoDir = context.getRealPath("/WEB-INF");
- Class erClass =
- Class.forName(
+ Class erClass = Class.forName(
"org.apache.axis.deployment.EngineRegistryFactoryImpl");
EngineRegistryFactory erfac =
(EngineRegistryFactory) erClass.newInstance();
@@ -73,13 +98,19 @@
}
}
+ /**
+ * Method doGet
+ *
+ * @param httpServletRequest
+ * @param httpServletResponse
+ * @throws ServletException
+ * @throws IOException
+ */
protected void doGet(
- HttpServletRequest httpServletRequest,
- HttpServletResponse httpServletResponse)
+ HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse)
throws ServletException, IOException {
String filePart = httpServletRequest.getRequestURL().toString();
- if (allowListServices
- && filePart != null
+ if (allowListServices && (filePart != null)
&& filePart.endsWith(Constants.LISTSERVICES)) {
listServices(httpServletRequest, httpServletResponse);
return;
@@ -88,41 +119,45 @@
listService(httpServletRequest, httpServletResponse, filePart);
return;
}
-
}
}
- /* (non-Javadoc)
- * @see javax.servlet.http.HttpServlet#doPost(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
- */
+ /*
+ * (non-Javadoc)
+ * @see javax.servlet.http.HttpServlet#doPost(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
+ */
+
+ /**
+ * Method doPost
+ *
+ * @param req
+ * @param res
+ * @throws ServletException
+ * @throws IOException
+ */
protected void doPost(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
try {
res.setContentType("text/xml; charset=utf-8");
AxisEngine engine = new AxisEngine(engineRegistry);
- Object sessionContext =
- req.getSession().getAttribute(
+ Object sessionContext = req.getSession().getAttribute(
Constants.SESSION_CONTEXT_PROPERTY);
if (sessionContext == null) {
sessionContext = new SimpleSessionContext();
req.getSession().setAttribute(
- Constants.SESSION_CONTEXT_PROPERTY,
- sessionContext);
+ Constants.SESSION_CONTEXT_PROPERTY, sessionContext);
}
- MessageContext msgContext =
- new MessageContext(
- engineRegistry,
+ MessageContext msgContext = new MessageContext(engineRegistry,
null,
(SessionContext) sessionContext);
msgContext.setServerSide(true);
String filePart = req.getRequestURL().toString();
- msgContext.setTo(
- new EndpointReference(AddressingConstants.WSA_TO, filePart));
+ msgContext.setTo(new EndpointReference(AddressingConstants.WSA_TO,
+ filePart));
String soapActionString =
req.getHeader(HTTPConstants.HEADER_SOAP_ACTION);
if (soapActionString != null) {
- msgContext.setProperty(
- MessageContext.SOAP_ACTION,
+ msgContext.setProperty(MessageContext.SOAP_ACTION,
soapActionString);
}
XMLStreamReader reader =
@@ -132,11 +167,9 @@
StAXBuilder builder =
new StAXSOAPModelBuilder(OMFactory.newInstance(), reader);
msgContext.setEnvelope((SOAPEnvelope) builder.getDocumentElement());
- msgContext.setProperty(
- MessageContext.TRANSPORT_TYPE,
+ msgContext.setProperty(MessageContext.TRANSPORT_TYPE,
Constants.TRANSPORT_HTTP);
- msgContext.setProperty(
- MessageContext.TRANSPORT_WRITER,
+ msgContext.setProperty(MessageContext.TRANSPORT_WRITER,
new BufferedWriter(res.getWriter()));
engine.receive(msgContext);
} catch (AxisFault e) {
@@ -146,9 +179,15 @@
} catch (FactoryConfigurationError e) {
throw new ServletException(e);
}
-
}
+ /**
+ * Method listServices
+ *
+ * @param req
+ * @param res
+ * @throws IOException
+ */
private void listServices(HttpServletRequest req, HttpServletResponse res)
throws IOException {
HashMap services = engineRegistry.getServices();
@@ -156,21 +195,24 @@
res.sendRedirect(LIST_MULTIPLE_SERVICE_JSP_NAME);
}
+ /**
+ * Method listService
+ *
+ * @param req
+ * @param res
+ * @param filePart
+ * @throws IOException
+ */
private void listService(
- HttpServletRequest req,
- HttpServletResponse res,
- String filePart)
+ HttpServletRequest req, HttpServletResponse res, String filePart)
throws IOException {
- String serviceName =
- filePart.substring(
- filePart.lastIndexOf("/") + 1,
+ String serviceName = filePart.substring(filePart.lastIndexOf("/") + 1,
filePart.length());
HashMap services = engineRegistry.getServices();
- if (services != null && !services.isEmpty()) {
+ if ((services != null) && !services.isEmpty()) {
Object serviceObj = services.get(new QName(serviceName));
if (serviceObj != null) {
- req.getSession().setAttribute(
- Constants.SINGLE_SERVICE,
+ req.getSession().setAttribute(Constants.SINGLE_SERVICE,
serviceObj);
}
}
@@ -178,5 +220,4 @@
URI = URI.substring(0, URI.indexOf("services"));
res.sendRedirect(URI + LIST_SINGLE_SERVICE_JSP_NAME);
}
-
}
Modified: webservices/axis/trunk/java/modules/core/src/java/org/apache/axis/transport/http/HTTPConstants.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/java/org/apache/axis/transport/http/HTTPConstants.java?view=diff&r1=154536&r2=154537
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/java/org/apache/axis/transport/http/HTTPConstants.java (original)
+++ webservices/axis/trunk/java/modules/core/src/java/org/apache/axis/transport/http/HTTPConstants.java Sun Feb 20 09:56:49 2005
@@ -1,135 +1,379 @@
-/*
- * Copyright 2004,2005 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.
- */
-package org.apache.axis.transport.http;
-
-/**
- * HTTP protocol and message context constants.
- */
-public class HTTPConstants {
- /**
- * The MessageContext transport ID of HTTP.
- * (Maybe this should be more specific, like "http_servlet",
- * whaddya think? - todo by Jacek)
- */
- public static final String PROTOCOL_VERSION = "PROTOCOL";
- public static final String REQUEST_URI = "REQUEST_URI";
- public static final String RESPONSE_CODE = "RESPONSE_CODE";
- public static final String RESPONSE_WORD = "RESPONSE_WORD";
- public static final String RESPONSE_ACK_CODE_VAL = "202";
- public static final String SOCKET = "SOCKET";
-
- public static final String HEADER_PROTOCOL_10 = "HTTP/1.0";
- public static final String HEADER_PROTOCOL_11 = "HTTP/1.1";
- public static final String HEADER_PROTOCOL_V10 = "1.0".intern();
- public static final String HEADER_PROTOCOL_V11 = "1.1".intern();
- public static final String HEADER_POST = "POST";
- public static final String HEADER_HOST = "Host";
- public static final String HEADER_CONTENT_DESCRIPTION = "Content-Description";
- public static final String HEADER_CONTENT_TYPE = "Content-Type";
- public static final String HEADER_CONTENT_TRANSFER_ENCODING = "Content-Transfer-Encoding";
- public static final String HEADER_CONTENT_TYPE_JMS = "ContentType";
- public static final String HEADER_CONTENT_LENGTH = "Content-Length";
- public static final String HEADER_CONTENT_LOCATION = "Content-Location";
- public static final String HEADER_CONTENT_ID = "Content-Id";
- public static final String HEADER_SOAP_ACTION = "SOAPAction";
- public static final String HEADER_AUTHORIZATION = "Authorization";
- public static final String HEADER_PROXY_AUTHORIZATION = "Proxy-Authorization";
- public static final String HEADER_EXPECT = "Expect";
- public static final String HEADER_EXPECT_100_Continue = "100-continue";
- public static final String HEADER_USER_AGENT = "User-Agent";
- public static final String HEADER_CACHE_CONTROL = "Cache-Control";
- public static final String HEADER_CACHE_CONTROL_NOCACHE = "no-cache";
- public static final String HEADER_PRAGMA = "Pragma";
- public static final String HEADER_LOCATION = "Location";
-
- public static final String REQUEST_HEADERS = "HTTP-Request-Headers";
- public static final String RESPONSE_HEADERS = "HTTP-Response-Headers";
-
- /*http 1.1*/
- public static final String HEADER_TRANSFER_ENCODING = "Transfer-Encoding".intern();
- public static final String HEADER_TRANSFER_ENCODING_CHUNKED = "chunked".intern();
-
- public static final String HEADER_CONNECTION = "Connection";
- public static final String HEADER_CONNECTION_CLOSE = "close".intern();
- public static final String HEADER_CONNECTION_KEEPALIVE = "Keep-Alive".intern();//The default don't send.
-
- public static final String HEADER_ACCEPT = "Accept";
- public static final String HEADER_ACCEPT_TEXT_ALL = "text/*";
- public static final String HEADER_ACCEPT_APPL_SOAP = "application/soap+xml";
- public static final String HEADER_ACCEPT_MULTIPART_RELATED = "multipart/related";
- public static final String HEADER_ACCEPT_APPLICATION_DIME = "application/dime";
-
- /**
- * Cookie headers
- */
- public static final String HEADER_COOKIE = "Cookie";
- public static final String HEADER_COOKIE2 = "Cookie2";
- public static final String HEADER_SET_COOKIE = "Set-Cookie";
- public static final String HEADER_SET_COOKIE2 = "Set-Cookie2";
-
- /**
- * Integer
- */
- public static String MC_HTTP_STATUS_CODE = "transport.http.statusCode";
-
- /**
- * String
- */
- public static String MC_HTTP_STATUS_MESSAGE = "transport.http.statusMessage";
-
- /**
- * HttpServlet
- */
- public static String MC_HTTP_SERVLET = "transport.http.servlet";
-
- /**
- * HttpServletRequest
- */
- public static String MC_HTTP_SERVLETREQUEST = "transport.http.servletRequest";
- /**
- * HttpServletResponse
- */
- public static String MC_HTTP_SERVLETRESPONSE = "transport.http.servletResponse";
- public static String MC_HTTP_SERVLETLOCATION = "transport.http.servletLocation";
- public static String MC_HTTP_SERVLETPATHINFO = "transport.http.servletPathInfo";
-
- /**
- * HTTP header field values
- */
- public static final String HEADER_DEFAULT_CHAR_ENCODING = "iso-8859-1";
-
- /**
- * AXIS servlet plugin parameter names.
- */
- public static final String PLUGIN_NAME = "transport.http.plugin.pluginName";
- public static final String PLUGIN_SERVICE_NAME = "transport.http.plugin.serviceName";
- public static final String PLUGIN_IS_DEVELOPMENT = "transport.http.plugin.isDevelopment";
- public static final String PLUGIN_ENABLE_LIST = "transport.http.plugin.enableList";
- public static final String PLUGIN_ENGINE = "transport.http.plugin.engine";
- public static final String PLUGIN_WRITER = "transport.http.plugin.writer";
- public static final String PLUGIN_LOG = "transport.http.plugin.log";
- public static final String PLUGIN_EXCEPTION_LOG = "transport.http.plugin.exceptionLog";
-
- public static final char OK[] = ("200 OK").toCharArray();
- public static final byte NOCONTENT[] = ("202 OK\n\n").getBytes();
- public static final byte UNAUTH[] = ("401 Unauthorized").getBytes();
- public static final byte SENDER[] = "400".getBytes();
- public static final byte ISE[] = ("500 Internal server error").getBytes();
- // HTTP prefix
- public static char HTTP[] = "HTTP/1.0 ".toCharArray();
-
-
-}
+/*
+ * Copyright 2004,2005 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.
+ */
+package org.apache.axis.transport.http;
+
+/**
+ * HTTP protocol and message context constants.
+ */
+public class HTTPConstants {
+ /**
+ * The MessageContext transport ID of HTTP.
+ * (Maybe this should be more specific, like "http_servlet",
+ * whaddya think? - todo by Jacek)
+ */
+ public static final String PROTOCOL_VERSION = "PROTOCOL";
+
+ /**
+ * Field REQUEST_URI
+ */
+ public static final String REQUEST_URI = "REQUEST_URI";
+
+ /**
+ * Field RESPONSE_CODE
+ */
+ public static final String RESPONSE_CODE = "RESPONSE_CODE";
+
+ /**
+ * Field RESPONSE_WORD
+ */
+ public static final String RESPONSE_WORD = "RESPONSE_WORD";
+
+ /**
+ * Field RESPONSE_ACK_CODE_VAL
+ */
+ public static final String RESPONSE_ACK_CODE_VAL = "202";
+
+ /**
+ * Field SOCKET
+ */
+ public static final String SOCKET = "SOCKET";
+
+ /**
+ * Field HEADER_PROTOCOL_10
+ */
+ public static final String HEADER_PROTOCOL_10 = "HTTP/1.0";
+
+ /**
+ * Field HEADER_PROTOCOL_11
+ */
+ public static final String HEADER_PROTOCOL_11 = "HTTP/1.1";
+
+ /**
+ * Field HEADER_PROTOCOL_V10
+ */
+ public static final String HEADER_PROTOCOL_V10 = "1.0".intern();
+
+ /**
+ * Field HEADER_PROTOCOL_V11
+ */
+ public static final String HEADER_PROTOCOL_V11 = "1.1".intern();
+
+ /**
+ * Field HEADER_POST
+ */
+ public static final String HEADER_POST = "POST";
+
+ /**
+ * Field HEADER_HOST
+ */
+ public static final String HEADER_HOST = "Host";
+
+ /**
+ * Field HEADER_CONTENT_DESCRIPTION
+ */
+ public static final String HEADER_CONTENT_DESCRIPTION =
+ "Content-Description";
+
+ /**
+ * Field HEADER_CONTENT_TYPE
+ */
+ public static final String HEADER_CONTENT_TYPE = "Content-Type";
+
+ /**
+ * Field HEADER_CONTENT_TRANSFER_ENCODING
+ */
+ public static final String HEADER_CONTENT_TRANSFER_ENCODING =
+ "Content-Transfer-Encoding";
+
+ /**
+ * Field HEADER_CONTENT_TYPE_JMS
+ */
+ public static final String HEADER_CONTENT_TYPE_JMS = "ContentType";
+
+ /**
+ * Field HEADER_CONTENT_LENGTH
+ */
+ public static final String HEADER_CONTENT_LENGTH = "Content-Length";
+
+ /**
+ * Field HEADER_CONTENT_LOCATION
+ */
+ public static final String HEADER_CONTENT_LOCATION = "Content-Location";
+
+ /**
+ * Field HEADER_CONTENT_ID
+ */
+ public static final String HEADER_CONTENT_ID = "Content-Id";
+
+ /**
+ * Field HEADER_SOAP_ACTION
+ */
+ public static final String HEADER_SOAP_ACTION = "SOAPAction";
+
+ /**
+ * Field HEADER_AUTHORIZATION
+ */
+ public static final String HEADER_AUTHORIZATION = "Authorization";
+
+ /**
+ * Field HEADER_PROXY_AUTHORIZATION
+ */
+ public static final String HEADER_PROXY_AUTHORIZATION =
+ "Proxy-Authorization";
+
+ /**
+ * Field HEADER_EXPECT
+ */
+ public static final String HEADER_EXPECT = "Expect";
+
+ /**
+ * Field HEADER_EXPECT_100_Continue
+ */
+ public static final String HEADER_EXPECT_100_Continue = "100-continue";
+
+ /**
+ * Field HEADER_USER_AGENT
+ */
+ public static final String HEADER_USER_AGENT = "User-Agent";
+
+ /**
+ * Field HEADER_CACHE_CONTROL
+ */
+ public static final String HEADER_CACHE_CONTROL = "Cache-Control";
+
+ /**
+ * Field HEADER_CACHE_CONTROL_NOCACHE
+ */
+ public static final String HEADER_CACHE_CONTROL_NOCACHE = "no-cache";
+
+ /**
+ * Field HEADER_PRAGMA
+ */
+ public static final String HEADER_PRAGMA = "Pragma";
+
+ /**
+ * Field HEADER_LOCATION
+ */
+ public static final String HEADER_LOCATION = "Location";
+
+ /**
+ * Field REQUEST_HEADERS
+ */
+ public static final String REQUEST_HEADERS = "HTTP-Request-Headers";
+
+ /**
+ * Field RESPONSE_HEADERS
+ */
+ public static final String RESPONSE_HEADERS = "HTTP-Response-Headers";
+
+ /* http 1.1 */
+
+ /**
+ * Field HEADER_TRANSFER_ENCODING
+ */
+ public static final String HEADER_TRANSFER_ENCODING =
+ "Transfer-Encoding".intern();
+
+ /**
+ * Field HEADER_TRANSFER_ENCODING_CHUNKED
+ */
+ public static final String HEADER_TRANSFER_ENCODING_CHUNKED =
+ "chunked".intern();
+
+ /**
+ * Field HEADER_CONNECTION
+ */
+ public static final String HEADER_CONNECTION = "Connection";
+
+ /**
+ * Field HEADER_CONNECTION_CLOSE
+ */
+ public static final String HEADER_CONNECTION_CLOSE = "close".intern();
+
+ /**
+ * Field HEADER_CONNECTION_KEEPALIVE
+ */
+ public static final String HEADER_CONNECTION_KEEPALIVE =
+ "Keep-Alive".intern(); // The default don't send.
+
+ /**
+ * Field HEADER_ACCEPT
+ */
+ public static final String HEADER_ACCEPT = "Accept";
+
+ /**
+ * Field HEADER_ACCEPT_TEXT_ALL
+ */
+ public static final String HEADER_ACCEPT_TEXT_ALL = "text/*";
+
+ /**
+ * Field HEADER_ACCEPT_APPL_SOAP
+ */
+ public static final String HEADER_ACCEPT_APPL_SOAP = "application/soap+xml";
+
+ /**
+ * Field HEADER_ACCEPT_MULTIPART_RELATED
+ */
+ public static final String HEADER_ACCEPT_MULTIPART_RELATED =
+ "multipart/related";
+
+ /**
+ * Field HEADER_ACCEPT_APPLICATION_DIME
+ */
+ public static final String HEADER_ACCEPT_APPLICATION_DIME =
+ "application/dime";
+
+ /**
+ * Cookie headers
+ */
+ public static final String HEADER_COOKIE = "Cookie";
+
+ /**
+ * Field HEADER_COOKIE2
+ */
+ public static final String HEADER_COOKIE2 = "Cookie2";
+
+ /**
+ * Field HEADER_SET_COOKIE
+ */
+ public static final String HEADER_SET_COOKIE = "Set-Cookie";
+
+ /**
+ * Field HEADER_SET_COOKIE2
+ */
+ public static final String HEADER_SET_COOKIE2 = "Set-Cookie2";
+
+ /**
+ * Integer
+ */
+ public static String MC_HTTP_STATUS_CODE = "transport.http.statusCode";
+
+ /**
+ * String
+ */
+ public static String MC_HTTP_STATUS_MESSAGE =
+ "transport.http.statusMessage";
+
+ /**
+ * HttpServlet
+ */
+ public static String MC_HTTP_SERVLET = "transport.http.servlet";
+
+ /**
+ * HttpServletRequest
+ */
+ public static String MC_HTTP_SERVLETREQUEST =
+ "transport.http.servletRequest";
+
+ /**
+ * HttpServletResponse
+ */
+ public static String MC_HTTP_SERVLETRESPONSE =
+ "transport.http.servletResponse";
+
+ /**
+ * Field MC_HTTP_SERVLETLOCATION
+ */
+ public static String MC_HTTP_SERVLETLOCATION =
+ "transport.http.servletLocation";
+
+ /**
+ * Field MC_HTTP_SERVLETPATHINFO
+ */
+ public static String MC_HTTP_SERVLETPATHINFO =
+ "transport.http.servletPathInfo";
+
+ /**
+ * HTTP header field values
+ */
+ public static final String HEADER_DEFAULT_CHAR_ENCODING = "iso-8859-1";
+
+ /**
+ * AXIS servlet plugin parameter names.
+ */
+ public static final String PLUGIN_NAME = "transport.http.plugin.pluginName";
+
+ /**
+ * Field PLUGIN_SERVICE_NAME
+ */
+ public static final String PLUGIN_SERVICE_NAME =
+ "transport.http.plugin.serviceName";
+
+ /**
+ * Field PLUGIN_IS_DEVELOPMENT
+ */
+ public static final String PLUGIN_IS_DEVELOPMENT =
+ "transport.http.plugin.isDevelopment";
+
+ /**
+ * Field PLUGIN_ENABLE_LIST
+ */
+ public static final String PLUGIN_ENABLE_LIST =
+ "transport.http.plugin.enableList";
+
+ /**
+ * Field PLUGIN_ENGINE
+ */
+ public static final String PLUGIN_ENGINE = "transport.http.plugin.engine";
+
+ /**
+ * Field PLUGIN_WRITER
+ */
+ public static final String PLUGIN_WRITER = "transport.http.plugin.writer";
+
+ /**
+ * Field PLUGIN_LOG
+ */
+ public static final String PLUGIN_LOG = "transport.http.plugin.log";
+
+ /**
+ * Field PLUGIN_EXCEPTION_LOG
+ */
+ public static final String PLUGIN_EXCEPTION_LOG =
+ "transport.http.plugin.exceptionLog";
+
+ /**
+ * Field OK[]
+ */
+ public static final char OK[] = ("200 OK").toCharArray();
+
+ /**
+ * Field NOCONTENT[]
+ */
+ public static final byte NOCONTENT[] = ("202 OK\n\n").getBytes();
+
+ /**
+ * Field UNAUTH[]
+ */
+ public static final byte UNAUTH[] = ("401 Unauthorized").getBytes();
+
+ /**
+ * Field SENDER[]
+ */
+ public static final byte SENDER[] = "400".getBytes();
+
+ /**
+ * Field ISE[]
+ */
+ public static final byte ISE[] = ("500 Internal server error").getBytes();
+
+ // HTTP prefix
+
+ /**
+ * Field HTTP[]
+ */
+ public static char HTTP[] = "HTTP/1.0 ".toCharArray();
+}