You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@chemistry.apache.org by fm...@apache.org on 2010/11/06 18:32:17 UTC

svn commit: r1032119 - in /incubator/chemistry/opencmis-browser-binding/trunk/src/main/java/org/apache/chemistry/opencmis/server/impl/browser: CmisBrowserBindingServlet.java NavigationService.java ObjectService.java

Author: fmui
Date: Sat Nov  6 17:32:17 2010
New Revision: 1032119

URL: http://svn.apache.org/viewvc?rev=1032119&view=rev
Log:
- adapted browser binding to call context changes

Modified:
    incubator/chemistry/opencmis-browser-binding/trunk/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/CmisBrowserBindingServlet.java
    incubator/chemistry/opencmis-browser-binding/trunk/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/NavigationService.java
    incubator/chemistry/opencmis-browser-binding/trunk/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/ObjectService.java

Modified: incubator/chemistry/opencmis-browser-binding/trunk/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/CmisBrowserBindingServlet.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis-browser-binding/trunk/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/CmisBrowserBindingServlet.java?rev=1032119&r1=1032118&r2=1032119&view=diff
==============================================================================
--- incubator/chemistry/opencmis-browser-binding/trunk/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/CmisBrowserBindingServlet.java (original)
+++ incubator/chemistry/opencmis-browser-binding/trunk/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/CmisBrowserBindingServlet.java Sat Nov  6 17:32:17 2010
@@ -102,7 +102,8 @@ public class CmisBrowserBindingServlet e
         // create a context object, dispatch and handle exceptions
         CallContext context = null;
         try {
-            context = HttpUtils.createContext(request, CallContext.BINDING_BROWSER, callContextHandler);
+            context = HttpUtils.createContext(request, getServletContext(), CallContext.BINDING_BROWSER,
+                    callContextHandler);
             dispatch(context, request, response);
         } catch (Exception e) {
             if (e instanceof CmisPermissionDeniedException) {
@@ -164,7 +165,8 @@ public class CmisBrowserBindingServlet e
             // set default method if necessary
             if (resource == null) {
                 try {
-                    BaseTypeId basetype = BaseTypeId.fromValue(context.get(BrowserBindingUtils.CONTEXT_BASETYPE_ID));
+                    BaseTypeId basetype = BaseTypeId.fromValue((String) context
+                            .get(BrowserBindingUtils.CONTEXT_BASETYPE_ID));
                     switch (basetype) {
                     case CMIS_DOCUMENT:
                         resource = BrowserBindingUtils.METHOD_GET_CONTENT;

Modified: incubator/chemistry/opencmis-browser-binding/trunk/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/NavigationService.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis-browser-binding/trunk/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/NavigationService.java?rev=1032119&r1=1032118&r2=1032119&view=diff
==============================================================================
--- incubator/chemistry/opencmis-browser-binding/trunk/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/NavigationService.java (original)
+++ incubator/chemistry/opencmis-browser-binding/trunk/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/NavigationService.java Sat Nov  6 17:32:17 2010
@@ -45,7 +45,7 @@ public final class NavigationService {
     public static void getChildren(CallContext context, CmisService service, String repositoryId,
             HttpServletRequest request, HttpServletResponse response) throws Exception {
         // get parameters
-        String folderId = context.get(BrowserBindingUtils.CONTEXT_OBJECT_ID);
+        String folderId = (String) context.get(BrowserBindingUtils.CONTEXT_OBJECT_ID);
         String filter = getStringParameter(request, Constants.PARAM_FILTER);
         String orderBy = getStringParameter(request, Constants.PARAM_ORDER_BY);
         Boolean includeAllowableActions = getBooleanParameter(request, Constants.PARAM_ALLOWABLE_ACTIONS);

Modified: incubator/chemistry/opencmis-browser-binding/trunk/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/ObjectService.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis-browser-binding/trunk/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/ObjectService.java?rev=1032119&r1=1032118&r2=1032119&view=diff
==============================================================================
--- incubator/chemistry/opencmis-browser-binding/trunk/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/ObjectService.java (original)
+++ incubator/chemistry/opencmis-browser-binding/trunk/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/ObjectService.java Sat Nov  6 17:32:17 2010
@@ -52,7 +52,7 @@ public final class ObjectService {
     public static void getObject(CallContext context, CmisService service, String repositoryId,
             HttpServletRequest request, HttpServletResponse response) throws Exception {
         // get parameters
-        String objectId = context.get(BrowserBindingUtils.CONTEXT_OBJECT_ID);
+        String objectId = (String) context.get(BrowserBindingUtils.CONTEXT_OBJECT_ID);
         ReturnVersion returnVersion = getEnumParameter(request, Constants.PARAM_RETURN_VERSION, ReturnVersion.class);
         String filter = getStringParameter(request, Constants.PARAM_FILTER);
         Boolean includeAllowableActions = getBooleanParameter(request, Constants.PARAM_ALLOWABLE_ACTIONS);
@@ -89,20 +89,11 @@ public final class ObjectService {
     public static void getContentStream(CallContext context, CmisService service, String repositoryId,
             HttpServletRequest request, HttpServletResponse response) throws Exception {
         // get parameters
-        String objectId = context.get(BrowserBindingUtils.CONTEXT_OBJECT_ID);
+        String objectId = (String) context.get(BrowserBindingUtils.CONTEXT_OBJECT_ID);
         String streamId = getStringParameter(request, Constants.PARAM_STREAM_ID);
 
-        BigInteger offset = null;
-        String offsetStr = context.get(CallContext.OFFSET);
-        if (offsetStr != null) {
-            offset = new BigInteger(offsetStr);
-        }
-
-        BigInteger length = null;
-        String lengthStr = context.get(CallContext.LENGTH);
-        if (lengthStr != null) {
-            length = new BigInteger(offsetStr);
-        }
+        BigInteger offset = context.getOffset();
+        BigInteger length = context.getLength();
 
         // execute
         ContentStream content = service.getContentStream(repositoryId, objectId, streamId, offset, length, null);



Re: svn commit: r1032119 - in /incubator/chemistry/opencmis-browser-binding/trunk/src/main/java/org/apache/chemistry/opencmis/server/impl/browser: CmisBrowserBindingServlet.java NavigationService.java ObjectService.java

Posted by Florian Müller <mu...@gotux.de>.
Hi Florent,

No problem. The browser binding is experimental and, as you said, not 
part of the main tree (yet). If it breaks, it breaks. I will fix it when 
it breaks.


Florian

Am 06.11.10 19:47, schrieb Florent Guillaume:
> Sorry about this, I hadn't realized that opencmis-browser-binding
> wasn't part of the main opencmis tree and thought the hudson failures
> were random, like we have sometimes.
> I'll checkout opencmis-browser-binding and be careful updating it as
> well next time.
>
> Florent
>
>
> On Sat, Nov 6, 2010 at 6:32 PM,<fm...@apache.org>  wrote:
>> Author: fmui
>> Date: Sat Nov  6 17:32:17 2010
>> New Revision: 1032119
>>
>> URL: http://svn.apache.org/viewvc?rev=1032119&view=rev
>> Log:
>> - adapted browser binding to call context changes
>>
>> Modified:
>>     incubator/chemistry/opencmis-browser-binding/trunk/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/CmisBrowserBindingServlet.java
>>     incubator/chemistry/opencmis-browser-binding/trunk/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/NavigationService.java
>>     incubator/chemistry/opencmis-browser-binding/trunk/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/ObjectService.java
>>
>> Modified: incubator/chemistry/opencmis-browser-binding/trunk/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/CmisBrowserBindingServlet.java
>> URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis-browser-binding/trunk/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/CmisBrowserBindingServlet.java?rev=1032119&r1=1032118&r2=1032119&view=diff
>> ==============================================================================
>> --- incubator/chemistry/opencmis-browser-binding/trunk/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/CmisBrowserBindingServlet.java (original)
>> +++ incubator/chemistry/opencmis-browser-binding/trunk/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/CmisBrowserBindingServlet.java Sat Nov  6 17:32:17 2010
>> @@ -102,7 +102,8 @@ public class CmisBrowserBindingServlet e
>>          // create a context object, dispatch and handle exceptions
>>          CallContext context = null;
>>          try {
>> -            context = HttpUtils.createContext(request, CallContext.BINDING_BROWSER, callContextHandler);
>> +            context = HttpUtils.createContext(request, getServletContext(), CallContext.BINDING_BROWSER,
>> +                    callContextHandler);
>>              dispatch(context, request, response);
>>          } catch (Exception e) {
>>              if (e instanceof CmisPermissionDeniedException) {
>> @@ -164,7 +165,8 @@ public class CmisBrowserBindingServlet e
>>              // set default method if necessary
>>              if (resource == null) {
>>                  try {
>> -                    BaseTypeId basetype = BaseTypeId.fromValue(context.get(BrowserBindingUtils.CONTEXT_BASETYPE_ID));
>> +                    BaseTypeId basetype = BaseTypeId.fromValue((String) context
>> +                            .get(BrowserBindingUtils.CONTEXT_BASETYPE_ID));
>>                      switch (basetype) {
>>                      case CMIS_DOCUMENT:
>>                          resource = BrowserBindingUtils.METHOD_GET_CONTENT;
>>
>> Modified: incubator/chemistry/opencmis-browser-binding/trunk/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/NavigationService.java
>> URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis-browser-binding/trunk/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/NavigationService.java?rev=1032119&r1=1032118&r2=1032119&view=diff
>> ==============================================================================
>> --- incubator/chemistry/opencmis-browser-binding/trunk/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/NavigationService.java (original)
>> +++ incubator/chemistry/opencmis-browser-binding/trunk/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/NavigationService.java Sat Nov  6 17:32:17 2010
>> @@ -45,7 +45,7 @@ public final class NavigationService {
>>      public static void getChildren(CallContext context, CmisService service, String repositoryId,
>>              HttpServletRequest request, HttpServletResponse response) throws Exception {
>>          // get parameters
>> -        String folderId = context.get(BrowserBindingUtils.CONTEXT_OBJECT_ID);
>> +        String folderId = (String) context.get(BrowserBindingUtils.CONTEXT_OBJECT_ID);
>>          String filter = getStringParameter(request, Constants.PARAM_FILTER);
>>          String orderBy = getStringParameter(request, Constants.PARAM_ORDER_BY);
>>          Boolean includeAllowableActions = getBooleanParameter(request, Constants.PARAM_ALLOWABLE_ACTIONS);
>>
>> Modified: incubator/chemistry/opencmis-browser-binding/trunk/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/ObjectService.java
>> URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis-browser-binding/trunk/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/ObjectService.java?rev=1032119&r1=1032118&r2=1032119&view=diff
>> ==============================================================================
>> --- incubator/chemistry/opencmis-browser-binding/trunk/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/ObjectService.java (original)
>> +++ incubator/chemistry/opencmis-browser-binding/trunk/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/ObjectService.java Sat Nov  6 17:32:17 2010
>> @@ -52,7 +52,7 @@ public final class ObjectService {
>>      public static void getObject(CallContext context, CmisService service, String repositoryId,
>>              HttpServletRequest request, HttpServletResponse response) throws Exception {
>>          // get parameters
>> -        String objectId = context.get(BrowserBindingUtils.CONTEXT_OBJECT_ID);
>> +        String objectId = (String) context.get(BrowserBindingUtils.CONTEXT_OBJECT_ID);
>>          ReturnVersion returnVersion = getEnumParameter(request, Constants.PARAM_RETURN_VERSION, ReturnVersion.class);
>>          String filter = getStringParameter(request, Constants.PARAM_FILTER);
>>          Boolean includeAllowableActions = getBooleanParameter(request, Constants.PARAM_ALLOWABLE_ACTIONS);
>> @@ -89,20 +89,11 @@ public final class ObjectService {
>>      public static void getContentStream(CallContext context, CmisService service, String repositoryId,
>>              HttpServletRequest request, HttpServletResponse response) throws Exception {
>>          // get parameters
>> -        String objectId = context.get(BrowserBindingUtils.CONTEXT_OBJECT_ID);
>> +        String objectId = (String) context.get(BrowserBindingUtils.CONTEXT_OBJECT_ID);
>>          String streamId = getStringParameter(request, Constants.PARAM_STREAM_ID);
>>
>> -        BigInteger offset = null;
>> -        String offsetStr = context.get(CallContext.OFFSET);
>> -        if (offsetStr != null) {
>> -            offset = new BigInteger(offsetStr);
>> -        }
>> -
>> -        BigInteger length = null;
>> -        String lengthStr = context.get(CallContext.LENGTH);
>> -        if (lengthStr != null) {
>> -            length = new BigInteger(offsetStr);
>> -        }
>> +        BigInteger offset = context.getOffset();
>> +        BigInteger length = context.getLength();
>>
>>          // execute
>>          ContentStream content = service.getContentStream(repositoryId, objectId, streamId, offset, length, null);
>>
>>
>>
>
>
>


Re: svn commit: r1032119 - in /incubator/chemistry/opencmis-browser-binding/trunk/src/main/java/org/apache/chemistry/opencmis/server/impl/browser: CmisBrowserBindingServlet.java NavigationService.java ObjectService.java

Posted by Florent Guillaume <fg...@nuxeo.com>.
Sorry about this, I hadn't realized that opencmis-browser-binding
wasn't part of the main opencmis tree and thought the hudson failures
were random, like we have sometimes.
I'll checkout opencmis-browser-binding and be careful updating it as
well next time.

Florent


On Sat, Nov 6, 2010 at 6:32 PM,  <fm...@apache.org> wrote:
> Author: fmui
> Date: Sat Nov  6 17:32:17 2010
> New Revision: 1032119
>
> URL: http://svn.apache.org/viewvc?rev=1032119&view=rev
> Log:
> - adapted browser binding to call context changes
>
> Modified:
>    incubator/chemistry/opencmis-browser-binding/trunk/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/CmisBrowserBindingServlet.java
>    incubator/chemistry/opencmis-browser-binding/trunk/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/NavigationService.java
>    incubator/chemistry/opencmis-browser-binding/trunk/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/ObjectService.java
>
> Modified: incubator/chemistry/opencmis-browser-binding/trunk/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/CmisBrowserBindingServlet.java
> URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis-browser-binding/trunk/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/CmisBrowserBindingServlet.java?rev=1032119&r1=1032118&r2=1032119&view=diff
> ==============================================================================
> --- incubator/chemistry/opencmis-browser-binding/trunk/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/CmisBrowserBindingServlet.java (original)
> +++ incubator/chemistry/opencmis-browser-binding/trunk/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/CmisBrowserBindingServlet.java Sat Nov  6 17:32:17 2010
> @@ -102,7 +102,8 @@ public class CmisBrowserBindingServlet e
>         // create a context object, dispatch and handle exceptions
>         CallContext context = null;
>         try {
> -            context = HttpUtils.createContext(request, CallContext.BINDING_BROWSER, callContextHandler);
> +            context = HttpUtils.createContext(request, getServletContext(), CallContext.BINDING_BROWSER,
> +                    callContextHandler);
>             dispatch(context, request, response);
>         } catch (Exception e) {
>             if (e instanceof CmisPermissionDeniedException) {
> @@ -164,7 +165,8 @@ public class CmisBrowserBindingServlet e
>             // set default method if necessary
>             if (resource == null) {
>                 try {
> -                    BaseTypeId basetype = BaseTypeId.fromValue(context.get(BrowserBindingUtils.CONTEXT_BASETYPE_ID));
> +                    BaseTypeId basetype = BaseTypeId.fromValue((String) context
> +                            .get(BrowserBindingUtils.CONTEXT_BASETYPE_ID));
>                     switch (basetype) {
>                     case CMIS_DOCUMENT:
>                         resource = BrowserBindingUtils.METHOD_GET_CONTENT;
>
> Modified: incubator/chemistry/opencmis-browser-binding/trunk/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/NavigationService.java
> URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis-browser-binding/trunk/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/NavigationService.java?rev=1032119&r1=1032118&r2=1032119&view=diff
> ==============================================================================
> --- incubator/chemistry/opencmis-browser-binding/trunk/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/NavigationService.java (original)
> +++ incubator/chemistry/opencmis-browser-binding/trunk/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/NavigationService.java Sat Nov  6 17:32:17 2010
> @@ -45,7 +45,7 @@ public final class NavigationService {
>     public static void getChildren(CallContext context, CmisService service, String repositoryId,
>             HttpServletRequest request, HttpServletResponse response) throws Exception {
>         // get parameters
> -        String folderId = context.get(BrowserBindingUtils.CONTEXT_OBJECT_ID);
> +        String folderId = (String) context.get(BrowserBindingUtils.CONTEXT_OBJECT_ID);
>         String filter = getStringParameter(request, Constants.PARAM_FILTER);
>         String orderBy = getStringParameter(request, Constants.PARAM_ORDER_BY);
>         Boolean includeAllowableActions = getBooleanParameter(request, Constants.PARAM_ALLOWABLE_ACTIONS);
>
> Modified: incubator/chemistry/opencmis-browser-binding/trunk/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/ObjectService.java
> URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis-browser-binding/trunk/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/ObjectService.java?rev=1032119&r1=1032118&r2=1032119&view=diff
> ==============================================================================
> --- incubator/chemistry/opencmis-browser-binding/trunk/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/ObjectService.java (original)
> +++ incubator/chemistry/opencmis-browser-binding/trunk/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/ObjectService.java Sat Nov  6 17:32:17 2010
> @@ -52,7 +52,7 @@ public final class ObjectService {
>     public static void getObject(CallContext context, CmisService service, String repositoryId,
>             HttpServletRequest request, HttpServletResponse response) throws Exception {
>         // get parameters
> -        String objectId = context.get(BrowserBindingUtils.CONTEXT_OBJECT_ID);
> +        String objectId = (String) context.get(BrowserBindingUtils.CONTEXT_OBJECT_ID);
>         ReturnVersion returnVersion = getEnumParameter(request, Constants.PARAM_RETURN_VERSION, ReturnVersion.class);
>         String filter = getStringParameter(request, Constants.PARAM_FILTER);
>         Boolean includeAllowableActions = getBooleanParameter(request, Constants.PARAM_ALLOWABLE_ACTIONS);
> @@ -89,20 +89,11 @@ public final class ObjectService {
>     public static void getContentStream(CallContext context, CmisService service, String repositoryId,
>             HttpServletRequest request, HttpServletResponse response) throws Exception {
>         // get parameters
> -        String objectId = context.get(BrowserBindingUtils.CONTEXT_OBJECT_ID);
> +        String objectId = (String) context.get(BrowserBindingUtils.CONTEXT_OBJECT_ID);
>         String streamId = getStringParameter(request, Constants.PARAM_STREAM_ID);
>
> -        BigInteger offset = null;
> -        String offsetStr = context.get(CallContext.OFFSET);
> -        if (offsetStr != null) {
> -            offset = new BigInteger(offsetStr);
> -        }
> -
> -        BigInteger length = null;
> -        String lengthStr = context.get(CallContext.LENGTH);
> -        if (lengthStr != null) {
> -            length = new BigInteger(offsetStr);
> -        }
> +        BigInteger offset = context.getOffset();
> +        BigInteger length = context.getLength();
>
>         // execute
>         ContentStream content = service.getContentStream(repositoryId, objectId, streamId, offset, length, null);
>
>
>



-- 
Florent Guillaume, Director of R&D, Nuxeo
Open Source, Java EE based, Enterprise Content Management (ECM)
http://www.nuxeo.com   http://www.nuxeo.org   +33 1 40 33 79 87