Server-wide Servlet Filter

Is there a way to deploy a server-wide servlet filter, that applies to all the deployed webapps?
thanx

Hi Mike,
I have a solution and can confirm all is working well.  This is how to do it...
1.) Create a master sieve config file
sudo mkdir /var/lib/dovecot/sieve/
sudo vi /var/lib/dovecot/sieve/default.sieve
In that file, add:
require ["fileinto"];
# Move spam to spam folder
if header :contains "X-Spam-Flag" ["YES"] {
  fileinto "Junk";
  stop;
sudo chown -R _dovecot:mail /var/lib/dovecot
sudo sievec /var/lib/dovecot/sieve/default.sieve
2.) Add the SPAM sieve conf include to the main config
sudo vi /Library/Server/Mail/Config/dovecot/conf.d/90-sieve.conf
Add the following (you can use the existing sieve_before and modify it):
sieve_before = /var/lib/dovecot/sieve/default.sieve
3.) Ensure that the Junk Folder is automatically created and subscribed to by default
sudo vi /Library/Server/Mail/Config/dovecot/conf.d/15-mailboxes.conf
Replace:
mailbox Junk {
    special_use = \Junk
With:
mailbox Junk {
    auto = subscribe
    special_use = \Junk
4.) Restart all Mail server services using the Server.app
5.) Ensure that SPAM is going into the Junk folder correctly.  You can test here: http://www.emailsecuritycheck.net/

