How do I enable page compression for Jboss EAP6.2 - http-compression

How can I enable page/gzip compression for JBoss EAP 6.2?
I have found information online for older JBoss AS, but nothing for EAP.

you can do this by:
file : standalone.xml (JBoss AS 7+ )
Position : right after
<extensions>
</extensions>
<system-properties>
<property name="org.apache.coyote.http11.Http11Protocol.COMPRESSION" value="on"/>
<property name="org.apache.coyote.http11.Http11Protocol.COMPRESSION_MIME_TYPES" value="text/javascript,text/css,text/html,text/xml,text/json"/> <!-- add other content types you want to gzip -->
</system-properties>

Related

How to configure an attribute to be edited with a RichTextBox editor in SmartEdit?

I noticed that CMSParagraphComponent's content attribute can be edited using a RichTextBox like depicted in below image:
I want to edit my custom attribute in the same way(with the depicted RichTextBox). How can I do that ?
I tried configuring the backoffice-config.xml to use the wysiwyg:
<context merge-by="type" type="MyType" component="editor-area" module="moduleBackoffice">
<editorArea:editorArea xmlns:editorArea="http://www.hybris.com/cockpitng/component/editorArea">
<editorArea:tab merge-mode="replace" name="hmc.properties">
<editorArea:section name="hmc.properties">
<editorArea:attribute
editor="com.hybris.cockpitng.editor.localized(com.hybris.cockpitng.editor.wysiwyg)"
qualifier="customStringAttribute"/>
</editorArea:section>
</editorArea:tab>
</editorArea:editorArea>
</context>
But this only reflects in backoffice and has no effect on SmartEdit.
How can I use the RichTextBox in smartEdit ?
Hybris version: 6.7.0.3
This can be resolved by creating below Spring bean:
<bean class="de.hybris.platform.cmsfacades.types.service.impl.DefaultComponentTypeAttributeStructure" p:typecode="MyType" p:qualifier="customStringAttribute">
<property name="populators">
<set>
<ref bean="richTextComponentTypeAttributePopulator" />
<ref bean="requiredComponentTypeAttributePopulator" />
</set>
</property>
</bean>
I added above defined bean in my ${extensionname}-spring.xml, restarted the server and everything worked as expected. The MyType's customStringAttribute is now configurable from smartedit in the exact same way as CMSParagraphComponent's content is.

Deploying Custom theme in production server

I'm working on a Liferay project.
I'm developing a new Liferay theme using Plugins SDK.
I wonder is it better to use ANT or MAVEN for the project?
Because I managed to run both projects in eclipse.
Also is there any way to deploy automatically the theme in the production server ? (Distant server using tomcat).
For now I'm just using auto deployment, copying the war file to the /deploy file.
Regards
You can add remote server to your Eclipse with Plugins SDK, check https://www.liferay.com/documentation/liferay-portal/6.2/development/-/ai/developing-apps-with-liferay-ide-liferay-portal-6-2-dev-guide-02-en
(this may be helpful for older versions of plugins-sdk)
Assuming that you have ssh access to the remote server, the following ant target can be added and used in /liferay-plugins-sdk/build-common-plugin.xml
<property name="web-server" value="11.11.11.11" />
<property name="web-server-username" value="yourusername" />
<property name="web-server-password" value="yourpassword" />
<property name="web-server-deploy-folder-path" value="/liferay-x.x/deploy" />
<target name="remote-deploy" depends="war">
<echo message="Copying plugin to remote server ..." />
<scp
file="${plugin.file}"
todir="${web-server-username}:${web-server-password}#${web-server}:${web-server-deploy-folder-path}"
trust="true"
/>
<echo message="Done!" />
</target>

Configuring log4j with jboss-as-7.1.1

