You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-user@portals.apache.org by je...@bnf.fr on 2012/01/13 16:31:22 UTC

Handling malformed uri with WebContent

Hello

First, just a word to say that our application has been released and is
running in "real life", and it works!

Second, I currenlty work on an integration with Lotus Notes, the goal is to
show a view  stored in Notes to see them through jetspeed so that users
cannot see the Notes machines.

The first step is to provide public document (no autentification stuff now,
just access through a proxy)

For that, I configued a proxy with the reverseProxyIFrame portlet: document
have there url.
Basically it works fine, I can even navigate through links inside Notes,
thanks to the reverse proxy feature.
I have a problem left, it's that some uri of documents are malformed and
contain space, and webcontent proxyx (I use the 1.1 version) doesn't encode
them with the default configuration.

Is there a mean to encode the url before parsing it?

here is the return exception
java.lang.IllegalArgumentException
	java.net.URI.create(URI.java:842)
	org.apache.http.client.methods.HttpGet.<init>(HttpGet.java:69)

org.apache.portals.applications.webcontent.proxy.impl.RewritableHttpReverseProxyServiceImpl.invoke
(RewritableHttpReverseProxyServiceImpl.java:289)

org.apache.portals.applications.webcontent.proxy.impl.DefaultHttpReverseProxyServlet.service
(DefaultHttpReverseProxyServlet.java:436)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

cause m�re

java.net.URISyntaxException: Illegal character in path at index 108:
http://SECRETSERVER.bnf.fr/DSI/PiloteProdV6.nsf/0/F8C57293124EDBF9C125783200376835/$FILE/EXO-ADM-2011-000020-01
 (p2).doc
	java.net.URI$Parser.fail(URI.java:2809)
	java.net.URI$Parser.checkChars(URI.java:2982)
	java.net.URI$Parser.parseHierarchical(URI.java:3066)
	java.net.URI$Parser.parse(URI.java:3014)
	java.net.URI.<init>(URI.java:578)
	java.net.URI.create(URI.java:840)
	org.apache.http.client.methods.HttpGet.<init>(HttpGet.java:69)

Cordialement,
-----------------------------------------------
Jérôme Dupont
Bibliothèque Nationale de France
Département des Systèmes d'Information
Tour T3 - Quai François Mauriac
75706 Paris Cedex 13
téléphone: 33 (0)1 53 79 45 40
e-mail: jerome.dupont@bnf.fr
-----------------------------------------------

Exposition  Casanova, la passion de la Liberté  - du 15 novembre 2011 au 19 février 2012 - BnF - François-Mitterrand / Grande Galerie Avant d'imprimer, pensez à l'environnement. 
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-user-help@portals.apache.org


Re: Handling malformed uri with WebContent

Posted by Woonsan Ko <wo...@yahoo.com>.
Thanks for the feedback, Jerôme!
Right, you don't have to add the properties unless you need to escape more than spaces.
By the way, it would take some time to get it released in 1.3 due to documentation, release process, etc.

Cheers,

Woonsan


