How to intercept Http requests by writing an App Server plugin?

Hi all,
My requirement of "Application Server plugin/filter" is to intercept all Httprequests coming to an
Application Server instance (and not webserver), get the related information from the request, do whatever
i want to do and then forward the request based on the info available in the request header to any
webapplication or EAR deployed in the application server.
I do not want to implement as a Servlet filter in a webapp. which is intrusive to the webapp.
as we are aware, Servlet Filters can be attached to resources in a Web application and are configured in the
web.xml file.
I have tried out my requirements in Tomcat as follows, it works:
In Tomcat, Valves are attached to a Tomcat container and are configured using a <Valve> element in the
server.xml file.
We have modified RequestDumperValve Filter ( source available) class extending Valve to intercept Http
requests.
I perform whatever i want to do in this custom Filter and then able to forward to the next valve in the valve
chain of Tomcat container. I have Configured this valve in server.xml and it works fine.
My queries are:
1. Can i do it the same thing in WebLogic application server or other IBM Websphere application server ?
2. Do the commercial appservers expose their APIs ( e.g. like Valve or Filter in Tomcat ) such that i can
implement an application server plugin ?
i.e. Are there any such Filter classes available which will intercept the Http request processing pipleine
in application server ( precisely, its web container )
If so, can you pls provide pointers for WebLogic application server and IBM Webpshere application server
3. Is this against J2ee specs ?
Appreciate if you can provide me any clues, tips, solutions, pointers regarding this problem.
thanks and regards
rajesh

Try proxyHandler property and implement a custom ProxyHandler.
ex:
<property name="authPassthroughEnabled" value="true"/>
<property name="proxyHandler" value="com.sun.enterprise.web.ProxyHandlerImpl"/>
null