I have been reading a lot on this forum,jboss docs and on the internet to successfully get log4j configuration to work with jboss as 7.1.1, I do not want to use the logging subsystem in jboss. I want to use my own log4j configuration. My jboss server is configured in standalone mode. The following is what I did to get log4j configured based on docs :
Define a jboss-deployment-structure.xml as per https://docs.jboss.org/author/display/AS71/How+To#HowTo-HowdoIuselog4j.propertiesorlog4j.xmlinsteadofusingtheloggingsubsystemconfiguration%3F, and I added this in the META-INF directory of my EAR
I added a log4j.xml as is, and packaged inside a jar in the lib directory of my ear.
Removed the logging subsystem and the extension module="org.jboss.as.logging" from standalone.xml.
I did not change the logging.properties that is provided as a startup parameter in the startup.sh as I've read that is the logging that the jboss server will use before the subsystem kicks in.
Inspite of doing all of this I cannot get the application to log as per my log4j configuration.
My reason to use my own log4j configuration instead of the logging subsytem is to be able to use a custom rolling file appender for size-rotating-file-handler, as I want the rotated files to have a timestamp attached to the file name.
Help appreciated,
Ok, so I created a class MyHandler.java that extends from the SizeRotatingFileHandler.java and I override the preWrite method. MyHandler.java is in a package a.b.c. I create a sub directory under modules a/b/c and inside the c directory I add a jar that has just the Myhandler.class file. I add a module.xml
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.0" name="a.b.c">
<resources>
<resource-root path="RotatingHandler.jar"/>
<!-- Insert resources here -->
</resources>
<dependencies>
<module name="org.jboss.logging"/>
</dependencies>
</module>
Then in the standalone.xml I added an entry for the custom handler
<custom-handler name="FILE3" class="a.b.c.MyHandler" module="a.b.c">
<level name="INFO"/>
<formatter>
<pattern-formatter pattern="%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"/>
</formatter>
<file relative-to="jboss.server.log.dir" path="srveree.log"/>
</custom-handler>
When I start Jboss it says it cant find the class a.b.c.MyHandler. How do I resolve this error ?
UPDATE : I resolved this error. There was a problem in the package structure inside the module. However, I am still going back to the original question of configuring log4j with jboss-as-7.1.1.Final.
I was able to configure log4j with jboss. It turns out that you need to add exculsions seperately for each of the sub-deployments inside your main deployment. For example, I have an ear that has jar and war files budled inside. So I added seperate entries for each of the them in the jboss-deployment-structure.xml and it worked.
<sub-deployment name="your-subdeployment.jar">
<exclusions>
<module name="org.apache.log4j"/>
<module name="org.slf4j" />
<module name="org.apache.commons.logging"/>
<module name="org.log4j"/>
<module name="org.jboss.logging"/>
</exclusions>
</sub-deployment>
One thing you didn't indicate was whether or not you added a log4j library in your EAR/lib folder as well. I assume you probably have though or you should be seeing other errors.
I'm not sure whether or not log4j would have a log4j.xml inside a JAR inside your EAR to be honest. I would think that the EAR/META-INF would be a more appropriate place for your log4j configuration file.
There is no real reason to remove the logging subsystem in this case. Also, I'm not trying to convince you to use it, but you could create a custom handler fairly easily to do what you're looking to do. You could base it on the SizeRotatingFileHandler and then just add a suffix on the rename.
Consider configuration in your standalone.xml at
<subsystem xmlns="urn:jboss:domain:logging:1.1">
Here you can set
<console-handler name="CONSOLE">
<level name="DEBUG"/>
...
<logger category="com.myCompany">
<level name="DEBUG"/>
</logger>
...
Means: your logger in you classes which are in package com.myCompany should log from level DEBUG.

Red5. No scope with my project

