Re: Handling malformed uri with WebContent

Woonsan Ko <[email protected]>
Newsgroups gmane.comp.jakarta.jetspeed.user
Message-ID <[email protected]>
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: "[email protected]" <[email protected]>
> To: [email protected]
> 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: [email protected]
> -----------------------------------------------
> 
> 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: [email protected]
> For additional commands, e-mail: [email protected]
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.