cancel
Showing results for 
Search instead for 
Did you mean: 

Using alf_method to simulate POST

andrepra
Champ in-the-making
Champ in-the-making
I developed an application using webscripts in Alfresco 3.0. To reduce the number of webscripts often i declared webscripts supporting POST but i called them also with a GET using the parameter alf_method.   

http://....../wcsevice/...?alf_method=POST&param1=….

Also indicated in this post
http://forums1.man.alfresco.com/en/viewtopic.php?f=36&t=25633#p83399

In Alfresco 3.4 seems that these feature is no longer available. The wiki page of webscripts report that these feature (tunneling) is available only for POST call. Is that right?

Thanks
Andrea
1 REPLY 1

andrepra
Champ in-the-making
Champ in-the-making
Looking into spring framework extension source code version CI included in Alfresco I found the problem.
Class org.springframework.extensions.webscripts.servlet.WebScriptServletRuntime
Row 73
    protected String getScriptMethod()    {        // Is this an overloaded POST request?        String method = req.getMethod();        if (method.equalsIgnoreCase("post"))        {            boolean overloadParam = false;            String overload = req.getHeader("X-HTTP-Method-Override");            if (overload == null || overload.length() == 0)            {                overload = req.getParameter("alf_method");                overloadParam = true;            }            if (overload != null && overload.length() > 0)            {                if (logger.isDebugEnabled())                    logger.debug("POST is tunnelling method '" + overload + "' as specified by " + (overloadParam ? "alf_method parameter" : "X-HTTP-Method-Override header"));                                method = overload;            }        }                return method;    }‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍
The problem is the if that check only the post method

Looking last release RC1 on subversion the "if" statement is
if (method.equalsIgnoreCase("get") || method.equalsIgnoreCase("post"))‍‍‍