How do I change the REST context generated by enunciate? - java

I have the following annotation in my RESTEasy code:
#Path("/v1/authenticateService")
Enunciate generates a "Mount Point" in the documentation as:
/rest/v1/authenticateService/authenticate
I have tried using the following in my enunciate.xml, to override the "/rest" context:
<services>
<rest defaultRestSubcontext="/gateway-service-access-pox" />
</services>
I have also tried the following, but it didn't do anything, either:
<deployment protocol="https" host="(host)" context="/gateway-service-access-pox" />
I am using enunciate 1.23 to generate docs for a Maven 3, multi-module project.
Here is what is written to the console:
[INFO] --- maven-site-plugin:3.0:site (default-cli) # gateway-service-access-pox ---
[INFO] configuring report plugin org.apache.maven.plugins:maven-project-info-reports-plugin:2.4
[INFO] configuring report plugin org.codehaus.enunciate:maven-enunciate-plugin:1.23
[WARNING] No project URL defined - decoration links will not be relativized!
[INFO] Rendering site with org.apache.maven.skins:maven-default-skin:jar:1.0 skin.
[INFO] Generating "About" report --- maven-project-info-reports-plugin:2.4
[INFO] Generating "Web Service API" report --- maven-enunciate-plugin:1.23
[INFO] initializing enunciate.
[INFO] invoking enunciate:generate step...
[INFO] invoking enunciate:compile step...
[INFO] invoking enunciate:build step...
[INFO] closing enunciate.
Any idea what I am doing wrong?
More info...
The complete enunciate.xml (in case there is a problem affecting the entry:
<?xml version="1.0"?>
<enunciate label="platform-gateway-api" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://enunciate.codehaus.org/schemas/enunciate-1.23.xsd">
<api-import pattern="com.intuit.platform.gateway.common.DetailedResponse" />
<api-import pattern="com.intuit.platform.gateway.service.access.domain.*" />
<api-import pattern="com.intuit.platform.gateway.service.identity.domain.Identity" />
<deployment protocol="https" host="(host)" context="/gateway-service-access-pox" />
<namespaces>
<namespace uri="http://schema.intuit.com/platform/integration/detailedResponse/v1" id="common" />
<namespace uri="http://schema.intuit.com/platform/identity/user/v1" id="user" />
<namespace uri="http://schema.intuit.com/platform/access/token/v1" id="token" />
</namespaces>
<services>
<rest defaultRestSubcontext="/gateway-service-access-pox" />
</services>
<modules>
<!-- Docs -->
<docs splashPackage="com.intuit.platform.gateway.service.ticket.api" title="Platform Gateway Access API"
copyright="Intuit Inc">
<download name="License" file="LICENSE.txt" description="The license file governing the use of this API." />
</docs>
<!-- Disable all the client generation tools -->
<basic-app disabled="true" />
<c disabled="true" />
<csharp disabled="true" />
<java-client disabled="true" />
<jaxws-client disabled="true" />
<jaxws-ri disabled="true" />
<jaxws-support disabled="true" />
<jersey disabled="true" />
<obj-c disabled="true" />
<xml disabled="true" />
</modules>
</enunciate>
BTW, if there is better way to get help on this issue (some sort of bug forum), please let me know. I am a newbie with enunciate and didn't know if this was a bug or my ignorance.

as Ryan said the "defaultRestSubcontext" works. For example I used it this way to remove "rest" from default generated mount point:
<services>
<rest defaultRestSubcontext="/" />
</services>
If one set defaultRestSubcontext to "/" the generation starts from "/" and then followed by the endpoint's path.
P.S. I am using Enunciate 1.24

Well... I have being around this for couple days and finally it is working and the mount point has proper default rest subcontext :)
2 Things I did to make it work.
enable the XML module
<xml disabled="false" />
Add enunciate-xml jar to runtime.
I don't know why is that, but it is working for me now.

Related

How to make VS Code organize Java imports like IntelliJ

