Highcharts not working correctly with htmlunit-driver - highcharts

Highcharts charts svg should be rendered using htmlunit-driver same as it is any other browser like chrome, edge, firefox etc
But the charts rendered are too small. Generated svg has a few NaN in the width attributes of couple rect tags. Moreover linearGradient and clipPath tags are all lowercased in the svg.
I have copied my sample project jdoodle. But it is not able to download maven dependencies. Anyways you can check my code for reference and copy the project to your local to run it:
https://www.jdoodle.com/ia/BEk
Brief structure of my example project:
highcharts-export.html (My custom html file to be used by htmlunitt)
highcharts-export.js (My custom js file to be used by htmlunit)
highcharts and highcharts-more js files
HighchartsExport.java the java code which uses selenium and htmlunit to execute the above html/js code to generate highcharts chart.
maven deps:
<dependencies>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>4.7.2</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>htmlunit-driver</artifactId>
<version>4.7.2</version>
</dependency>
</dependencies>

Related

What is currently the **best** and **secure** way to extract a certain text using jenkins in a pom.xml file

What is currently the best and secure way to extract a certain text using jenkins in a pom.xml file. I have read many articles mentioning not to use readMavenPom because it's already depreciated. I would like to extract item in groupId, artifactId, version and name.
<groupId>**LoveMyGroup**</groupId>
<artifactId>**portal**</artifactId>
<version>**0.0.1-SNAPSHOT**</version>
<packaging>war</packaging>
<name>**My first Project**</name>
<description>My first Project ever</description>
<properties>
<java.version>1.8</java.version>
</properties>

Apache tika custom parser

<dependency>
<groupId>org.apache.tika</groupId>
<artifactId>tika-server-core</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>org.apache.tika</groupId>
<artifactId>tika-parser-audiovideo-module</artifactId>
<version>2.3.0</version>
</dependency>
I have my own parser class also meta/services/ ... parser.Parser files
When i NOT use audio module -> i see my custom parser
When i add audio dependency -> i see audio parser, but dont see my custom
I think problem in audio module manifest file, which rewrite my own manifest file
How i can fix it???

Swagger-ui doesn't provide how i pass MediaType.APPLICATION_OCTET_STREAM content

Actually i am facing a problem that Swagger-ui can't show me input for MediaType.APPLICATION_OCTET_STREAM, so lets imagine this next service:
#PUT
#Path("/performAudioQuery")
#Consumes(MediaType.APPLICATION_OCTET_STREAM)
public Response performAudioQuery(InputStream audioInputStream){
//Impl of the service
}
and here are the dependencies
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-jersey2-jaxrs</artifactId>
<version>1.5.6</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-multipart</artifactId>
<version>2.22.2</version>
</dependency>
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.3.1</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
and i am using wildfly 9.x
So what should i do to make it possible for Swagger-ui working good with this previous service?
The current version of the Swagger/OpenAPI specification (2.0) doesn't deal kindly with file uploads as what's known as body parameter. We've formulated a workable solution that is covered at https://github.com/OAI/OpenAPI-Specification/issues/50 - however that solution is currently not fully supported by swagger-core and not supported at all in swagger-ui.

Portlet preferences

I'm trying to store portlet preferences in a backing bean (JSF) as mentioned in this tutorial
But, I can not understand how they imported Preference class here
Map<String, Preference> mutablePreferenceMap =
(Map<String, Preference>) elResolver.getValue(
facesContext.getELContext(), null, elExpression);
the package javax.portlet.* don't contain faces.preference.Preference
Anyone has an idea about that, specially how to save portlet preferences
thanks in advance
You have to add the Liferay Faces Bridge JAR to your project.
Add the following dependencies:
<dependencies>
<dependency>
<groupId>com.liferay.faces</groupId>
<artifactId>liferay-faces-alloy</artifactId>
<version>3.1.0-ga1</version>
</dependency>
<dependency>
<groupId>com.liferay.faces</groupId>
<artifactId>liferay-faces-bridge-impl</artifactId>
<version>3.1.0-ga1</version>
</dependency>
<dependency>
<groupId>com.liferay.faces</groupId>
<artifactId>liferay-faces-portal</artifactId>
<version>3.1.0-ga1</version>
</dependency>
</dependencies>
and the liferay-faces-bridge-api jar which is a dependency for liferay-faces-bridge-impl has this Preference interface.
More info:
http://www.liferay.com/community/liferay-projects/liferay-faces/download

ui repeat separator char

Using jsf2 (see maven dependencies)
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>2.1.10</version>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.1.10</version>
</dependency>
<dependency>
<groupId>com.sun.facelets</groupId>
<artifactId>jsf-facelets</artifactId>
<version>1.1.14</version>
</dependency>
I found out that configuration of jsf doesn't be used by ui:repeat tag. If I redefine the separator char in web.xml
<context-param>
<param-name>javax.faces.SEPARATOR_CHAR</param-name>
<param-value>_</param-value>
</context-param>
a <ui:repeat> renderes a : anyway, this is why I can't use jquery for finding a div's Id in my custom component:
<a href="#" onclick="toggleDiv('#{cc.clientId}Div')">
<h:outputText value="#{cc.attrs.value}" />
</a>
<div id="#{cc.clientId}Div" style="display: none">...</div>
The HTML result of this component is:
123456
<div id="j_idt12:0_j_idt18_0_j_idt24Div" style="display: none">
...
</div>
As you can see, there's a : in j_idt12:0_j... that makes jquery functions invalid. What can I do about it? Is there a way to set a special ui separator char?
As to the jQuery "problem", just escape : as \\: or use the [id] selector instead. See also How to select JSF components using jQuery? By the way, I'd rather use fixed IDs instead of relying on JSF-generated IDs, otherwise your webapp is highly unportable.
As to the <ui:repeat> problem, sorry, I can't reproduce it. But that Facelets 1.x dependency is highly suspicious. It would possibly only conflict with Facelets 2.x which is already bundled in JSF 2.x which in turn can indeed explain this problem. Get rid of that Facelets 1.x dependency altogether, you don't need it when already using JSF 2.x.

Resources