How to use RequestContext custom attributes of armeria in log4j2.xml configuration? - log4j2

I'm using log4j2 2.14.0 with armeria 1.3.0. According to the armeria documentation, I could see RequestContext custom atrributes can be exported using com.linecorp.armeria.common.logback.RequestContextExportingAppender in logback configuration. So, I tried to configure it in log4j2.xml but it didn't work. Is there any way to use the atrributes for setting %X{some_value} in log4j2.xml ? or Is it possible to use ThreadContext(like MDC) with armeria ?

Armeria currently doesn't have the Log4J2 version of RequestContextExportingAppender yet. Please stay tuned by subscribing to this GitHub issue.

Related

web.xml vs. annotation in Vaadin

I'm using Vaadin 7.4.3, tomcat 8. During the wizard to create Vaadin 7 project in eclipse, it has a checkbox called "Generate web.xml deployment descriptor".
The new way is to use annotation instead of specify it in the web.xml. Are there any configurations that I have to use web.xml because there's no annotation for it? Is it a good practice to always generate the web.xml even if you might not use it for Vaadin 7.1 projects and up?
Thanks
Yes, there are for sure some aspects of app that cannot be configured using annotations (i.e. there is no annotation to state that you want to have your session cookies "http-only" ).
I would recommend you to create web.xml file when it is needed. Sooner or later it would probably will be used, but don't worry too much in advance. It is not a dark magic to create web.xml file in existing project :)

How to add filters to a Grails app

I'm trying to add these single signout filters to my Grails 2.3.6 app. According to the Grails docs on Filters it seems like you can only add new (custom) filters to Grails apps, whereas these are existing filters imported from another project/JAR.
I scanned my project for the existence of a web.xml and didn't find anything.
How can I add the specific filters in the above link to my Grails app?
The easiest way is to run "grails install-templates" and edit the resulting src/templates/war/web.xml file.
You can use WebXmlConfig plugin which provides a DSL approach to add/modify contents to web.xml.

View Grails configuration at runtime

Is it possible to view your Grails configuration (i.e. properties in your Config.groovy) anyway at all at runtime via JMX (or any other way)?
Before going off writing something to do this, I just wanted to check what is the grails way to do this?
Thanks in advance

Consuming a WSDL in Grails

I have been handed a .WSDL file which I need to test within a Grails Framework.
Any suggestions how to go about this.
Take a look at the http://grails.org/plugin/cxf and http://grails.org/plugin/cxf-client plugins. They're easy to use and backed by Apache CXF - https://cxf.apache.org/
The client plugin has a wsdl2java script that will generate code that you can use in your Grails app.
You could start with documentation itself: http://grails.org/Calling+External+WebServices

Grails portlet plugin problems

Wonder if anyone has come accross this problem. I have created a demo portlet using the grails portlet and liferay plugins.
After installing the grails plugins in a project i simply ran the following commands
grails create-portlet MyFirst
grails generate-portlet-views MyFirst
grails liferay-deploy
The portlet deploys fine. However when i try to add the portlet to a page then i get the following stacktrace. Anyone have any ideas ?
23:04:52,134 ERROR [jsp:165] javax.servlet.ServletException: File "/WEB-INF/grails-app/views/myfirst/render.jsp" not found
I am running liferay version 5.2.3 that has tomcat version 6.0.18 embedded. I am also using JVM 1.6
thanks in advance.
The current versjon of the Grails portlet plugin (0.7) doesn't support portletnames with capital cases. Change MyFirst to myfirst and it will work like a charm (well, almost ;)
Regards
Armaz
It looks like it's not able to find render.gsp (the default gsp for a porltet if no mode specific view is found).
What did generate-portlet-views generate for you?
Take a closer look to your stacktrace - it attempts to look for render.jsp, not gsp. render.jsp is the default template LR attempts to find if it does not find what it is looking for depending on the action.
Read Armaz's answer, he is correct. You must change template folder name to lower case: myFirst => myfirst.
The next problem you might experience is solved here: Grails Liferay portlet not invoking action ;)

Resources