I'm using VS Code for Java development and working with other developers who use IntelliJ. I'd like to use the Organize Imports command (Shift+Alt+O) to clean up my imports, but I don't want to fight over import order with every commit. So I'd like to configure VS Code to organize the imports in the same order as IntelliJ's default. Does anybody have a configuration that would do this?
If this is not possible, is there a workspace configuration I can apply to both VS Code and IntelliJ so that the two IDEs will agree, even if they aren't agreeing on IntelliJ's default?
We were able to get it the almost identical with the following config tweaks.
VS Code:
{
"java.completion.importOrder": [
"",
"javax",
"java",
"#"
]
}
IntelliJ
The only difference from the IntelliJ default is a new line between import javax... and import java....
It's possible to get VS Code and IntelliJ to agree on a standard format, as long as that standard format:
Puts static imports at the top*
Separates all specific sections with empty lines
Puts everything not in its own specific section in a catch-all section at the end*
Never uses wildcard imports
Not actually true; static imports can be positioned in VS Code with '#', and everything else can be position in VS Code with ''.
IntelliJ's default settings don't work for this, but it is flexible enough to be reconfigured. Here are the files to add to a project to make just that project set up consistent rules for both IDEs (make sure they are not excluded in .gitignore).
Rule: The following groups separated by empty lines: Static imports, java.*, javax.*, everything else.
.vscode/settings.json:
{
"java.completion.importOrder": ["java", "javax"],
}
.idea/codeStyles/codeStyleConfig.xml:
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
</state>
</component>
.idea/codeStyles/Project.xml
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<JavaCodeStyleSettings>
<option name="CLASS_COUNT_TO_USE_IMPORT_ON_DEMAND" value="99" />
<option name="NAMES_COUNT_TO_USE_IMPORT_ON_DEMAND" value="99" />
<option name="IMPORT_LAYOUT_TABLE">
<value>
<package name="" withSubpackages="true" static="true" />
<emptyLine />
<package name="java" withSubpackages="true" static="false" />
<emptyLine />
<package name="javax" withSubpackages="true" static="false" />
<emptyLine />
<package name="" withSubpackages="true" static="false" />
</value>
</option>
</JavaCodeStyleSettings>
</code_scheme>
</component>

java.lang.IllegalStateException: not started exception occurs at line <sonar:sonar/>

I am trying to configure sonar for my project. First I am trying in local environment. Below is my configuration
<project name="dev" default="war" xmlns:sonar="antlib:org.sonar.ant">
<!-- Define the SonarQube global properties (the most usual way is to pass these properties via the command line) -->
<property name="sonar.host.url" value="http://localhost:9000/sonar" />
<!-- Define the SonarQube project properties -->
<property name="sonar.projectKey" value="org.codehaus.sonar:sonarqube-scanner-ant" />
<property name="sonar.projectName" value="Example of SonarQube Scanner for Ant Usage" />
<property name="sonar.projectVersion" value="1.0" />
<property name="sonar.language" value="java" />
<property name="sonar.sources" value="src" />
<property name="sonar.java.binaries" value="build" />
<property name="sonar.java.libraries" value="lib/*.jar" />
<property name="sonar.sourceEncoding" value="UTF-8" />
<!-- Code for clean compile the java files code comes here -->
<!-- Define SonarQube Scanner for Ant Target -->
<target name="sonar">
<taskdef uri="antlib:org.sonar.ant" resource="org/sonar/ant/antlib.xml">
<!-- Update the following line, or put the "sonarqube-ant-task-*.jar" file in your "$HOME/.ant/lib" folder -->
<classpath path="C:/eclipse-oxygen2-wf/plugins/org.apache.ant_1.10.1.v20170504-0840/lib/sonarqube-ant-task-2.5.jar" />
</taskdef>
<sonar:sonar/>
</target>
</project>
I am using sonarqube7.2.1 ansonarqube-ant-task-2.5.jar. When I run the below command it gives me IllegalStateException
ant sonar
Is there something I am missing here?
Below is the console output
Buildfile: C:\workspace\project_sonar\build.xml
sonar:
[sonar:sonar] Apache Ant(TM) version 1.10.1 compiled on February 2 2017
[sonar:sonar] SonarQube Ant Task version: 2.5
[sonar:sonar] Loaded from: file:/C:/sonar/sonarqube-ant-task-2.5.jar
[sonar:sonar] User cache: C:\Users\Usha\.sonar\cache
BUILD FAILED
C:\workspace\project_sonar\build.xml:231: java.lang.IllegalStateException: not started