----- Original Message -----
> From: "jerome.dupont@bnf.fr" <je...@bnf.fr>
> To: jetspeed-user@portals.apache.org
> Cc: 
> Sent: Thursday, January 19, 2012 8:43 AM
> Subject: Re: Handling malformed uri with WebContent
> 
> Yes,
> 
> I've tried rapidly to get your patch
> 
> 1/ I've generated a webcontent.jar form 1.2 version + your patch:
> IT WORKS FINE,
> even with a jetspeed 2.2.1
> 
> Notice that I didn't change the properties, because I just have a problem
> with space, not with some other caracter.
> 
> 2/ I've tried to generate the jar from 1.1 src code, it didn't work, for 
> a
> reason I didn't analysed.
> 
> Thanks very much again,
> Regards,
> Jerôme
> 
> |----------->
> |           |
> |           |
> |           |
> |           |
> |           |
> |----------->
>   
>> --------------------------------------------------------------------------------------------------------------------------------------------|
>   |                                                                              
>                                                               |
>   |                                                                              
>                                                               |
>   |  Message de : Woonsan Ko <wo...@yahoo.com>                          
>                                                                     |
>   |                        19/01/2012 07:33                                      
>                                                               |
>   |                                                                              
>                                                               |
>   |                                                                              
>                                                               |
>   |                                                                              
>                                                               |
>   |                                                                              
>                                                               |
>   |                                                                              
>                                                               |
>   |                                Veuillez répondre à "Jetspeed Users 
> List" <je...@portals.apache.org>                              
>   |
>   |                                                                              
>                                                               |
>   |                                                                              
>                                                               |
>   |                                                                              
>                                                               |
>   |                                                                              
>                                                               |
>   |                                                                              
>                                                               |
>   |                                                                              
>                                                               |
>   |                                                                              
>                                                               |
>   |                                                                              
>                                                           Pour|
>   |           Jetspeed Users List <je...@portals.apache.org>      
>                                                                      |
>   |                                                                              
>                                                          Copie|
>   |                                                                              
>                                                               |
>   |                                                                              
>                                                          Objet|
>   |           Re: Handling malformed uri with WebContent                        
>                                                                |
>   |                                                                              
>                                                               |
>   
>> --------------------------------------------------------------------------------------------------------------------------------------------|
> 
> 
> 
> 
> Hi Jérôme,
> 
> Just FYI, the issue has been fixed. [1] So you may check it out and build a
> snapshot build (1.3-SNAPSHOT) for your testing if you want.
> Also, I think it should be backward compatible with 1.1.
> 
> Regards,
> 
> Woonsan
> 
> [1] https://issues.apache.org/jira/browse/APA-47
> 
> 
> ----- Original Message -----
>>  From: "jerome.dupont@bnf.fr" <je...@bnf.fr>
>>  To: jetspeed-user@portals.apache.org
>>  Cc:
>>  Sent: Monday, January 16, 2012 3:33 AM
>>  Subject: Re: Handling malformed uri with WebContent
>> 
>> G reat!!
>> 
>>  Thanks. I'll try the workaround.
>> 
>>  Regards,
>>  Jérôme
>> 
>>  Exposition  Casanova, la passion de la Liberté  - du 15 novembre 2011 au
> 19
>>  février 2012 - BnF - François-Mitterrand / Grande Galerie Avant
> d'imprimer,
>>  pensez à l'environnement.
>>  ---------------------------------------------------------------------
>>  To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
>>  For additional commands, e-mail: jetspeed-user-help@portals.apache.org
>> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
> For additional commands, e-mail: jetspeed-user-help@portals.apache.org
> 
> 
> 
> Exposition  Casanova, la passion de la Liberté  - du 15 novembre 2011 au 19 
> février 2012 - BnF - François-Mitterrand / Grande Galerie Avant d'imprimer, 
> pensez à l'environnement. 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
> For additional commands, e-mail: jetspeed-user-help@portals.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-user-help@portals.apache.org


Re: Handling malformed uri with WebContent

Posted by je...@bnf.fr.
Yes,

I've tried rapidly to get your patch

1/ I've generated a webcontent.jar form 1.2 version + your patch:
 IT WORKS FINE,
even with a jetspeed 2.2.1

Notice that I didn't change the properties, because I just have a problem
with space, not with some other caracter.

2/ I've tried to generate the jar from 1.1 src code, it didn't work, for a
reason I didn't analysed.

Thanks very much again,
Regards,
Jerôme

