chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f...@apache.org
Subject svn commit: r1179674 - in /chemistry/opencmis/trunk: ./ chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/ chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main...
Date Thu, 06 Oct 2011 15:58:00 GMT
Author: fmui
Date: Thu Oct  6 15:57:59 2011
New Revision: 1179674

URL: http://svn.apache.org/viewvc?rev=1179674&view=rev
Log:
CMIS-441: merged client and server tube setup and moved it to the commons package
added HTTP headers with client and server versions

Added:
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/ClientVersion.java   (with props)
    chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/tube/
    chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/tube/AbstractWssTube.java   (with props)
    chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/tube/OpenCMISTubeAssembler.java   (with props)
    chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/tube/OpenCMISTubelineAssemblerFactory.java   (with props)
    chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/tube/client/
    chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/tube/client/WssMUTube.java   (with props)
    chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/tube/server/
    chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/tube/server/WssTube.java   (with props)
    chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/resources/META-INF/
    chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/resources/META-INF/services/
    chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/resources/META-INF/services/com.sun.xml.ws.api.pipe.TubelineAssemblerFactory
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/ServerVersion.java   (with props)
Removed:
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/wss/
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/resources/META-INF/services/com.sun.xml.ws.api.pipe.TubelineAssemblerFactory
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/resources/
Modified:
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/HttpUtils.java
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/PortProvider.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/CmisAtomPubServlet.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/CmisBrowserBindingServlet.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/AbstractService.java
    chemistry/opencmis/trunk/pom.xml

Added: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/ClientVersion.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/ClientVersion.java?rev=1179674&view=auto
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/ClientVersion.java (added)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/ClientVersion.java Thu Oct  6 15:57:59 2011
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.chemistry.opencmis.client.bindings.impl;
+
+public class ClientVersion {
+    
+    public static final String OPENCMIS_VERSION;
+    public static final String OPENCMIS_CLIENT;
+
+    static {
+        Package p = Package.getPackage("org.apache.chemistry.opencmis.client.bindings.impl");
+        if (p == null) {
+            OPENCMIS_VERSION = "?";
+            OPENCMIS_CLIENT = "Apache Chemistry OpenCMIS";
+        } else {
+            OPENCMIS_VERSION = p.getImplementationVersion();
+            OPENCMIS_CLIENT = "Apache Chemistry OpenCMIS/" + (OPENCMIS_VERSION == null ? "?" : OPENCMIS_VERSION);
+        }
+    }
+}

Propchange: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/ClientVersion.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/HttpUtils.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/HttpUtils.java?rev=1179674&r1=1179673&r2=1179674&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/HttpUtils.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/HttpUtils.java Thu Oct  6 15:57:59 2011
@@ -35,6 +35,7 @@ import java.util.zip.GZIPOutputStream;
 import java.util.zip.Inflater;
 import java.util.zip.InflaterInputStream;
 
+import org.apache.chemistry.opencmis.client.bindings.impl.ClientVersion;
 import org.apache.chemistry.opencmis.client.bindings.impl.CmisBindingsHelper;
 import org.apache.chemistry.opencmis.client.bindings.spi.BindingSession;
 import org.apache.chemistry.opencmis.commons.SessionParameter;
@@ -91,7 +92,7 @@ public class HttpUtils {
             conn.setRequestMethod(method);
             conn.setDoInput(true);
             conn.setDoOutput(writer != null);
-            conn.setRequestProperty("User-Agent", "Apache Chemistry OpenCMIS");
+            conn.setRequestProperty("User-Agent", ClientVersion.OPENCMIS_CLIENT);
 
             // timeouts
             int connectTimeout = session.get(SessionParameter.CONNECT_TIMEOUT, -1);

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/PortProvider.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/PortProvider.java?rev=1179674&r1=1179673&r2=1179674&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/PortProvider.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/PortProvider.java Thu Oct  6 15:57:59 2011
@@ -28,6 +28,7 @@ import javax.xml.ws.Service;
 import javax.xml.ws.handler.MessageContext;
 import javax.xml.ws.soap.MTOMFeature;
 
+import org.apache.chemistry.opencmis.client.bindings.impl.ClientVersion;
 import org.apache.chemistry.opencmis.client.bindings.impl.CmisBindingsHelper;
 import org.apache.chemistry.opencmis.commons.SessionParameter;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisBaseException;
@@ -110,34 +111,29 @@ public class PortProvider extends Abstra
                 httpHeaders = authProvider.getHTTPHeaders(service.getWSDLDocumentLocation().toString());
             }
 
+            if (httpHeaders == null) {
+                httpHeaders = new HashMap<String, List<String>>();
+            }
+
+            // CMIS client header
+            httpHeaders.put("X-CMIS-Client", Collections.singletonList(ClientVersion.OPENCMIS_CLIENT));
+            
             // compression
             if (useCompression) {
-                if (httpHeaders == null) {
-                    httpHeaders = new HashMap<String, List<String>>();
-                }
                 httpHeaders.put("Accept-Encoding", Collections.singletonList("gzip"));
             }
 
             // client compression
             if (useClientCompression) {
-                if (httpHeaders == null) {
-                    httpHeaders = new HashMap<String, List<String>>();
-                }
                 httpHeaders.put("Content-Encoding", Collections.singletonList("gzip"));
             }
 
             // locale
             if (acceptLanguage != null) {
-                if (httpHeaders == null) {
-                    httpHeaders = new HashMap<String, List<String>>();
-                }
                 httpHeaders.put("Accept-Language", Collections.singletonList(acceptLanguage));
             }
 