Similar Messages

  • How to Intercept Http requests by Application Server plugin ?

    Hi all,
    My requirement of "Application Server plugin/filter" is to intercept all Httprequests coming to an
    Application Server instance (and not webserver), get the related information from the request, do whatever
    i want to do and then forward the request based on the info available in the request header to any webapplication or EAR deployed in the application server.
    I do not want to implement as a Servlet filter in a webapp. which is intrusive to the webapp.
    as we are aware, Servlet Filters can be attached to resources in a Web application and are configured in the web.xml file.
    I have tried out my requirements in Tomcat as follows, it works:
    In Tomcat, Valves are attached to a Tomcat container and are configured using a <Valve> element in the server.xml file.
    We have modified RequestDumperValve Filter ( source available) class extending Valve to intercept Http requests.
    I perform whatever i want to do in this custom Filter and then able to forward to the next valve in the valve chain of Tomcat container. I have Configured this valve in server.xml and it works fine.
    My queries are:
    1. Can i do it the same thing in SunONe application server or other IBM Websphere application server ?
    2. Do the commercial appservers expose their APIs ( e.g. like Valve in Tomcat ) such that i can implement an application server plugin ?
    i.e. Are there any such Filter classes available which will intercept the Http request processing pipleine
    in application server ( precisely, its web container )
    If so, can you pls provide pointers for SunONE application server and IBM Webpshere application server
    3. Is this against J2ee specs ?
    Appreciate if you can provide me any clues, tips, solutions, pointers regarding this problem.
    thanks and regards
    rajesh

    Thanks for the info, vbk.
    Actually we are looking filers not at the servlet level in a web application.
    We are looking ways for the filter to work at web container level across different web applications... That is whatever comes to the application server, should hit at this filter ,then we perform some processing, analysis and then continue for the correspnding web application
    thanks
    rajesh

  • How to Record HTTP Requests and POST data

    Hai all..
    Can anyone help me to solve this issue..
    How to Record HTTP Requests and POST data by using java..
    regards
    Ranjith Nair

    You should read about TCP and splitting data stream into packets and learn how to understand packet header to assemble stream from packets.
    Actually there are few different stages:
    1. detect handshake to start new empty stream within your code;
    2. detect subsequent packets and assemble stream (there are counters within packet header and they will help).
    After creating start of TCP stream (usually 1KB is enough) you'll be able to detect is it HTTP request/header or no and start logging or ignoring packets for this connection.

  • How to monitor Http Request and Response when load testing is going on

    Hi,
    can any one please let me know how to monitor http request sent and response received for each virtual ID when a load test is going on ?
    Thanks,

    You used to be able to see what the VUs "see" using the "VU Monitor" (it would only do a simple rendering of the HTML but it served it's purpose). However this was replaced (in v12 I think?) by the "VU Log". While this offers simlilar functionality, I have had problems getting to see the same level of detail. You may need to use the "debug" modes. Also check the "Content" tab within the VU Logs (it is the closest equivalent to the HTML you would see in the responses in the old VU Monitor).

  • How to Implement HTTP Request Status Code Processing

    I actually have two questions. First, I wondering how to add multiple status code processing to an http request. Secondly, I was wondering how to go about using alternate http requests to different servers in case the primary server is down. What kind of parameter would the program use to determine that the server is unavailable and switch to another server??
    Currently, the program I've written calls an rdf server (http://www.rdfabout.com/sparql) using a sparql query,
    the server returns an xml string, the program parses it, and calculates numbers
    from the string. The program works, but the problem is that the server is down occasionally.
    When the server is down, we need to add calls to another server to
    increase reliability. So, the next task is to call this server:
    http://www.melissadata.com/lookups/ZipDemo2000.asp
    I need to do exactly the same things I did with the rdf server. The
    difference will be constructing a request and a bit different parsing of
    the response.
    current SPARQL query is defined as follows:
    PREFIX dc:  <http://purl.org/dc/elements/1.1/>
    PREFIX census: <http://www.rdfabout.com/rdf/schema/census/>
    PREFIX census1: <tag:govshare.info,2005:rdf/census/details/100pct/>
    DESCRIBE ?table WHERE {
    <http://www.rdfabout.com/rdf/usgov/geo/census/zcta/90292> census:details
    ?details .
    ?details census1:totalPopulation ?table .
    ?table dc:title "SEX BY AGE (P012001)" .
    }current HTTP Request is defined as follows:
    import java.net.*;
    import java.net.URL;
    import java.net.URLConnection;
    import java.io.*;
    import java.io.DataOutputStream;
    import java.io.BufferedReader;
    import java.io.StringReader;
    import java.io.InputStreamReader;
    import java.io.PrintStream;
    import java.util.Scanner;
    import java.util.regex.Matcher;
    import java.util.regex.Pattern;
    import java.util.Arrays; 
    public class MyConnection
         static Scanner sc = new Scanner(System.in);//allows user to input zipcode
        public static void main(String[] args) throws Exception
             int zip;//zipcode is declared as integer format
            //User defines zip through input
            //proceed to put SPARQL query into string, which is then used to call the server
            String requestPart1 =
            "query=PREFIX+dc%3A++%3Chttp%3A%2F%2Fpurl.org%2Fdc%2Felements%2F1.1%2F%3E+%0D%0APREFIX+census%3A+%3Chttp%3A%2F%2Fwww.rdfabout.com%2Frdf%2Fschema%2Fcensus%2F%3E+%0D%0APREFIX+census1%3A+%3Ctag%3Agovshare.info%2C2005%3Ardf%2Fcensus%2Fdetails%2F100pct%2F%3E+%0D%0A%0D%0ADESCRIBE+%3Ftable+WHERE+%7B+%0D%0A+%3Chttp%3A%2F%2Fwww.rdfabout.com%2Frdf%2Fusgov%2Fgeo%2Fcensus%2Fzcta%2F";
            String requestPart2 = "" + zip; // zipcode is transformed from int to string format and plugged into SPARQL query here
            String requestPart3 =
            "%3E+census%3Adetails+%3Fdetails+.+%0D%0A+%3Fdetails+census1%3AtotalPopulation+%3Ftable+.+%0D%0A+%3Ftable+dc%3Atitle+%22SEX+BY+AGE+%28P012001%29%22+.+%0D%0A%7D%0D%0A&outputMimeType=text%2Fxml";
            String response = "";
            URL url = new URL("http://www.rdfabout.com/sparql");//designates server to connect to
            URLConnection conn = url.openConnection();//opens connection to server
            // Set connection parameters.
            conn.setDoInput (true);
            conn.setDoOutput (true);
            conn.setUseCaches (false);
            // Make server believe we are form data…
            conn.setRequestProperty("Content-Type","application/x-www-form-urlencoded");
            DataOutputStream out = new DataOutputStream (conn.getOutputStream ());
            // Write out the bytes of the content string to the stream.
            out.writeBytes(requestPart1 + requestPart2 + requestPart3);
            out.flush ();
            out.close ();
            // Read response from the input stream.
            BufferedReader in = new BufferedReader (new InputStreamReader(conn.getInputStream ()));
            String temp;
            while ((temp = in.readLine()) != null)
                 response += temp + "\n";
            temp = null;
            in.close ();
            //parsing stuff is taken care of after here
    }What remains now is to:
    1) add status code processing: notify if the server is not available, ect.
    2) add ability to connect to additional server if primary server is down.
    I'm thinking an if/else statement, which I've tried a few different ways,
    but I don't quite know how to implement that...Also trying to add the
    status code processing/error handling, but I'm not sure how to do that
    for multiple/different errors, such as 404, 503, 504, ect.. try/catch statements?
    So yeah, just been scratching my head on this trying to figure out how to work it..
    If you can help me out on this, I've been going nuts trying to figure this out...

    I think your issue comes form the fact that you are not casting URLConnection to HttpURLConnection.
    Doing the cast would allow you to use getResponseCode() - among other methods - and test for a response different than 200.
    Read: [http://mindprod.com/jgloss/urlconnection.html|http://mindprod.com/jgloss/urlconnection.html]

  • How to test HTTP request for Sender SOAP Channel

    Hi all,
    We are testing Soap requests from SOAP UI tool.
    We are able to call HTTPS calls from SOAPUI tool, but unable to call HTTP request.
    we eanbles ssl and able to post https requests.
    please advice .
    Thanks
    RGDASARI

    Hi Stefan, I configured the way you have put it, but I get the error "no receiver could be determined"
    Here are my settings:
    Sender service - HTTP_SEND
    sender o/b interface - PROD_MSG_INT_OB_ASYNC
    receiver service - FILE_RECEIVE
    receiver i/b interface - PROD_MSG_INT_IB_ASYNC
    receiver communication channel - FILE adapter
    JAVA script:
    String Party       = "MFC";
    String Service     = "HTTP_SEND";
    String XINameSpace = "mfc%3Anamespace1";
    String Interface   = "PROD_MSG_INT_OB_ASYNC";
    String Url   = "http://nemo:8000/sap/xi/adapter_plain?";
    XML DATA File:
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:PRODUCT xmlns:ns0="mfc:namespace1">
    <ID>E</ID>
    <NAME>thank god</NAME>
    <BRAND>SOME BRAND</BRAND>
    </ns0:PRODUCT>
    Stefan Am I missing anything?
    XML error message:
    <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
    - <!--  Receiver Identification
      -->
    - <SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="1">
      <SAP:Category>XIServer</SAP:Category>
      <SAP:Code area="RCVR_DETERMINATION">NO_RECEIVER_CASE_BE</SAP:Code>
      <SAP:P1 />
      <SAP:P2 />
      <SAP:P3 />
      <SAP:P4 />
      <SAP:AdditionalText />
      <SAP:ApplicationFaultMessage namespace="" />
      <SAP:Stack>No receiver could be determined</SAP:Stack>
      <SAP:Retry>N</SAP:Retry>
      </SAP:Error>
    It would be great if you have solution for this.
    Regards
    felix

  • Problem with HTTPS requests to host with untrusted server certificate

    Hi,
    I develop an iPhone framework which sends HTTPS requests in order to communicate with a publicly available backend server. Currently I have a big problem regarding untrusted server certificates.
    The certificate of the backend server is not signed by a trusted CA, so my first approach was to use NSURLRequest's private allowsAnyHTTPSCertificateForHost. While this worked as expected an was fine as temporary workaround, our customer demands a clean solution as final result. Therefore I wrote a method which allows to install a provided certificate from the file system in the keychain, but this method does not work as expected in the iPhone Simulator. The certificate is installed in the host machine's Mac OS X keychain instead. Unfortunately, if I call NSURLConnection's sendSynchronousRequest method, I retrieve an "untrusted server certificate" error. It seems as if NSURLConnection is not able to access the host's Mac OS X keychain to retrieve the certificate.
    Is my guess correct or did I miss something?
    Would my approach work if I ran my app on a real iPhone device instead (I do not have one available yet)?
    Does there exist a keychain in the iPhone Simulator at all?
    Is it at all possible to send HTTPS requests to a server with an untrusted certificate on the iPhone Simulator or do I have to use precompiler directives to implement different routines depending on the underlying platform (simulator or device, respectively)?
    Any help is highly appreciated.
    Thanks,
    Matthias

    Indeed this would be a clean and simple solution. But our customer is not willing to get a real certificate, for whatever reasons.
    The question that remains is if the HTTPS requests would succeed on the iPhone device itself if the server certificate was installed in the keychain by the same app beforehand.

  • Scalability Test: parallel requests not matching between app server and db.

    We have an environment where we have started doing some load testing on our weblogic 11g instance.
    The current flow and configuration is the following:
    There are https requests that go into a servlet, which then calls a local EJB which uses a connection pool to request data that is returned to the caller.
    The following diagram shows the general flow w/ pool size limits:
    (Socket Readers: 33%) --> Servlet --> Local EJB (initial 100, max 200) --> Connection pool (initial 400, max 400) --> Oracle RAC database
    First thing worth pointing out is I know that the connection pool size is drastically larger than the ejb pool -- and this needs to be addressed.
    During a scalability test, we saw that there were the following max stats on the system:
    Max number of sockets to the app server was approximately 450, while the maximum number of connections used during the test was 122.
    We did not have instrumentation on the ejb pool to see how much it grew, but I'm assuming that the limit was due to the pool being to small and not growing fast enough.
    what are people's thoughts on what to measure and test. We are trying to get a baseline configuration before jumping to a cluster environment.
    Is there recommendations in terms of industry standards for matching the socket readers, thread pool, ejb pool and connection pool for a system? General recommendation read so far indicate that inital and max should be set to the same values?
    Any recommend literature is appreciated.
    Thank you.

    Another measurement point that was captured is the max number of threads (LWPs) on the server went up to 196 (then dropped to 179 and stabalized there)
    Any help is definitely appreciated.

  • An HTTPS problem...Sun App Server issue?

    When I access my app using https, I get a certificate message asking me to accept the certificate (which must have been automatically generated since I did not puchase one).
    Anyway, after I accept the certificate, I get a message that says "The page contains both secure and nonsecure items". I then click yes and continue, but this message keeps coming back time and again for each page (even ones that have been visited before).
    Now I know this message can be caused by things like me grabbing images from non-secure sites, but all of my images are local, and all calls to servlets that read images from the database are made using https.
    So......what in the world do I need to do to stop this?
    Thanks.

    This is getting worse.
    I just tried getting to the site using HTTPS from two different Windows 2003 boxes. Both of those machines were unable to see the images coming from the servlet, but could see the default images.
    I looked at the app server log and saw this reported:
    [#|2005-06-22T12:50:42.807-0500|SEVERE|sun-appserver-pe8.0.0_01|org.apache.tomcat.util.net.PoolTcpEndpoint|_ThreadID=16;|Handshake failed
    javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?
         at com.sun.net.ssl.internal.ssl.InputRecord.b(DashoA12275)
         at com.sun.net.ssl.internal.ssl.InputRecord.read(DashoA12275)
         at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA12275)
         at com.sun.net.ssl.internal.ssl.SSLSocketImpl.j(DashoA12275)
         at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(DashoA12275)
         at org.apache.tomcat.util.net.jsse.JSSESocketFactory.handshake(JSSESocketFactory.java:118)
         at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:534)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:647)
         at java.lang.Thread.run(Thread.java:534)
    |#]Why would this die for Windows 2003 and work (although you still have to click the box each time that talks about secure and nonsecure items)?
    I could really use some help here! I know that it is JavaOne time, but running on HTTPS is vital and I need to know how to solve these issues.
    THANKS!

  • How do I install Mavericks without invoking the OSX Server Plugin?

    How do I perfrom a clean install of Mavericks from the Recovery Partition without it automatically installing, and then invoking or executing the OSX Server Plugin that ultimately results in rendering open directory operable as well as the server.  I have ignored this continously, but the other day I went into the terminal and typed ARP -s that lists the shortname for the host of my MacBook Pro and it gave a totally different name than what I had given it in the wi-fi network interface under the WINS tab. More importantly, I do not want to install open directory nor the osx server plugin as it opens up more complexity than I want to deal with.  Any suggestions is greatly appreciated.  BTW, below are the steps I performed for installing Mavericks.
    1. Powered on the MacBook Pro and then hit the Option key.
    2. This took me into the Recovery Partition, whereby I went into the Disk Util and erased or formatted the hard-drive.
    3. I then clicked out of the Disk Utility and went into the Recovery Mode by clicking on reinstall the current OS.
    4. I went through all the prompts and the system downloaded a current version of Mavericks.
    5. After completion, I turned on my Macbook Pro and went through the prompts to install Mavericks.
    6. This is all I did, and I didn't download the OSX plugin nor invoke it in the new version of the Operating System. 
    I just assumed that it was a standalone version until I found the server for osx running with open directory invoked, the server invoked, along
    with other components relative to a new standalone version.
    Again, my question is simple: How can I reinstall Mavericks without it downloading and automatically
    iinvoking the components as described above? 

    Hi. Because both Mavericks and Windows 8 are still new, they may not be free of error. Apple needs more time to perform more tests to ensure that these two different OS's will work properly without getting in conflicts. If it's posdible, I highly recommand you to downgrade back to Lion or Mountain Lion and install Windows 7 (if you have a copy of it). In my experience, all advises from Genius Bar members and computer articles confirm that  Windows 7 will work on Macs with Lion OS. It should also work on Mountain Lion. Besides Boot Camp, you could try to virtualize Windows OS and its applications by using VirtualBox, CrossOver and other VMs. I already have an Oracle VirtualBox but I would like to try Boot Camp since it allows me to enjoy almost all Windows features that may be limited in VMs.

  • How to find out the ip address in app.server

    Hi,
    is there anyway to find the ip/hostnames from app.server or webcache?
    coz currently we have the setup of two webcache its acts as a load balancer and then 6 oracle app.server
    some times if anybody login to our site (hackers) if we want to track the details how do we proceed?
    is anybody having idea on this, coz i checked Apache logs on app.server it shows the ip's of our two web-cache server and then i tried to get some thing from webcache apache logs. but i couldn't find or i dont know how i clear on this.
    I just want to know did anyone knows abt this? is it possible to get the IP from app.server/webcache?
    pls let me know
    Thanks
    Murali..

    please check the webcache/logs/access_log. that shows the ip address of the machine hitting your webcache.

  • Kodo-ds.xml: how to use for two database in same app server?

    hi,
    i meet a problem: i have two applications in the same app server(one app
    use one database.). BUT, only one kodo-ds.xml can configure the
    PersistenceManagerFactory with jndi name. When i figure the two jidi name
    for two "<tx-connection-factoy>" in the root element
    "<connection-factories>" in the kodo.ds.xml. That's unavailable!
    eg:
    <connection-factories>
    <tx-connection-factoy>
    <!-- specify the the first database connection properties with jndi name A
    -->
    </tx-connection-factoy>
    <tx-connection-factoy>
    <!-- specify the the SECOND database connection properties with jndi name
    B -->
    </tx-connection-factoy>
    </connection-factories>
    THAT'S MY CONFIGURATION. UNAVALIABLE NOW.... Who can help me solve this
    problem?
    thx!

    You should deploy multiple kodo-ds.xml files (i.e. kodo-ds-oracle.xml).
    Kidwish wrote:
    hi,
    i meet a problem: i have two applications in the same app server(one app
    use one database.). BUT, only one kodo-ds.xml can configure the
    PersistenceManagerFactory with jndi name. When i figure the two jidi name
    for two "<tx-connection-factoy>" in the root element
    "<connection-factories>" in the kodo.ds.xml. That's unavailable!
    eg:
    <connection-factories>
    <tx-connection-factoy>
    <!-- specify the the first database connection properties with jndi name A
    -->
    </tx-connection-factoy>
    <tx-connection-factoy>
    <!-- specify the the SECOND database connection properties with jndi name
    B -->
    </tx-connection-factoy>
    </connection-factories>
    THAT'S MY CONFIGURATION. UNAVALIABLE NOW.... Who can help me solve this
    problem?
    thx!
    Steve Kim
    [email protected]
    SolarMetric Inc.
    http://www.solarmetric.com

  • How to download a service object attachment to app server?

    I found some postings / blogs to download an attachment (service objects).
    This tells to download to local drive or to a mapped network drive .
    How do I download to an applications erver?
    Thanks,
    Ven

    I know OPEN DATE SET and all that stuff.
    and it seems we are moving in another tangent.
    I need to download Service Object Attachments to the app server.  aR's reply is some what relevant but is not exactly relevant.
    I am able to download to presentations erver by using the code:
    This function module creates a file in the PC
                  CALL FUNCTION 'SO_DOCUMENT_REPOSITORY_MANAGER'
                    EXPORTING
                      method      = 'PUTCONTENTTOFILE'
                      office_user = sy-uname
                    TABLES
                      files       = i_files
                    CHANGING
                      document    = sw_document.
                  READ TABLE i_files INDEX 1.
                  MOVE:
                   i_files TO sw_document1.
    However this does not seem to work to download on the app server.

  • How do I clear the Disco cache on App Server 9.0.4

    Can anyone tell me how I can clear the Discoverer cache installed on 9.0.4 Oracle App Server? Can it be done using App Server Control, is there command line syntax I can use?
    Thanks
    Andy

    Hi Andy
    I think the only way to get the memory back is to bounce the server. Sorry.
    Best wishes
    Michael

  • How to send a request to other apex app users?

    HI,
    Is there any kind of function in apex can enable me to make a thing that can enable apex app end users communicating with each other?
    Like, If I input an error item no, and I wouuld like my administrator to change it, I now will write him a small text in stick paper, can we do things within apex?

    Hello,
    I don't think it's too hard to make something like that. Basically you've a table for messages and you have a region on page 0 (to show on all pages) or whatever page you want that queries that table. You could even let it query every x seconds automatically with ajax.
    Carl for ex has in his app a comments section: http://apex.oracle.com/pls/otn/f?p=11933:5
    Regards,
    Dimitri
    -- http://dgielis.blogspot.com/
    -- http://www.apex-evangelists.com/
    -- http://www.apexblogs.info/

