You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by ek...@apache.org on 2005/05/14 01:30:37 UTC

svn commit: r170107 [10/10] - in /incubator/beehive/trunk/samples: controls-blank/src/pkg/ controls-db/src/dbControl/ controls-db/src/dbControl/util/ controls-spring/web/ controls-spring/web/WEB-INF/ controls-spring/web/WEB-INF/src/ controls-webservices-blank/ controls-webservices-blank/junit/ controls-webservices-blank/junit/test/ controls-webservices-blank/schemas/ netui-samples/ netui-samples/WEB-INF/src/ netui-samples/WEB-INF/src/org/apache/beehive/samples/controls/pets/ netui-samples/WEB-INF/src/org/apache/beehive/samples/netui/beans/ netui-samples/WEB-INF/src/shared/ netui-samples/resources/template/ netui-samples/ui/datagrid/ netui-samples/ui/popup/ netui-samples/ui/popup/getColorPopup/ netui-samples/ui/tree/ netui-samples/ui/tree/content/ netui-samples/validation/ petstoreWeb/src/org/apache/beehive/samples/petstore/controller/ petstoreWeb/src/org/apache/beehive/samples/petstore/controls/ petstoreWeb/src/org/apache/beehive/samples/petstore/controls/data/ petstoreWeb/src/org/apache/beehive/samples/petstore/controls/exceptions/ petstoreWeb/src/org/apache/beehive/samples/petstore/forms/ petstoreWeb/src/org/apache/beehive/samples/petstore/model/ petstoreWeb/test-src/org/apache/beehive/samples/petstore/test/ petstoreWeb/web/ petstoreWeb/web/WEB-INF/ petstoreWeb/web/WEB-INF/tags/beehive/petstore/ petstoreWeb/web/account/addresses/ petstoreWeb/web/account/create/ petstoreWeb/web/account/edit/ petstoreWeb/web/auth/ petstoreWeb/web/checkout/ petstoreWeb/web/search/ petstoreWeb/web/shop/ petstoreWeb/web/site/ petstoreWeb/web/webappRoot/ wsm-addressbook-enhanced/ wsm-addressbook-enhanced/WEB-INF/ wsm-addressbook-enhanced/WEB-INF/src-ws/web/ wsm-addressbook-enhanced/WEB-INF/src/ wsm-addressbook-enhanced/WEB-INF/src/org/apache/beehive/sample/ wsm-addressbook-fromWSDL/ wsm-addressbook-fromWSDL/WEB-INF/ wsm-addressbook-fromWSDL/WEB-INF/src/ wsm-addressbook-fromWSDL/WEB-INF/wsdl/ wsm-addressbook/ wsm-addressbook/WEB-INF/ wsm-addressbook/WEB-INF/src-ws/web/ wsm-addressbook/WEB-INF/src/ wsm-addressbook/WEB-INF/src/org/apache/beehive/sample/ wsm-blank/ wsm-blank/WEB-INF/ wsm-blank/WEB-INF/src-ws/web/ wsm-blank/WEB-INF/src/ wsm-employee/ wsm-employee/WEB-INF/ wsm-employee/WEB-INF/client-tests/org/apache/beehive/EmployeeDB/ wsm-employee/WEB-INF/src-ws/web/ wsm-employee/WEB-INF/src/ wsm-employee/WEB-INF/src/org/apache/beehive/sample/ wsm-petstore-dashboard/lib/ wsm-petstore-dashboard/src/ wsm-petstore-dashboard/src/ui/ wsm-samples/ wsm-samples/WEB-INF/ wsm-samples/WEB-INF/src-ws/web/complex/ wsm-samples/WEB-INF/src-ws/web/handlerchain/ wsm-samples/WEB-INF/src-ws/web/header/ wsm-samples/WEB-INF/src-ws/web/oneway/ wsm-samples/WEB-INF/src-ws/web/soapmessagehandlers/ wsm-samples/WEB-INF/src-ws/web/webmethod/ wsm-samples/WEB-INF/src-ws/web/webparam/ wsm-samples/WEB-INF/src-ws/web/webresult/ wsm-samples/WEB-INF/src-ws/web/webservice/ wsm-samples/WEB-INF/src-ws/web/xsdtypes/ wsm-samples/WEB-INF/src/ wsm-samples/WEB-INF/src/org/apache/beehive/sample/ wsm-samples/WEB-INF/src/web/header/

Modified: incubator/beehive/trunk/samples/wsm-samples/WEB-INF/src/web/header/SignException.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/samples/wsm-samples/WEB-INF/src/web/header/SignException.java?rev=170107&r1=170106&r2=170107&view=diff
==============================================================================
--- incubator/beehive/trunk/samples/wsm-samples/WEB-INF/src/web/header/SignException.java (original)
+++ incubator/beehive/trunk/samples/wsm-samples/WEB-INF/src/web/header/SignException.java Fri May 13 16:30:30 2005
@@ -1,58 +1,58 @@
-package web.header;
-
-/*
- * 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.
- *
- * $Header:$Factory
- */
-
-/*  
- * Note:  This sample was developed based on the example in the article:
- * http://www-128.ibm.com/developerworks/webservices/library/ws-tip-extend/
- */
-/**
- * SignException for general faults associated with signing.
- */
-public class SignException extends RuntimeException {
-
-    /**
-     * 
-     */
-    public SignException() {
-        super();
-    }
-
-    /**
-     * @param message
-     */
-    public SignException(String message) {
-        super(message);
-    }
-
-    /**
-     * @param message
-     * @param cause
-     */
-    public SignException(String message, Throwable cause) {
-        super(message, cause);
-    }
-
-    /**
-     * @param cause
-     */
-    public SignException(Throwable cause) {
-        super(cause);
-    }
-}
+package web.header;
+
+/*
+ * 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.
+ *
+ * $Header:$Factory
+ */
+
+/*  
+ * Note:  This sample was developed based on the example in the article:
+ * http://www-128.ibm.com/developerworks/webservices/library/ws-tip-extend/
+ */
+/**
+ * SignException for general faults associated with signing.
+ */
+public class SignException extends RuntimeException {
+
+    /**
+     * 
+     */
+    public SignException() {
+        super();
+    }
+
+    /**
+     * @param message
+     */
+    public SignException(String message) {
+        super(message);
+    }
+
+    /**
+     * @param message
+     * @param cause
+     */
+    public SignException(String message, Throwable cause) {
+        super(message, cause);
+    }
+
+    /**
+     * @param cause
+     */
+    public SignException(Throwable cause) {
+        super(cause);
+    }
+}