i can't create my application with Red5 server. I've got an error
NetConnection.Connect.Rejected: No scope 'TestEcho' on this server.
NetConnection.Connect.Closed
I did something like ping application to test that everything works fine. My class looks like this:
package org.red5.core;
import org.red5.server.adapter.ApplicationAdapter;
import org.red5.server.api.IConnection;
import org.red5.server.api.IScope;
import org.red5.server.api.service.ServiceUtils;
public class Application extends ApplicationAdapter {
public void appDisconnect(IConnection conn)
{
super.appDisconnect(conn);
}
public boolean appStart()
{
return true;
}
public void appStop()
{}
public boolean appConnect(IConnection conn, Object[] params)
{
return true;
}
public Object echo(Object p)
{
return p;
}
}
Also i have red5-web.xml and red5-web.properties
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<!--
Defines a properties file for dereferencing variables
-->
<bean id="placeholderConfig" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location" value="/WEB-INF/red5-web.properties" />
</bean>
<!--
Defines the web context
-->
<bean id="web.context" class="org.red5.server.Context"
autowire="byType" />
<!--
Defines the web scopes
-->
<bean id="web.scope" class="org.red5.server.WebScope"
init-method="register">
<property name="server" ref="red5.server" />
<property name="parent" ref="global.scope" />
<property name="context" ref="web.context" />
<property name="handler" ref="web.handler" />
<property name="contextPath" value="${webapp.contextPath}" />
<property name="virtualHosts" value="${webapp.virtualHosts}" />
</bean>
<!--
Defines the web handler which acts as an applications endpoint
-->
<bean id="web.handler"
class="org.red5.core.Application"
singleton="true" />
</beans>
And
webapp.contextPath=/TestEcho
webapp.virtualHosts=127.0.0.1
So, it's strange but in echo-demo application i can't get connection to rtmp://localhost:1935/TestEcho
And i'd like to notice that demo applications work good, for example, oflaDemo. Where is the problem?....
which version do you use?
if you use red5 1.0, please use
<bean id="web.scope" class="org.red5.server.scope.WebScope" init-method="register">
instead of
<bean id="web.scope" class="org.red5.server.WebScope" init-method="register">
Check the below things
check your folder name with in webapp folder. It should be "TestEcho"
check webAppRootKey in your web.xml file
enable debug in logback.xml in red5 conf folder. check your log while starting.
Ref: https://github.com/arulrajnet/red5Demo/wiki/Different-context-name
I am a bigginer in Red5. I have also Struggled with the same problem. After searching Plenty of forums I have figured it out. In my searching process I have gone through your query also. So I thought it would be helpful if I post solution here.
The problem is with having duplicate red5.jar file. In my scenario I have one jar file in my RED5_HOME and the other in myapp/WEB-INF/lib folder. We should not have two Red5.jar files. red5.jar must be in RED5_HOME directory. So I have removed all the jars including red5.jar from myapp/WEB-INF/lib folder. It Solved my issue.
I just had the very same issue, it was configuration issue with the virtualHost name.
I fixed by changing red5-web.properties from webapp.virtualHosts=localhost to webapp.virtualHosts=*.
Hope it helps
Check something very simple - if you are on Windows - red5 installs and starts a services by default. Then you might have manually copied another version of red5 - which you use for development. That is what happened with me - there was a Windows Service - running red5 - long forgotten. Whereas I was actually running another version of red5 form my filesystem.

wrong encoding with JSF input

I use java 6 jsf1.2 and rich faces 3.3.3 on jboss 7 linux.
Everything worked fine on windows + tomcat but when I moved to linux + jboss I got a problem where h:inputText in hebrew would get to the server side as jibrish( ###!# ) instead of the hebrew letters. all of the files are utf-8.
How do I fix this encoding problem?
This needs to be configured in /standalone/configuration/standalone.xml. Add the following piece right after the </extensions>:
<system-properties>
<property name="org.apache.catalina.connector.URI_ENCODING" value="UTF-8"/>
<property name="org.apache.catalina.connector.USE_BODY_ENCODING_FOR_QUERY_STRING" value="true"/>
</system-properties>

Resources