There is ClassnotFound Exception in my struts2 application - exception

<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>

Related

JSF2.0: Mojibake for primefaces4.0

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" />

working of NTLMv2 with LDAP

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

JRuby Rack - How to add a servlet filter?

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 to Enable SSI (Server Side Includes) on Tomcat 7 at Ubuntu?

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

How to configure cache for static resources in web.xml for Jetty?

I was reading this:
http://docs.codehaus.org/display/JETTY/LastModifiedCacheControl
It says
The Jetty default servlet allows the cache control header to
be set for static content by using the cacheControl init parameter
using:
<init-param>
<param-name>cacheControl</param-name>
<param-value>max-age=3600,public</param-value>
</init-param>
However, I am not sure that I am using the default servlet. At least
such configuration is not in web.xml:
<web-app>
<display-name>Wicket QuickStart</display-name>
<context-param>
<param-name>configuration</param-name>
<param-value>development</param-value>
</context-param>
<servlet>
<servlet-name>quickstart</servlet-name>
<servlet-class>org.apache.wicket.protocol.http.WicketServlet</servlet-class>
<init-param>
<param-name>applicationClassName</param-name>
<param-value>wicket.quickstart.WicketApplication</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>quickstart</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
</web-app>
I would like to configure cache for static resources such as:
/src/webapp/*, i.e.: /src/webapp/images, /src/webapp/css, /src/webapp/js, etc.
What should I add into my web.xml?
Need to add the following to your web.xml
<servlet>
<servlet-name>default</servlet-name>
<servlet-class>org.mortbay.jetty.servlet.DefaultServlet</servlet-class>
<init-param>
<param-name>cacheControl</param-name>
<param-value>max-age=3600,public</param-value>
</init-param>
</servlet>