How to create a package in Cognos - SDK?

I have been trying to create a package for Cognos via the sdk.
So far so good. I can created a package but I cannot add a datasource to that package. So basicly it does not do anything.
I am getting:
ANS-MES-0003 A server error occurred. Unable to complete the action.
when launching the package with the analysis studio.
If you are using IIS, you may not be getting the underlying issue because IIS will intercept the error. The error may be bad permissions or corrupt user data, but the error code returned seems to be an umbrella for specifics.
As outlined in this troubleshooting page, you can see the original error by setting httpErrors to PassThough. Replace:
<httpErrors lockAttributes="allowAbsolutePathsWhenDelegated,defaultPath">
<error statusCode="401" prefixLanguageFilePath="%SystemDrive%\inetpub\custerr" path="401.htm" />
<error statusCode="403" prefixLanguageFilePath="%SystemDrive%\inetpub\custerr" path="403.htm" />
<error statusCode="404" prefixLanguageFilePath="%SystemDrive%\inetpub\custerr" path="404.htm" />
<error statusCode="405" prefixLanguageFilePath="%SystemDrive%\inetpub\custerr" path="405.htm" />
<error statusCode="406" prefixLanguageFilePath="%SystemDrive%\inetpub\custerr" path="406.htm" />
<error statusCode="412" prefixLanguageFilePath="%SystemDrive%\inetpub\custerr" path="412.htm" />
<error statusCode="500" prefixLanguageFilePath="%SystemDrive%\inetpub\custerr" path="500.htm" />
<error statusCode="501" prefixLanguageFilePath="%SystemDrive%\inetpub\custerr" path="501.htm" />
<error statusCode="502" prefixLanguageFilePath="%SystemDrive%\inetpub\custerr" path="502.htm" />
</httpErrors>
with:
<httpErrors existingResponse="PassThrough" />
in you IIS config file.
OR
List item
Stop IIS
Open the IIS config file
Search for <section name="httpErrors" overrideModeDefault="Deny" /> and change Deny to Allow.
Look for <httpErrors> in <system.webserver>. If it has lockAllAttributesExcept="errorMode", remove the attribute and value.
In command, run %windir%\system32\inetsrv\appcmd.exe set config "<Your Website>/<Your virtual directory>" -section:system.webServer/httpErrors - existingResponse:PassThrough
Start IIS.

How to use Vaadin add-on with Spring Boot?