Modified: incubator/beehive/trunk/samples/wsm-samples/WEB-INF/src/web/header/SignHandler.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/samples/wsm-samples/WEB-INF/src/web/header/SignHandler.java?rev=170107&r1=170106&r2=170107&view=diff
==============================================================================
--- incubator/beehive/trunk/samples/wsm-samples/WEB-INF/src/web/header/SignHandler.java (original)
+++ incubator/beehive/trunk/samples/wsm-samples/WEB-INF/src/web/header/SignHandler.java Fri May 13 16:30:30 2005
@@ -1,322 +1,322 @@
-package web.header;
-/*
- * 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.
- *
- * $Header:$Factory
- */
-
-/*  
- * Note:  This sample was developed based on the example in the article:
- * http://www-128.ibm.com/developerworks/webservices/library/ws-tip-extend/
- */
-import java.util.Iterator;
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-import javax.xml.rpc.handler.Handler;
-import javax.xml.rpc.handler.HandlerInfo;
-import javax.xml.rpc.handler.soap.SOAPMessageContext;
-import javax.xml.soap.Name;
-import javax.xml.soap.SOAPElement;
-import javax.xml.soap.SOAPEnvelope;
-import javax.xml.soap.SOAPException;
-import javax.xml.soap.SOAPHeader;
-import javax.xml.soap.SOAPHeaderElement;
-import javax.xml.soap.SOAPMessage;
-import javax.xml.soap.SOAPPart;
-
-
-/**
- * Provides common behavior for client & service handlers,
- * generalized as outgoing and incoming message processing.
- */
-abstract class SignHandler implements Handler
-{
-    /**
-     * Header element namespace
-     */
-    private static final String SIGN_NS_URI
-        = "uri://org.example.webservices.signature.Sign";
-
-    /**
-     * Header element namespace prefix
-     */
-    private static final String SIGN_PREFIX
-        = "sign";
-
-    /**
-     * Header element
-     */
-    private static final String SIGN_ELEMENT
-        = "sign";
-
-    /**
-     * Header element qualifed name
-     */
-    private static final QName SIGN_HEADER
-        = new QName(SIGN_NS_URI, SIGN_ELEMENT);
-
-
-    private SignatureTool signatureTool
-        = new SignatureToolImpl();
-
-    private HandlerInfo info;
-
-
-    /**
-     * Name of required property, in HandlerInfo handler configuration,
-     * that specifies who signs outgoing messages.
-     */
-    public  static final String SIGNERS_NAME_PROPERTY
-        = "org.example.webservices.signature.SignersName";
-    
-    /**
-     * Set of SOAP headers that this handler knows how to process.
-     * It is expected that this is set on the HandlerInfo for
-     * instances of this handler's subclasses.
-     */
-    public  static final QName[] HEADERS
-        = new QName[] { SIGN_HEADER };
-
-
-    public void init(HandlerInfo config) {
-        info = config;
-    }
-
-    public void destroy() {}
-
-    public QName[] getHeaders() { return info.getHeaders(); }
-
-
-    /**
-     * Obtain signers name from handler configuration (HandlerInfo),
-     * and sign message.
-     * @throws SignException if SIGNERS_NAME_PROPERTY is not available
-     *                       in the handler config.
-     */
-    public void signOutgoing(SOAPMessageContext mc) throws SignException {
-        /**
-         * SIGNERS_NAME_PROPERTY is required to be on the configuration.
-         */
-        Map config = info.getHandlerConfig();
-        if (config == null) {
-            throw new SignException("Signers Name not provided");
-        }
-
-        Object nameObj = config.get(SIGNERS_NAME_PROPERTY);
-        if (!(nameObj instanceof String)) {
-            throw new SignException("Signers Name not provided");
-        }
-        
-        String name = (String)nameObj;
-        
-
-        try {
-            /**
-             * Dig down into message, locate or create header block.
-             */
-            SOAPMessage msg = mc.getMessage();
-            SOAPPart part = msg.getSOAPPart();
-            SOAPEnvelope envelope = part.getEnvelope();
-        
-            SOAPHeader header = envelope.getHeader();
-            if (header == null) {
-                header = envelope.addHeader();
-            }
-            
-            /**
-             * Create new header element.
-             * Use simple-security as role
-             */
-            SOAPHeaderElement headerElement
-                = (SOAPHeaderElement)header.addChildElement(SIGN_ELEMENT,
-                                                            SIGN_PREFIX,
-                                                            SIGN_NS_URI);
-            headerElement.setActor("simple-security");
-//  Just sign with name in the header, leave the content alone
-//            /**
-//             * Locate portion of message content that is to be signed.
-//             */
-//            SOAPElement content = getContent(part);
-
-            /**
-             * Create new element representing signature,
-             * and add as child to new header element.
-             */
-            SOAPElement element = signatureTool.getSignature(name);   //, content);
-            headerElement.addChildElement(element);
-        } catch (SOAPException e) {
-            e.printStackTrace();
-            throw new SignException("Unable to sign message", e);
-        }
-    }
-
-
-    /**
-     * Look for signature on incoming message.
-     * If signature not found, then continue message processing.
-     * If signature is found, then verify that it is "correct".
-     * If correct, then continue message processing.
-     * If not correct, then throw SignException.
-     */
-    public void checkIncoming(SOAPMessageContext mc) throws SignException {
-        int     validSignatures = 0;
-        boolean expectedSignature = false;
-
-        try {
-            SOAPMessage msg = mc.getMessage();
-            SOAPPart part = msg.getSOAPPart();
-            SOAPEnvelope envelope = part.getEnvelope();
-
-            
-//            /**
-//             * Locate portion of message content that is to be signed.
-//             */
-//            SOAPElement content = getContent(part);
-
-
-            /**
-             * Dig down through SOAP headers looking for matches to
-             * SIGN_HEADER, that are also targeted for this SOAP Node.
-             */
-            SOAPHeader header = envelope.getHeader();
-            if (header != null) {
-                /**
-                 * The roles the node acts in are specified by the
-                 * MessageContext.getRoles() method.  This code
-                 * examines each role independently.
-                 */
-                String[] roles = mc.getRoles();
-
-                /**
-                 * If no roles are found, then default to
-                 * "ultimate destination".
-                 */
-                if (roles == null  ||  roles.length == 0) {
-                    System.out.println("checkIncoming: no roles, " +
-                                       "default to ultimate destination");
-                    roles = new String[] { "" };
-                }
-
-                /**
-                 * Examine headers bound to each role this node acts in.
-                 */
-                for (int ridx = 0; ridx < roles.length; ridx++) {
-                    String role = roles[ridx];
-
-                    System.out.println("checkIncoming: role == \"" +
-                                       role + "\"");
-                    
-                    /**
-                     * Headers are determined to be targeted for a SOAP Node by
-                     * matching the node's roles with the header's actor role.
-                     *
-                     * So now go through list of headers associated with
-                     * the role we are currently working on.
-                     */
-                    Iterator headerElementIter
-                        = header.examineHeaderElements(role);
-    
-                    while (headerElementIter.hasNext()) {
-                        SOAPHeaderElement headerElement
-                            = (SOAPHeaderElement)headerElementIter.next();
-    
-                        /**
-                         * Is header recognized by this handler?
-                         */
-                        Name headerElementName
-                            = headerElement.getElementName();
-
-                        if (equals(headerElementName, SIGN_HEADER)) {
-                            System.out.println("checkIncoming: header match" +
-                                               ": \"" +
-                                               elementName(headerElementName) +
-                                               "\"");
-
-                            /**
-                             * We got this far, we expect a signature now.
-                             */
-                            expectedSignature = true;
-
-                            /**
-                             * Look for SOAPElement(s) in header,
-                             * ignoring mixed content.
-                             */
-                            Iterator headerIter
-                                = headerElement.getChildElements();
-    
-                            while (headerIter.hasNext()) {
-                                Object elementObj = headerIter.next();
-    
-                                if (elementObj instanceof SOAPElement) {
-                                    SOAPElement element
-                                        = (SOAPElement)elementObj;
-
-                                    signatureTool.isSignatureValid(element); //,content);
-                                    validSignatures++;
-                                }
-                            }
-                        }
-                    }
-                }
-            } else {
-                System.out.println("Header not found!");
-            }
-        } catch (SOAPException e) {
-            e.printStackTrace();
-            throw new SignException("Unable to verify signature", e);
-        }
-        
-        /**
-         * Throw an exception if we ever got to a point where we
-         * expected a signature, but then we never found one
-         * [this logic is weak, but sufficient].
-         */
-        if (expectedSignature && validSignatures < 1) {
-            throw new SignException("Expected signature(s) not found");
-        }
-    }
-    
-    /**
-     * Compare two qnames
-     */
-    private boolean equals(Name name, QName qname) {
-        return (name == null  &&  qname == null) ||
-               (name.getURI().equals(qname.getNamespaceURI()) &&
-                name.getLocalName().equals(qname.getLocalPart()));
-    }
-    
-//    /**
-//     * Helper method, return content of SOAPPart that we want to sign.
-//     */
-//    private SOAPElement getContent(SOAPPart part) throws SOAPException {
-//        SOAPEnvelope envelope = part.getEnvelope();
-//        return envelope.getBody();
-//    }
-
-    /**
-     * Return name of SOAPElement as a String.
-     */
-    private String elementName(SOAPElement e) {
-        return elementName(e.getElementName());
-    }
-    
-    /**
-     * Return name of SOAPElement as a String.
-     */
-    private String elementName(Name name) {
-        return "{" + name.getURI() + "}" + name.getLocalName();
-    }
-}
+package web.header;
+/*
+ * 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.
+ *
+ * $Header:$Factory
+ */
+
+/*  
+ * Note:  This sample was developed based on the example in the article:
+ * http://www-128.ibm.com/developerworks/webservices/library/ws-tip-extend/
+ */
+import java.util.Iterator;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+import javax.xml.rpc.handler.Handler;
+import javax.xml.rpc.handler.HandlerInfo;
+import javax.xml.rpc.handler.soap.SOAPMessageContext;
+import javax.xml.soap.Name;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPEnvelope;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPHeader;
+import javax.xml.soap.SOAPHeaderElement;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.soap.SOAPPart;
+
+
+/**
+ * Provides common behavior for client & service handlers,
+ * generalized as outgoing and incoming message processing.
+ */
+abstract class SignHandler implements Handler
+{
+    /**
+     * Header element namespace
+     */
+    private static final String SIGN_NS_URI
+        = "uri://org.example.webservices.signature.Sign";
+
+    /**
+     * Header element namespace prefix
+     */
+    private static final String SIGN_PREFIX
+        = "sign";
+
+    /**
+     * Header element
+     */
+    private static final String SIGN_ELEMENT
+        = "sign";
+
+    /**
+     * Header element qualifed name
+     */
+    private static final QName SIGN_HEADER
+        = new QName(SIGN_NS_URI, SIGN_ELEMENT);
+
+
+    private SignatureTool signatureTool
+        = new SignatureToolImpl();
+
+    private HandlerInfo info;
+
+
+    /**
+     * Name of required property, in HandlerInfo handler configuration,
+     * that specifies who signs outgoing messages.
+     */
+    public  static final String SIGNERS_NAME_PROPERTY
+        = "org.example.webservices.signature.SignersName";
+    
+    /**
+     * Set of SOAP headers that this handler knows how to process.
+     * It is expected that this is set on the HandlerInfo for
+     * instances of this handler's subclasses.
+     */
+    public  static final QName[] HEADERS
+        = new QName[] { SIGN_HEADER };
+
+
+    public void init(HandlerInfo config) {
+        info = config;
+    }
+
+    public void destroy() {}
+
+    public QName[] getHeaders() { return info.getHeaders(); }
+
+
+    /**
+     * Obtain signers name from handler configuration (HandlerInfo),
+     * and sign message.
+     * @throws SignException if SIGNERS_NAME_PROPERTY is not available
+     *                       in the handler config.
+     */
+    public void signOutgoing(SOAPMessageContext mc) throws SignException {
+        /**
+         * SIGNERS_NAME_PROPERTY is required to be on the configuration.
+         */
+        Map config = info.getHandlerConfig();
+        if (config == null) {
+            throw new SignException("Signers Name not provided");
+        }
+
+        Object nameObj = config.get(SIGNERS_NAME_PROPERTY);
+        if (!(nameObj instanceof String)) {
+            throw new SignException("Signers Name not provided");
+        }
+        
+        String name = (String)nameObj;
+        
+
+        try {
+            /**
+             * Dig down into message, locate or create header block.
+             */
+            SOAPMessage msg = mc.getMessage();
+            SOAPPart part = msg.getSOAPPart();
+            SOAPEnvelope envelope = part.getEnvelope();
+        
+            SOAPHeader header = envelope.getHeader();
+            if (header == null) {
+                header = envelope.addHeader();
+            }
+            
+            /**
+             * Create new header element.
+             * Use simple-security as role
+             */
+            SOAPHeaderElement headerElement
+                = (SOAPHeaderElement)header.addChildElement(SIGN_ELEMENT,
+                                                            SIGN_PREFIX,
+                                                            SIGN_NS_URI);
+            headerElement.setActor("simple-security");
+//  Just sign with name in the header, leave the content alone
+//            /**
+//             * Locate portion of message content that is to be signed.
+//             */
+//            SOAPElement content = getContent(part);
+
+            /**
+             * Create new element representing signature,
+             * and add as child to new header element.
+             */
+            SOAPElement element = signatureTool.getSignature(name);   //, content);
+            headerElement.addChildElement(element);
+        } catch (SOAPException e) {
+            e.printStackTrace();
+            throw new SignException("Unable to sign message", e);
+        }
+    }
+
+
+    /**
+     * Look for signature on incoming message.
+     * If signature not found, then continue message processing.
+     * If signature is found, then verify that it is "correct".
+     * If correct, then continue message processing.
+     * If not correct, then throw SignException.
+     */
+    public void checkIncoming(SOAPMessageContext mc) throws SignException {
+        int     validSignatures = 0;
+        boolean expectedSignature = false;
+
+        try {
+            SOAPMessage msg = mc.getMessage();
+            SOAPPart part = msg.getSOAPPart();
+            SOAPEnvelope envelope = part.getEnvelope();
+
+            
+//            /**
+//             * Locate portion of message content that is to be signed.
+//             */
+//            SOAPElement content = getContent(part);
+
+
+            /**
+             * Dig down through SOAP headers looking for matches to
+             * SIGN_HEADER, that are also targeted for this SOAP Node.
+             */
+            SOAPHeader header = envelope.getHeader();
+            if (header != null) {
+                /**
+                 * The roles the node acts in are specified by the
+                 * MessageContext.getRoles() method.  This code
+                 * examines each role independently.
+                 */
+                String[] roles = mc.getRoles();
+
+                /**
+                 * If no roles are found, then default to
+                 * "ultimate destination".
+                 */
+                if (roles == null  ||  roles.length == 0) {
+                    System.out.println("checkIncoming: no roles, " +
+                                       "default to ultimate destination");
+                    roles = new String[] { "" };
+                }
+
+                /**
+                 * Examine headers bound to each role this node acts in.
+                 */
+                for (int ridx = 0; ridx < roles.length; ridx++) {
+                    String role = roles[ridx];
+
+                    System.out.println("checkIncoming: role == \"" +
+                                       role + "\"");
+                    
+                    /**
+                     * Headers are determined to be targeted for a SOAP Node by
+                     * matching the node's roles with the header's actor role.
+                     *
+                     * So now go through list of headers associated with
+                     * the role we are currently working on.
+                     */
+                    Iterator headerElementIter
+                        = header.examineHeaderElements(role);
+    
+                    while (headerElementIter.hasNext()) {
+                        SOAPHeaderElement headerElement
+                            = (SOAPHeaderElement)headerElementIter.next();
+    
+                        /**
+                         * Is header recognized by this handler?
+                         */
+                        Name headerElementName
+                            = headerElement.getElementName();
+
+                        if (equals(headerElementName, SIGN_HEADER)) {
+                            System.out.println("checkIncoming: header match" +
+                                               ": \"" +
+                                               elementName(headerElementName) +
+                                               "\"");
+
+                            /**
+                             * We got this far, we expect a signature now.
+                             */
+                            expectedSignature = true;
+
+                            /**
+                             * Look for SOAPElement(s) in header,
+                             * ignoring mixed content.
+                             */
+                            Iterator headerIter
+                                = headerElement.getChildElements();
+    
+                            while (headerIter.hasNext()) {
+                                Object elementObj = headerIter.next();
+    
+                                if (elementObj instanceof SOAPElement) {
+                                    SOAPElement element
+                                        = (SOAPElement)elementObj;
+
+                                    signatureTool.isSignatureValid(element); //,content);
+                                    validSignatures++;
+                                }
+                            }
+                        }
+                    }
+                }
+            } else {
+                System.out.println("Header not found!");
+            }
+        } catch (SOAPException e) {
+            e.printStackTrace();
+            throw new SignException("Unable to verify signature", e);
+        }
+        
+        /**
+         * Throw an exception if we ever got to a point where we
+         * expected a signature, but then we never found one
+         * [this logic is weak, but sufficient].
+         */
+        if (expectedSignature && validSignatures < 1) {
+            throw new SignException("Expected signature(s) not found");
+        }
+    }
+    
+    /**
+     * Compare two qnames
+     */
+    private boolean equals(Name name, QName qname) {
+        return (name == null  &&  qname == null) ||
+               (name.getURI().equals(qname.getNamespaceURI()) &&
+                name.getLocalName().equals(qname.getLocalPart()));
+    }
+    
+//    /**
+//     * Helper method, return content of SOAPPart that we want to sign.
+//     */
+//    private SOAPElement getContent(SOAPPart part) throws SOAPException {
+//        SOAPEnvelope envelope = part.getEnvelope();
+//        return envelope.getBody();
+//    }
+
+    /**
+     * Return name of SOAPElement as a String.
+     */
+    private String elementName(SOAPElement e) {
+        return elementName(e.getElementName());
+    }
+    
+    /**
+     * Return name of SOAPElement as a String.
+     */
+    private String elementName(Name name) {
+        return "{" + name.getURI() + "}" + name.getLocalName();
+    }
+}

Modified: incubator/beehive/trunk/samples/wsm-samples/WEB-INF/src/web/header/SignatureTool.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/samples/wsm-samples/WEB-INF/src/web/header/SignatureTool.java?rev=170107&r1=170106&r2=170107&view=diff
==============================================================================
--- incubator/beehive/trunk/samples/wsm-samples/WEB-INF/src/web/header/SignatureTool.java (original)
+++ incubator/beehive/trunk/samples/wsm-samples/WEB-INF/src/web/header/SignatureTool.java Fri May 13 16:30:30 2005
@@ -1,43 +1,43 @@
-package web.header;
-/*
- * 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.
- *
- * $Header:$Factory
- */
-
-/*  
- * Note:  This sample was developed based on the example in the article:
- * http://www-128.ibm.com/developerworks/webservices/library/ws-tip-extend/
- */
-import javax.xml.soap.SOAPElement;
-import javax.xml.soap.SOAPException;
-
-
-interface SignatureTool {
-    /**
-     * @return Result of signer signing content.
-     */
-    public SOAPElement getSignature(String signersName) //, SOAPElement content) 
-    throws SOAPException;
-
-
-    /**
-     * @return true if content was signed, unchanged, by signer of signature.
-     * This is only true if the content is the same content signed originally
-     * by a signer, resulting in signature.
-     */
-    public boolean isSignatureValid(SOAPElement signature) //, SOAPElement content) 
-    throws SOAPException;
-}
+package web.header;
+/*
+ * 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.
+ *
+ * $Header:$Factory
+ */
+
+/*  
+ * Note:  This sample was developed based on the example in the article:
+ * http://www-128.ibm.com/developerworks/webservices/library/ws-tip-extend/
+ */
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPException;
+
+
+interface SignatureTool {
+    /**
+     * @return Result of signer signing content.
+     */
+    public SOAPElement getSignature(String signersName) //, SOAPElement content) 
+    throws SOAPException;
+
+
+    /**
+     * @return true if content was signed, unchanged, by signer of signature.
+     * This is only true if the content is the same content signed originally
+     * by a signer, resulting in signature.
+     */
+    public boolean isSignatureValid(SOAPElement signature) //, SOAPElement content) 
+    throws SOAPException;
+}

