Skip to content

[CAMEL-13213] Cannot use rest-swagger component with swagger.json pro…#3374

Merged
davsclaus merged 1 commit intoapache:masterfrom
JiriOndrusek:CAMEL-13213_rest-swagger-https
Dec 3, 2019
Merged

[CAMEL-13213] Cannot use rest-swagger component with swagger.json pro…#3374
davsclaus merged 1 commit intoapache:masterfrom
JiriOndrusek:CAMEL-13213_rest-swagger-https

Conversation

@JiriOndrusek
Copy link
Contributor

@JiriOndrusek JiriOndrusek commented Dec 2, 2019

…vided over HTTPS protocol

Issue: https://issues.apache.org/jira/browse/CAMEL-13213

There was on static call for swagger.json, which didn't care about ssl. I was trying to follow suggested direction from issue "What we should do is to load the resource via the chose camel http component and do a HTTP GET call. Then you setup SSL on it (as you would need to do to use https for the actual HTTP rest calls)."
So I've:

  • added dependency to camel-http
  • added sslContextParameters definition to endpoint
  • replaced "ResourceHelper.resolveMandatoryResourceAsInputStream" with camel-http call, which uses sslContextParameters
  • added JUnit test to cover this case

@davsclaus what do you think?

Copy link
Member

@omarsmak omarsmak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @JiriOndrusek , couples of nits here and there :)

@JiriOndrusek
Copy link
Contributor Author

JiriOndrusek commented Dec 2, 2019

@omarsmak thank you for your hints. I agree with a the majority of them (to be honest, I wanted to create this PR to have feedback whether this approach will be acceptable - I've completely forget to refactor for example method "getMethod", because I wasn't sure about this PR at all)

@JiriOndrusek JiriOndrusek force-pushed the CAMEL-13213_rest-swagger-https branch 3 times, most recently from 6ed7a48 to 69db025 Compare December 2, 2019 17:28
@JiriOndrusek
Copy link
Contributor Author

@omarsmak I've made all changes as requested

@davsclaus
Copy link
Contributor

@JiriOndrusek can you fix the last bit with closing that input stream after you are done

@davsclaus
Copy link
Contributor

Since camel-http is now required, then you need to change the karaf feature file to include it also
https://github.com/apache/camel/blob/master/platforms/karaf/features/src/main/resources/features.xml#L2085

You can add a new line with camel-http that is similar to camel-core

@JiriOndrusek JiriOndrusek force-pushed the CAMEL-13213_rest-swagger-https branch from 69db025 to 99c448e Compare December 3, 2019 13:08
@JiriOndrusek
Copy link
Contributor Author

@davsclaus Thank you for pointing it out. It is fixed now.

@davsclaus davsclaus merged commit 0c2aa42 into apache:master Dec 3, 2019
bobpaulin pushed a commit to bobpaulin/camel that referenced this pull request Dec 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Comments