Mojibake problem
[I use netbeans - jsf 2.2 - primefaces 4.0 - Mysql database]
I use Arabic in my JSF application and unfortunately the Arabic values sent to the server as other characters like this (بÙÙس Ùب ) (seen by debugger) and so stored in database like this.
the project work well at the beginning but after I do some other tasks in my project this problem occur but what cause the problem I do not know
the following solutions done but no effect
use the following line at every jsf page (.xhtml page)
<meta http-equiv="content-type" content="text/html;charset=utf-8"/>
use the following filter
<filter>
<filter-name>encoding-filter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>utf-8</param-value>
</init-param>
<init-param>
<param-name>forceEncoding</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>encoding-filter</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
</filter-mapping>
and also I try my written filter
I use the form like this
<h:form acceptcharset="UTF-8" enctype="application/form-data">
Any one can help me
The problem here
Reconfigure the server to use UTF-8 instead of ISO-8859-1 as default encoding. In Glassfish, that would be a matter of adding the following entry to of the /WEB-INF/glassfish-web.xml file:
<parameter-encoding default-charset="UTF-8" />
Related
<filter>
<filter-name>struts2</filter-name>
filterclass>
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
This is my Filter code. Is there anything wrong in it
I am getting severe Exception class not found error.
Use this in your web.xml. Also make sure struts2-core-x.x.x.jar is in the WEB-INF/lib folder as well as the complete set of required libraries. The core jar contains a class used by the filter configuration and loaded by server classloader when you deploy your application.
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
I'm using NTLMv1 and its working fine. The only disdavantage is once if I logged in then its hitting LDAP server for 3 to 4 times.
So I don't want that. Can any one please explain me how this process is in NTLMv2?
below is the code for NTLMv2
<filter>
<filter-name>ntlmv2-auth</filter-name>
<filter-class>org.ntlmv2.filter.NtlmFilter</filter-class>
<init-param>
<!-- Windows domain name -->
<param-name>ntlm-domain</param-name>
<param-value>ACME.CORP</param-value>
</init-param>
<init-param>
<!-- IP-address of domain controller -->
<param-name>ntlm-dc</param-name>
<param-value>dcone.acme.com</param-value>
</init-param>
<init-param>
<!-- Simple (non-FQDN) hostname of DC host -->
<param-name>ntlm-dc-name</param-name>
<param-value>dcone</param-value>
</init-param>
<init-param>
<!-- Computer account for connection to DC -->
<param-name>ntlm-account</param-name>
<param-value>TECHUSER$#ACME.CORP</param-value>
</init-param>
<init-param>
<!-- Password of computer account -->
<param-name>ntlm-password</param-name>
<param-value>test1234</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>NTLMv2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
The answer is that you cannot avoid the repeated LDAP connection, as the NTLM protocol is designed to do this exactly. You can find more information on the Microsoft Page defining the NTLM Protocol
I have root.war and cgi-bin-perl directory under Jetty's webapps directory. I am able to run the UI code in root.war, but I am not able to read cgi files and xml files under cgi-bin-perl directory, e.g. hello.cgi, plugin.xml. It returns the error "cannot be found". Here is my etc/webdefault.xml file. What do I miss?
<servlet>
<servlet-name>PerlCGI</servlet-name>
<servlet-class>org.eclipse.jetty.servlets.CGI</servlet-class>
<init-param>
<param-name>commandPrefix</param-name>
<param-value>/usr/bin/perl</param-value>
</init-param>
<init-param>
<param-name>cgibinResourceBase</param-name>
<param-value>/opt/jetty/webapps/cgi-bin-perl</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>PerlCGI</servlet-name>
<url-pattern>*.pl</url-pattern>
</servlet-mapping>
Your servlet mapping means that only patterns that end in pl will be executed by the servlet....there is nothing here that will serve out other files under that url.
If you want access to those files then you should setup a default servlet under that url space and let it serve out those files. By default jetty will not let you download whatever files you like, you have to configure it to do that!
I'm trying (with no success) to pass the response of a JRuby Rack - Rails application to a filter in order to get it processed. Basically I want to use the Orbeon XForm Engine to enhance the XHTML output coming from my Rails application. If I use a simple Java servlet instead on JRuby Rack everything works smoothly.
Here's the web.xml file:
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<context-param>
<param-name>public.root</param-name>
<param-value>/</param-value>
</context-param>
<context-param>
<param-name>rails.env</param-name>
<param-value>production</param-value>
</context-param>
<context-param>
<param-name>jruby.min.runtimes</param-name>
<param-value>2</param-value>
</context-param>
<context-param>
<param-name>jruby.max.runtimes</param-name>
<param-value>4</param-value>
</context-param>
<filter>
<filter-name>orbeon-xforms-filter</filter-name>
<filter-class>org.orbeon.oxf.servlet.OrbeonXFormsFilter</filter-class>
<init-param>
<param-name>oxf.xforms.renderer.context</param-name>
<param-value>/orbeon</param-value>
</init-param>
</filter>
<!-- This is necessary so that XForms engine resources can be served appropriately -->
<filter-mapping>
<filter-name>orbeon-xforms-filter</filter-name>
<url-pattern>/orbeon/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
</filter-mapping>
<!-- Any web resource under /xforms-jsp is processed by the XForms engine -->
<filter-mapping>
<filter-name>orbeon-xforms-filter</filter-name>
<url-pattern>/page/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
</filter-mapping>
<filter>
<filter-name>RackFilter</filter-name>
<filter-class>org.jruby.rack.RackFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>RackFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<listener>
<listener-class>org.jruby.rack.rails.RailsServletContextListener</listener-class>
</listener>
</web-app>
Thanks in advance
Sandro.
I'm not familiar with Orbeon XForms, so I'm not positive about what your problem is. But according to the above web.xml, the Orbeon filters are only applied to /orbeon/* and /page/* URLs, while the Rack filter gets applied to everything.
If the servlet approach works, why not stick with that?
How can I enable SSI on Tomcat 7?.
I follow the directions however it doesn't work. I changed my main file's extension from html to shtml (not imported one) and unquoted that lines at web.xml:
<servlet>
<servlet-name>ssi</servlet-name>
<servlet-class>
org.apache.catalina.ssi.SSIServlet
</servlet-class>
<init-param>
<param-name>buffered</param-name>
<param-value>1</param-value>
</init-param>
<init-param>
<param-name>debug</param-name>
<param-value>0</param-value>
</init-param>
<init-param>
<param-name>expires</param-name>
<param-value>666</param-value>
</init-param>
<init-param>
<param-name>isVirtualWebappRelative</param-name>
<param-value>0</param-value>
</init-param>
<load-on-startup>4</load-on-startup>
</servlet>
What do do more, where is the wrong?
You also need to uncomment the SSI servlet mapping in web.xml
<servlet-mapping>
<servlet-name>ssi</servlet-name>
<url-pattern>*.shtml</url-pattern>
</servlet-mapping>
And create $CATALINA_HOME/conf/Catalina/localhost/<your app name>.xml
<?xml version="1.0" encoding="UTF-8"?>
<Context privileged="true" >
</Context>
http://tomcat.apache.org/tomcat-7.0-doc/ssl-howto.html#Introduction_to_SSL
You have to add the SSL configuration to the tomcat config this is detailed above and should help you out any questions after reading this let me know