Setting proxy authentication on ServiceMix - apache-servicemix

I have ServiceMix installed behind a web proxy, and I need it to call a web service over the Internet.
I tried setting the proxy settings within my code with
System.setProperty("http.proxyHost" .....
(ugly and hacky, I know)
as well as setting the
http.proxyHost=myproxy
http.proxyPort=8080
http.proxyUser=myuser
http.proxyPassword=mypassword
in the etc/system.properties file of ServiceMix.
None of that worked.
Any suggestions would be appreciated.
Thank you.

Since your using ServiceMix you most likely are using Camel with CXF to call this webservice.
You need to set this proxy in your Camel context especially for CXF by setting the http-client configuration. Take a look at this link, it shows you how to configure the http conduit of CXF.
I'm sure your also able to set the proxy this way.

Use http:conduit:
<http:conduit name="*.http-conduit">
<http:authorization>
<sec:UserName>Betty</sec:UserName>
<sec:Password>password</sec:Password>
</http:authorization>
<http:client ProxyServer="x.x.x.x" ProxyServerPort="xxxx"/>
</http:conduit>
See: http://cxf.apache.org/docs/client-http-transport-including-ssl-support.html

Related

Open API (Swagger) non working in Spring Boot when adding context path

I have a Spring Boot application exposing REST services that are easily called on addresses like
http://localhost:8080/<controller_mapping>/<service_mapping>.
I've been asked to modify my settings in order to add a context path and have my services to respond on
http://localhost:8080//gesev-mensa/<controller_mapping>/<service_mapping>.
Thus I edited my application.properties adding
server.servlet.context-path=/gesev-mensa
Everything works but I can't call Swagger on old address
http://localhost:8080/swagger-ui/index.html?configUrl=/v3/api-docs/swagger-config#/
I get the error Failed to load remote configuration
As suggested, I tried to add property
springdoc.swagger-ui.path=/gesev-mensa/swagger-ui/index.html
but problem persists.
I guess Swagger should be reachable at
http://localhost:8080/gesev-mensa/swagger-ui/index.html?configUrl=/v3/api-docs/swagger-config#/
but that doesn't work.
Any hint?
Thanks for support.
Try removing
springdoc.swagger-ui.path=/gesev-mensa/swagger-ui/index.html
from your properties,
And your swagger will be available in
http://localhost:8080/gesev-mensa/swagger-ui/index.html
As per your current configuration with,
springdoc.swagger-ui.path=/gesev-mensa/swagger-ui/index.html
Swagger will be available in
http://localhost:8080/gesev-mensa/gesev-mensa/swagger-ui/index.html

How to disable re-negotiate in Spring boot embedded jetty

Generally we can disable Client-initiated re-negotation in Jetty containers by setting the below property jetty.xml
<New id="ssl" class="org.eclipse.jetty.server.ssl.SslSelectChannelConnector">
<Set name="allowRenegotiate">FALSE</Set>
I would like to disable re-negotation in Spring boot embedded jetty. I checked below links but I didn't find any related property to implement this.
https://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html
https://github.com/spring-projects/spring-boot/blob/v1.5.4.RELEASE/spring-boot/src/main/java/org/springframework/boot/context/embedded/Ssl.java
Could someone please provide me some pointers to implement this. Appreciate your help.
Edited:
From the below link, I can see that by default allowRenegotiate is set to false. Is it is the same case with embedded Jetty?
https://wiki.eclipse.org/Jetty/Reference/SSL_Connectors
In regards to your question about embedded Jetty, allowRenegtionate is true by default; it is also on by default if you enable the ssl module in a current Jetty distribution.
I am unsure what version of Jetty you are using, but the wiki you linked to is for Jetty 7 and 8 which are both End of Life and no longer under active development. I strongly encourage you to upgrade to the latest release of Jetty, if possible, and to refer to current documentation as much has changed.

properties file reload on change in server, Spring

i am using Spring 4.2.5 and jboss 7 server.
Is it possible to change in application.properties files and make server to reload changed data in application.properties file automatically on refresh without restarting server?
Please suggest on this. Any idea or steps or api to use anything to move forward.
Regards
Ideal way would be use spring cloud config
#EnableConfigServer. You will have separate config server pointed all the properties pointed. And a client will be able to access the properties. This allows you to change the properties on the fly in server with out need for any restart.
http://jeroenbellen.ghost.io/manage-and-reload-spring-application-properties-on-the-fly/

How to only auto configure the embedded container?

I'm trying bootify my app, which is XML configured. I'd love to have an embedded tomcat server that I can just run through the main method.
The simplest way to do it is to bootstrap the app using the existing XML config through #ImportResource("classpath:app-servlet.xml").
I cannot use auto configuration. We have certain circular dependencies that are not trivial to fix at this point.
The problem is that the embedded tomcat server only gets automatically configured if you use #EnableAutoConfiguration.
Is there a way to only auto configure the embedded server? I tried looking that Spring Boot's sources, namely EmbeddedServletContainerAutoConfiguration, including extending it and "running" it through my setup, but it only runs the customizers, not the ServletInitializer, therfore I'm getting an error "Root context already initialized".
Any help would be greatly appreciated.

Grizzly and Jersey are hiding my other annotations

we have to update a Spring project where we need to embed a https server which supports SSL protocols and cipher suites selection.
My setup is : Spring 3.2.4, jersey 1.15.1 and Grizzly 1.9.60
The main problem that our resource class is calling some components which are expecting annotations. But Grizzly seems to ignore the non-jersey REST annotations. So my custom annotations aren't transmitted at all.
I was wondering if you can give a an idea on how to work past this:
is it possible to configure Jersey so it won't use annotations (maybe a xml or java config), hopefully keeping my own annotations to be transmitted down the line ?
or it is possible to manually add the annotations on the method call ?
I recently tried this with Jetty 1.9.2 and jersey2 and it seems I have the same result. The only thing that worked was a SimpleServerFactory from Jersey 1, but like I said it didn't provide customizable SSL parameters.
Please someone :) ...
OK, just posting here maybe it will help someone. I finally got my hands on the components code and I noticed that the called class was looking for annotations in the last three stack traces.
What happened was Grizzly was adding a proxy of some kind, and that causes the three stack traces not to be enough and the annotations were not sent through.

Resources