Return-Path: X-Original-To: apmail-chemistry-commits-archive@www.apache.org Delivered-To: apmail-chemistry-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B05DA17950 for ; Mon, 6 Apr 2015 17:13:18 +0000 (UTC) Received: (qmail 41223 invoked by uid 500); 6 Apr 2015 17:13:09 -0000 Delivered-To: apmail-chemistry-commits-archive@chemistry.apache.org Received: (qmail 41113 invoked by uid 500); 6 Apr 2015 17:13:09 -0000 Mailing-List: contact commits-help@chemistry.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@chemistry.apache.org Delivered-To: mailing list commits@chemistry.apache.org Received: (qmail 39922 invoked by uid 99); 6 Apr 2015 17:13:08 -0000 Received: from eris.apache.org (HELO hades.apache.org) (140.211.11.105) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 06 Apr 2015 17:13:08 +0000 Received: from hades.apache.org (localhost [127.0.0.1]) by hades.apache.org (ASF Mail Server at hades.apache.org) with ESMTP id 3F4ABAC0163 for ; Mon, 6 Apr 2015 17:13:08 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1671601 [42/44] - in /chemistry/site/trunk/content/java/0.13.0/maven/chemistry-opencmis-server/chemistry-opencmis-server-bindings: ./ css/ images/ images/logos/ xref-test/ xref-test/org/ xref-test/org/apache/ xref-test/org/apache/chemistry... Date: Mon, 06 Apr 2015 17:13:04 -0000 To: commits@chemistry.apache.org From: gabriele@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20150406171308.3F4ABAC0163@hades.apache.org> Added: chemistry/site/trunk/content/java/0.13.0/maven/chemistry-opencmis-server/chemistry-opencmis-server-bindings/xref/org/apache/chemistry/opencmis/server/shared/NoBodyHttpServletResponseWrapper.html URL: http://svn.apache.org/viewvc/chemistry/site/trunk/content/java/0.13.0/maven/chemistry-opencmis-server/chemistry-opencmis-server-bindings/xref/org/apache/chemistry/opencmis/server/shared/NoBodyHttpServletResponseWrapper.html?rev=1671601&view=auto ============================================================================== --- chemistry/site/trunk/content/java/0.13.0/maven/chemistry-opencmis-server/chemistry-opencmis-server-bindings/xref/org/apache/chemistry/opencmis/server/shared/NoBodyHttpServletResponseWrapper.html (added) +++ chemistry/site/trunk/content/java/0.13.0/maven/chemistry-opencmis-server/chemistry-opencmis-server-bindings/xref/org/apache/chemistry/opencmis/server/shared/NoBodyHttpServletResponseWrapper.html Mon Apr 6 17:13:02 2015 @@ -0,0 +1,83 @@ + + + + +NoBodyHttpServletResponseWrapper xref + + + +
+
+1   /*
+2    * Licensed to the Apache Software Foundation (ASF) under one
+3    * or more contributor license agreements.  See the NOTICE file
+4    * distributed with this work for additional information
+5    * regarding copyright ownership.  The ASF licenses this file
+6    * to you under the Apache License, Version 2.0 (the
+7    * "License"); you may not use this file except in compliance
+8    * with the License.  You may obtain a copy of the License at
+9    *
+10   * http://www.apache.org/licenses/LICENSE-2.0
+11   *
+12   * Unless required by applicable law or agreed to in writing,
+13   * software distributed under the License is distributed on an
+14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+15   * KIND, either express or implied.  See the License for the
+16   * specific language governing permissions and limitations
+17   * under the License.
+18   */
+19  package org.apache.chemistry.opencmis.server.shared;
+20  
+21  import java.io.IOException;
+22  import java.io.OutputStreamWriter;
+23  import java.io.PrintWriter;
+24  import java.io.UnsupportedEncodingException;
+25  
+26  import javax.servlet.ServletOutputStream;
+27  import javax.servlet.http.HttpServletResponse;
+28  import javax.servlet.http.HttpServletResponseWrapper;
+29  
+30  public class NoBodyHttpServletResponseWrapper extends HttpServletResponseWrapper {
+31  
+32      private final NoBodyOutputStream noBodyStream;
+33      private PrintWriter writer;
+34  
+35      public NoBodyHttpServletResponseWrapper(HttpServletResponse response) throws IOException {
+36          super(response);
+37          noBodyStream = new NoBodyOutputStream();
+38      }
+39  
+40      @Override
+41      public ServletOutputStream getOutputStream() throws IOException {
+42          return noBodyStream;
+43      }
+44  
+45      public PrintWriter getWriter() throws UnsupportedEncodingException {
+46          if (writer == null) {
+47              writer = new PrintWriter(new OutputStreamWriter(noBodyStream, getCharacterEncoding()));
+48          }
+49  
+50          return writer;
+51      }
+52  
+53      private static class NoBodyOutputStream extends ServletOutputStream {
+54          @Override
+55          public void write(int b) throws IOException {
+56              // ignore
+57          }
+58  
+59          @Override
+60          public void write(byte[] b) throws IOException {
+61              // ignore
+62          }
+63  
+64          @Override
+65          public void write(byte[] b, int off, int len) throws IOException {
+66              // ignore
+67          }
+68      }
+69  }
+
+
+ + Added: chemistry/site/trunk/content/java/0.13.0/maven/chemistry-opencmis-server/chemistry-opencmis-server-bindings/xref/org/apache/chemistry/opencmis/server/shared/QueryStringHttpServletRequestWrapper.html URL: http://svn.apache.org/viewvc/chemistry/site/trunk/content/java/0.13.0/maven/chemistry-opencmis-server/chemistry-opencmis-server-bindings/xref/org/apache/chemistry/opencmis/server/shared/QueryStringHttpServletRequestWrapper.html?rev=1671601&view=auto ============================================================================== --- chemistry/site/trunk/content/java/0.13.0/maven/chemistry-opencmis-server/chemistry-opencmis-server-bindings/xref/org/apache/chemistry/opencmis/server/shared/QueryStringHttpServletRequestWrapper.html (added) +++ chemistry/site/trunk/content/java/0.13.0/maven/chemistry-opencmis-server/chemistry-opencmis-server-bindings/xref/org/apache/chemistry/opencmis/server/shared/QueryStringHttpServletRequestWrapper.html Mon Apr 6 17:13:02 2015 @@ -0,0 +1,142 @@ + + + + +QueryStringHttpServletRequestWrapper xref + + + +
+
+1   /*
+2    * Licensed to the Apache Software Foundation (ASF) under one
+3    * or more contributor license agreements.  See the NOTICE file
+4    * distributed with this work for additional information
+5    * regarding copyright ownership.  The ASF licenses this file
+6    * to you under the Apache License, Version 2.0 (the
+7    * "License"); you may not use this file except in compliance
+8    * with the License.  You may obtain a copy of the License at
+9    *
+10   * http://www.apache.org/licenses/LICENSE-2.0
+11   *
+12   * Unless required by applicable law or agreed to in writing,
+13   * software distributed under the License is distributed on an
+14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+15   * KIND, either express or implied.  See the License for the
+16   * specific language governing permissions and limitations
+17   * under the License.
+18   */
+19  package org.apache.chemistry.opencmis.server.shared;
+20  
+21  import java.io.IOException;
+22  import java.util.Collections;
+23  import java.util.Enumeration;
+24  import java.util.HashMap;
+25  import java.util.Map;
+26  
+27  import javax.servlet.http.HttpServletRequest;
+28  import javax.servlet.http.HttpServletRequestWrapper;
+29  
+30  import org.apache.chemistry.opencmis.commons.impl.IOUtils;
+31  
+32  /**
+33   * HttpServletRequest wrapper that reads the query string in container
+34   * independent way and decodes the parameter values with UTF-8.
+35   */
+36  public class QueryStringHttpServletRequestWrapper extends HttpServletRequestWrapper {
+37  
+38      protected Map<String, String[]> parameters;
+39  
+40      public QueryStringHttpServletRequestWrapper(HttpServletRequest request) throws IOException {
+41          super(request);
+42  
+43          parameters = new HashMap<String, String[]>();
+44  
+45          // parse query string
+46          parseFormData(request.getQueryString());
+47      }
+48  
+49      /**
+50       * Parses the query string.
+51       */
+52      protected final void parseFormData(String queryString) throws IOException {
+53          if (queryString == null || queryString.length() < 3) {
+54              return;
+55          }
+56  
+57          String[] nameValuePairs = queryString.split("&");
+58          for (String nameValuePair : nameValuePairs) {
+59              int x = nameValuePair.indexOf('=');
+60              if (x > 0) {
+61                  String name = IOUtils.decodeURL(nameValuePair.substring(0, x));
+62                  String value = (x == nameValuePair.length() - 1 ? "" : IOUtils
+63                          .decodeURL(nameValuePair.substring(x + 1)));
+64                  addParameter(name, value);
+65              } else {
+66                  String name = IOUtils.decodeURL(nameValuePair);
+67                  addParameter(name, (String) null);
+68              }
+69          }
+70      }
+71  
+72      /**
+73       * Adds a value to a parameter.
+74       */
+75      protected final void addParameter(String name, String value) {
+76          String[] values = parameters.get(name);
+77  
+78          if (values == null) {
+79              parameters.put(name, new String[] { value });
+80          } else {
+81              String[] newValues = new String[values.length + 1];
+82              System.arraycopy(values, 0, newValues, 0, values.length);
+83              newValues[newValues.length - 1] = value;
+84              parameters.put(name, newValues);
+85          }
+86      }
+87  
+88      /**
+89       * Adds an array of values to a parameter.
+90       */
+91      protected final void addParameter(String name, String[] additionalValues) {
+92          String[] values = parameters.get(name);
+93  
+94          if (values == null) {
+95              parameters.put(name, additionalValues);
+96          } else {
+97              String[] newValues = new String[values.length + additionalValues.length];
+98              System.arraycopy(values, 0, newValues, 0, values.length);
+99              System.arraycopy(additionalValues, 0, newValues, values.length, additionalValues.length);
+100             parameters.put(name, newValues);
+101         }
+102     }
+103 
+104     @Override
+105     public final String getParameter(String name) {
+106         String[] values = parameters.get(name);
+107         if ((values == null) || (values.length == 0)) {
+108             return null;
+109         }
+110 
+111         return values[0];
+112     }
+113 
+114     @Override
+115     public final Map<String, String[]> getParameterMap() {
+116         return parameters;
+117     }
+118 
+119     @Override
+120     public final Enumeration<String> getParameterNames() {
+121         return Collections.enumeration(parameters.keySet());
+122     }
+123 
+124     @Override
+125     public final String[] getParameterValues(String name) {
+126         return parameters.get(name);
+127     }
+128 }
+
+
+ + Added: chemistry/site/trunk/content/java/0.13.0/maven/chemistry-opencmis-server/chemistry-opencmis-server-bindings/xref/org/apache/chemistry/opencmis/server/shared/ServiceCall.html URL: http://svn.apache.org/viewvc/chemistry/site/trunk/content/java/0.13.0/maven/chemistry-opencmis-server/chemistry-opencmis-server-bindings/xref/org/apache/chemistry/opencmis/server/shared/ServiceCall.html?rev=1671601&view=auto ============================================================================== --- chemistry/site/trunk/content/java/0.13.0/maven/chemistry-opencmis-server/chemistry-opencmis-server-bindings/xref/org/apache/chemistry/opencmis/server/shared/ServiceCall.html (added) +++ chemistry/site/trunk/content/java/0.13.0/maven/chemistry-opencmis-server/chemistry-opencmis-server-bindings/xref/org/apache/chemistry/opencmis/server/shared/ServiceCall.html Mon Apr 6 17:13:02 2015 @@ -0,0 +1,48 @@ + + + + +ServiceCall xref + + + +
+
+1   /*
+2    * Licensed to the Apache Software Foundation (ASF) under one
+3    * or more contributor license agreements.  See the NOTICE file
+4    * distributed with this work for additional information
+5    * regarding copyright ownership.  The ASF licenses this file
+6    * to you under the Apache License, Version 2.0 (the
+7    * "License"); you may not use this file except in compliance
+8    * with the License.  You may obtain a copy of the License at
+9    *
+10   * http://www.apache.org/licenses/LICENSE-2.0
+11   *
+12   * Unless required by applicable law or agreed to in writing,
+13   * software distributed under the License is distributed on an
+14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+15   * KIND, either express or implied.  See the License for the
+16   * specific language governing permissions and limitations
+17   * under the License.
+18   */
+19  package org.apache.chemistry.opencmis.server.shared;
+20  
+21  import javax.servlet.http.HttpServletRequest;
+22  import javax.servlet.http.HttpServletResponse;
+23  
+24  import org.apache.chemistry.opencmis.commons.server.CallContext;
+25  import org.apache.chemistry.opencmis.commons.server.CmisService;
+26  
+27  public interface ServiceCall {
+28  
+29      /**
+30       * Serves an AtomPub or Browser binding call.
+31       */
+32      void serve(CallContext context, CmisService service, String repositoryId, HttpServletRequest request,
+33              HttpServletResponse response) throws Exception;
+34  }
+
+
+ + Added: chemistry/site/trunk/content/java/0.13.0/maven/chemistry-opencmis-server/chemistry-opencmis-server-bindings/xref/org/apache/chemistry/opencmis/server/shared/TempStoreOutputStreamFactory.html URL: http://svn.apache.org/viewvc/chemistry/site/trunk/content/java/0.13.0/maven/chemistry-opencmis-server/chemistry-opencmis-server-bindings/xref/org/apache/chemistry/opencmis/server/shared/TempStoreOutputStreamFactory.html?rev=1671601&view=auto ============================================================================== --- chemistry/site/trunk/content/java/0.13.0/maven/chemistry-opencmis-server/chemistry-opencmis-server-bindings/xref/org/apache/chemistry/opencmis/server/shared/TempStoreOutputStreamFactory.html (added) +++ chemistry/site/trunk/content/java/0.13.0/maven/chemistry-opencmis-server/chemistry-opencmis-server-bindings/xref/org/apache/chemistry/opencmis/server/shared/TempStoreOutputStreamFactory.html Mon Apr 6 17:13:02 2015 @@ -0,0 +1,147 @@ + + + + +TempStoreOutputStreamFactory xref + + + +
+
+1   /*
+2    * Licensed to the Apache Software Foundation (ASF) under one
+3    * or more contributor license agreements.  See the NOTICE file
+4    * distributed with this work for additional information
+5    * regarding copyright ownership.  The ASF licenses this file
+6    * to you under the Apache License, Version 2.0 (the
+7    * "License"); you may not use this file except in compliance
+8    * with the License.  You may obtain a copy of the License at
+9    *
+10   * http://www.apache.org/licenses/LICENSE-2.0
+11   *
+12   * Unless required by applicable law or agreed to in writing,
+13   * software distributed under the License is distributed on an
+14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+15   * KIND, either express or implied.  See the License for the
+16   * specific language governing permissions and limitations
+17   * under the License.
+18   */
+19  package org.apache.chemistry.opencmis.server.shared;
+20  
+21  import java.io.File;
+22  
+23  import org.apache.chemistry.opencmis.commons.server.CmisServiceFactory;
+24  import org.apache.chemistry.opencmis.commons.server.TempStoreOutputStream;
+25  
+26  /**
+27   * A factory for {@link TempStoreOutputStream} objects.
+28   */
+29  public class TempStoreOutputStreamFactory {
+30  
+31      private CmisServiceFactory factory;
+32      private String repositoryId;
+33  
+34      private File tempDir;
+35      private int memoryThreshold;
+36      private long maxContentSize;
+37      private boolean encrypt;
+38  
+39      protected TempStoreOutputStreamFactory(CmisServiceFactory factory, String repositoryId) {
+40          this.factory = factory;
+41          this.repositoryId = repositoryId;
+42          this.tempDir = factory.getTempDirectory();
+43          this.memoryThreshold = factory.getMemoryThreshold();
+44          this.maxContentSize = factory.getMaxContentSize();
+45          this.encrypt = factory.encryptTempFiles();
+46      }
+47  
+48      protected TempStoreOutputStreamFactory(File tempDir, int memoryThreshold, long maxContentSize, boolean encrypt) {
+49          this.factory = null;
+50          this.repositoryId = null;
+51          this.tempDir = tempDir;
+52          this.memoryThreshold = memoryThreshold;
+53          this.maxContentSize = maxContentSize;
+54          this.encrypt = encrypt;
+55      }
+56  
+57      /**
+58       * Creates a new factory. The parameters are used to create new
+59       * {@link TempStoreOutputStream} objects.
+60       * 
+61       * @param factory
+62       *            the CmisService object factory
+63       * @param repositoryId
+64       *            the repository ID
+65       */
+66      public static TempStoreOutputStreamFactory newInstance(CmisServiceFactory factory, String repositoryId) {
+67          return new TempStoreOutputStreamFactory(factory, repositoryId);
+68      }
+69  
+70      /**
+71       * Creates a new factory. The parameters are used to create new
+72       * {@link TempStoreOutputStream} objects.
+73       * 
+74       * @param tempDir
+75       *            temp directory or {@code null} for the default temp directory
+76       * @param memoryThreshold
+77       *            memory threshold in bytes
+78       * @param maxContentSize
+79       *            max size of the content in bytes (-1 to disable the check)
+80       * @param encrypt
+81       *            indicates if temporary files must be encrypted
+82       */
+83      public static TempStoreOutputStreamFactory newInstance(File tempDir, int memoryThreshold, long maxContentSize,
+84              boolean encrypt) {
+85          return new TempStoreOutputStreamFactory(tempDir, memoryThreshold, maxContentSize, encrypt);
+86      }
+87  
+88      /**
+89       * Creates a new {@link TempStoreOutputStream} object.
+90       */
+91      public TempStoreOutputStream newOutputStream() {
+92          TempStoreOutputStream stream = null;
+93  
+94          if (factory != null) {
+95              stream = factory.getTempFileOutputStream(repositoryId);
+96          }
+97  
+98          if (stream == null) {
+99              stream = new ThresholdOutputStream(tempDir, memoryThreshold, maxContentSize, encrypt);
+100         }
+101 
+102         return stream;
+103     }
+104 
+105     /**
+106      * Returns the temp directory or {@code null} for the default temp
+107      * directory.
+108      */
+109     public File getTempDir() {
+110         return tempDir;
+111     }
+112 
+113     /**
+114      * Returns the memory threshold in bytes.
+115      */
+116     public int getMemoryThreshold() {
+117         return memoryThreshold;
+118     }
+119 
+120     /**
+121      * Returns the max content size in bytes.
+122      */
+123     public long getMaxContentSize() {
+124         return maxContentSize;
+125     }
+126 
+127     /**
+128      * Indicates if temporary files are encrypted.
+129      */
+130     public boolean isEncrypted() {
+131         return encrypt;
+132     }
+133 }
+
+
+ +