You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@chemistry.apache.org by Florian Müller <fm...@apache.org> on 2016/01/09 18:03:57 UTC

Re: Filter to change org.apache.chemistry.opencmis.baseurl does not work on opencmis bridge?

Hi Wentao,

Use the placeholder "{repositoryId}" in the base URL for the repository ID.


- Florian

On 09.01.2016 01:22, Lu, Wentao wrote:
> Hi,
> 
> We are currently using opencmis-bridge 0.10. Based on corporate policy, all request to CMIS need to go through ESB servers. The high level data flow is:   client->ESB->OpenCMIS-Bridge->CMIS Server
> 
> I am trying to add a filter for atompub to update the "org.apache.chemistry.opencmis.baseurl" with ESB base url, the code snip as below:
> 
>     public void doFilter(ServletRequest request, ServletResponse response, final FilterChain chain) throws IOException,
>             ServletException {
> 
>         // check for request header
>         if (request instanceof HttpServletRequest) {
>               HttpServletRequest httpRequest = (HttpServletRequest)request;
>               String esbURL = httpRequest.getHeader("ESBURL");
>               if (esbURL != null) {
>                      request.setAttribute("org.apache.chemistry.opencmis.baseurl", esbURL);
>               }
>         }
> 
>         // call next
>         chain.doFilter(request, response);
> }
> 
> Web.xml as below
> <filter>
>               <filter-name>ESB</filter-name>
>               <filter-class>mytest.ESBFilter</filter-class>
>        </filter>
>        <filter-mapping>
>               <filter-name>ESB</filter-name>
>               <servlet-name>cmisatom</servlet-name>
>    </filter-mapping>
> 
> However, when I tested it with "ESBURL" header value "http://esbserver:1234/cmis/atom", the returned url missed the repositoryid part.
> i.e.  I send a request  http://localhost:7001/cmis/atom and the result supposed to return all repositories href as below:
> 
> <app:workspace>
>                                 <atom:title>DevOS1</atom:title>
>                                 <app:collection href="http://localhost:7001/cmis/atom/DevOS1/children?id=idf_0F1E2D3C-4B5A-6978-8796-A5B4C3D2E1F0">
> ...........................
> ...........................
> <app:workspace>
>                                 <atom:title>DevOS2</atom:title>
>                                 <app:collection href="http://localhost:7001/cmis/atom/DevOS2/children?id=idf_0F1E2D3C-4B5A-6978-8796-A5B4C3D2E1F0">
> ...................
> 
> But in fact, it returns
> 
> <app:workspace>
>                                 <atom:title>DevOS1</atom:title>
>                                 <app:collection href="http://localhost:7001/cmis/atom/children?id=idf_0F1E2D3C-4B5A-6978-8796-A5B4C3D2E1F0">
> ...........................
> ...........................
> <app:workspace>
>                                 <atom:title>DevOS2</atom:title>
>                                 <app:collection href="http://localhost:7001/cmis/atom/children?id=idf_0F1E2D3C-4B5A-6978-8796-A5B4C3D2E1F0">
> ...................
> 
> 
> Did I missed something?
> 
> Thanks
> Wentao
> 
> 
> 
> ________________________________
> This email and its attachments are intended solely for the personal use of the individual or entity named above. Any use of this communication by an unintended recipient is strictly prohibited. If you have received this email in error, any publication, use, reproduction, disclosure or dissemination of its contents is strictly prohibited. Please immediately delete this message and its attachments from your computer and servers. We would also appreciate if you would contact us by a collect call or return email to notify us of this error. Thank you for your cooperation.
> -BCHydroDisclaimerID5.2.8.1541
> 

RE: Filter to change org.apache.chemistry.opencmis.baseurl does not work on opencmis bridge?

Posted by "Lu, Wentao" <We...@bchydro.com>.
Hi Florian,

It looks good now. I'll do more testing with ESB team to make sure end-to-end works.


Thanks again.

Wentao

-----Original Message-----
From: Florian Müller [mailto:fmui@apache.org] 
Sent: 2016, January 11 9:51 AM
To: Lu, Wentao
Cc: dev@chemistry.apache.org
Subject: RE: Filter to change org.apache.chemistry.opencmis.baseurl does not work on opencmis bridge?

Hi Wentao,

Yes, that should do it.


- Florian


