Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better example how to use cookies in HTTP #5

Open
bmaschio opened this issue Jul 9, 2015 · 10 comments
Open

Better example how to use cookies in HTTP #5

bmaschio opened this issue Jul 9, 2015 · 10 comments

Comments

@bmaschio
Copy link
Member

bmaschio commented Jul 9, 2015

@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
Copy link
Member

thesave commented Jul 9, 2015

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
Copy link
Member Author

bmaschio commented Jul 9, 2015

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

@fmontesi
Copy link
Member

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

@bmaschio
Copy link
Member Author

@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
Copy link
Member

@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
Copy link
Member

thesave commented Jul 30, 2015

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

@fmontesi
Copy link
Member

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 [email protected] 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
6ccc386?diff=unified


Reply to this email directly or view it on GitHub
#5 (comment).

@bmaschio
Copy link
Member Author

@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
Copy link
Member

thesave commented Jul 30, 2015

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
Copy link
Member

Any progress here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants