jolie / website

The Jolie website
8 stars 8 forks source link

Better example how to use cookies in HTTP #5

Open bmaschio opened 9 years ago

bmaschio commented 9 years ago

@fmontesi I think we should improve the documentation on the HTTP protocol. I did struggle myself to get it working If you are able to tell were to add the further documentation i would put an example of use in a InputPort and use in outputPort, Tnks Balint

thesave commented 9 years ago

If I understand correctly, you are proposing to add some tutorial on the use of the HTTP protocol. In that case, I would suggest to create a new page like [1] under [2] with a name like "HTTP use cases" of "HTTP patterns".

Let me know if you need more information on how to integrate the page into the website repo.

[1] http://docs.jolie-lang.org/#!documentation/architectural_composition/java_services.html [2] https://github.com/jolie/website/tree/master/docs/documentation/web_applications

bmaschio commented 9 years ago

@thesave We could /docs/documentation/web_applications into web_applications something like working with cookies

fmontesi commented 9 years ago

@bmaschio : great idea, please go ahead! How about "Using Cookies" as page title under Web Applications?

bmaschio commented 9 years ago

@fmontesi I have added a bit more of documentation still not managing to make work http cookies in outputPort. Please check the right terms have been used not sure about "architecture"

fmontesi commented 9 years ago

@bmaschio Great!

Looks fine overall, I would not use "branch name" though for the subnodes of a value. Also I would just remove the "architectural" part (the text looks fine without it, leaving just ports). @thesave ideas for making the nomenclature uniform with the rest of the docs?

thesave commented 9 years ago

Sorry, I am a little lost in here. Are you referring to this [1]? I read it but I failed to understand what

.osc.operationName.cookies.cookieName = "branchName"

means. Can you make a brief example of what that declaration means?

[1] https://github.com/jolie/website/commit/6ccc38649dcc89c4ed263bf91b3a2fac2682e46b?diff=unified

fmontesi commented 9 years ago

http://arxiv.org/pdf/1410.3712v2.pdf

It's a work in progress (I'm adding REST), but p.16 has an example about cookies (applies to everything, not just correlation sets as in the paper).

On Thu, Jul 30, 2015 at 8:36 AM, thesave notifications@github.com wrote:

Sorry, I am a little lost in here. Are you referring to this [1]? I read it but I failed to understand what

.osc.operationName.cookies.cookieName = "branchName"

means. Can you make a brief example of what that declaration means?

[1] 6ccc386?diff=unified https://github.com/jolie/website/commit/6ccc38649dcc89c4ed263bf91b3a2fac2682e46b?diff=unified

— Reply to this email directly or view it on GitHub https://github.com/jolie/website/issues/5#issuecomment-126202184.

bmaschio commented 9 years ago

@thesave this come from the exmple I am going to upload

type Op1Request: void {
    .cookie1:string
}

type Op1Response: string 

type Op2Request: void {
    .cookie1:string
    .cookie2:string
}

type Op2Response: string 

interface ExampleInterface {
RequestResponse: 
    op1(Op1Request)(Op1Response),
    op2 (Op2Request)(Op2Response),
}

interface HTTPInterface {
RequestResponse:
    default(DefaultOperationHttpRequest)(undefined)
}

inputPort HTTPInput {
Protocol: http {
    .keepAlive = 0; // Do not keep connections open
    .debug = DebugHttp; 
    .debug.showContent = DebugHttpContent;
    .format -> format;
    .contentType -> mime;
    .osc.op1.cookies.cookie1 = "cookie1";
    .osc.op2.cookies.cookie1 = "cookie1";
    .osc.op2.cookies.cookie2 = "cookie2";
    .default = "default"
}```
thesave commented 9 years ago

Ok, let me recap what I understand from the two examples.

In the case of inputPorts, with .osc.op1.cookies.cookie1 = "cookie1"; I tell the interpreter that if it gets a message for operation op1 and the message contains a cookie called cookie1, the value of the cookie is copied into a variable with path .cookie1 in the root of the received message.

For outputPorts I guess it should be the reverse: if I send a message with .cookie1 via operation op1 the interpreter includes in the http message a cookie called cookie1 whose value is the value of .cookie1 in the message I am sending.

Provided I got it right (:P) and returning to @fmontesi's question: does in this context "branch name" mean the branching behaviour on an operation op1, op2, op3 like in input-choices[1]?

[1] http://docs.jolie-lang.org/#!documentation/basics/composing_statements.html#input-choice

mwallnoefer commented 8 years ago

Any progress here?