Hi Edo,

XWiki has indeed problems with action_ request parameters. In my case the action_type_map and the action_ref_map parameters caused the problems. My solution is an apache RewriteRule (my xwiki instance is running behind an apache http server).

RewriteCond %{QUERY_STRING} ^(.*)(^|&|%26|%20)action_.*_map=[^&]+(.*)$
RewriteRule ^(.*) $1?%1%3 [R=307]

This rule deletes all action_*_map parameters from the request string.

Thank you for your help

   Richard


Am 23.01.2014 14:31, schrieb Edo Beutler:
Hi Richard

I don't think it's a character encoding problem. Facebook creates many
millions of these links each day. If there were an encoding problem the
internet would be full of it.

Furthermore, I ran into the same (I think) problem a few months ago. I
found that xwiki claims all parameters starting in 'action_'. After finding
the problem, Vincent was so kind as to point me to:

In ActionFilter.java:


...
                if (parameter.startsWith(ACTION_PREFIX)) {
…
where:
    /** The query property name prefix that indicates the target action. */
    private static final String ACTION_PREFIX = "action_";
This code is in a Filter. FTR here's its javadoc:
* A filter that dispatches requests to the right action, depending on the
button that was pressed in the editing form.
* This is needed since the browser cannot send the form data to different
URLs depending on the button pressed, and an
* XHTML form has only one target URL. In previous versions of XWiki this
was accomplished using javascript code, with a
* fall-back on a pseudo-dispatcher inside the {@link PreviewAction}, which
was on obvious case of bad code design.
* </p>
* <p>
* The filter dispatches requests based on the presence of a request
parameter starting with <tt>action_</tt> followed
* by the name of the struts action that should actually process the
request. For example, the button that does
* <tt>Save and Continue</tt> looks like:
*
* <pre>
* &lt;input type=&quot;submit&quot;
name=&quot;action_saveandcontinue&quot; value=&quot;...&quot;/&gt;
* </pre>
*
* As a result, when clicking the button, the request is not sent to the
form's target (<tt>preview</tt>), but is
* actually forwarded internally to
<tt>/bin/saveandcontinue/The/Document</tt>.
* </p>


You can find our "solution" for the problem on
https://github.com/celements/celements-core/blob/dev/src/main/java/com/xpn/xwiki/web/ActionFilterFBHack.java(needsDispatch-90:99)
Be aware that this is not a good (robust) solution, but a quick fix just
for these Facebook links and there is no guarantee that sooner or later a
similar problem will not pop up again.

Hope this helps.
Edo



On Wed, Jan 22, 2014 at 2:43 PM, [email protected] <[email protected]>wrote:

Hi Richard,

Indeed, the { character needs to be escaped. check section 2.4.3 of the
spec at http://www.ietf.org/rfc/rfc2396.txt, specifically:

------
Other characters are excluded because gateways and other transport
    agents are known to sometimes modify such characters, or they are
    used as delimiters.

    unwise      = "{" | "}" | "|" | "\" | "^" | "[" | "]" | "`"

    Data corresponding to excluded characters must be escaped in order to
    be properly represented within a URI.
------

Thanks
-Vincent

On 22 Jan 2014 at 14:28:42, Richard Hierlmeier ([email protected]
(mailto:[email protected])) wrote:


Hi Vincent,

I get the following exception:

java.net.URISyntaxException: Illegal character in query at index 160:
http://
???????????????????????????/bin/ref_map/Main/WebHome?fb_action_ids=22334241213413241&fb_action_types=og.likes&fb_source=feed_opengraph&action_object_map={%22334241213413241%22%3A211180592403908}&action_type_map={%22334241213413241%22%3A%22og.likes%22}&action_ref_map=[]
at java.net.URI$Parser.fail(URI.java:2829)
at java.net.URI$Parser.checkChars(URI.java:3002)
at java.net.URI$Parser.parseHierarchical(URI.java:3092)
at java.net.URI$Parser.parse(URI.java:3034)
at

It's the { character after action_type_map.

Do I have a character encoding problem?

The XWiki instance is running in tomcat behind a Apache http instance.
It is connection via mod_proxy and ajp. Here is my Apache configuration:

ProxyPreserveHost On
ProxyPass / ajp://localhost:9080/
ProxyPassReverse / http://???????????????????????????/

Here ist the ajp connector configuration from server.conf

maxThreads="20" URIEncoding="UTF-8"/>


Thank you

Richard


Am 22.01.2014 13:54, schrieb Vincent Massol:
Hi Richard,

On 21 Jan 2014, at 21:07, Richard Hierlmeier wrote:


I have a Facebook like Button on my xwiki instance. When clicking on
the button in facebook the following link is created:

http://
/bin/view/Main/Sample?fb_action_ids=22334241213413241&fb_action_types=og.likes&fb_source=feed_opengraph&action_object_map={%22334241213413241%22%3A211180592403908}&action_type_map={%22334241213413241%22%3A%22og.likes%22}&action_ref_map=[]

However XWiki can not handle this link correctly. When clicking on it
I get the following error message (it's in german language):

Hinweis

Während der Verarbeitung Ihrer Anfrage trat ein Problem auf. Bitte
verständigen Sie den Webmaster, falls der Fehler erneut auftritt.

How can I solve this problem?

I don’t see any reason why XWiki would care about anything put after
the ? unless it contains a parameter that xwiki uses (like “rev”).

What error do you get in the xwiki logs?

Thanks
-Vincent

_______________________________________________
users mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/users


_______________________________________________
users mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/users
_______________________________________________
users mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/users

_______________________________________________
users mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/users


_______________________________________________
users mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/users

Reply via email to