> Hi Florian,
> 
> So you mean the base URL string should be 
> "http://esbserver:1234/cmis/atom/{repositoryId}"?
> 
> 
> Thanks
> Wentao
> 
> -----Original Message-----
> From: Florian Müller [mailto:fmui@apache.org]
> Sent: 2016, January 09 9:04 AM
> To: dev@chemistry.apache.org
> Cc: Lu, Wentao
> Subject: Re: Filter to change org.apache.chemistry.opencmis.baseurl
> does not work on opencmis bridge?
> 
> Hi Wentao,
> 
> Use the placeholder "{repositoryId}" in the base URL for the 
> repository ID.
> 
> 
> - Florian
> 
> On 09.01.2016 01:22, Lu, Wentao wrote:
>> Hi,
>> 
>> We are currently using opencmis-bridge 0.10. Based on corporate 
>> policy, all request to CMIS need to go through ESB servers. The high
>> level data flow is:   client->ESB->OpenCMIS-Bridge->CMIS Server
>> 
>> I am trying to add a filter for atompub to update the 
>> "org.apache.chemistry.opencmis.baseurl" with ESB base url, the code 
>> snip as below:
>> 
>>     public void doFilter(ServletRequest request, ServletResponse 
>> response, final FilterChain chain) throws IOException,
>>             ServletException {
>> 
>>         // check for request header
>>         if (request instanceof HttpServletRequest) {
>>               HttpServletRequest httpRequest = 
>> (HttpServletRequest)request;
>>               String esbURL = httpRequest.getHeader("ESBURL");
>>               if (esbURL != null) {
>>                      
>> request.setAttribute("org.apache.chemistry.opencmis.baseurl", esbURL);
>>               }
>>         }
>> 
>>         // call next
>>         chain.doFilter(request, response); }
>> 
>> Web.xml as below
>> <filter>
>>               <filter-name>ESB</filter-name>
>>               <filter-class>mytest.ESBFilter</filter-class>
>>        </filter>
>>        <filter-mapping>
>>               <filter-name>ESB</filter-name>
>>               <servlet-name>cmisatom</servlet-name>
>>    </filter-mapping>
>> 
>> However, when I tested it with "ESBURL" header value 
>> "http://esbserver:1234/cmis/atom", the returned url missed the 
>> repositoryid part.
>> i.e.  I send a request  http://localhost:7001/cmis/atom and the 
>> result supposed to return all repositories href as below:
>> 
>> <app:workspace>
>>                                 <atom:title>DevOS1</atom:title>
>>                                 <app:collection
>> href="http://localhost:7001/cmis/atom/DevOS1/children?id=idf_0F1E2D3C
>> -
>> 4B5A-6978-8796-A5B4C3D2E1F0">
>> ...........................
>> ...........................
>> <app:workspace>
>>                                 <atom:title>DevOS2</atom:title>
>>                                 <app:collection
>> href="http://localhost:7001/cmis/atom/DevOS2/children?id=idf_0F1E2D3C
>> -
>> 4B5A-6978-8796-A5B4C3D2E1F0">
>> ...................
>> 
>> But in fact, it returns
>> 
>> <app:workspace>
>>                                 <atom:title>DevOS1</atom:title>
>>                                 <app:collection
>> href="http://localhost:7001/cmis/atom/children?id=idf_0F1E2D3C-4B5A-6
>> 9
>> 78-8796-A5B4C3D2E1F0">
>> ...........................
>> ...........................
>> <app:workspace>
>>                                 <atom:title>DevOS2</atom:title>
>>                                 <app:collection
>> href="http://localhost:7001/cmis/atom/children?id=idf_0F1E2D3C-4B5A-6
>> 9
>> 78-8796-A5B4C3D2E1F0">
>> ...................
>> 
>> 
>> Did I missed something?
>> 
>> Thanks
>> Wentao
>> 
>> 
>> 
>> ________________________________
>> This email and its attachments are intended solely for the personal 
>> use of the individual or entity named above. Any use of this 
>> communication by an unintended recipient is strictly prohibited. If 
>> you have received this email in error, any publication, use, 
>> reproduction, disclosure or dissemination of its contents is strictly 
>> prohibited. Please immediately delete this message and its 
>> attachments from your computer and servers. We would also appreciate 
>> if you would contact us by a collect call or return email to notify 
>> us of this error. Thank you for your cooperation.
>> -BCHydroDisclaimerID5.2.8.1541
>> 