Modified: incubator/beehive/trunk/samples/wsm-samples/WEB-INF/src/web/header/SignatureToolImpl.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/samples/wsm-samples/WEB-INF/src/web/header/SignatureToolImpl.java?rev=170107&r1=170106&r2=170107&view=diff
==============================================================================
--- incubator/beehive/trunk/samples/wsm-samples/WEB-INF/src/web/header/SignatureToolImpl.java (original)
+++ incubator/beehive/trunk/samples/wsm-samples/WEB-INF/src/web/header/SignatureToolImpl.java Fri May 13 16:30:30 2005
@@ -1,188 +1,188 @@
-package web.header;
-/*
- * 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.
- *
- * $Header:$Factory
- */
-
-/*  
- * Note:  This sample was developed based on the example in the article:
- * http://www-128.ibm.com/developerworks/webservices/library/ws-tip-extend/
- */
-import java.util.Iterator;
-
-import javax.xml.soap.Name;
-import javax.xml.soap.SOAPElement;
-import javax.xml.soap.SOAPException;
-import javax.xml.soap.SOAPFactory;
-import javax.xml.soap.Text;
-
-
-/**
- * Produce signature of the form:
- *   <simpleSignature>
- *     <signer>...</signer>
- *     <seal>...</seal>
- *   </simpleSignature>
- */
-public class SignatureToolImpl implements SignatureTool {
-    private static final SOAPFactory factory;
-
-    private static final String SIGNATURE_NS = "uri://org.example.webservices.signature.SimpleSignature";
-    private static final String SIGNATURE_NS_PREFIX = "ssig";
-
-    private static final String SIGNATURE_ELEMENT = "signature";
-    private static final String SIGNER_ELEMENT = "signer";
-    private static final String SEAL_ELEMENT = "seal";
-
-    private static final Name   SIGNATURE_NAME;
-    private static final Name   SIGNER_NAME;
-    private static final Name   SEAL_NAME;
-
-
-    static {
-        try {
-            factory = SOAPFactory.newInstance();
-            
-            SIGNATURE_NAME = factory.createName(SIGNATURE_ELEMENT,
-                                                SIGNATURE_NS_PREFIX,
-                                                SIGNATURE_NS);
-
-            SIGNER_NAME = factory.createName(SIGNER_ELEMENT);
-
-            SEAL_NAME = factory.createName(SEAL_ELEMENT);
-        } catch (SOAPException e) {
-            e.printStackTrace();
-            throw new SignException("SignatureToolImpl init failed", e);
-        }
-    }
-
-    /* (non-Javadoc)
-     * @see org.example.webservices.signature.SignatureTool#getSignature(java.lang.String, javax.xml.soap.SOAPElement)
-     */
-    public SOAPElement getSignature(String signersName) //, SOAPElement content)
-        throws SOAPException
-    {
-        SOAPElement sig = factory.createElement(SIGNATURE_NAME);
-
-        SOAPElement signer = sig.addChildElement(SIGNER_NAME);
-        signer.addTextNode(signersName);
-
-        SOAPElement seal = sig.addChildElement(SEAL_NAME);
- //       String strContent = getContent(content);
-        String signature = sign(signersName);  //, strContent);
-        System.out.println("getSignature: seal= " + signature);
-
-        seal.addTextNode(signature);
-
-        return sig;
-    }
-
-    /* (non-Javadoc)
-     * @see org.example.webservices.signature.SignatureTool#isSignatureValid(javax.xml.soap.SOAPElement, javax.xml.soap.SOAPElement)
-     */
-    public boolean isSignatureValid(SOAPElement signature) //, SOAPElement content)
-        throws SOAPException
-    {
-        System.out.println("Testing signature");
-        if (!signature.getElementName().equals(SIGNATURE_NAME)) {
-            System.out.println("Failed signature test... SIGNATURE_NAME doesn't exist.");
-           throw new SignException("Unexpected element.  got \"" +
-                                    signature.getElementName() +
-                                    "\", expected \"" +
-                                    SIGNATURE_NAME + "\"");
-        }
-        
-        Iterator signerIter = signature.getChildElements(SIGNER_NAME);
-        if (!signerIter.hasNext()) {
-            System.out.println("Failed signature test... SIGNATURE_NAME doesn't have any child");
-           throw new SignException("Expected element missing.  expected \"" +
-                                    SIGNER_NAME + "\"");
-        }
-        SOAPElement signer = (SOAPElement)signerIter.next();
-        
-        Iterator sealIter = signature.getChildElements(SEAL_NAME);
-        if (!sealIter.hasNext()) {
-            System.out.println("Failed signature test... SIGNATURE_NAME doesn't have SEAL_NAME");
-             throw new SignException("Expected element missing.  expected \"" +
-                                    SEAL_NAME + "\"");
-        }
-        SOAPElement seal = (SOAPElement)sealIter.next();
-
-        String signersName = signer.getValue();
- //       String strContent = getContent(content);
-        String signedContent = sign(signersName);  //, strContent);
-        
-        String sealedContent = seal.getValue();
-
-        System.out.println("isSignatureValid: expected= " + signedContent);
-        System.out.println("isSignatureValid: received= " + sealedContent);
-
-        if (!signedContent.equals(sealedContent)) {
-            System.out.println("Signatures don't match!");
-             throw new SignException("Signed document does not match signature");
-        }
-
-        System.out.println("signatures match!");
-        return true;
-    }
-    
-    /**
-     * So here we do a VERY simple (and unsecure) signature.
-     * There are texts on how to do a secure signature,
-     * but they are all beyond the scope of this handler sample.
-     * 
-     * @param signer
-     * @param root
-     * @return
-     */
-    protected String sign(String signer) {  //, String content) {
-        return signer; //+ "#" + content;
-    }
-
-
-    /**
-     * Reminder: this is not about performance, or security...
-     */
-    private String getContent(SOAPElement element) throws SOAPException {
-        String result = elementName(element) + "=(";
-
-        int count = 0;
-        Iterator children = element.getChildElements();
-        while (children.hasNext()) {
-            Object child = children.next();
-            if (child instanceof SOAPElement) {
-                result += getContent((SOAPElement)child);
-                if (count > 0) result += ",";
-                count++;
-            } else if (child instanceof Text) {
-                result += ((Text)child).getValue();
-                if (count > 0) result += ",";
-                count++;
-            }
-        }
-        result += ")";
-
-        return result;
-    }
-
-    private String elementName(SOAPElement e) {
-        return elementName(e.getElementName());
-    }
-    
-    private String elementName(Name name) {
-        return "{" + name.getURI() + "}" + name.getLocalName();
-    }
-}
+package web.header;
+/*
+ * 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.
+ *
+ * $Header:$Factory
+ */
+
+/*  
+ * Note:  This sample was developed based on the example in the article:
+ * http://www-128.ibm.com/developerworks/webservices/library/ws-tip-extend/
+ */
+import java.util.Iterator;
+
+import javax.xml.soap.Name;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPFactory;
+import javax.xml.soap.Text;
+
+
+/**
+ * Produce signature of the form:
+ *   <simpleSignature>
+ *     <signer>...</signer>
+ *     <seal>...</seal>
+ *   </simpleSignature>
+ */
+public class SignatureToolImpl implements SignatureTool {
+    private static final SOAPFactory factory;
+
+    private static final String SIGNATURE_NS = "uri://org.example.webservices.signature.SimpleSignature";
+    private static final String SIGNATURE_NS_PREFIX = "ssig";
+
+    private static final String SIGNATURE_ELEMENT = "signature";
+    private static final String SIGNER_ELEMENT = "signer";
+    private static final String SEAL_ELEMENT = "seal";
+
+    private static final Name   SIGNATURE_NAME;
+    private static final Name   SIGNER_NAME;
+    private static final Name   SEAL_NAME;
+
+
+    static {
+        try {
+            factory = SOAPFactory.newInstance();
+            
+            SIGNATURE_NAME = factory.createName(SIGNATURE_ELEMENT,
+                                                SIGNATURE_NS_PREFIX,
+                                                SIGNATURE_NS);
+
+            SIGNER_NAME = factory.createName(SIGNER_ELEMENT);
+
+            SEAL_NAME = factory.createName(SEAL_ELEMENT);
+        } catch (SOAPException e) {
+            e.printStackTrace();
+            throw new SignException("SignatureToolImpl init failed", e);
+        }
+    }
+
+    /* (non-Javadoc)
+     * @see org.example.webservices.signature.SignatureTool#getSignature(java.lang.String, javax.xml.soap.SOAPElement)
+     */
+    public SOAPElement getSignature(String signersName) //, SOAPElement content)
+        throws SOAPException
+    {
+        SOAPElement sig = factory.createElement(SIGNATURE_NAME);
+
+        SOAPElement signer = sig.addChildElement(SIGNER_NAME);
+        signer.addTextNode(signersName);
+
+        SOAPElement seal = sig.addChildElement(SEAL_NAME);
+ //       String strContent = getContent(content);
+        String signature = sign(signersName);  //, strContent);
+        System.out.println("getSignature: seal= " + signature);
+
+        seal.addTextNode(signature);
+
+        return sig;
+    }
+
+    /* (non-Javadoc)
+     * @see org.example.webservices.signature.SignatureTool#isSignatureValid(javax.xml.soap.SOAPElement, javax.xml.soap.SOAPElement)
+     */
+    public boolean isSignatureValid(SOAPElement signature) //, SOAPElement content)
+        throws SOAPException
+    {
+        System.out.println("Testing signature");
+        if (!signature.getElementName().equals(SIGNATURE_NAME)) {
+            System.out.println("Failed signature test... SIGNATURE_NAME doesn't exist.");
+           throw new SignException("Unexpected element.  got \"" +
+                                    signature.getElementName() +
+                                    "\", expected \"" +
+                                    SIGNATURE_NAME + "\"");
+        }
+        
+        Iterator signerIter = signature.getChildElements(SIGNER_NAME);
+        if (!signerIter.hasNext()) {
+            System.out.println("Failed signature test... SIGNATURE_NAME doesn't have any child");
+           throw new SignException("Expected element missing.  expected \"" +
+                                    SIGNER_NAME + "\"");
+        }
+        SOAPElement signer = (SOAPElement)signerIter.next();
+        
+        Iterator sealIter = signature.getChildElements(SEAL_NAME);
+        if (!sealIter.hasNext()) {
+            System.out.println("Failed signature test... SIGNATURE_NAME doesn't have SEAL_NAME");
+             throw new SignException("Expected element missing.  expected \"" +
+                                    SEAL_NAME + "\"");
+        }
+        SOAPElement seal = (SOAPElement)sealIter.next();
+
+        String signersName = signer.getValue();
+ //       String strContent = getContent(content);
+        String signedContent = sign(signersName);  //, strContent);
+        
+        String sealedContent = seal.getValue();
+
+        System.out.println("isSignatureValid: expected= " + signedContent);
+        System.out.println("isSignatureValid: received= " + sealedContent);
+
+        if (!signedContent.equals(sealedContent)) {
+            System.out.println("Signatures don't match!");
+             throw new SignException("Signed document does not match signature");
+        }
+
+        System.out.println("signatures match!");
+        return true;
+    }
+    
+    /**
+     * So here we do a VERY simple (and unsecure) signature.
+     * There are texts on how to do a secure signature,
+     * but they are all beyond the scope of this handler sample.
+     * 
+     * @param signer
+     * @param root
+     * @return
+     */
+    protected String sign(String signer) {  //, String content) {
+        return signer; //+ "#" + content;
+    }
+
+
+    /**
+     * Reminder: this is not about performance, or security...
+     */
+    private String getContent(SOAPElement element) throws SOAPException {
+        String result = elementName(element) + "=(";
+
+        int count = 0;
+        Iterator children = element.getChildElements();
+        while (children.hasNext()) {
+            Object child = children.next();
+            if (child instanceof SOAPElement) {
+                result += getContent((SOAPElement)child);
+                if (count > 0) result += ",";
+                count++;
+            } else if (child instanceof Text) {
+                result += ((Text)child).getValue();
+                if (count > 0) result += ",";
+                count++;
+            }
+        }
+        result += ")";
+
+        return result;
+    }
+
+    private String elementName(SOAPElement e) {
+        return elementName(e.getElementName());
+    }
+    
+    private String elementName(Name name) {
+        return "{" + name.getURI() + "}" + name.getLocalName();
+    }
+}

Modified: incubator/beehive/trunk/samples/wsm-samples/WEB-INF/src/web/header/StockQuote.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/samples/wsm-samples/WEB-INF/src/web/header/StockQuote.java?rev=170107&r1=170106&r2=170107&view=diff
==============================================================================
--- incubator/beehive/trunk/samples/wsm-samples/WEB-INF/src/web/header/StockQuote.java (original)
+++ incubator/beehive/trunk/samples/wsm-samples/WEB-INF/src/web/header/StockQuote.java Fri May 13 16:30:30 2005
@@ -1,29 +1,29 @@
-/*
- * 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.
- *
- * $Header:$Factory
- */
-
-/*  
- * Note:  This sample was developed based on the example in the article:
- * http://www-128.ibm.com/developerworks/webservices/library/ws-tip-extend/
- */
-
-
-package web.header;
-
-public interface StockQuote  {
-    public float getQuote(java.lang.String arg0);
-}
+/*
+ * 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.
+ *
+ * $Header:$Factory
+ */
+
+/*  
+ * Note:  This sample was developed based on the example in the article:
+ * http://www-128.ibm.com/developerworks/webservices/library/ws-tip-extend/
+ */
+
+
+package web.header;
+
+public interface StockQuote  {
+    public float getQuote(java.lang.String arg0);
+}

Modified: incubator/beehive/trunk/samples/wsm-samples/WEB-INF/web.xml
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/samples/wsm-samples/WEB-INF/web.xml?rev=170107&r1=170106&r2=170107&view=diff
==============================================================================
--- incubator/beehive/trunk/samples/wsm-samples/WEB-INF/web.xml (original)
+++ incubator/beehive/trunk/samples/wsm-samples/WEB-INF/web.xml Fri May 13 16:30:30 2005
@@ -1,57 +1,57 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-
-<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
-
-<web-app>
-
-  <display-name>Beehive Web Services - Samples for JSR-181 Annotations</display-name>
-    
-  <filter>
-    <filter-name>ControlFilter</filter-name>
-    <filter-class>org.apache.beehive.controls.runtime.servlet.ControlFilter</filter-class>
-  </filter>
-
-  <filter-mapping>
-    <filter-name>ControlFilter</filter-name>
-    <url-pattern>*.jws</url-pattern>
-  </filter-mapping>
-
-  <listener>
-    <listener-class>org.apache.axis.transport.http.AxisHTTPSessionListener</listener-class>
-  </listener>
-
-  <servlet>
-    <servlet-name>AxisServlet</servlet-name>
-    <display-name>Apache-Axis Servlet</display-name>
-    <servlet-class>org.apache.axis.transport.http.AxisServlet</servlet-class>
-  </servlet>
-
-  <servlet-mapping>
-    <servlet-name>AxisServlet</servlet-name>
-    <url-pattern>*.jws</url-pattern>
-  </servlet-mapping>
-
-  <session-config>
-    <!-- Default to 5 minute session timeouts -->
-    <session-timeout>5</session-timeout>
-  </session-config>
-
-  <!-- currently the W3C havent settled on a media type for WSDL;
-    http://www.w3.org/TR/2003/WD-wsdl12-20030303/#ietf-draft
-    for now we go with the basic 'it's XML' response -->
-  <mime-mapping>
-    <extension>wsdl</extension>
-    <mime-type>text/xml</mime-type>
-  </mime-mapping>
-
-  <mime-mapping>
-    <extension>xsd</extension>
-    <mime-type>text/xml</mime-type>
-  </mime-mapping>
-
-  <welcome-file-list id="WelcomeFileList">
-    <welcome-file>index.html</welcome-file>
-    <welcome-file>index.jsp</welcome-file>
-  </welcome-file-list>
-
-</web-app>
+<?xml version="1.0" encoding="ISO-8859-1"?>
+
+<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
+
+<web-app>
+
+  <display-name>Beehive Web Services - Samples for JSR-181 Annotations</display-name>
+    
+  <filter>
+    <filter-name>ControlFilter</filter-name>
+    <filter-class>org.apache.beehive.controls.runtime.servlet.ControlFilter</filter-class>
+  </filter>
+
+  <filter-mapping>
+    <filter-name>ControlFilter</filter-name>
+    <url-pattern>*.jws</url-pattern>
+  </filter-mapping>
+
+  <listener>
+    <listener-class>org.apache.axis.transport.http.AxisHTTPSessionListener</listener-class>
+  </listener>
+
+  <servlet>
+    <servlet-name>AxisServlet</servlet-name>
+    <display-name>Apache-Axis Servlet</display-name>
+    <servlet-class>org.apache.axis.transport.http.AxisServlet</servlet-class>
+  </servlet>
+
+  <servlet-mapping>
+    <servlet-name>AxisServlet</servlet-name>
+    <url-pattern>*.jws</url-pattern>
+  </servlet-mapping>
+
+  <session-config>
+    <!-- Default to 5 minute session timeouts -->
+    <session-timeout>5</session-timeout>
+  </session-config>
+
+  <!-- currently the W3C havent settled on a media type for WSDL;
+    http://www.w3.org/TR/2003/WD-wsdl12-20030303/#ietf-draft
+    for now we go with the basic 'it's XML' response -->
+  <mime-mapping>
+    <extension>wsdl</extension>
+    <mime-type>text/xml</mime-type>
+  </mime-mapping>
+
+  <mime-mapping>
+    <extension>xsd</extension>
+    <mime-type>text/xml</mime-type>
+  </mime-mapping>
+
+  <welcome-file-list id="WelcomeFileList">
+    <welcome-file>index.html</welcome-file>
+    <welcome-file>index.jsp</welcome-file>
+  </welcome-file-list>
+
+</web-app>