|----------->
|           |
|           |
|           |
|           |
|           |
|----------->
  >--------------------------------------------------------------------------------------------------------------------------------------------|
  |                                                                                                                                            |
  |                                                                                                                                            |
  |  Message de : Woonsan Ko <wo...@yahoo.com>                                                                                              |
  |                        19/01/2012 07:33                                                                                                    |
  |                                                                                                                                            |
  |                                                                                                                                            |
  |                                                                                                                                            |
  |                                                                                                                                            |
  |                                                                                                                                            |
  |                                Veuillez répondre à "Jetspeed Users List" <je...@portals.apache.org>                                |
  |                                                                                                                                            |
  |                                                                                                                                            |
  |                                                                                                                                            |
  |                                                                                                                                            |
  |                                                                                                                                            |
  |                                                                                                                                            |
  |                                                                                                                                            |
  |                                                                                                                                        Pour|
  |           Jetspeed Users List <je...@portals.apache.org>                                                                           |
  |                                                                                                                                       Copie|
  |                                                                                                                                            |
  |                                                                                                                                       Objet|
  |           Re: Handling malformed uri with WebContent                                                                                       |
  |                                                                                                                                            |
  >--------------------------------------------------------------------------------------------------------------------------------------------|




Hi Jérôme,

Just FYI, the issue has been fixed. [1] So you may check it out and build a
snapshot build (1.3-SNAPSHOT) for your testing if you want.
Also, I think it should be backward compatible with 1.1.

Regards,

Woonsan

[1] https://issues.apache.org/jira/browse/APA-47


----- Original Message -----
> From: "jerome.dupont@bnf.fr" <je...@bnf.fr>
> To: jetspeed-user@portals.apache.org
> Cc:
> Sent: Monday, January 16, 2012 3:33 AM
> Subject: Re: Handling malformed uri with WebContent
>
>G reat!!
>
> Thanks. I'll try the workaround.
>
> Regards,
> Jérôme
>
> Exposition  Casanova, la passion de la Liberté  - du 15 novembre 2011 au
19
> février 2012 - BnF - François-Mitterrand / Grande Galerie Avant
d'imprimer,
> pensez à l'environnement.
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
> For additional commands, e-mail: jetspeed-user-help@portals.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-user-help@portals.apache.org



Exposition  Casanova, la passion de la Liberté  - du 15 novembre 2011 au 19 février 2012 - BnF - François-Mitterrand / Grande Galerie Avant d'imprimer, pensez à l'environnement. 
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-user-help@portals.apache.org


Re: Handling malformed uri with WebContent

Posted by Woonsan Ko <wo...@yahoo.com>.
Hi Jérôme,

Just FYI, the issue has been fixed. [1] So you may check it out and build a snapshot build (1.3-SNAPSHOT) for your testing if you want.
Also, I think it should be backward compatible with 1.1.

Regards,

Woonsan

[1] https://issues.apache.org/jira/browse/APA-47


----- Original Message -----
> From: "jerome.dupont@bnf.fr" <je...@bnf.fr>
> To: jetspeed-user@portals.apache.org
> Cc: 
> Sent: Monday, January 16, 2012 3:33 AM
> Subject: Re: Handling malformed uri with WebContent
> 
>G reat!!
> 
> Thanks. I'll try the workaround.
> 
> Regards,
> Jérôme
> 
> Exposition  Casanova, la passion de la Liberté  - du 15 novembre 2011 au 19 
> février 2012 - BnF - François-Mitterrand / Grande Galerie Avant d'imprimer, 
> pensez à l'environnement. 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
> For additional commands, e-mail: jetspeed-user-help@portals.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-user-help@portals.apache.org


Re: Handling malformed uri with WebContent

Posted by je...@bnf.fr.
Great!!

Thanks. I'll try the workaround.

Regards,
Jérôme

Exposition  Casanova, la passion de la Liberté  - du 15 novembre 2011 au 19 février 2012 - BnF - François-Mitterrand / Grande Galerie Avant d'imprimer, pensez à l'environnement. 
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-user-help@portals.apache.org


Re: Handling malformed uri with WebContent

Posted by Woonsan Ko <wo...@yahoo.com>.
Hi Jérôme,

Thank you for reporting this problem.

I've created an issue to fix this problem:
https://issues.apache.org/jira/browse/APA-47

I think RewritableHttpReverseProxyServiceImpl may need to replace some disallowed characters such as space before creating HTTP Client Methods.
I think it's a good time to release apa-webcontent-1.2 after fixing this problem.
I will try to release 1.2 in a couple of weeks.