RE: Filter to change org.apache.chemistry.opencmis.baseurl does not work on opencmis bridge?

Posted by Florian Müller <fm...@apache.org>.
Hi Wentao,

Yes, that should do it.


- Florian


> Hi Florian,
> 
> So you mean the base URL string should be
> "http://esbserver:1234/cmis/atom/{repositoryId}"?
> 
> 
> Thanks
> Wentao
> 
> -----Original Message-----
> From: Florian Müller [mailto:fmui@apache.org]
> Sent: 2016, January 09 9:04 AM
> To: dev@chemistry.apache.org
> Cc: Lu, Wentao
> Subject: Re: Filter to change org.apache.chemistry.opencmis.baseurl
> does not work on opencmis bridge?
> 
> Hi Wentao,
> 
> Use the placeholder "{repositoryId}" in the base URL for the repository 
> ID.
> 
> 
> - Florian
> 
> On 09.01.2016 01:22, Lu, Wentao wrote:
>> Hi,
>> 
>> We are currently using opencmis-bridge 0.10. Based on corporate 
>> policy, all request to CMIS need to go through ESB servers. The high 
>> level data flow is:   client->ESB->OpenCMIS-Bridge->CMIS Server
>> 
>> I am trying to add a filter for atompub to update the 
>> "org.apache.chemistry.opencmis.baseurl" with ESB base url, the code 
>> snip as below:
>> 
>>     public void doFilter(ServletRequest request, ServletResponse 
>> response, final FilterChain chain) throws IOException,
>>             ServletException {
>> 
>>         // check for request header
>>         if (request instanceof HttpServletRequest) {
>>               HttpServletRequest httpRequest = 
>> (HttpServletRequest)request;
>>               String esbURL = httpRequest.getHeader("ESBURL");
>>               if (esbURL != null) {
>>                      
>> request.setAttribute("org.apache.chemistry.opencmis.baseurl", esbURL);
>>               }
>>         }
>> 
>>         // call next
>>         chain.doFilter(request, response); }
>> 
>> Web.xml as below
>> <filter>
>>               <filter-name>ESB</filter-name>
>>               <filter-class>mytest.ESBFilter</filter-class>
>>        </filter>
>>        <filter-mapping>
>>               <filter-name>ESB</filter-name>
>>               <servlet-name>cmisatom</servlet-name>
>>    </filter-mapping>
>> 
>> However, when I tested it with "ESBURL" header value 
>> "http://esbserver:1234/cmis/atom", the returned url missed the 
>> repositoryid part.
>> i.e.  I send a request  http://localhost:7001/cmis/atom and the result 
>> supposed to return all repositories href as below:
>> 
>> <app:workspace>
>>                                 <atom:title>DevOS1</atom:title>
>>                                 <app:collection
>> href="http://localhost:7001/cmis/atom/DevOS1/children?id=idf_0F1E2D3C-
>> 4B5A-6978-8796-A5B4C3D2E1F0">
>> ...........................
>> ...........................
>> <app:workspace>
>>                                 <atom:title>DevOS2</atom:title>
>>                                 <app:collection
>> href="http://localhost:7001/cmis/atom/DevOS2/children?id=idf_0F1E2D3C-
>> 4B5A-6978-8796-A5B4C3D2E1F0">
>> ...................
>> 
>> But in fact, it returns
>> 
>> <app:workspace>
>>                                 <atom:title>DevOS1</atom:title>
>>                                 <app:collection
>> href="http://localhost:7001/cmis/atom/children?id=idf_0F1E2D3C-4B5A-69
>> 78-8796-A5B4C3D2E1F0">
>> ...........................
>> ...........................
>> <app:workspace>
>>                                 <atom:title>DevOS2</atom:title>
>>                                 <app:collection
>> href="http://localhost:7001/cmis/atom/children?id=idf_0F1E2D3C-4B5A-69
>> 78-8796-A5B4C3D2E1F0">
>> ...................
>> 
>> 
>> Did I missed something?
>> 
>> Thanks
>> Wentao
>> 
>> 
>> 
>> ________________________________
>> This email and its attachments are intended solely for the personal 
>> use of the individual or entity named above. Any use of this 
>> communication by an unintended recipient is strictly prohibited. If 
>> you have received this email in error, any publication, use, 
>> reproduction, disclosure or dissemination of its contents is strictly 
>> prohibited. Please immediately delete this message and its attachments 
>> from your computer and servers. We would also appreciate if you would 
>> contact us by a collect call or return email to notify us of this 
>> error. Thank you for your cooperation.
>> -BCHydroDisclaimerID5.2.8.1541
>> 