Modified: incubator/beehive/trunk/samples/wsm-samples/happyaxis.jsp
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/samples/wsm-samples/happyaxis.jsp?rev=170107&r1=170106&r2=170107&view=diff
==============================================================================
--- incubator/beehive/trunk/samples/wsm-samples/happyaxis.jsp (original)
+++ incubator/beehive/trunk/samples/wsm-samples/happyaxis.jsp Fri May 13 16:30:30 2005
@@ -1,488 +1,488 @@
-<html>
-<%@ page import="java.io.InputStream,
-                 java.io.IOException,
-                 javax.xml.parsers.SAXParser,
-                 javax.xml.parsers.SAXParserFactory"
-   session="false" %>
- <%
-    /*
- * 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>
-<title>Axis Happiness Page</title>
-</head>
-<body bgcolor='#ffffff'>
-<%!
-
-    /*
-     * Happiness tests for axis. These look at the classpath and warn if things
-     * are missing. Normally addng this much code in a JSP page is mad
-     * but here we want to validate JSP compilation too, and have a drop-in
-     * page for easy re-use
-     * @author Steve 'configuration problems' Loughran
-     * @author dims
-     * @author Brian Ewins
-     */
-
-
-    /**
-     * Get a string providing install information.
-     * TODO: make this platform aware and give specific hints
-     */
-    public String getInstallHints(HttpServletRequest request) {
-
-        String hint=
-            "<B><I>Note:</I></B> On Tomcat 4.x and Java1.4, you may need to put libraries that contain "
-            +"java.* or javax.* packages into CATALINA_HOME/common/lib"
-            +"<br>jaxrpc.jar and saaj.jar are two such libraries.";
-        return hint;
-    }
-
-    /**
-     * test for a class existing
-     * @param classname
-     * @return class iff present
-     */
-    Class classExists(String classname) {
-        try {
-            return Class.forName(classname);
-        } catch (ClassNotFoundException e) {
-            return null;
-        }
-    }
-
-    /**
-     * test for resource on the classpath
-     * @param resource
-     * @return true iff present
-     */
-    boolean resourceExists(String resource) {
-        boolean found;
-        InputStream instream=this.getClass().getResourceAsStream(resource);
-        found=instream!=null;
-        if(instream!=null) {
-            try {
-                instream.close();
-            } catch (IOException e) {
-            }
-        }
-        return found;
-    }
-
-    /**
-     * probe for a class, print an error message is missing
-     * @param out stream to print stuff
-     * @param category text like "warning" or "error"
-     * @param classname class to look for
-     * @param jarFile where this class comes from
-     * @param errorText extra error text
-     * @param homePage where to d/l the library
-     * @return the number of missing classes
-     * @throws IOException
-     */
-    int probeClass(JspWriter out,
-                   String category,
-                   String classname,
-                   String jarFile,
-                   String description,
-                   String errorText,
-                   String homePage) throws IOException {
-        try {
-            Class clazz = classExists(classname);
-            if(clazz == null)  {
-               String url="";
-               if(homePage!=null) {
-                  url="<br>  See <a href="+homePage+">"+homePage+"</a>";
-               }
-               out.write("<p>"+category+": could not find class "+classname
-                   +" from file <b>"+jarFile
-                   +"</b><br>  "+errorText
-                   +url
-                   +"<p>");
-               return 1;
-            } else {
-               String location = getLocation(out, clazz);
-               if(location == null) {
-                  out.write("Found "+ description + " (" + classname + ")<br>");
-               }
-               else {
-                  out.write("Found "+ description + " (" + classname + ") at " + location + "<br>");
-               }
-               return 0;
-            }
-        } catch(NoClassDefFoundError ncdfe) { 
-            String url="";
-            if(homePage!=null) {
-                url="<br>  See <a href="+homePage+">"+homePage+"</a>";
-            }
-            out.write("<p>"+category+": could not find a dependency"
-                    +" of class "+classname
-                    +" from file <b>"+jarFile
-                    +"</b><br> "+errorText
-                    +url
-                    +"<br>The root cause was: "+ncdfe.getMessage()
-                    +"<br>This can happen e.g. if "+classname+" is in" 
-                    +" the 'common' classpath, but a dependency like "
-                    +" activation.jar is only in the webapp classpath."
-                    +"<p>");
-            return 1;
-        }
-    }
-
-    /**
-     * get the location of a class
-     * @param out
-     * @param clazz
-     * @return the jar file or path where a class was found
-     */
-
-    String getLocation(JspWriter out,
-                       Class clazz) {
-        try {
-            java.net.URL url = clazz.getProtectionDomain().getCodeSource().getLocation();
-            String location = url.toString();
-            if(location.startsWith("jar")) {
-                url = ((java.net.JarURLConnection)url.openConnection()).getJarFileURL();
-                location = url.toString();
-            } 
-            
-            if(location.startsWith("file")) {
-                java.io.File file = new java.io.File(url.getFile());
-                return file.getAbsolutePath();
-            } else {
-                return url.toString();
-            }
-        } catch (Throwable t){
-        }
-        return "an unknown location";
-    }
-
-    /**
-     * a class we need if a class is missing
-     * @param out stream to print stuff
-     * @param classname class to look for
-     * @param jarFile where this class comes from
-     * @param errorText extra error text
-     * @param homePage where to d/l the library
-     * @throws IOException when needed
-     * @return the number of missing libraries (0 or 1)
-     */
-    int needClass(JspWriter out,
-                   String classname,
-                   String jarFile,
-                   String description,
-                   String errorText,
-                   String homePage) throws IOException {
-        return probeClass(out,
-                "<b>Error</b>",
-                classname,
-                jarFile,
-                description,
-                errorText,
-                homePage);
-    }
-
-    /**
-     * print warning message if a class is missing
-     * @param out stream to print stuff
-     * @param classname class to look for
-     * @param jarFile where this class comes from
-     * @param errorText extra error text
-     * @param homePage where to d/l the library
-     * @throws IOException when needed
-     * @return the number of missing libraries (0 or 1)
-     */
-    int wantClass(JspWriter out,
-                   String classname,
-                   String jarFile,
-                   String description,
-                   String errorText,
-                   String homePage) throws IOException {
-        return probeClass(out,
-                "<b>Warning</b>",
-                classname,
-                jarFile,
-                description,
-                errorText,
-                homePage);
-    }
-
-    /**
-     * probe for a resource existing,
-     * @param out
-     * @param resource
-     * @param errorText
-     * @throws Exception
-     */
-    int wantResource(JspWriter out,
-                      String resource,
-                      String errorText) throws Exception {
-        if(!resourceExists(resource)) {
-            out.write("<p><b>Warning</b>: could not find resource "+resource
-                        +"<br>"
-                        +errorText);
-            return 0;
-        } else {
-            out.write("found "+resource+"<br>");
-            return 1;
-        }
-    }
-
-
-    /**
-     *  get servlet version string
-     *
-     */
-
-    public String getServletVersion() {
-        ServletContext context=getServletConfig().getServletContext();
-        int major = context.getMajorVersion();
-        int minor = context.getMinorVersion();
-        return Integer.toString(major) + '.' + Integer.toString(minor);
-    }
-
-
-
-    /**
-     * what parser are we using.
-     * @return the classname of the parser
-     */
-    private String getParserName() {
-        SAXParser saxParser = getSAXParser();
-        if (saxParser == null) {
-            return "Could not create an XML Parser";
-        }
-
-        // check to what is in the classname
-        String saxParserName = saxParser.getClass().getName();
-        return saxParserName;
-    }
-
-    /**
-     * Create a JAXP SAXParser
-     * @return parser or null for trouble
-     */
-    private SAXParser getSAXParser() {
-        SAXParserFactory saxParserFactory = SAXParserFactory.newInstance();
-        if (saxParserFactory == null) {
-            return null;
-        }
-        SAXParser saxParser = null;
-        try {
-            saxParser = saxParserFactory.newSAXParser();
-        } catch (Exception e) {
-        }
-        return saxParser;
-    }
-
-    /**
-     * get the location of the parser
-     * @return path or null for trouble in tracking it down
-     */
-
-    private String getParserLocation(JspWriter out) {
-        SAXParser saxParser = getSAXParser();
-        if (saxParser == null) {
-            return null;
-        }
-        String location = getLocation(out,saxParser.getClass());
-        return location;
-    }
-    %>
-<html><head><title>Axis Happiness Page</title></head>
-<body>
-<h1>Axis Happiness Page</h1>
-<h2>Examining webapp configuration</h2>
-
-<p>
-<h3>Needed Components</h3>
-<%
-    int needed=0,wanted=0;
-
-    /**
-     * the essentials, without these Axis is not going to work
-     */
-    needed=needClass(out, "javax.xml.soap.SOAPMessage",
-            "saaj.jar",
-            "SAAJ API",
-            "Axis will not work",
-            "http://xml.apache.org/axis/");
-
-    needed+=needClass(out, "javax.xml.rpc.Service",
-            "jaxrpc.jar",
-            "JAX-RPC API",
-            "Axis will not work",
-            "http://xml.apache.org/axis/");
-
-    needed+=needClass(out, "org.apache.axis.transport.http.AxisServlet",
-            "axis.jar",
-            "Apache-Axis",
-            "Axis will not work",
-            "http://xml.apache.org/axis/");
-
-    needed+=needClass(out, "org.apache.commons.discovery.Resource",
-            "commons-discovery.jar",
-            "Jakarta-Commons Discovery",
-            "Axis will not work",
-            "http://jakarta.apache.org/commons/discovery.html");
-
-    needed+=needClass(out, "org.apache.commons.logging.Log",
-            "commons-logging.jar",
-            "Jakarta-Commons Logging",
-            "Axis will not work",
-            "http://jakarta.apache.org/commons/logging.html");
-
-    needed+=needClass(out, "org.apache.log4j.Layout",
-            "log4j-1.2.8.jar",
-            "Log4j",
-            "Axis may not work",
-            "http://jakarta.apache.org/log4j");
-
-    //should we search for a javax.wsdl file here, to hint that it needs
-    //to go into an approved directory? because we dont seem to need to do that.
-    needed+=needClass(out, "com.ibm.wsdl.factory.WSDLFactoryImpl",
-            "wsdl4j.jar",
-            "IBM's WSDL4Java",
-            "Axis will not work",
-            null);
-
-    needed+=needClass(out, "javax.xml.parsers.SAXParserFactory",
-            "xerces.jar",
-            "JAXP implementation",
-            "Axis will not work",
-            "http://xml.apache.org/xerces-j/");
-
-    needed+=needClass(out,"javax.activation.DataHandler",
-            "activation.jar",
-            "Activation API",
-            "Axis will not work",
-            "http://java.sun.com/products/javabeans/glasgow/jaf.html");
-%>
-<h3>Optional Components</h3>
-<%
-    /*
-     * now the stuff we can live without
-     */
-    wanted+=wantClass(out,"javax.mail.internet.MimeMessage",
-            "mail.jar",
-            "Mail API",
-            "Attachments will not work",
-            "http://java.sun.com/products/javamail/");
-
-    wanted+=wantClass(out,"org.apache.xml.security.Init",
-            "xmlsec.jar",
-            "XML Security API",
-            "XML Security is not supported",
-            "http://xml.apache.org/security/");
-
-    wanted += wantClass(out, "javax.net.ssl.SSLSocketFactory",
-            "jsse.jar or java1.4+ runtime",
-            "Java Secure Socket Extension",
-            "https is not supported",
-            "http://java.sun.com/products/jsse/");
-    /*
-     * resources on the classpath path
-     */
-    /* broken; this is a file, not a resource
-    wantResource(out,"/server-config.wsdd",
-            "There is no server configuration file;"
-            +"run AdminClient to create one");
-    */
-    /* add more libraries here */
-
-    out.write("<h3>");
-    //is everythng we need here
-    if(needed==0) {
-       //yes, be happy
-        out.write("<i>The core axis libraries are present. </i>");
-    } else {
-        //no, be very unhappy
-        response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
-        out.write("<i>"
-                +needed
-                +" core axis librar"
-                +(needed==1?"y is":"ies are")
-                +" missing</i>");
-    }
-    //now look at wanted stuff
-    if(wanted>0) {
-        out.write("<i>"
-                +wanted
-                +" optional axis librar"
-                +(wanted==1?"y is":"ies are")
-                +" missing</i>");
-    } else {
-        out.write("The optional components are present.");
-    }
-    out.write("</h3>");
-    //hint if anything is missing
-    if(needed>0 || wanted>0 ) {
-        out.write(getInstallHints(request));
-    }
-
-    %>
-    <p>
-    <B><I>Note:</I></B> Even if everything this page probes for is present, there is no guarantee your
-    web service will work, because there are many configuration options that we do
-    not check for. These tests are <i>necessary</i> but not <i>sufficient</i>
-    <hr>
-
-    <h2>Examining Application Server</h2>
-    <%
-        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>
-    </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>
-<%
-    /** 
-     * Dump the system properties
-     */
-    java.util.Enumeration e=null;
-    try {
-        e= System.getProperties().propertyNames();
-    } catch (SecurityException se) {
-    }
-    if(e!=null) {
-        out.write("<pre>");
-        for (;e.hasMoreElements();) {
-            String key = (String) e.nextElement();
-            out.write(key + "=" + System.getProperty(key)+"\n");
-        }
-        out.write("</pre><p>");
-    } else {
-        out.write("System properties are not accessible<p>");
-    }
-%>
-    <hr>
-    Platform: <%= getServletConfig().getServletContext().getServerInfo()  %>
-</body>
-</html>
-
-
+<html>
+<%@ page import="java.io.InputStream,
+                 java.io.IOException,
+                 javax.xml.parsers.SAXParser,
+                 javax.xml.parsers.SAXParserFactory"
+   session="false" %>
+ <%
+    /*
+ * 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>
+<title>Axis Happiness Page</title>
+</head>
+<body bgcolor='#ffffff'>
+<%!
+
+    /*
+     * Happiness tests for axis. These look at the classpath and warn if things
+     * are missing. Normally addng this much code in a JSP page is mad
+     * but here we want to validate JSP compilation too, and have a drop-in
+     * page for easy re-use
+     * @author Steve 'configuration problems' Loughran
+     * @author dims
+     * @author Brian Ewins
+     */
+
+
+    /**
+     * Get a string providing install information.
+     * TODO: make this platform aware and give specific hints
+     */
+    public String getInstallHints(HttpServletRequest request) {
+
+        String hint=
+            "<B><I>Note:</I></B> On Tomcat 4.x and Java1.4, you may need to put libraries that contain "
+            +"java.* or javax.* packages into CATALINA_HOME/common/lib"
+            +"<br>jaxrpc.jar and saaj.jar are two such libraries.";
+        return hint;
+    }
+
+    /**
+     * test for a class existing
+     * @param classname
+     * @return class iff present
+     */
+    Class classExists(String classname) {
+        try {
+            return Class.forName(classname);
+        } catch (ClassNotFoundException e) {
+            return null;
+        }
+    }
+
+    /**
+     * test for resource on the classpath
+     * @param resource
+     * @return true iff present
+     */
+    boolean resourceExists(String resource) {
+        boolean found;
+        InputStream instream=this.getClass().getResourceAsStream(resource);
+        found=instream!=null;
+        if(instream!=null) {
+            try {
+                instream.close();
+            } catch (IOException e) {
+            }
+        }
+        return found;
+    }
+
+    /**
+     * probe for a class, print an error message is missing
+     * @param out stream to print stuff
+     * @param category text like "warning" or "error"
+     * @param classname class to look for
+     * @param jarFile where this class comes from
+     * @param errorText extra error text
+     * @param homePage where to d/l the library
+     * @return the number of missing classes
+     * @throws IOException
+     */
+    int probeClass(JspWriter out,
+                   String category,
+                   String classname,
+                   String jarFile,
+                   String description,
+                   String errorText,
+                   String homePage) throws IOException {
+        try {
+            Class clazz = classExists(classname);
+            if(clazz == null)  {
+               String url="";
+               if(homePage!=null) {
+                  url="<br>  See <a href="+homePage+">"+homePage+"</a>";
+               }
+               out.write("<p>"+category+": could not find class "+classname
+                   +" from file <b>"+jarFile
+                   +"</b><br>  "+errorText
+                   +url
+                   +"<p>");
+               return 1;
+            } else {
+               String location = getLocation(out, clazz);
+               if(location == null) {
+                  out.write("Found "+ description + " (" + classname + ")<br>");
+               }
+               else {
+                  out.write("Found "+ description + " (" + classname + ") at " + location + "<br>");
+               }
+               return 0;
+            }
+        } catch(NoClassDefFoundError ncdfe) { 
+            String url="";
+            if(homePage!=null) {
+                url="<br>  See <a href="+homePage+">"+homePage+"</a>";
+            }
+            out.write("<p>"+category+": could not find a dependency"
+                    +" of class "+classname
+                    +" from file <b>"+jarFile
+                    +"</b><br> "+errorText
+                    +url
+                    +"<br>The root cause was: "+ncdfe.getMessage()
+                    +"<br>This can happen e.g. if "+classname+" is in" 
+                    +" the 'common' classpath, but a dependency like "
+                    +" activation.jar is only in the webapp classpath."
+                    +"<p>");
+            return 1;
+        }
+    }
+
+    /**
+     * get the location of a class
+     * @param out
+     * @param clazz
+     * @return the jar file or path where a class was found
+     */
+
+    String getLocation(JspWriter out,
+                       Class clazz) {
+        try {
+            java.net.URL url = clazz.getProtectionDomain().getCodeSource().getLocation();
+            String location = url.toString();
+            if(location.startsWith("jar")) {
+                url = ((java.net.JarURLConnection)url.openConnection()).getJarFileURL();
+                location = url.toString();
+            } 
+            
+            if(location.startsWith("file")) {
+                java.io.File file = new java.io.File(url.getFile());
+                return file.getAbsolutePath();
+            } else {
+                return url.toString();
+            }
+        } catch (Throwable t){
+        }
+        return "an unknown location";
+    }
+
+    /**
+     * a class we need if a class is missing
+     * @param out stream to print stuff
+     * @param classname class to look for
+     * @param jarFile where this class comes from
+     * @param errorText extra error text
+     * @param homePage where to d/l the library
+     * @throws IOException when needed
+     * @return the number of missing libraries (0 or 1)
+     */
+    int needClass(JspWriter out,
+                   String classname,
+                   String jarFile,
+                   String description,
+                   String errorText,
+                   String homePage) throws IOException {
+        return probeClass(out,
+                "<b>Error</b>",
+                classname,
+                jarFile,
+                description,
+                errorText,
+                homePage);
+    }
+
+    /**
+     * print warning message if a class is missing
+     * @param out stream to print stuff
+     * @param classname class to look for
+     * @param jarFile where this class comes from
+     * @param errorText extra error text
+     * @param homePage where to d/l the library
+     * @throws IOException when needed
+     * @return the number of missing libraries (0 or 1)
+     */
+    int wantClass(JspWriter out,
+                   String classname,
+                   String jarFile,
+                   String description,
+                   String errorText,
+                   String homePage) throws IOException {
+        return probeClass(out,
+                "<b>Warning</b>",
+                classname,
+                jarFile,
+                description,
+                errorText,
+                homePage);
+    }
+
+    /**
+     * probe for a resource existing,
+     * @param out
+     * @param resource
+     * @param errorText
+     * @throws Exception
+     */
+    int wantResource(JspWriter out,
+                      String resource,
+                      String errorText) throws Exception {
+        if(!resourceExists(resource)) {
+            out.write("<p><b>Warning</b>: could not find resource "+resource
+                        +"<br>"
+                        +errorText);
+            return 0;
+        } else {
+            out.write("found "+resource+"<br>");
+            return 1;
+        }
+    }
+
+
+    /**
+     *  get servlet version string
+     *
+     */
+
+    public String getServletVersion() {
+        ServletContext context=getServletConfig().getServletContext();
+        int major = context.getMajorVersion();
+        int minor = context.getMinorVersion();
+        return Integer.toString(major) + '.' + Integer.toString(minor);
+    }
+
+
+
+    /**
+     * what parser are we using.
+     * @return the classname of the parser
+     */
+    private String getParserName() {
+        SAXParser saxParser = getSAXParser();
+        if (saxParser == null) {
+            return "Could not create an XML Parser";
+        }
+
+        // check to what is in the classname
+        String saxParserName = saxParser.getClass().getName();
+        return saxParserName;
+    }
+
+    /**
+     * Create a JAXP SAXParser
+     * @return parser or null for trouble
+     */
+    private SAXParser getSAXParser() {
+        SAXParserFactory saxParserFactory = SAXParserFactory.newInstance();
+        if (saxParserFactory == null) {
+            return null;
+        }
+        SAXParser saxParser = null;
+        try {
+            saxParser = saxParserFactory.newSAXParser();
+        } catch (Exception e) {
+        }
+        return saxParser;
+    }
+
+    /**
+     * get the location of the parser
+     * @return path or null for trouble in tracking it down
+     */
+
+    private String getParserLocation(JspWriter out) {
+        SAXParser saxParser = getSAXParser();
+        if (saxParser == null) {
+            return null;
+        }
+        String location = getLocation(out,saxParser.getClass());
+        return location;
+    }
+    %>
+<html><head><title>Axis Happiness Page</title></head>
+<body>
+<h1>Axis Happiness Page</h1>
+<h2>Examining webapp configuration</h2>
+
+<p>
+<h3>Needed Components</h3>
+<%
+    int needed=0,wanted=0;
+
+    /**
+     * the essentials, without these Axis is not going to work
+     */
+    needed=needClass(out, "javax.xml.soap.SOAPMessage",
+            "saaj.jar",
+            "SAAJ API",
+            "Axis will not work",
+            "http://xml.apache.org/axis/");
+
+    needed+=needClass(out, "javax.xml.rpc.Service",
+            "jaxrpc.jar",
+            "JAX-RPC API",
+            "Axis will not work",
+            "http://xml.apache.org/axis/");
+
+    needed+=needClass(out, "org.apache.axis.transport.http.AxisServlet",
+            "axis.jar",
+            "Apache-Axis",
+            "Axis will not work",
+            "http://xml.apache.org/axis/");
+
+    needed+=needClass(out, "org.apache.commons.discovery.Resource",
+            "commons-discovery.jar",
+            "Jakarta-Commons Discovery",
+            "Axis will not work",
+            "http://jakarta.apache.org/commons/discovery.html");
+
+    needed+=needClass(out, "org.apache.commons.logging.Log",
+            "commons-logging.jar",
+            "Jakarta-Commons Logging",
+            "Axis will not work",
+            "http://jakarta.apache.org/commons/logging.html");
+
+    needed+=needClass(out, "org.apache.log4j.Layout",
+            "log4j-1.2.8.jar",
+            "Log4j",
+            "Axis may not work",
+            "http://jakarta.apache.org/log4j");
+
+    //should we search for a javax.wsdl file here, to hint that it needs
+    //to go into an approved directory? because we dont seem to need to do that.
+    needed+=needClass(out, "com.ibm.wsdl.factory.WSDLFactoryImpl",
+            "wsdl4j.jar",
+            "IBM's WSDL4Java",
+            "Axis will not work",
+            null);
+
+    needed+=needClass(out, "javax.xml.parsers.SAXParserFactory",
+            "xerces.jar",
+            "JAXP implementation",
+            "Axis will not work",
+            "http://xml.apache.org/xerces-j/");
+
+    needed+=needClass(out,"javax.activation.DataHandler",
+            "activation.jar",
+            "Activation API",
+            "Axis will not work",
+            "http://java.sun.com/products/javabeans/glasgow/jaf.html");
+%>
+<h3>Optional Components</h3>
+<%
+    /*
+     * now the stuff we can live without
+     */
+    wanted+=wantClass(out,"javax.mail.internet.MimeMessage",
+            "mail.jar",
+            "Mail API",
+            "Attachments will not work",
+            "http://java.sun.com/products/javamail/");
+
+    wanted+=wantClass(out,"org.apache.xml.security.Init",
+            "xmlsec.jar",
+            "XML Security API",
+            "XML Security is not supported",
+            "http://xml.apache.org/security/");
+
+    wanted += wantClass(out, "javax.net.ssl.SSLSocketFactory",
+            "jsse.jar or java1.4+ runtime",
+            "Java Secure Socket Extension",
+            "https is not supported",
+            "http://java.sun.com/products/jsse/");
+    /*
+     * resources on the classpath path
+     */
+    /* broken; this is a file, not a resource
+    wantResource(out,"/server-config.wsdd",
+            "There is no server configuration file;"
+            +"run AdminClient to create one");
+    */
+    /* add more libraries here */
+
+    out.write("<h3>");
+    //is everythng we need here
+    if(needed==0) {
+       //yes, be happy
+        out.write("<i>The core axis libraries are present. </i>");
+    } else {
+        //no, be very unhappy
+        response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+        out.write("<i>"
+                +needed
+                +" core axis librar"
+                +(needed==1?"y is":"ies are")
+                +" missing</i>");
+    }
+    //now look at wanted stuff
+    if(wanted>0) {
+        out.write("<i>"
+                +wanted
+                +" optional axis librar"
+                +(wanted==1?"y is":"ies are")
+                +" missing</i>");
+    } else {
+        out.write("The optional components are present.");
+    }
+    out.write("</h3>");
+    //hint if anything is missing
+    if(needed>0 || wanted>0 ) {
+        out.write(getInstallHints(request));
+    }
+
+    %>
+    <p>
+    <B><I>Note:</I></B> Even if everything this page probes for is present, there is no guarantee your
+    web service will work, because there are many configuration options that we do
+    not check for. These tests are <i>necessary</i> but not <i>sufficient</i>
+    <hr>
+
+    <h2>Examining Application Server</h2>
+    <%
+        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>
+    </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>
+<%
+    /** 
+     * Dump the system properties
+     */
+    java.util.Enumeration e=null;
+    try {
+        e= System.getProperties().propertyNames();
+    } catch (SecurityException se) {
+    }
+    if(e!=null) {
+        out.write("<pre>");
+        for (;e.hasMoreElements();) {
+            String key = (String) e.nextElement();
+            out.write(key + "=" + System.getProperty(key)+"\n");
+        }
+        out.write("</pre><p>");
+    } else {
+        out.write("System properties are not accessible<p>");
+    }
+%>
+    <hr>
+    Platform: <%= getServletConfig().getServletContext().getServerInfo()  %>
+</body>
+</html>
+
+