-            if (httpHeaders != null) {
-                ((BindingProvider) portObject).getRequestContext()
-                        .put(MessageContext.HTTP_REQUEST_HEADERS, httpHeaders);
-            }
+            ((BindingProvider) portObject).getRequestContext().put(MessageContext.HTTP_REQUEST_HEADERS, httpHeaders);
 
             // timeouts
             int connectTimeout = getSession().get(SessionParameter.CONNECT_TIMEOUT, -1);

Added: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/tube/AbstractWssTube.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/tube/AbstractWssTube.java?rev=1179674&view=auto
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/tube/AbstractWssTube.java (added)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/tube/AbstractWssTube.java Thu Oct  6 15:57:59 2011
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.chemistry.opencmis.commons.impl.tube;
+
+import javax.xml.namespace.QName;
+
+import com.sun.xml.ws.api.pipe.Tube;
+import com.sun.xml.ws.api.pipe.TubeCloner;
+import com.sun.xml.ws.api.pipe.helper.AbstractFilterTubeImpl;
+
+/**
+ * Abstract WS-Security tube for OpenCMIS.
+ */
+public abstract class AbstractWssTube extends AbstractFilterTubeImpl {
+
+    protected static final String WSSE_NAMESPACE = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd";
+    protected static final String WSU_NAMESPACE = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd";
+    protected static final QName WSSE = new QName(WSSE_NAMESPACE, "Security");
+
+    public AbstractWssTube(Tube next) {
+        super(next);
+    }
+
+    protected AbstractWssTube(AbstractFilterTubeImpl that, TubeCloner cloner) {
+        super(that, cloner);
+    }
+}

Propchange: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/tube/AbstractWssTube.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/tube/OpenCMISTubeAssembler.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/tube/OpenCMISTubeAssembler.java?rev=1179674&view=auto
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/tube/OpenCMISTubeAssembler.java (added)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/tube/OpenCMISTubeAssembler.java Thu Oct  6 15:57:59 2011
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.chemistry.opencmis.commons.impl.tube;
+
+import org.apache.chemistry.opencmis.commons.impl.tube.client.WssMUTube;
+import org.apache.chemistry.opencmis.commons.impl.tube.server.WssTube;
+
+import com.sun.xml.ws.api.pipe.ClientTubeAssemblerContext;
+import com.sun.xml.ws.api.pipe.ServerTubeAssemblerContext;
+import com.sun.xml.ws.api.pipe.Tube;
+import com.sun.xml.ws.api.pipe.TubelineAssembler;
+
+/**
+ * Assembler for OpenCMIS client and server tubelines.
+ */
+public class OpenCMISTubeAssembler implements TubelineAssembler {
+
+    public Tube createClient(ClientTubeAssemblerContext context) {
+        Tube head = context.createTransportTube();
+        head = context.createSecurityTube(head);
+        head = context.createWsaTube(head);
+        head = new WssMUTube(context.getBinding(), head);
+
+        return context.createHandlerTube(head);
+    }
+
+    public Tube createServer(ServerTubeAssemblerContext context) {
+        Tube head = context.getTerminalTube();
+        head = new WssTube(head);
+        head = context.createHandlerTube(head);
+        head = context.createMonitoringTube(head);
+        head = context.createServerMUTube(head);
+        head = context.createWsaTube(head);
+        head = context.createSecurityTube(head);
+
+        return head;
+    }
+}

Propchange: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/tube/OpenCMISTubeAssembler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/tube/OpenCMISTubelineAssemblerFactory.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/tube/OpenCMISTubelineAssemblerFactory.java?rev=1179674&view=auto
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/tube/OpenCMISTubelineAssemblerFactory.java (added)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/tube/OpenCMISTubelineAssemblerFactory.java Thu Oct  6 15:57:59 2011
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.chemistry.opencmis.commons.impl.tube;
+
+import com.sun.xml.ws.api.BindingID;
+import com.sun.xml.ws.api.pipe.TubelineAssembler;
+import com.sun.xml.ws.api.pipe.TubelineAssemblerFactory;
+
+/**
+ * Assembler Factory for OpenCMIS client and server tubelines.
+ */
+public class OpenCMISTubelineAssemblerFactory extends TubelineAssemblerFactory {
+
+    @Override
+    public TubelineAssembler doCreate(BindingID bindingID) {
+        return new OpenCMISTubeAssembler();
+    }
+}

Propchange: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/tube/OpenCMISTubelineAssemblerFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/tube/client/WssMUTube.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/tube/client/WssMUTube.java?rev=1179674&view=auto
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/tube/client/WssMUTube.java (added)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/tube/client/WssMUTube.java Thu Oct  6 15:57:59 2011
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.chemistry.opencmis.commons.impl.tube.client;
+
+import javax.xml.namespace.QName;
+
+import org.apache.chemistry.opencmis.commons.exceptions.CmisConnectionException;
+import org.apache.chemistry.opencmis.commons.impl.tube.AbstractWssTube;
+
+import com.sun.xml.ws.api.SOAPVersion;
+import com.sun.xml.ws.api.WSBinding;
+import com.sun.xml.ws.api.message.Header;
+import com.sun.xml.ws.api.message.HeaderList;
+import com.sun.xml.ws.api.message.Packet;
+import com.sun.xml.ws.api.pipe.NextAction;
+import com.sun.xml.ws.api.pipe.Tube;
+import com.sun.xml.ws.api.pipe.TubeCloner;
+
+public class WssMUTube extends AbstractWssTube {
+
+    private final SOAPVersion soapVersion;
+
+    public WssMUTube(WSBinding binding, Tube next) {
+        super(next);
+        soapVersion = binding.getSOAPVersion();
+    }
+
+    protected WssMUTube(WssMUTube that, TubeCloner cloner) {
+        super(that, cloner);
+        soapVersion = that.soapVersion;
+    }
+
+    public WssMUTube copy(TubeCloner cloner) {
+        return new WssMUTube(this, cloner);
+    }
+
+    @Override
+    public NextAction processResponse(Packet response) {
+        if (response.getMessage() == null) {
+            return super.processResponse(response);
+        }
+
+        HeaderList headers = response.getMessage().getHeaders();
+
+        for (int i = 0; i < headers.size(); i++) {
+            if (!headers.isUnderstood(i)) {
+                Header header = headers.get(i);
+                if (!header.isIgnorable(soapVersion, soapVersion.implicitRoleSet)) {
+                    QName qName = new QName(header.getNamespaceURI(), header.getLocalPart());
+                    if (WSSE.equals(qName)) {
+                        checkSecurityHeader(header);
+                    } else {
+                        throw new CmisConnectionException("MustUnderstand header is not understood: " + qName);
+                    }
+                }
+            }
+        }
+
+        return super.processResponse(response);
+    }
+
+    private void checkSecurityHeader(Header header) {
+        // TODO
+    }
+}

