From what I can tell, the docs all point to the command line interface. We have a java interface that can call a section of our API that is generic that uses JMX for weblogic to configure everything. Our code would be more simple if I kept it similar between the two server types.
What I am finding is that everything I would normally configure in JMX (JDBC, Mail Sessions, JMS, etc) is documented to be called by wildfly on command line.
Is this the normal (recommended) way to configure wildfly so it is ready for your EAR deployment?
One way is to use the native management API - ModelControllerClient - in Java to do your configuration tasks:
ModelControllerClient client = ModelControllerClient.Factory
.create(new ModelControllerClientConfiguration.Builder().setHostName(HOSTNAME).setPort(9990)
.setConnectionTimeout(36000).build());
ModelNode operation = new ModelNode();
operation.get("operation").set("whoami");
operation.get("verbose").set("true");
ModelNode result = client.execute(operation);
System.out.println(result.toString());
Other way is to use the HTTP management API and do the same by this way using any fitting client (e.g. curl):
curl --digest -u admin:passwd.123 -L -D - http://localhost:9990/management \
--header "Content-Type: application/json" \
-d '{"operation":"whoami","verbose":"true","json.pretty":1}'
Related
I'm trying to implement a "dynamic" proxy forward to access localhost from Internet, like Ngrok in pure Java.
This guy does essentially the same thing: https://serveo.net/#intro (but, without a client)
The idea would be to use the SAME port on the server, and make a dynamic proxy for each client, based on a subdomain
The problem is that the default implementation throws error on the second connection .. saying that the port is already open.
org.apache.sshd.common.forward.DefaultForwardingFilter # doBind
Who has an idea of how to implement this?
The advantage of this is that you do not even need a CLIENT like Ngrok for that ... just using normal ssh would be possible.
ssh -R http2:9000:localhost:8002 localhost -p 4440
ssh -R http2:pSERVER:localhost:pLOCAL localhost -p SSHD_PORT
an option I imagined, is to generate the ports dynamically on the server: IGNORING THE 'pSERVER' port, and creating an HttpProxy, to do the redirection for each port. But I find this very inefficient, I believe it would be possible to do only by analyzing the request header and making the redirects for the corresponding channels / connections
After too much headache.
The code is in very low quality, just a proof of concept that can be implemented.
The implemented idea was made by changing sshd-netty, and adding a function to unpack the http request and remove the HOST HEADER (this needs to be improved here).
Only 1 port on the server is used, and it is kind of a reverse proxy for clients ...
I would like the help of the developers to improve the code in question. My knowledge in Netty and Mina is very limited.
Appreciate:
Source: https://github.com/ricardojlrufino/sshd-dyn-tunneling
Testing: Open 2 connections:
ssh -v -R http1:9000:localhost:8001 localhost -p 4440
ssh -v -R http2:9000:localhost:8002 localhost -p 4440
Make requests:
curl -v -H "Host: http1" http1:9000
curl -v -H "Host: http2" http2:9000
Start test servers:
https://github.com/ricardojlrufino/sshd-dyn-tunneling/blob/tunel/src/test/resources/setup_remotes.sh
I need to disable IPv6 when starting a Docker container from Java code. Using the command line, it is as follows:
docker run --sysctl net.ipv6.conf.all.disable_ipv6=1 ...
Is it possible to do the same but using Java with Spotify's docker-client?
As alternative solution... would it be possible to do with docker-java?
I think you should be able to do that with our docker-java-api (see Wiki and the linked blog post for details about it): https://www.github.com/amihaiemil/docker-java-api
In principle, it should be as simple as:
final Docker docker = new LocalDocker(...); //or new RemoteDocker(...);
final Container container = docker.containers().create(/*javax.json.JsonObject config*/);
Of course, you have to study the Docker API documentation in order to see what format the JsonObject should have (it should accept config about IpV 6 as well).
Please follow this -
https://github.com/spotify/docker-client/blob/2966b5cad6568d3c1b23f8891fbecab110834785/src/test/java/com/spotify/docker/client/DefaultDockerClientTest.java
final NetworkConfig networkConfig =
NetworkConfig.builder().name(networkName).driver("bridge").checkDuplicate(true).ipam(ipam)
.internal(false).enableIPv6(false).labels(labels)
.build();
Im using fabric8 Kubernetes Java Client and Im accessing Kubernetes through HTTP, I followed the example from
fabric8 but I get the following error:
Expected HTTP 100 but received 400 instead, Bad Request.
What do I need to do to upgrade my connection to http/2?
I found out that this has to do with http2, because Kubernetes exec uses SPDY, the problem went away when I upgraded to curl version > 7.36 and installed nghttp2 on the server.
After installing curl I was able to get the response by adding some headers
curl -H "Connection: upgrade" -H "Upgrade: SPDY/3.1" {master url:port/pod/exec}
I have a mule application deployed on linux (RHEL 6) box which talks to twilio API and Gmail API. The server where the mule application is deployed has to go out via proxy.
I have modified /usr/local/mule-standalone-3.5.0/conf/wrapper.conf and added additional java property for proxy settings (using wrapper.java.additional.4)
and when I search the mule process, here is what I see
$ ps -ef | grep mule
root 12940 12938 0 Dec04 ? 00:04:24 java -Dmule.home=/usr/local/mule-standalone-3.5.0 -Dmule.base=/usr/local/mule-standalone-3.5.0 -Djava.net.preferIPv4Stack=TRUE **-Dhttp.proxyHost=http://<proxy> -Dhttp.proxyPort=80 -Dhttps.proxyHost=http://<proxy> -Dhttps.proxyPort=80**
I still am not able to hit the outbound HTTP/ HTTPS urls.
Is there a different way of setting outbound proxy in mule?
Please try configuring the proxy in the connector.
I need simple web server for debugging my application (Arduino web client, curl, etc.).
What is my idea:
I run command like
curl -X POST -H "Content-Type: application/json" \
-H "Accept: application/json" -d '{"address":"192.168.200.3", \
"title":"Abc" }' http://SERVER/xyz
to test webserver running at http://SERVER:80. This webserver write data + all http headers to standard terminal output.
It will be great for testing Arduino with Ethernet shield.
Is there any exiting product (for Linux)? I can write it in Java, but I do not want to reinvent the wheel...
I always use nc (netcat) for this, in a style like:
nc -l -p 8080
It isn't really a "HTTP server" but only a dumb TCP server, but if you're mostly interested in seeing the client request and not necessarily serving back a proper HTTP response then it is good enough.