I'm using Vaadin 7.6.3 with Spring Boot. I'm trying to use the PopupButton add-on (but I don't think the issue is specific to the add-on).
I added the add-on as a dependency to gradle. This is the code for creating a PopupButton:
PopupButton btn = new PopupButton("Test Button");
btn.setContent(new Label("Test"));
layout.addComponent(btn);
Via the Vaadin plugin for Gradle I ran the task vaadinCompile which created the file src/main/resources/addon/client/ListaideWidgetset.gwt.xml and serveral files in src/main/webapp/VAADIN/gwt-unitCache and
src/main/webapp/VAADIN/widgetsets/addon.client.ListaideWidgetset. I also added #Widgetset("addon.client.ListaideWidgetset") to my UI. I confirmed that the widgetset is used via the client's ?debug mode.
Content of ListaideWidgetset.gwt.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Vaadin//DTD Vaadin 7//EN" "https://raw.github.com/vaadin/gwt/master/distro-source/core/src/gwt-module.dtd">
<!-- WS Compiler: manually edited -->
<module>
<inherits name="com.vaadin.DefaultWidgetSet" />
<set-configuration-property name="devModeRedirectEnabled" value="true" />
<set-property name="user.agent" value="ie8,ie9,gecko1_8,safari,ie10" />
<source path="client" />
<source path="shared" />
<collapse-all-properties />
<set-property name="compiler.useSymbolMaps" value="true" />
</module>
The problem is that on the client the button shows up as a standard button (no chevron) and doesn't open a popup when clicked.
Your widgetset does not contain the addon. See the the example:
<inherits name="org.vaadin.hene.popupbutton.widgetset.PopupbuttonWidgetset" />
Once added, recompile the widgetset, restart your application.
Usually the gradle plugin can handle this for you, but that feature can be disabled and or some other configuration error could prevent it. Hard to tell without the build.gradle...
edit
The gradle vaadin plugin seems not to be able to handle this addon properly. As a workaround disable the automatic management for widgetset, which prevents regeneration of the gwt.xml. See manageWidgetset in https://github.com/johndevs/gradle-vaadin-plugin/wiki/Tasks-and-configuration-DSL). E.g. add vaadinCompile.manageWidgetset = false in your vaadin{}-block.

How can I tell a Cursive Clojure module to depend on a local Java/Scala module?

I imported a Leiningen project into Intellij to sit alongside some existing Java & Scala modules. I would like to call functions from those modules from my Clojure module, but I'm not sure how to define this dependency. I went to Project Settings -> Modules and the "Dependencies" tab that's usually there is missing, leading me to believe that I'm not allowed to express dependencies anywhere other than the Leiningen project file (I've played with the Leiningen project editor and can't figure out how to do this there either...).
Here is the .iml file if anyone is curious how Intellij is viewing this module.
<?xml version="1.0" encoding="UTF-8"?>
<module cursive.leiningen.project.LeiningenProjectsManager.displayName="testproject:0.1.0-SNAPSHOT" cursive.leiningen.project.LeiningenProjectsManager.isLeinModule="true" type="WEB_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/classes" />
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/dev-resources" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/resources" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Leiningen: clojure-complete:0.2.3" level="project" />
<orderEntry type="library" name="Leiningen: org.clojure/clojure:1.6.0" level="project" />
<orderEntry type="library" name="Leiningen: org.clojure/tools.nrepl:0.2.10" level="project" />
I develop Cursive. I suspect there may not be a good solution for this right now. I'll look at the code and see if I can figure out a way to do it, but it'll require knowledge of how Maven, Gradle or SBT (in your case) represent the modules internally. I'll try to look at this today and let you know. I actually don't know if it's possible in IntelliJ for a Maven project to depend on an SBT project, for example, or a Gradle one.
In the meantime, publishing to your local repo is the only workaround I can think of. Sorry, I know it's clunky.
There's no difference from IntelliJ's point of view between a "normal" project and an IntelliJ one, it's just that Cursive will rewrite a lot of the module configuration on each sync since in theory that configuration should be managed by Leiningen. This is more or less how the Maven integration works.
So, I eventually was able to do this... as dAni suggested, I was able to create a new Clojure project (through IntelliJ this time -- previously I did "lein new clj-test" then tried to import this into IntelliJ), create a Leiningen build file, process that build file, and then see the Dependencies tab for the module in Project Structure.
Still, the REPL could not find the classes. So I had to edit the Run configuration to use nREPL in "a normal JVM process" which let me select the module whose classpath I would presumably be using.
Hate to be the guy to accept my own answer (especially since this has some limitation... I want to use this with Gorilla REPL in the end so will probably devise a different strategy for that) but I think this answers the original question pretty well, hope it helps someone. I think essentially what the above strategy is doing is using Leiningen for dependency resolution but not actually for the REPL, so Leiningen's dependencies are available on the classpath but the REPL is launched some other way via IntelliJ.

Categories