Propchange: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/tube/client/WssMUTube.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/tube/server/WssTube.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/tube/server/WssTube.java?rev=1179674&view=auto
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/tube/server/WssTube.java (added)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/tube/server/WssTube.java Thu Oct  6 15:57:59 2011
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.chemistry.opencmis.commons.impl.tube.server;
+
+import java.text.SimpleDateFormat;
+import java.util.TimeZone;
+
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.apache.chemistry.opencmis.commons.impl.tube.AbstractWssTube;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+import com.sun.xml.ws.api.message.HeaderList;
+import com.sun.xml.ws.api.message.Headers;
+import com.sun.xml.ws.api.message.Message;
+import com.sun.xml.ws.api.message.Packet;
+import com.sun.xml.ws.api.pipe.NextAction;
+import com.sun.xml.ws.api.pipe.Tube;
+import com.sun.xml.ws.api.pipe.TubeCloner;
+import com.sun.xml.ws.api.pipe.helper.AbstractFilterTubeImpl;
+
+public class WssTube extends AbstractWssTube {
+
+    public WssTube(Tube next) {
+        super(next);
+    }
+
+    protected WssTube(AbstractFilterTubeImpl that, TubeCloner cloner) {
+        super(that, cloner);
+    }
+
+    public WssTube copy(TubeCloner cloner) {
+        return new WssTube(this, cloner);
+    }
+
+    @Override
+    public NextAction processResponse(Packet packet) {
+        Message message = packet.getMessage();
+        if (message == null) {
+            return super.processResponse(packet);
+        }
+
+        try {
+            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
+            sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
+            long created = System.currentTimeMillis();
+            long expires = created + 24 * 60 * 60 * 1000; // 24 hours
+
+            Document document = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
+
+            Element wsseSecurityElement = document.createElementNS(WSSE_NAMESPACE, "Security");
+
+            Element wsuTimestampElement = document.createElementNS(WSU_NAMESPACE, "Timestamp");
+            wsseSecurityElement.appendChild(wsuTimestampElement);
+
+            Element tsCreatedElement = document.createElementNS(WSU_NAMESPACE, "Created");
+            tsCreatedElement.setTextContent(sdf.format(created));
+            wsuTimestampElement.appendChild(tsCreatedElement);
+
+            Element tsExpiresElement = document.createElementNS(WSU_NAMESPACE, "Expires");
+            tsExpiresElement.setTextContent(sdf.format(expires));
+            wsuTimestampElement.appendChild(tsExpiresElement);
+
+            HeaderList headers = message.getHeaders();
+            headers.add(Headers.create(wsseSecurityElement));
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+        return super.processResponse(packet);
+    }
+}

Propchange: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/tube/server/WssTube.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/resources/META-INF/services/com.sun.xml.ws.api.pipe.TubelineAssemblerFactory
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/resources/META-INF/services/com.sun.xml.ws.api.pipe.TubelineAssemblerFactory?rev=1179674&view=auto
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/resources/META-INF/services/com.sun.xml.ws.api.pipe.TubelineAssemblerFactory (added)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/resources/META-INF/services/com.sun.xml.ws.api.pipe.TubelineAssemblerFactory Thu Oct  6 15:57:59 2011
@@ -0,0 +1 @@
+org.apache.chemistry.opencmis.commons.impl.tube.OpenCMISTubelineAssemblerFactory
\ No newline at end of file

Added: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/ServerVersion.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/ServerVersion.java?rev=1179674&view=auto
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/ServerVersion.java (added)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/ServerVersion.java Thu Oct  6 15:57:59 2011
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.chemistry.opencmis.server.impl;
+
+public class ServerVersion {
+
+    public static final String OPENCMIS_VERSION;
+    public static final String OPENCMIS_SERVER;
+
+    static {
+        Package p = Package.getPackage("org.apache.chemistry.opencmis.server.impl");
+        if (p == null) {
+            OPENCMIS_VERSION = "?";
+            OPENCMIS_SERVER = "Apache-Chemistry-OpenCMIS";
+        } else {
+            OPENCMIS_VERSION = p.getImplementationVersion();
+            OPENCMIS_SERVER = "Apache-Chemistry-OpenCMIS/" + (OPENCMIS_VERSION == null ? "?" : OPENCMIS_VERSION);
+        }
+    }
+}

Propchange: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/ServerVersion.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/CmisAtomPubServlet.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/CmisAtomPubServlet.java?rev=1179674&r1=1179673&r2=1179674&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/CmisAtomPubServlet.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/CmisAtomPubServlet.java Thu Oct  6 15:57:59 2011
@@ -18,6 +18,31 @@
  */
 package org.apache.chemistry.opencmis.server.impl.atompub;
 
+import static org.apache.chemistry.opencmis.server.impl.atompub.AtomPubUtils.RESOURCE_ACL;
+import static org.apache.chemistry.opencmis.server.impl.atompub.AtomPubUtils.RESOURCE_ALLOWABLEACIONS;
+import static org.apache.chemistry.opencmis.server.impl.atompub.AtomPubUtils.RESOURCE_CHANGES;
+import static org.apache.chemistry.opencmis.server.impl.atompub.AtomPubUtils.RESOURCE_CHECKEDOUT;
+import static org.apache.chemistry.opencmis.server.impl.atompub.AtomPubUtils.RESOURCE_CHILDREN;
+import static org.apache.chemistry.opencmis.server.impl.atompub.AtomPubUtils.RESOURCE_CONTENT;
+import static org.apache.chemistry.opencmis.server.impl.atompub.AtomPubUtils.RESOURCE_DESCENDANTS;
+import static org.apache.chemistry.opencmis.server.impl.atompub.AtomPubUtils.RESOURCE_ENTRY;
+import static org.apache.chemistry.opencmis.server.impl.atompub.AtomPubUtils.RESOURCE_FOLDERTREE;
+import static org.apache.chemistry.opencmis.server.impl.atompub.AtomPubUtils.RESOURCE_OBJECTBYID;
+import static org.apache.chemistry.opencmis.server.impl.atompub.AtomPubUtils.RESOURCE_OBJECTBYPATH;
+import static org.apache.chemistry.opencmis.server.impl.atompub.AtomPubUtils.RESOURCE_PARENTS;
+import static org.apache.chemistry.opencmis.server.impl.atompub.AtomPubUtils.RESOURCE_POLICIES;
+import static org.apache.chemistry.opencmis.server.impl.atompub.AtomPubUtils.RESOURCE_QUERY;
+import static org.apache.chemistry.opencmis.server.impl.atompub.AtomPubUtils.RESOURCE_RELATIONSHIPS;
+import static org.apache.chemistry.opencmis.server.impl.atompub.AtomPubUtils.RESOURCE_TYPE;
+import static org.apache.chemistry.opencmis.server.impl.atompub.AtomPubUtils.RESOURCE_TYPES;
+import static org.apache.chemistry.opencmis.server.impl.atompub.AtomPubUtils.RESOURCE_TYPESDESC;
+import static org.apache.chemistry.opencmis.server.impl.atompub.AtomPubUtils.RESOURCE_UNFILED;
+import static org.apache.chemistry.opencmis.server.impl.atompub.AtomPubUtils.RESOURCE_VERSIONS;
+import static org.apache.chemistry.opencmis.server.shared.Dispatcher.METHOD_DELETE;
+import static org.apache.chemistry.opencmis.server.shared.Dispatcher.METHOD_GET;
+import static org.apache.chemistry.opencmis.server.shared.Dispatcher.METHOD_POST;
+import static org.apache.chemistry.opencmis.server.shared.Dispatcher.METHOD_PUT;
+
 import java.io.IOException;
 import java.io.PrintWriter;
 
@@ -45,6 +70,7 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.server.CmisService;
 import org.apache.chemistry.opencmis.commons.server.CmisServiceFactory;
 import org.apache.chemistry.opencmis.server.impl.CmisRepositoryContextListener;
+import org.apache.chemistry.opencmis.server.impl.ServerVersion;
 import org.apache.chemistry.opencmis.server.shared.CallContextHandler;
 import org.apache.chemistry.opencmis.server.shared.Dispatcher;
 import org.apache.chemistry.opencmis.server.shared.ExceptionHelper;
@@ -53,9 +79,6 @@ import org.apache.commons.lang.StringEsc
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
-import static org.apache.chemistry.opencmis.server.impl.atompub.AtomPubUtils.*;
-import static org.apache.chemistry.opencmis.server.shared.Dispatcher.*;
-
 /**
  * CMIS AtomPub servlet.
  */
@@ -89,72 +112,40 @@ public class CmisAtomPubServlet extends 
         dispatcher = new Dispatcher();
 
         try {
-            dispatcher.addResource(RESOURCE_TYPES, METHOD_GET, RepositoryService.class,
-                    "getTypeChildren");
-            dispatcher.addResource(RESOURCE_TYPESDESC, METHOD_GET, RepositoryService.class,
-                    "getTypeDescendants");
-            dispatcher.addResource(RESOURCE_TYPE, METHOD_GET, RepositoryService.class,
-                    "getTypeDefinition");
-            dispatcher.addResource(RESOURCE_CHILDREN, METHOD_GET, NavigationService.class,
-                    "getChildren");
-            dispatcher.addResource(RESOURCE_DESCENDANTS, METHOD_GET, NavigationService.class,
-                    "getDescendants");
-            dispatcher.addResource(RESOURCE_FOLDERTREE, METHOD_GET, NavigationService.class,
-                    "getFolderTree");
-            dispatcher.addResource(RESOURCE_PARENTS, METHOD_GET, NavigationService.class,
-                    "getObjectParents");
-            dispatcher.addResource(RESOURCE_CHECKEDOUT, METHOD_GET, NavigationService.class,
-                    "getCheckedOutDocs");
-            dispatcher.addResource(RESOURCE_ENTRY, METHOD_GET, ObjectService.class,
-                    "getObject");
-            dispatcher.addResource(RESOURCE_OBJECTBYID, METHOD_GET, ObjectService.class,
-                    "getObject");
-            dispatcher.addResource(RESOURCE_OBJECTBYPATH, METHOD_GET, ObjectService.class,
-                    "getObjectByPath");
-            dispatcher.addResource(RESOURCE_ALLOWABLEACIONS, METHOD_GET, ObjectService.class,
-                    "getAllowableActions");
-            dispatcher.addResource(RESOURCE_CONTENT, METHOD_GET, ObjectService.class,
-                    "getContentStream");
-            dispatcher.addResource(RESOURCE_CONTENT, METHOD_PUT, ObjectService.class,
-                    "setContentStream");
-            dispatcher.addResource(RESOURCE_CONTENT, METHOD_DELETE, ObjectService.class,
-                    "deleteContentStream");
-            dispatcher.addResource(RESOURCE_CHILDREN, METHOD_POST, ObjectService.class,
-                    "create");
-            dispatcher.addResource(RESOURCE_RELATIONSHIPS, METHOD_POST, ObjectService.class,
-                    "createRelationship");
-            dispatcher.addResource(RESOURCE_ENTRY, METHOD_PUT, ObjectService.class,
-                    "updateProperties");
-            dispatcher.addResource(RESOURCE_ENTRY, METHOD_DELETE, ObjectService.class,
-                    "deleteObject");
-            dispatcher.addResource(RESOURCE_DESCENDANTS, METHOD_DELETE, ObjectService.class,
-                    "deleteTree");
-            dispatcher.addResource(RESOURCE_CHECKEDOUT, METHOD_POST, VersioningService.class,
-                    "checkOut");
-            dispatcher.addResource(RESOURCE_VERSIONS, METHOD_GET, VersioningService.class,
-                    "getAllVersions");
-            dispatcher.addResource(RESOURCE_VERSIONS, METHOD_DELETE, VersioningService.class,
-                    "deleteAllVersions");
-            dispatcher.addResource(RESOURCE_QUERY, METHOD_GET, DiscoveryService.class,
-                    "query");
-            dispatcher.addResource(RESOURCE_QUERY, METHOD_POST, DiscoveryService.class,
-                    "query");
-            dispatcher.addResource(RESOURCE_CHANGES, METHOD_GET, DiscoveryService.class,
-                    "getContentChanges");
+            dispatcher.addResource(RESOURCE_TYPES, METHOD_GET, RepositoryService.class, "getTypeChildren");
+            dispatcher.addResource(RESOURCE_TYPESDESC, METHOD_GET, RepositoryService.class, "getTypeDescendants");
+            dispatcher.addResource(RESOURCE_TYPE, METHOD_GET, RepositoryService.class, "getTypeDefinition");
+            dispatcher.addResource(RESOURCE_CHILDREN, METHOD_GET, NavigationService.class, "getChildren");
+            dispatcher.addResource(RESOURCE_DESCENDANTS, METHOD_GET, NavigationService.class, "getDescendants");
+            dispatcher.addResource(RESOURCE_FOLDERTREE, METHOD_GET, NavigationService.class, "getFolderTree");
+            dispatcher.addResource(RESOURCE_PARENTS, METHOD_GET, NavigationService.class, "getObjectParents");
+            dispatcher.addResource(RESOURCE_CHECKEDOUT, METHOD_GET, NavigationService.class, "getCheckedOutDocs");
+            dispatcher.addResource(RESOURCE_ENTRY, METHOD_GET, ObjectService.class, "getObject");
+            dispatcher.addResource(RESOURCE_OBJECTBYID, METHOD_GET, ObjectService.class, "getObject");
+            dispatcher.addResource(RESOURCE_OBJECTBYPATH, METHOD_GET, ObjectService.class, "getObjectByPath");
+            dispatcher.addResource(RESOURCE_ALLOWABLEACIONS, METHOD_GET, ObjectService.class, "getAllowableActions");
+            dispatcher.addResource(RESOURCE_CONTENT, METHOD_GET, ObjectService.class, "getContentStream");
+            dispatcher.addResource(RESOURCE_CONTENT, METHOD_PUT, ObjectService.class, "setContentStream");
+            dispatcher.addResource(RESOURCE_CONTENT, METHOD_DELETE, ObjectService.class, "deleteContentStream");
+            dispatcher.addResource(RESOURCE_CHILDREN, METHOD_POST, ObjectService.class, "create");
+            dispatcher.addResource(RESOURCE_RELATIONSHIPS, METHOD_POST, ObjectService.class, "createRelationship");
+            dispatcher.addResource(RESOURCE_ENTRY, METHOD_PUT, ObjectService.class, "updateProperties");
+            dispatcher.addResource(RESOURCE_ENTRY, METHOD_DELETE, ObjectService.class, "deleteObject");
+            dispatcher.addResource(RESOURCE_DESCENDANTS, METHOD_DELETE, ObjectService.class, "deleteTree");
+            dispatcher.addResource(RESOURCE_CHECKEDOUT, METHOD_POST, VersioningService.class, "checkOut");
+            dispatcher.addResource(RESOURCE_VERSIONS, METHOD_GET, VersioningService.class, "getAllVersions");
+            dispatcher.addResource(RESOURCE_VERSIONS, METHOD_DELETE, VersioningService.class, "deleteAllVersions");
+            dispatcher.addResource(RESOURCE_QUERY, METHOD_GET, DiscoveryService.class, "query");
+            dispatcher.addResource(RESOURCE_QUERY, METHOD_POST, DiscoveryService.class, "query");
+            dispatcher.addResource(RESOURCE_CHANGES, METHOD_GET, DiscoveryService.class, "getContentChanges");
             dispatcher.addResource(RESOURCE_RELATIONSHIPS, METHOD_GET, RelationshipService.class,
                     "getObjectRelationships");
-            dispatcher.addResource(RESOURCE_UNFILED, METHOD_POST, MultiFilingService.class,
-                    "removeObjectFromFolder");
-            dispatcher.addResource(RESOURCE_ACL, METHOD_GET, AclService.class,
-                    "getAcl");
-            dispatcher.addResource(RESOURCE_ACL, METHOD_PUT, AclService.class,
-                    "applyAcl");
-            dispatcher.addResource(RESOURCE_POLICIES, METHOD_GET, PolicyService.class,
-                    "getAppliedPolicies");
-            dispatcher.addResource(RESOURCE_POLICIES, METHOD_POST, PolicyService.class,
-                    "applyPolicy");
-            dispatcher.addResource(RESOURCE_POLICIES, METHOD_DELETE, PolicyService.class,
-                    "removePolicy");
+            dispatcher.addResource(RESOURCE_UNFILED, METHOD_POST, MultiFilingService.class, "removeObjectFromFolder");
+            dispatcher.addResource(RESOURCE_ACL, METHOD_GET, AclService.class, "getAcl");
+            dispatcher.addResource(RESOURCE_ACL, METHOD_PUT, AclService.class, "applyAcl");
+            dispatcher.addResource(RESOURCE_POLICIES, METHOD_GET, PolicyService.class, "getAppliedPolicies");
+            dispatcher.addResource(RESOURCE_POLICIES, METHOD_POST, PolicyService.class, "applyPolicy");
+            dispatcher.addResource(RESOURCE_POLICIES, METHOD_DELETE, PolicyService.class, "removePolicy");
         } catch (NoSuchMethodException e) {
             LOG.error("Cannot initialize dispatcher!", e);
         }
@@ -164,6 +155,10 @@ public class CmisAtomPubServlet extends 
     protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException,
             IOException {
 
+        // set default headers
+        response.addHeader("Cache-Control", "private, max-age=0");
+        response.addHeader("Server", ServerVersion.OPENCMIS_SERVER);
+
         // create a context object, dispatch and handle exceptions
         CallContext context = null;
         try {

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/CmisBrowserBindingServlet.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/CmisBrowserBindingServlet.java?rev=1179674&r1=1179673&r2=1179674&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/CmisBrowserBindingServlet.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/CmisBrowserBindingServlet.java Thu Oct  6 15:57:59 2011
@@ -19,7 +19,35 @@
 package org.apache.chemistry.opencmis.server.impl.browser;
 
 import static org.apache.chemistry.opencmis.commons.impl.Constants.PARAM_OBJECT_ID;
-import static org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.*;
+import static org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.CMISACTION_CREATE_DOCUMENT;
+import static org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.CMISACTION_CREATE_FOLDER;
+import static org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.CMISACTION_DELETE;
+import static org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.CMISACTION_DELETE_TREE;
+import static org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.CMISACTION_QUERY;
+import static org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.CMISACTION_SET_CONTENT;
+import static org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.CONTEXT_BASETYPE_ID;
+import static org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.CONTEXT_TRANSACTION;
+import static org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.CONTROL_CMISACTION;
+import static org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.CONTROL_OBJECT_ID;
+import static org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.CONTROL_TRANSACTION;
+import static org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.JSON_MIME_TYPE;
+import static org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.PARAM_SELECTOR;
+import static org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.SELECTOR_CHILDREN;
+import static org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.SELECTOR_CONTENT;
+import static org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.SELECTOR_DESCENDANTS;
+import static org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.SELECTOR_FOLDER_TREE;
+import static org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.SELECTOR_LAST_RESULT;
+import static org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.SELECTOR_OBJECT;
+import static org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.SELECTOR_PARENTS;
+import static org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.SELECTOR_QUERY;
+import static org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.SELECTOR_TYPE_CHILDREN;
+import static org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.SELECTOR_TYPE_DEFINITION;
+import static org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.SELECTOR_TYPE_DESCENDANTS;
+import static org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.SELECTOR_VERSIONS;
+import static org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.createCookieValue;
+import static org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.prepareContext;
+import static org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.setCookie;
+import static org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.writeJSON;
 import static org.apache.chemistry.opencmis.server.impl.browser.json.JSONConstants.ERROR_EXCEPTION;
 import static org.apache.chemistry.opencmis.server.impl.browser.json.JSONConstants.ERROR_MESSAGE;
 import static org.apache.chemistry.opencmis.server.impl.browser.json.JSONConstants.ERROR_STACKTRACE;
@@ -50,13 +78,12 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.exceptions.CmisStreamNotSupportedException;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisUpdateConflictException;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisVersioningException;
-import org.apache.chemistry.opencmis.commons.impl.Constants;
 import org.apache.chemistry.opencmis.commons.server.CallContext;
 import org.apache.chemistry.opencmis.commons.server.CmisService;
 import org.apache.chemistry.opencmis.commons.server.CmisServiceFactory;
 import org.apache.chemistry.opencmis.server.impl.CmisRepositoryContextListener;
+import org.apache.chemistry.opencmis.server.impl.ServerVersion;
 import org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.CallUrl;
-import org.apache.chemistry.opencmis.server.impl.browser.json.JSONConstants;
 import org.apache.chemistry.opencmis.server.shared.CallContextHandler;
 import org.apache.chemistry.opencmis.server.shared.Dispatcher;
 import org.apache.chemistry.opencmis.server.shared.ExceptionHelper;
@@ -97,48 +124,33 @@ public class CmisBrowserBindingServlet e
         rootDispatcher = new Dispatcher();
 
         try {
-            repositoryDispatcher.addResource("", METHOD_GET,
-                    RepositoryService.class, "getRepositoryInfo");
-            repositoryDispatcher.addResource(SELECTOR_LAST_RESULT, METHOD_GET,
-                    RepositoryService.class, "getLastResult");
-            repositoryDispatcher.addResource(SELECTOR_TYPE_CHILDREN, METHOD_GET,
-                    RepositoryService.class, "getTypeChildren");
-            repositoryDispatcher.addResource(SELECTOR_TYPE_DESCENDANTS, METHOD_GET,
-                    RepositoryService.class, "getTypeDescendants");
-            repositoryDispatcher.addResource(SELECTOR_TYPE_DEFINITION, METHOD_GET,
-                    RepositoryService.class, "getTypeDefinition");
-            repositoryDispatcher.addResource(SELECTOR_QUERY, METHOD_GET,
-                    DiscoveryService.class, "query");
-            repositoryDispatcher.addResource(CMISACTION_QUERY, METHOD_POST,
-                    DiscoveryService.class, "query");
-            repositoryDispatcher.addResource(CMISACTION_CREATE_DOCUMENT, METHOD_POST,
-                    ObjectService.class, "createDocument");
-
-            rootDispatcher.addResource(SELECTOR_OBJECT, METHOD_GET, ObjectService.class,
-                    "getObject");
-            rootDispatcher.addResource(SELECTOR_CONTENT, METHOD_GET,
-                    ObjectService.class, "getContentStream");
-            rootDispatcher.addResource(SELECTOR_CHILDREN, METHOD_GET,
-                    NavigationService.class, "getChildren");
-            rootDispatcher.addResource(SELECTOR_DESCENDANTS, METHOD_GET,
-                    NavigationService.class, "getDescendants");
-            rootDispatcher.addResource(SELECTOR_FOLDER_TREE, METHOD_GET,
-                    NavigationService.class, "getFolderTree");
-            rootDispatcher.addResource(SELECTOR_PARENTS, METHOD_GET,
-                    NavigationService.class, "getObjectParents");
-            rootDispatcher.addResource(SELECTOR_VERSIONS, METHOD_GET,
-                    VersioningService.class, "getAllVersions");
-
-            rootDispatcher.addResource(CMISACTION_CREATE_DOCUMENT, METHOD_POST,
-                    ObjectService.class, "createDocument");
-            rootDispatcher.addResource(CMISACTION_CREATE_FOLDER, METHOD_POST,
-                    ObjectService.class, "createFolder");
-            rootDispatcher.addResource(CMISACTION_SET_CONTENT, METHOD_POST,
-                    ObjectService.class, "setContentStream");
-            rootDispatcher.addResource(CMISACTION_DELETE, METHOD_POST,
-                    ObjectService.class, "deleteObject");
-            rootDispatcher.addResource(CMISACTION_DELETE_TREE, METHOD_POST,
-                    ObjectService.class, "deleteTree");
+            repositoryDispatcher.addResource("", METHOD_GET, RepositoryService.class, "getRepositoryInfo");
+            repositoryDispatcher
+                    .addResource(SELECTOR_LAST_RESULT, METHOD_GET, RepositoryService.class, "getLastResult");
+            repositoryDispatcher.addResource(SELECTOR_TYPE_CHILDREN, METHOD_GET, RepositoryService.class,
+                    "getTypeChildren");
+            repositoryDispatcher.addResource(SELECTOR_TYPE_DESCENDANTS, METHOD_GET, RepositoryService.class,
+                    "getTypeDescendants");
+            repositoryDispatcher.addResource(SELECTOR_TYPE_DEFINITION, METHOD_GET, RepositoryService.class,
+                    "getTypeDefinition");
+            repositoryDispatcher.addResource(SELECTOR_QUERY, METHOD_GET, DiscoveryService.class, "query");
+            repositoryDispatcher.addResource(CMISACTION_QUERY, METHOD_POST, DiscoveryService.class, "query");
+            repositoryDispatcher.addResource(CMISACTION_CREATE_DOCUMENT, METHOD_POST, ObjectService.class,
+                    "createDocument");
+
+            rootDispatcher.addResource(SELECTOR_OBJECT, METHOD_GET, ObjectService.class, "getObject");
+            rootDispatcher.addResource(SELECTOR_CONTENT, METHOD_GET, ObjectService.class, "getContentStream");
+            rootDispatcher.addResource(SELECTOR_CHILDREN, METHOD_GET, NavigationService.class, "getChildren");
+            rootDispatcher.addResource(SELECTOR_DESCENDANTS, METHOD_GET, NavigationService.class, "getDescendants");
+            rootDispatcher.addResource(SELECTOR_FOLDER_TREE, METHOD_GET, NavigationService.class, "getFolderTree");
+            rootDispatcher.addResource(SELECTOR_PARENTS, METHOD_GET, NavigationService.class, "getObjectParents");
+            rootDispatcher.addResource(SELECTOR_VERSIONS, METHOD_GET, VersioningService.class, "getAllVersions");
+
+            rootDispatcher.addResource(CMISACTION_CREATE_DOCUMENT, METHOD_POST, ObjectService.class, "createDocument");
+            rootDispatcher.addResource(CMISACTION_CREATE_FOLDER, METHOD_POST, ObjectService.class, "createFolder");
+            rootDispatcher.addResource(CMISACTION_SET_CONTENT, METHOD_POST, ObjectService.class, "setContentStream");
+            rootDispatcher.addResource(CMISACTION_DELETE, METHOD_POST, ObjectService.class, "deleteObject");
+            rootDispatcher.addResource(CMISACTION_DELETE_TREE, METHOD_POST, ObjectService.class, "deleteTree");
         } catch (NoSuchMethodException e) {
             LOG.error("Cannot initialize dispatcher!", e);
         }
@@ -148,6 +160,10 @@ public class CmisBrowserBindingServlet e
     protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException,
             IOException {
 
+        // set default headers
+        response.addHeader("Cache-Control", "private, max-age=0");
+        response.addHeader("Server", ServerVersion.OPENCMIS_SERVER);
+
         // create a context object, dispatch and handle exceptions
         CallContext context = null;
         try {
@@ -265,8 +281,7 @@ public class CmisBrowserBindingServlet e
                 }
 
                 // add object id and object base type id to context
-                prepareContext(context, callUrl, service, repositoryId, objectId, transaction,
-                        postRequest);
+                prepareContext(context, callUrl, service, repositoryId, objectId, transaction, postRequest);
 
                 // dispatch
                 if (callUrl == CallUrl.REPOSITORY) {
@@ -327,7 +342,8 @@ public class CmisBrowserBindingServlet e
      * Prints the error as JSON.
      */
     @SuppressWarnings("unchecked")
-    private static void printError(Exception ex, HttpServletRequest request, HttpServletResponse response, CallContext context) {
+    private static void printError(Exception ex, HttpServletRequest request, HttpServletResponse response,
+            CallContext context) {
         int statusCode = HttpServletResponse.SC_INTERNAL_SERVER_ERROR;
         String exceptionName = "runtime";
 
@@ -343,8 +359,7 @@ public class CmisBrowserBindingServlet e
         response.setStatus(statusCode);
         response.setContentType(JSON_MIME_TYPE);
         if (context != null) {
-            setCookie(request, response, context.getRepositoryId(),
-                    (String) context.get(CONTEXT_TRANSACTION),
+            setCookie(request, response, context.getRepositoryId(), (String) context.get(CONTEXT_TRANSACTION),
                     createCookieValue(statusCode, null, exceptionName, ex.getMessage()));
         }
 

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/AbstractService.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/AbstractService.java?rev=1179674&r1=1179673&r2=1179674&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/AbstractService.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/AbstractService.java Thu Oct  6 15:57:59 2011
@@ -23,6 +23,7 @@ import java.util.List;
 import java.util.Map;
 
 import javax.servlet.ServletContext;
+import javax.servlet.http.HttpServletResponse;
 import javax.xml.ws.WebServiceContext;
 import javax.xml.ws.handler.MessageContext;
 
@@ -48,6 +49,7 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.server.CmisServiceFactory;
 import org.apache.chemistry.opencmis.server.impl.CallContextImpl;
 import org.apache.chemistry.opencmis.server.impl.CmisRepositoryContextListener;
+import org.apache.chemistry.opencmis.server.impl.ServerVersion;
 import org.apache.chemistry.opencmis.server.shared.ExceptionHelper;
 import org.w3c.dom.Node;
 
@@ -73,6 +75,10 @@ public abstract class AbstractService {
             throw new CmisRuntimeException("Service factory not available! Configuration problem?");
         }
 
+        HttpServletResponse httpResp = (HttpServletResponse) wsContext.getMessageContext().get(
+                MessageContext.SERVLET_RESPONSE);
+        httpResp.setHeader("Server", ServerVersion.OPENCMIS_SERVER);
+
         return factory;
     }
 

Modified: chemistry/opencmis/trunk/pom.xml
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/pom.xml?rev=1179674&r1=1179673&r2=1179674&view=diff
==============================================================================
--- chemistry/opencmis/trunk/pom.xml (original)
+++ chemistry/opencmis/trunk/pom.xml Thu Oct  6 15:57:59 2011
@@ -280,6 +280,17 @@
                 <configuration>
                     <archiveClasses>true</archiveClasses>
                     <attachClasses>true</attachClasses>
+                    <archive>
+                        <manifestEntries>
+                            <X-Compile-Source-JDK>${maven.compile.source}</X-Compile-Source-JDK>
+                            <X-Compile-Target-JDK>${maven.compile.target}</X-Compile-Target-JDK>
+                            <X-Apache-SVN-Revision>${buildNumber}</X-Apache-SVN-Revision>
+                            <Implementation-Title>${project.name}</Implementation-Title>
+                            <Implementation-Version>${project.version}</Implementation-Version>
+                            <Implementation-Vendor-Id>${project.groupId}</Implementation-Vendor-Id>
+                            <Implementation-Vendor>${project.organization.name}</Implementation-Vendor>
+                        </manifestEntries>
+                    </archive>
                 </configuration>
             </plugin>
             <plugin>
@@ -365,6 +376,10 @@
                             <X-Compile-Source-JDK>${maven.compile.source}</X-Compile-Source-JDK>
                             <X-Compile-Target-JDK>${maven.compile.target}</X-Compile-Target-JDK>
                             <X-Apache-SVN-Revision>${buildNumber}</X-Apache-SVN-Revision>
+                            <Implementation-Title>${project.name}</Implementation-Title>
+                            <Implementation-Version>${project.version}</Implementation-Version>
+                            <Implementation-Vendor-Id>${project.groupId}</Implementation-Vendor-Id>
+                            <Implementation-Vendor>${project.organization.name}</Implementation-Vendor>
                         </manifestEntries>
                     </archive>
                 </configuration>



Mime
View raw message