By the way, you may consider to provide a custom proxyPathMapper by setting it to a request attribute.
RewritableHttpReverseProxyServiceImpl checks if there exists one custom one by the following line:


    HttpReverseProxyPathMapper proxyPathMapper = (HttpReverseProxyPathMapper) request.getAttribute(HttpReverseProxyConstants.PATH_MAPPER);

    // ...
    String proxyTargetURL = proxyPathMapper.getRemoteURL(localPathInfo);

And, it invokes proxyPathMapper.getRemoteURL(). So, you may implement a custom proxyPathMapper for the specific website in order to replace disallowed characters (in the overriden method). You can set it to request attribute in the pre-processing filter.
But, anyway, this doesn't look a nice and easy solution.

I'll try to fix it and keep you updated.

Regards,

Woonsan



----- Original Message -----
> From: "jerome.dupont@bnf.fr" <je...@bnf.fr>
> To: jetspeed-user@portals.apache.org
> Cc: 
> Sent: Friday, January 13, 2012 10:31 AM
> Subject: Handling malformed uri with WebContent
> 
> 
> Hello
> 
> First, just a word to say that our application has been released and is
> running in "real life", and it works!
> 
> Second, I currenlty work on an integration with Lotus Notes, the goal is to
> show a view  stored in Notes to see them through jetspeed so that users
> cannot see the Notes machines.
> 
> The first step is to provide public document (no autentification stuff now,
> just access through a proxy)
> 
> For that, I configued a proxy with the reverseProxyIFrame portlet: document
> have there url.
> Basically it works fine, I can even navigate through links inside Notes,
> thanks to the reverse proxy feature.
> I have a problem left, it's that some uri of documents are malformed and
> contain space, and webcontent proxyx (I use the 1.1 version) doesn't encode
> them with the default configuration.
> 
> Is there a mean to encode the url before parsing it?
> 
> here is the return exception
> java.lang.IllegalArgumentException
>     java.net.URI.create(URI.java:842)
>     org.apache.http.client.methods.HttpGet.<init>(HttpGet.java:69)
> 
> org.apache.portals.applications.webcontent.proxy.impl.RewritableHttpReverseProxyServiceImpl.invoke
> (RewritableHttpReverseProxyServiceImpl.java:289)
> 
> org.apache.portals.applications.webcontent.proxy.impl.DefaultHttpReverseProxyServlet.service
> (DefaultHttpReverseProxyServlet.java:436)
>     javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
> 
> cause m�re
> 
> java.net.URISyntaxException: Illegal character in path at index 108:
> http://SECRETSERVER.bnf.fr/DSI/PiloteProdV6.nsf/0/F8C57293124EDBF9C125783200376835/$FILE/EXO-ADM-2011-000020-01
> (p2).doc
>     java.net.URI$Parser.fail(URI.java:2809)
>     java.net.URI$Parser.checkChars(URI.java:2982)
>     java.net.URI$Parser.parseHierarchical(URI.java:3066)
>     java.net.URI$Parser.parse(URI.java:3014)
>     java.net.URI.<init>(URI.java:578)
>     java.net.URI.create(URI.java:840)
>     org.apache.http.client.methods.HttpGet.<init>(HttpGet.java:69)
> 
> Cordialement,
> -----------------------------------------------
> Jérôme Dupont
> Bibliothèque Nationale de France
> Département des Systèmes d'Information
> Tour T3 - Quai François Mauriac
> 75706 Paris Cedex 13
> téléphone: 33 (0)1 53 79 45 40
> e-mail: jerome.dupont@bnf.fr
> -----------------------------------------------
> 
> Exposition  Casanova, la passion de la Liberté  - du 15 novembre 2011 au 19 
> février 2012 - BnF - François-Mitterrand / Grande Galerie Avant d'imprimer, 
> pensez à l'environnement. 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
> For additional commands, e-mail: jetspeed-user-help@portals.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-user-help@portals.apache.org