Modified: incubator/beehive/trunk/samples/wsm-samples/index.html
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/samples/wsm-samples/index.html?rev=170107&r1=170106&r2=170107&view=diff
==============================================================================
--- incubator/beehive/trunk/samples/wsm-samples/index.html (original)
+++ incubator/beehive/trunk/samples/wsm-samples/index.html Fri May 13 16:30:30 2005
@@ -1,59 +1,59 @@
-<html>
-
-<head>
-
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<title>Beehive Web Services - Samples</title>
-
-</head>
-
-
-<body bgcolor="#FFFFFF">
-
-<h1>Beehive Web Service Examples</h1>
-<hr>
-<p>
-<a href="happyaxis.jsp">Validate the local installation</a>
-<ul>
-If the validation page displays an exception instead of a
-status page, the likely cause is that you have multiple XML
-parsers in your classpath. Clean up your classpath by eliminating
-extraneous parsers.
-</ul>
-</p>
-<hr>
-<p>
-Miscellaneous samples for web services
-<ul>
-    <li>
-        WSDL for <a href="web/header/StockQuoteImpl.jws?wsdl">header sample</a>
-    </li>
-</ul>
-</p>
-<hr>
-<p>
-Samples for usage of JSR-181 annotations
-<ul>
-  <li><a href="handlerchain.html">@javax.jws.HandlerChain</a></li>
-  <li><a href="oneway.html">@javax.jws.Oneway</a></li>
-  <li><a href="webmethod.html">@javax.jws.WebMethod</a></li>
-  <li><a href="webparam.html">@javax.jws.WebParam</a></li>
-  <li><a href="webresult.html">@javax.jws.WebResult</a></li>
-  <li><a href="webservice.html">@javax.jws.WebService</a></li>
-  <li><a href="soapbinding.html">@javax.jws.soap.SOAPBinding</a> (samples with complex data types)</li>
-  <li><a href="soapmessagehandlers.html">@javax.jws.soap.SOAPMessageHandlers</a></li>
-</ul>
-</p>
-<p>
-<b>Note</b>: Use the WSDL files of the respective services to create more
-comprehensive clients, e.g. exchanging complex objects with the server.
-<br>
-For tools and samples on client generation see for instance:
-<a href="http://webservice.controlhaus.org/">ControlHaus</a>.
-</p>
-<hr>
-<i>Copyright (C) 2004, 2005. The Apache Software Foundation.</i>
-
-</body>
-
-</html>
+<html>
+
+<head>
+
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+<title>Beehive Web Services - Samples</title>
+
+</head>
+
+
+<body bgcolor="#FFFFFF">
+
+<h1>Beehive Web Service Examples</h1>
+<hr>
+<p>
+<a href="happyaxis.jsp">Validate the local installation</a>
+<ul>
+If the validation page displays an exception instead of a
+status page, the likely cause is that you have multiple XML
+parsers in your classpath. Clean up your classpath by eliminating
+extraneous parsers.
+</ul>
+</p>
+<hr>
+<p>
+Miscellaneous samples for web services
+<ul>
+    <li>
+        WSDL for <a href="web/header/StockQuoteImpl.jws?wsdl">header sample</a>
+    </li>
+</ul>
+</p>
+<hr>
+<p>
+Samples for usage of JSR-181 annotations
+<ul>
+  <li><a href="handlerchain.html">@javax.jws.HandlerChain</a></li>
+  <li><a href="oneway.html">@javax.jws.Oneway</a></li>
+  <li><a href="webmethod.html">@javax.jws.WebMethod</a></li>
+  <li><a href="webparam.html">@javax.jws.WebParam</a></li>
+  <li><a href="webresult.html">@javax.jws.WebResult</a></li>
+  <li><a href="webservice.html">@javax.jws.WebService</a></li>
+  <li><a href="soapbinding.html">@javax.jws.soap.SOAPBinding</a> (samples with complex data types)</li>
+  <li><a href="soapmessagehandlers.html">@javax.jws.soap.SOAPMessageHandlers</a></li>
+</ul>
+</p>
+<p>
+<b>Note</b>: Use the WSDL files of the respective services to create more
+comprehensive clients, e.g. exchanging complex objects with the server.
+<br>
+For tools and samples on client generation see for instance:
+<a href="http://webservice.controlhaus.org/">ControlHaus</a>.
+</p>
+<hr>
+<i>Copyright (C) 2004, 2005. The Apache Software Foundation.</i>
+
+</body>
+
+</html>