RE: Filter to change org.apache.chemistry.opencmis.baseurl does not work on opencmis bridge?

Posted by "Lu, Wentao" <We...@bchydro.com>.
Hi Florian,

So you mean the base URL string should be "http://esbserver:1234/cmis/atom/{repositoryId}"?


Thanks
Wentao

-----Original Message-----
From: Florian Müller [mailto:fmui@apache.org] 
Sent: 2016, January 09 9:04 AM
To: dev@chemistry.apache.org
Cc: Lu, Wentao
Subject: Re: Filter to change org.apache.chemistry.opencmis.baseurl does not work on opencmis bridge?

Hi Wentao,

Use the placeholder "{repositoryId}" in the base URL for the repository ID.


- Florian

On 09.01.2016 01:22, Lu, Wentao wrote:
> Hi,
> 
> We are currently using opencmis-bridge 0.10. Based on corporate policy, all request to CMIS need to go through ESB servers. The high level data flow is:   client->ESB->OpenCMIS-Bridge->CMIS Server
> 
> I am trying to add a filter for atompub to update the "org.apache.chemistry.opencmis.baseurl" with ESB base url, the code snip as below:
> 
>     public void doFilter(ServletRequest request, ServletResponse response, final FilterChain chain) throws IOException,
>             ServletException {
> 
>         // check for request header
>         if (request instanceof HttpServletRequest) {
>               HttpServletRequest httpRequest = (HttpServletRequest)request;
>               String esbURL = httpRequest.getHeader("ESBURL");
>               if (esbURL != null) {
>                      request.setAttribute("org.apache.chemistry.opencmis.baseurl", esbURL);
>               }
>         }
> 
>         // call next
>         chain.doFilter(request, response); }
> 
> Web.xml as below
> <filter>
>               <filter-name>ESB</filter-name>
>               <filter-class>mytest.ESBFilter</filter-class>
>        </filter>
>        <filter-mapping>
>               <filter-name>ESB</filter-name>
>               <servlet-name>cmisatom</servlet-name>
>    </filter-mapping>
> 
> However, when I tested it with "ESBURL" header value "http://esbserver:1234/cmis/atom", the returned url missed the repositoryid part.
> i.e.  I send a request  http://localhost:7001/cmis/atom and the result supposed to return all repositories href as below:
> 
> <app:workspace>
>                                 <atom:title>DevOS1</atom:title>
>                                 <app:collection 
> href="http://localhost:7001/cmis/atom/DevOS1/children?id=idf_0F1E2D3C-
> 4B5A-6978-8796-A5B4C3D2E1F0">
> ...........................
> ...........................
> <app:workspace>
>                                 <atom:title>DevOS2</atom:title>
>                                 <app:collection 
> href="http://localhost:7001/cmis/atom/DevOS2/children?id=idf_0F1E2D3C-
> 4B5A-6978-8796-A5B4C3D2E1F0">
> ...................
> 
> But in fact, it returns
> 
> <app:workspace>
>                                 <atom:title>DevOS1</atom:title>
>                                 <app:collection 
> href="http://localhost:7001/cmis/atom/children?id=idf_0F1E2D3C-4B5A-69
> 78-8796-A5B4C3D2E1F0">
> ...........................
> ...........................
> <app:workspace>
>                                 <atom:title>DevOS2</atom:title>
>                                 <app:collection 
> href="http://localhost:7001/cmis/atom/children?id=idf_0F1E2D3C-4B5A-69
> 78-8796-A5B4C3D2E1F0">
> ...................
> 
> 
> Did I missed something?
> 
> Thanks
> Wentao
> 
> 
> 
> ________________________________
> This email and its attachments are intended solely for the personal use of the individual or entity named above. Any use of this communication by an unintended recipient is strictly prohibited. If you have received this email in error, any publication, use, reproduction, disclosure or dissemination of its contents is strictly prohibited. Please immediately delete this message and its attachments from your computer and servers. We would also appreciate if you would contact us by a collect call or return email to notify us of this error. Thank you for your cooperation.
> -BCHydroDisclaimerID5.2.8.1541
>