Similar Messages

  • Searching specific arguments in context sent to server in Servlet Filter

    hi,
    I would like to build a filter, that recieves the html content, searches for specific words (for example: "taste"=shoo) and according to that sets the expires or content type of the response.
    I understand that I have to build a Wrapper, but how do I extract the request context from the server?

    would you send the trace of error/exceptions for the case in 10.1.3?

  • Servlet Filter not working in Oracel9iAS(9.2.0.3)

    Hi,
    May i know what cause the servlet filter not workinng in Oracle9iAS? Is there any library files missing? I have tried deploy the war file in Tomcat but is working fine but when i try to deploy in Oracle9iAS, the application seems like can't call the servlet filter.
    Please advice.
    Thanks.
    Regards,
    Ming Jade

    I'm not exactly sure what version you are using.
    Servlet Filters were introduced in Servlet 2.3 which was part of J2EE 1.3.
    Oracle9iAS 9.0.2.3 is J2EE 1.2 compatible .
    Oracle Application Server 10g 9.0.4.x and 10.1.2 is J2EE 1.3 compatible
    Oracle Application Server 10g 10.1.3 is J2EE 1.4 compatible.
    So the problem could be that the version of the product you are using does does not support the version of the servlet spec that covers Servlet Filters.
    Can you upgrade to/install the 10.1.2 release as a minimum?
    cheers
    -steve-

  • How to Add a Servlet Filter to Reports 11.1.1.2.0

    I am running Fusion Middleware 11g (Weblogic 10.3.2), with Oracle Forms/Reports 11.1.1.2.0. The installation is running the default managed servers WLS_FORMS and WLS_REPORTS.
    How can I add a Servlet Filter to the Reports 11.1.1.2.0 application which is running under the WLS_REPORTS managed server?
    I have read the Oracle Doc ID: 418366.1, which describes a process for adding a servlet filter to Reports Developer 10.1.2.2, but I am unclear as to which web.xml file I need to modify in weblogic and where to place the class file for the servlet filter.
    Thanks in advance for your help.

    I can provide some partial help.
    The set up I have was running it locally on Windows 7 (64 bit) laptop and running the reports server (version 11.1.1.4) in XP Mode as part of Windows 7 Professional.
    To find which web.xml file to change, I searched the directories for web.xml and then removed then renamed the web.xml files to something else to see which impacted the start up of the reports server.
    It turns out it was a web.xml file in web.war file in the following directory which impacted the start up:
    C:\Oracle\Middleware\user_projects\domains\ClassicDomain\servers\WLS_REPORTS\tmp\_WL_user\reports_11.1.1.2.0\1ww4ab
    So used winzip to extract files, update web.xml file and and java class as a jar file in the WEB-INF\lib directory and zipped back up to a web.war and put it in the above directory and restarted the Reports Server.
    Note the url pattern I used was slightly different to that shown in the oracle note (forward slash before asterix):
    <url-pattern>/rwservlet/*</url-pattern>
    Have not investigated how to do in for a production environment, but hopefully this information is of use.
    Les.

  • Memory leak in Servlet Filter handling?

    In Sun Web Server 6.1, I'm finding a memory leak when using servlet filters. I've even created a "no op" servlet filter. When it's registered, every 10000 hits or so to filtered static content will eat up about 5 to 10 MB of RAM. The JVM heap size doesn't increase.
    When I remove the filter, I've hit the same static page on the server 50000 times without seeing an increase in memory usage by the process.
    This is on Windows 2000, and I think the Sun Web Server 6.1 is SP1. I haven't tried SP2 yet.
    For reference, here's the filter I put in:
    public class NoOpFilter implements Filter
    public void init(FilterConfig arg0) throws ServletException {}
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException
    chain.doFilter(request, response);
    public void destroy() {}
    }

    I found the bug. I get the memory leak if magnus.conf has either or both of the following entries:
    AdminLanguage en
    DefaultLanguage en
    If I delete the entries, the memory leak goes away. I suppose this should get fixed by Sun sometime. Maybe I'll figure out how to officially report the bug later.

  • Servlet Filter

    Hi, all
    I work on a web application running on a Jboss server and i would like to filter all the http request in order to save it in a database. (i save those informations for manage web stats).
    I suppose i may use servlet filter, but i don't know the operation of this
    Does anyone could help me giving some example and the protocol to set up this on the server (file server configuration as web.xml)

    Well here is what I know. I hope it helps.....
    First thing is to create a class that implements the "javax.servlet.Filter" interface. But there are also other Filter interfaces that you could use depending on what you want: Filter, FilterChain, and FilterConfig.
    You have to implement the init(), destroy() and doFilter() methods (I ommitted the arguments).
    But most of your work will be done in the doFilter () method. You could extract request information from one of the arguments in these method and have a datasource connection to save to your back-end.
    Something like :
    public void doFilter( ServletRequest request, ServletResponse responce, FilterChain chain ) throws  ServletException {
          HttpServletRequest httpRequest = (HttpServletRequest) request;
          backEndDelegate.saveInformation(  request.getRemoteAddr(),  request.getRemoteHost() );
          chain.doFilter( request, responce );
    }Second, you need to configure the Filter. In the web.xml file add the following tags:
    <filter>
         <filter-name>StatsFilter</filter-name>
          <description>Logs Web Stats to the back end</description>
         <filter-class>com.yourpackage.StatsFilter</filter-class>
         <!--  you can also pass parameters to the StatsFilter -->
          <!--
           <init-param>
                   <param-name>some parameter</param-name>
                   <param-value>some parameter</param-value>
            </init-param>
            -->
    </filter>
    <filter-mapping>
          <filter-name>StatsFilter</filter-name>
          <filter-pattern>*.jsp</filter-pattern>
    </filter-mapping>That is just a little example. You can associate a filter with a Servlet using the <filter-mapping> tags too. And you can also do filter chains, but I don't feel like going there.
    I sure hope that it was helpful. If not then "RTFM"

  • How to embed servlet filter to an existing website

    I want to make an application using java servlet filters and I want to know the possibility of making this application as an add-on where anyone could take this application as it is and attach it to his website without knowing anything about servletes and with a very low programming or no programming effort, is it possible? If yes how and if no what is the alternative?

    836522 wrote:
    I really cant thank everyone enough for your help, thank you :)
    why not proxy? because I don't want the full functionalities of a proxy, so I thought why not to implement a servlet filter to do my task especially that all what I want to do could be easily implemented using the methods provided in servlets/filters. what I am thinking of now is to install servlet container and make it run in the proxy mode so any request to the website I want to protect will be directed first to the servlet then the servlet decide whether to pass this request to website or not, what do you think of this??I am afraid that will either not work or be overly complicated. The problem is with this
    so any request to the website I want to protect will be directed first to the servlet then the servlet decide whether to pass this request to website or notHow will the servlet pass on the request to the web site? Since it is not part of the other application, it cannot do a forward or include on the resource. Similarly a chain.doFilter() which is the normal way for the Filter to pass the request along to the end resource will not work.
    You can theorotically use a HttpClient from the Filter which will create a new http request to the underlying web site and flush the response received back to the browser. I think using a Proxy is the best bet. I would recommend an apache http server with some custom modules to implement your 'filter' code
    ram.

  • Can java servlet filter capture anchors in URL

    Hi I need to capture the anchor in the URL that is requested by user. For example, if some one clicks http://www.abc.com/somepage.html#intro, I would like to capture all the info in the URL including "intro". Is it possible through the java servlet filter architecture? If so, what API should I use? Some sample code would be very helpful as well. Thanks!!

    No, this is not possible. Anchors are handled by the client (i.e. web browser). The server never sees them.

  • SSO2Ticket within servlet filter - Orionserver

    Hi,
    I need to validate user that already logged in via SAP portal.
    So I get ticket as cookie.
    I read this cookie and try to validate it with SSO2Ticket.java that is JNI wrapper for C application.
    For this I put 2 files in system32 folder: sapssoext.dll and sapsecu.dll and I register first one with regsvr32.
    Now I try to run SSO2Ticket.java and it works perfectly. But I need this functionality inside my login servlet filter.
    So I still use SSO2Ticket.java but in stead of main method I put same calls into may filter.
    It seams to load sapssoext.dll but what ever method I call I get:
    java.lang.UnsatisfiedLinkError
    Here is method that performs calls. Method is called from filter doFilter method.
    There is SSO2Ticket.java attached here.
    private void checkSAPTicket(HttpServletRequest request) throws Exception
    System.out.println("checkSAPTicket");
    //Ticket is hardcoded and valid
    String ticket="AjExMDAgABNwb3J0YWw6U0VEQVZJRFNTT05QiAATYmFzaWNhdXRoZW50aWNhdGlvbgEADFNFREFWSURTU09OUAIAAzAwMAMAA0hTMQQADDIwMDYxMjE1MDgwOQUABAAAAAgKAAxTRURBVklEU1NPTlD/APUwgfIGCSqGSIb3DQEHAqCB5DCB4QIBATELMAkGBSsOAwIaBQAwCwYJKoZIhvcNAQcBMYHBMIGAgEBMBMwDjEMMAoGA1UEAxMDSFMxAgEAMAkGBSsOAwIaBQCgXTAYBgkqhkiG9w0BCQMxCwYJKoZIhvcNAQcBMBwGCSqGSIb3DQEJBTEPFw0wNjEyMTUwODA5NTFaMCMGCSqGSIb3DQEJBDEWBBRhLnWWaKW8yXyGSrs6gBTC97XnlTAJBgcqhkjOOAQDBC8wLQIUQrgjCpKQeEScuFP7rGWO7V76b5ICFQCT0WhSpqIB11L+HVLmyAjcWeUlw==";
    // get PAB (public key) of issuing system. It is in root of my app server
    File pab=new File("verify.pse");
    String pabFilePath=pab.getAbsolutePath();
    System.out.println("pabFilePath="+pabFilePath);
    Object [] o=null;
    File sapsecu=new File("sapsecu.dll");
    String ssf_library=sapsecu.getAbsolutePath();
    System.out.println("ssf_library="+ssf_library);
    try
    String version =SSO2Ticket.getVersion();
    //String ssf_library="sapsecu.dll";
    if(!SSO2Ticket.init(ssf_library)) {
    System.out.println ("Could not load library: " + ssf_library);
    return;
    System.out.println("evalLogonTicket call...");
    // Validate logon ticket.
    o = SSO2Ticket.evalLogonTicket (ticket, pabFilePath, null);
    } catch (Exception e) {
    System.out.println(e);
    } catch (Throwable te) {
    System.out.println(te);
    System.out.println("evalLogonTicket call ended...");
    And the log I get when I run this:
    checkSAPTicket
    pabFilePath=C:\project\GSS\orion-2.0.2\verify.pse
    ssf_library=C:\project\GSS\orion-2.0.2\sapsecu.dll
    SAPSSOEXT loaded.
    static part ends.
    java.lang.UnsatisfiedLinkError: getVersion
    evalLogonTicket call ended...
    Could not validate SAP login ticket from HTTP Header.
    If I omit call SSO2Ticket.getVersion(); than the same exception is for SSO2Ticket.init(ssf_library).

    Hi,
    I think java.lang.UnsatisfiedLinkError means that it cannot find the .dll files.
    I am not sure it will find them even if the are registered with regsvr32.
    Have you tried placing the .dll files somewhere in the classpath ?
    Dagfinn

  • Please Help!!! Deployment failure error Jps servlet filter creation failed.

    Hello All,
    We are trying to move from 10g to Jdev 11g. We are in the process of deploying the WAR application to weblogic server. However, we keep getting one error after another. This is the latest one:
    [12:40:02 PM] [Deployer:149193]Operation 'deploy' on application 'webapp1' has failed on 'AdminServer'
    [12:40:02 PM] [Deployer:149034]An exception occurred for task [Deployer:149026]deploy application webapp1 on AdminServer.: JPS-00063: Jps servlet filter creation failed. Reason: oracle.security.jps.JpsException: JPS-00065: Jps platform factory creation failed. Reason: java.security.PrivilegedActionException: oracle.security.jps.JpsException: JPS-00065: Jps platform factory creation failed. Reason: java.lang.ClassNotFoundException: oracle.security.jps.wls.JpsWlsPlatformFactory...:oracle.security.jps.JpsRuntimeException:JPS-00063: Jps servlet filter creation failed. Reason: oracle.security.jps.JpsException: JPS-00065: Jps platform factory creation failed. Reason: java.security.PrivilegedActionException: oracle.security.jps.JpsException: JPS-00065: Jps platform factory creation failed. Reason: java.lang.ClassNotFoundException: oracle.security.jps.wls.JpsWlsPlatformFactory....
    [12:40:02 PM] Weblogic Server Exception: weblogic.application.ModuleException: JPS-00063: Jps servlet filter creation failed. Reason: oracle.security.jps.JpsException: JPS-00065: Jps platform factory creation failed. Reason: java.security.PrivilegedActionException: oracle.security.jps.JpsException: JPS-00065: Jps platform factory creation failed. Reason: java.lang.ClassNotFoundException: oracle.security.jps.wls.JpsWlsPlatformFactory...:oracle.security.jps.JpsRuntimeException:JPS-00063: Jps servlet filter creation failed. Reason: oracle.security.jps.JpsException: JPS-00065: Jps platform factory creation failed. Reason: java.security.PrivilegedActionException: oracle.security.jps.JpsException: JPS-00065: Jps platform factory creation failed. Reason: java.lang.ClassNotFoundException: oracle.security.jps.wls.JpsWlsPlatformFactory...
    [12:40:02 PM] See server logs or server console for more details.
    [*12:40:02 PM] weblogic.application.ModuleException: JPS-00063: Jps servlet filter creation failed. Reason: oracle.security.jps.JpsException: JPS-00065: Jps platform factory creation failed. Reason: java.security.PrivilegedActionException: oracle.security.jps.JpsException: JPS-00065: Jps platform factory creation failed. Reason: java.lang.ClassNotFoundException: oracle.security.jps.wls.JpsWlsPlatformFactory...:oracle.security.jps.JpsRuntimeException:JPS-00063: Jps servlet filter creation failed. Reason: oracle.security.jps.JpsException: JPS-00065: Jps platform factory creation failed. Reason: java.security.PrivilegedActionException: oracle.security.jps.JpsException: JPS-00065: Jps platform factory creation failed. Reason: java.lang.ClassNotFoundException: oracle.security.jps.wls.JpsWlsPlatformFactory...*[12:40:02 PM] Deployment cancelled.
    I am sorry to have made the post title so eye catching, but we keep getting issues, one after the other and we are fast approaching the deadline for this upgrade. Thanks for being understanding.
    Please help!!!
    Edited by: user12054715 on Aug 29, 2011 7:16 PM

    UPDATE:
    I have been trying to find the class JpsWlsPlatformFactory and some sites say that it is present in the jar - jps-api.jar. So I looked in D:\Oracle\Middleware\oracle_common\modules\oracle.jps_11.1.1 and found a jar called jps-api.jar but the class JpsWlsPlatformFactory was not there. I also tried to find this class on the web but no success.
    This is very wierd that oracle.security.jps.wls.JpsWlsPlatformFactory is nowhere to be found on the internet!!!
    NOTE: Our application is based on JSF/ADF.
    Please help!
    Edited by: user12054715 on Aug 29, 2011 9:43 PM

  • Servlet filter is not protecting html files

    Hi All,
    I am using Iplanet web server 6.0 SP4 with JDK v1.3.1_06. I am able to protect the JSP page using the servlet filter. But when I try to access the html files then filter is not getting invoked. The content of web-apps.xml is given below :-
    <web-app>
    <filter>
    <filter-name>TestIntercepto</filter-name>
    <filter-class>testinterceptor</filter-class>
    </filter>
    <filter-mapping>
    <filter-name>TestInterceptor</filter-name>
    <url-pattern>/*</url-pattern>
    </filter-mapping>
    </web-app>
    Can you guys tell me the reason ?

    I don't know much about IPlanet but with Apache/Tomcat it is possible to configure Apache to serve static content from a web application (eg: non-JSP pages) which would mean that Tomcat was never able to intercept the request for the page in the first place. Just a though.

  • Access of JSF Beans from Servlet Filter

    Is there any way how can I access session JSF beans from servlet filter?
    I need to check certain value of JSF bean stored in session scope in my filter.
    Thanks
    ferdo

    Frank,
    I am not sure about phase listener, this is the whole situation:
    as I am not using Container Managed Security with my JSF, after I do sucessfull login into application, I need to store some information into the session scope (user etc) and in the servlet filter I need to find out if the user is connected.
    I was trying to put such info into Servlet Session directly in my bean via External Context and reading the info in Filter.
    This is working fine when my application is running locally (jdev oc4j) but once deployed into Application server, when user login first time, user information is somehow removed from the session, and cannot figure out why.
    So I was thinking to try another approach, to find out from servlet filter if JSF bean value is set or not.
    Any other suggestions? Do not want to swicth to Container Manages Security now.
    ferdo
    null

  • Strange behavior when using servlet filter with simple index.htm

    I am new to J2EE development so please tolerate my ignorance. I have a web application that starts with a simple index.htm file. I am using a servlet filter throughout the website to check for session timeout, redirecting the user to a session expiration page if the session has timed out. When I do something as simple as loading the index.htm page in the browser, the .css file and one image file that are associated, or referenced in the file are somehow corrupted and not being rendered. How do I get the filter to ignore css and image files??? Thank you!!
    The servlet filter:
    import java.io.IOException;
    import javax.servlet.Filter;
    import javax.servlet.FilterChain;
    import javax.servlet.FilterConfig;
    import javax.servlet.ServletException;
    import javax.servlet.ServletRequest;
    import javax.servlet.ServletResponse;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    public class SessionTimeoutFilter implements Filter {
         String[] excludedPages = {"SessionExpired.jsp","index.htm","index.jsp"};
         String timeoutPage = "SessionExpired.jsp";
         public void destroy() {
         public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
              if ((request instanceof HttpServletRequest) && (response instanceof HttpServletResponse)) {
                   HttpServletRequest httpServletRequest = (HttpServletRequest) request;
                   HttpServletResponse httpServletResponse = (HttpServletResponse) response;
                   //httpServletResponse.setHeader("Cache-Control","no-cache");
                   //httpServletResponse.setHeader("Pragma","no-cache");
                   //httpServletResponse.setDateHeader ("Expires", 0);
                   String requestPath = httpServletRequest.getRequestURI();
                   boolean sessionInvalid = httpServletRequest.getSession().getAttribute("loginFlag") != "loggedIn";               
                   System.out.println(sessionInvalid);
                   boolean requestExcluded = false;
                   System.out.println(requestExcluded);
                   for (int i=0;i<excludedPages.length;i++){
                        if(requestPath.contains(excludedPages)){
                             requestExcluded = true;
                   if (sessionInvalid && !requestExcluded){
                        System.out.println("redirecting");
                        httpServletResponse.sendRedirect(timeoutPage);
              // pass the request along the filter chain
              chain.doFilter(request, response);
         public void init(FilterConfig arg0) throws ServletException {
              //System.out.println(arg0.getInitParameter("test-param"));
    The index.htm file (or the relevant portion)<HTML>
    <Head>
    <META http-equiv="Content-Style-Type" content="text/css">
    <LINK href="RTEStyleSheet.css" rel="stylesheet" type="text/css">
    <TITLE>Login</TITLE>
    </HEAD>
    <BODY>
    <FORM NAME="Login" METHOD="POST" ACTION="rte.ServletLDAP"><!-- Branding information -->
    <table width="100%" border="0" cellpadding="0" cellspacing="0">
         <tr>
              <td width="30%" align="left"><img src="images/top_logo_new2.gif">
              </td>
              <td width="37%" align="center"></td>
              <td width="33%" align="right"></td>
         </tr>
    </table>
    My web.xml entry for the filter:     <filter>
              <description>
              Checks for a session timeout on each user request, redirects to logout if the session has expired.</description>
              <display-name>
              SessionTimeoutFilter</display-name>
              <filter-name>SessionTimeoutFilter</filter-name>
              <filter-class>SessionTimeoutFilter</filter-class>
              <init-param>
                   <param-name>test-param</param-name>
                   <param-value>this is a test parameter</param-value>
              </init-param>
         </filter>
         <filter-mapping>
              <filter-name>SessionTimeoutFilter</filter-name>
              <url-pattern>/*</url-pattern>
              <dispatcher>REQUEST</dispatcher>
              <dispatcher>FORWARD</dispatcher>
         </filter-mapping>

    Hi,
    Try adding CSS files and images to the excluded Pages.

  • How to terminate the "process" running in weblogic server by servlet

    hi all !!
    i have executed a external command from servlet but i am not getting the output untill i logoff the weblogic server.
    now i want to kill the process running in my server by servlet code.how could i do this? here is my code ,it is executing the command but not giving output untill i logoff the server.
                     Runtime rt = Runtime.getRuntime();
                     Process proc = rt.exec("var.bat");
                     proc.wait(60);
                     proc.destroy();Thanks and Regards
    Allwyn

    hey !
    anybody is here?????

  • Uploading a file to server using servlet (Without using Jakarta Commons)

    Hi,
    I was trying to upload a file to server using servlet, but i need to do that without the help of anyother API packages like Jakarta Commons Upload. If any class for retrieval is necessary, how can i write my own code to upload from client machine?.
    From
    Velu

    <p>Why put such a restriction on the solution? Whats wrong about using that library?
    The uploading bit is easy - you put a <input type="file"> component on the form, and set it to be method="post" and enctype="multipart/form-data"
    Reading the input stream at the other end - thats harder - which is why they wrote a library for it. </p>
    why i gave the restriction is that, i have a question that <code>'can't we implement the same upload'</code>
    I was with the view that the same can be implemented by our own code right?

Maybe you are looking for

  • Creation of user in J2EE ?

    Dear all experts We are implementing SAP BI 7.0 SP11 and the portal and are trying to get these two 100% connected with the BI template installer etc. But when I run the "BI support tool (com.sap.ip.bi.supportdesk.default) I get an error saying : "Cr

  • Using Package to produce pl/sql function body returning sql query Report

    I have existing code that we want to use in building reports in APEX. We are needing to modify it slightly to handle some new requirements, but would like to use them in reports based upon SQL query (pl/sql function body returning sql query) function

  • Compilation errors

    Hi, I need to modify an standard Oracle Applications form, ARXRWRCT.fmb in order to add a column name into a record group. I transferred, in binary mode, the ARXRWRCT.fmb from our Unix server onto my client machine (its size was about 2.7Mb). Using F

  • Screen dims in itunes based on video content

    When watching a video in iTunes my screen dims based on the content of the video to such a level that it's very hard to see anything. This only happens when the content of the video is actually dark at the moment (eg shadows, at night). When the cont

  • How is the largest cde point differs from UTF-8 to UTF-16

    how is the largest cde point differs from UTF-8 to UTF-16 the largest code point is 10FFFF for both of them then how is differ from the fromat thank you, Regards, Jagrut BharatKumar Shukla