Maybe you are looking for

  • Linking iViews

    I know this is probably a stupid question, but for some reason it's stumping me.  I have a par project and have created multiple portal components inside it.  The pages are simple and I just want to hyperlink navigate between the pages with as little

  • No tablespace assigned to table

    select table_name, tablespace_name from user_tables order by table_name; Running this query gives a few tables with no assigned tablespace name. I expected at least the default tablespace to be displayed, since the table has to be somewhere. Any idea

  • Jboss4/ejb

    hi experts, i did not know about ejb and jboss server. my question somewhat sounding silly. and somewhat blind. kindly help me. but my client requirement, by using jboss 4 with ejb3.0, can we send sms(messaging) ?. in jdeveloper 11g r1 if yes please

  • Safari web attack help me delete safari n re-download or delete the hack

    my safari when opening doesnt allow me to do anything just keeps launching websites, ive deleted best part of ten thousand files so scared to open it up again, so i was thinking to either delete the safari if can be done then re-install the latest on

  • Unable to test MPEG-4 files using fmscheck.exe

    I am trying to run fmscheck.exe to test server status i am using bat file with code: set /A counter = 0 :start start /B fmscheck.exe --host localhost --app vod --play sample 0 all --timeout 360 --logfile output_log.txt set /A counter = %counter% + 1