<html><body bgcolor="#FFFFFF"><div>Hi Ulf:</div><div><br></div><div>Modifying the source of a framework to achieve your goals has serious drawbacks.  It can introduce subtle bugs and can make updating the framework to follow security or performance fixes much harder.</div><div><br></div><div>More importantly there is no advantage in modifying webmachine in this way since the behaviour you are looking for is cleanly achievable in resource code.</div><div><br></div><div>I strongly advise you to reconsider altering the framework source.  Having made that mistake myself and having experienced the maintenance nightmare it creates in a real product I want to save you the pain of experiencing it yourself :)</div><div><br></div><div>Either way, plot out the pros and cons and clearly document the rationale for whatever decision you make.<br><br></div><div>Best regards,</div><div>Alain<br><div><br></div></div><div><br>On 2011-03-26, at 2:24, Ulf Angermann <<a href="mailto:uangermann@googlemail.com">uangermann@googlemail.com</a>> wrote:<br><br></div><div></div><blockquote type="cite"><div>Hi Alain,<br><br>you are right that i have my delete logic in seperate handler, but nevertheless it will POST and not a DELETE.<br><br>I think about a solution, that i enhance the webmachine_mochiweb modul, so it will do the work for me. <br>

In this modul i will ask when it is a post and there is a method=delete tunneld i will create a DELETE method. We'll see if this will work for me.<br><br>XHR isn't a solution for me, because i want to use plain HTML without any JS, As i understood, you can't use it without. <br>

<br>I will post my question to the webmachine mailing list, too. <br><br>Thanks,<br>Ulf<br><br><br><div class="gmail_quote">2011/3/25 Alain O'Dea <span dir="ltr"><<a href="mailto:alain.odea@gmail.com"><a href="mailto:alain.odea@gmail.com">alain.odea@gmail.com</a></a>></span><br>

<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">Hi Ulf:<br>
<br>
You won't actually need two delete functions, since process_post can<br>
delegate to your delete handler if the correct form parameter is<br>
present.<br>
<br>
It's a compromise.  Modifying the webmachine_decision_core to handle<br>
protocol tunneling would be a serious challenge.  An alternative would<br>
be to have to have an HTTP proxy in front of webmachine that<br>
understands your representation of tunneling.<br>
<br>
Overall a proxy would be epically more complicated and operational<br>
problematic than a small amount of branching within a resource.  A<br>
much better alternative is to implement a generic webmachine resource<br>
that accepts a callback module whose functions perform the<br>
application-level request processing.  That way you could effectively<br>
have a generic HTTP method tunneling webmachine resource :)<br>
<br>
None of this is necessary if you use XHR to send your forms since it<br>
allows you to set the method.<br>
<br>
Cheers,<br>
<font color="#888888">Alain<br>
</font><div><div></div><div class="h5"><br>
On Fri, Mar 25, 2011 at 1:58 AM, Ulf Angermann<br>
<<a href="mailto:uangermann@googlemail.com"><a href="mailto:uangermann@googlemail.com">uangermann@googlemail.com</a></a>> wrote:<br>
> Hi Alan,<br>
><br>
> thanks for answer, but i am not really happy with your first one, because<br>
> than i have to implement two "delete" functions. In my opinion it would be<br>
> nicer, if i could change the method from POST to DELETE. Than i could handle<br>
> the tunneld delete as the "normal" one.<br>
><br>
> I will look at zotonic if i find something there, thank you.<br>
><br>
> Thanks,<br>
> Ulf<br>
><br>
> 2011/3/24 Alain O'Dea <<a href="mailto:alain.odea@gmail.com"><a href="mailto:alain.odea@gmail.com">alain.odea@gmail.com</a></a>><br>
>><br>
>> Hi Ulf:<br>
>><br>
>> On 2011-03-24, at 5:45, u a <<a href="mailto:uaforum1@googlemail.com"><a href="mailto:uaforum1@googlemail.com">uaforum1@googlemail.com</a></a>> wrote:<br>
>><br>
>> > Hello,<br>
>> ><br>
>> > i am working on a small project, where i am using webmachine.<br>
>> > Everything works fine, but know i have some question regarding the<br>
>> > tool.<br>
>> ><br>
>> > 1. Tunneld delete throw POST (HTML forms)<br>
>> ><br>
>> > Because of the limitation of the browser, i have to tunnel a delete<br>
>> > request throw a post request to webmachine.<br>
>> > When i look in the trace, great tool :-) , my request comes to the<br>
>> > decision M16 where the question is asked if this is a DELETE method or<br>
>> > not.<br>
>> > The answer is false , because it is a POST and not a DELETE method.<br>
>> ><br>
>> > Is it possible to change the method from a POST to a DELETE or which<br>
>> > kind of solution is the best?<br>
>> ><br>
>> > 2. Getting the protocol for the location<br>
>> ><br>
>> > When i create a location header or a redirect, i want to decide of the<br>
>> > underlying socket, which kind of protocol i have to use (HTTP or HTTPS<br>
>> > for instance. I found that the socket is part of webmachine_request,<br>
>> > but there is no function inside wrq to retrieve this information.<br>
>> ><br>
>> > Is there an easy way to detect the protocol which is used inside the<br>
>> > resource?<br>
>> ><br>
>> > Thanks for your help,<br>
>> > Ulf<br>
>> ><br>
>><br>
>> 1. Your resource's process_post function needs to handle this.  Since you<br>
>> are tunneling DELETE through POST it is actually POST that you need to<br>
>> handle.  I am guessing your tunneling is based on a form param called<br>
>> method.  Read that and branch in process_post :)<br>
>><br>
>> 2. No idea off the top of my head how to get the protocol.  I don't think<br>
>> vanilla webmachine wrq has this info.  I'm pretty sure it is visible in<br>
>> Zotonic webmachine resources though<br>
><br>
</div></div></blockquote></div><br>
</div></blockquote></body></html>