How to set Axis2 Web Service Client configuration using axis2.xml? - java

The documentation for Axis2 mentions axis2.xml file for configuration transport settings. However I could not seem to set transport type from HTTP/1.1 to HTTP/1.0 without chunking. I have put axis2.xml file in the classpath, in the same directory but no luck. Where should I put this configuration file in order to change the transport settings?

I believe that the axis2.xml file location can specified as a jvm property parameter:
java MyApp -Daxis2.xml="location of axis2.xml"
or by creating a ConfigurationContext using a ConfigurationContextFactory and passing this to the ServiceClient constructor

you should be able to create a configuration context from the axis2.xml and set it as given above. But your requirement is just to use http 1.0 you can do that like this as well.
serviceClient.getOptions().setProperty(HTTPConstants.HTTP_PROTOCOL_VERSION, HTTPConstants.HEADER_PROTOCOL_10);

Related

How to request https endpoints through quarkus

I am creating endpoint that is dependent on another endpoint,i have created interface and did all of that stuff but when i requested https://example.com to give me info it did not responded and request timeout exception came up.the quarkus is not supporting https request i also have added certificates kindly let me know what i am doing wrong or what i need to do.
quarkus.http.ssl.certificate.file=META-INF/dev.crt
quarkus.http.ssl.certificate.key-file=META-INF/dev.com.key
com.package.xyz/mp-rest/url=https://example.com
You need to specify some properties in your application.properties file:
quarkus.http.ssl-port=8443
quarkus.http.insecure-requests=enabled
quarkus.http.ssl.certificate.key-store-file=keystore.jks
quarkus.http.ssl.certificate.key-store-password=password
Documentation source I used for this was the Quarkus cookbook available from RedHat: https://developers.redhat.com/books/quarkus-cookbook see section 3.8

how to add a parameter to spring project before <projectname>/login and after <localhost>:<portnumber> without hardcode?

I'm working on a Spring MVC project. When I run the application the URL is:
http://localhost:8080/insureYou/login
but I want:
http://localhost:8080/contextroot/insureYou/login
Is there any way of doing it without hardcoding?
In a spring-boot project you can set the context-root by specifying the following property in the application.properties file:
server.servlet.context-path=/yourcontextroot
Without spring-boot, it depends on the webserver and Tomcat offers a number of options.
I would personally opt for a META-INF/context.xml file in your war file containing the necessary information but you can also include the information in the server.xml file or in a ROOT.xml file.
See the following links for further guidance:
How to set the context path of a web application in Tomcat 7.0
https://tomcat.apache.org/tomcat-8.0-doc/config/context.html
https://www.baeldung.com/tomcat-root-application
This type of deployment however sometimes is handled separately, through an Apache server reverse-proxy or through URL rewriting.
I recommend you ascertain whether this type of need is already taken care of by your company's deployment procedures, as you may not need to deal with it at all.

Is possible to load log4j2 config from config server?

Is possible to load log4j2 config.yml from config server or reaload spring boot logging configuration allways from the config server?
Or get the config from a git?
For example:
logging:
config: http://xxx.xx.xx.xx:3000/admin123/config-repository/src/master/log4j2.yml
You must read the file in raw mode to get the configuration from gogs.
So, your url with be something like this:
http://xxx.xx.xx.75:3000/admin123/config-repository/raw/master/log4j2.xml
Yes, by specifying the destination URL with system property log4j.configurationFile. This accepts any wellformed URL.

How to make Jetty reload its xml config files automatically?

Is it possible to extend jetty's hot deployment feature to reload, automatically, its xml config files?
I would like to make the client, through the webapp, choose to enable or disable the HTTPS service. However, for enabling/disabling, at least one xml file must be modified, which requires restarting the server. However, I would not like to restart the server when the client configure this, I would like to change it on the fly.
Is it possible? If it is, how should I configure it?
If you want to create/edit/change active Connectors at runtime, do that in code, not with the XML.
Get access to the Server object and then CRUD the Connectors to your desired end.
See:
addConnector(Connector)
removeConnector(Connector)
setConnectors(Connector[])
getConnectors()

How do I set X-FRAME-OPTIONS in JBoss EAP 6.1?

I am running a java spring application on Jboss EAP 6.1
X-FRAME-OPTIONS in the request header when performing a file upload is DENY and I receive the following errors. The file upload also does not appear on the page.
All of the solutions I see online say that I should try setting this value to SAMEORIGIN. They also show how to configure this in Apache but does anyone know how I set this option for Jboss?
Ok the other way is to create a HTTP filter.
Create a class that implements javax.servlet.Filter
Annotate the class with #WebFilter("/*") or the context you need.
In the doFilter method set the HTTP header you need and do not forget to call chain.doFilter(request, response); afterwards.
Build this class into a JAR and make sure it is placed in your WEB-INF/lib directory.
See the answer to this question system-properties In standalone-full.xml
In your standalone XML you can set the Apache Catalina properties like this:
<system-properties>
<property name="org.apache.tomcat.util.http.Parameters.MAX_COUNT" value="5000"/>
</system-properties>

Categories

Resources