Java and http request

when I start a java applet behind a proxy server, a http request can be used by setting proxy variables http.proxyHost and http.proxyPort.
but is there any way I can get these values from the browser setting(or the internect connection LAN settings on the user's PC)? for the simplest case lets assume we are using internet explorer.
please let me know on how this can be done?
thanks!

To my knowledge, the default situation is that the proxy will be set by the browser.

Similar Messages

  • Switching between https and http requests

    Hi,
    Our application is built using ADF 10.1.3
    This application need to be integrated with an in house built single sign on system. ( SSO system is built in C# and .NET)
    This single sign on system only understand https request. Once user is validated against single sign on system, our application's authorization page is called in HTTPS mode. Once the user is authorized, he is forwarded to home page. While forwarding to home page, we want to convert the HTTPS request to HTTP.
    Currently once the user is authenticated, all requests are happening in HTTPS mode.
    We do not know how to make http request from existing https requested page.
    Any help is appreciated.
    Thanks
    Ranajit

    Hi,
    the way to do this is by redirecting the call from a PhaseListener or command button. The solution Avrom refers to is a PhaseListener that uses XML configuration file to determine whether or not the page you are navigating to requires https or http. The code that handles the protocol switch is printed below
      * Determines if the requested page requires SSL and if the current protocol
      * meets this need. If not the protocol is switched between http and https
      * @param viewId
      * @param pageRequiresSSL
      public void handleProtocolSwitch(String viewId, boolean pageRequiresSSL)
        ExternalContext exctx = FacesContext.getCurrentInstance().getExternalContext();
        boolean isSecureSSLChannel = ((HttpServletRequest)exctx.getRequest()).isSecure();
        // pages that require SSL and SSL is on, or pages that don't require
        // SSL but SSL is on and should be kept
        if (pageRequiresSSL && isSecureSSLChannel || !pageRequiresSSL && isSecureSSLChannel && isKeepSSLMode) {
        printDebugMessage("Page requires SSL = "+pageRequiresSSL+", channel is secure = "+isSecureSSLChannel+", is keep SSL = "+isKeepSSLMode);
        printDebugMessage("No protocol change required");
        // page requires SSL and SSL is not active. Switch to SSL.
        if (pageRequiresSSL && !isSecureSSLChannel) {
          printDebugMessage("Page requires SSL = "+pageRequiresSSL+", channel is secure = "+isSecureSSLChannel);
          printDebugMessage("Protocol change required to use https");
          switchToHttps(viewId);
        // switch to HTTP is page doesn't require SSL and channel isn't secure
        // and isKeepSSLMode is false
        if (!pageRequiresSSL && !isKeepSSLMode && isSecureSSLChannel) {
          printDebugMessage("Page requires SSL = "+pageRequiresSSL+", channel is secure = "+isSecureSSLChannel+", is keep SSL = "+isKeepSSLMode);
          printDebugMessage("Protocol change required to use http");
          switchToHttp(viewId);
        if (!pageRequiresSSL && !isSecureSSLChannel) {
          printDebugMessage("Page requires SSL = "+pageRequiresSSL+", channel is secure = "+isSecureSSLChannel);
          printDebugMessage("No protocol change required");
      * Switches from https to http using a redirect call
      * @param viewId
      private void switchToHttp(String viewId) {
          FacesContext facesContext = FacesContext.getCurrentInstance();
          ExternalContext exctx = facesContext.getExternalContext();
          ViewHandler vh = facesContext.getApplication().getViewHandler();
          String pageURI = vh.getActionURL(FacesContext.getCurrentInstance(), viewId);
          //redirect to http URL
          String remoteHost = getHostNameFromRequest();
          printDebugMessage("Switch to http on host "+ remoteHost);
          try {
              String port = httpPort.equalsIgnoreCase("80") ? "" : ":" + httpPort;
              String url = "http://" + remoteHost + port + pageURI;
              printDebugMessage("Redirecting to http URL "+ url); 
              //TODO check request Map
               this.printDebugMessage(" Content size of RequestMap before redirect "+exctx.getRequestMap().size());
              exctx.redirect(url);         
          } catch (IOException e) {
              printDebugMessage("Redirect to http port failed "+ e.getMessage());
      * switches to https using a redirect call
      * @param viewId
      private void switchToHttps(String viewId) {
          FacesContext facesContext = FacesContext.getCurrentInstance();
          ExternalContext exctx = facesContext.getExternalContext();
          ViewHandler vh = facesContext.getApplication().getViewHandler();
          String pageURI = vh.getActionURL(FacesContext.getCurrentInstance(), viewId);
          //redirect to https URL
          String remoteHost = getHostNameFromRequest();
          printDebugMessage("Switch to SLL/https on host "+ remoteHost);
          try {
              String port = httpsPort.equalsIgnoreCase("443") ? "" : ":" + httpsPort;
              String url = "https://" + remoteHost + port + pageURI;
              printDebugMessage("Redirecting to https URL "+ url);       
              //TODO check request Map
              this.printDebugMessage(" Content of RequestMap before redirect "+exctx.getRequestMap().size());
              exctx.redirect(url);         
          } catch (Exception e) {
              printDebugMessage("Redirect to http port failed "+ e.getMessage());
      * @return the hostname of the page request
      private String getHostNameFromRequest() {
          ExternalContext exctx = FacesContext.getCurrentInstance().getExternalContext();
          String requestUrlString = ((HttpServletRequest)exctx.getRequest()).getRequestURL().toString();
          URL requestUrl = null;
          try {
              requestUrl = new URL(requestUrlString);
          } catch (MalformedURLException e) {
              e.printStackTrace();
          String remoteHost = requestUrl.getHost();
          return remoteHost;
      }If your container doesn't support session sharing between http and https then the session is renewed. In OC4J you will have to configure this.
    Frank

  • Localhost and http request dilemma!

    Right I have 2 web app servers, one running on serverA from machine1 and one running on serverB from machine2.
    OK, what I want to be able to do is from machine1 open a browser to a webpage running on serverB/page1.jsp.
    From page1.jsp I want to make an http request to "localhost/page2.jsp" which is running on ServerA on machine1 and NOT on the same webserver as page1.jsp.
    Now because each machine sees itself as localhost, when I use "localhost/page2.jsp" instead of making a request to "serverA/page2.jsp", it is trying to make a request to ServerB.page2jsp.
    Now I cant just replace "localhost" with "ServerA" due to security restrictions of my web application. So far what I've tried is putting this javascript within page1.jsp:
        <%
                URL url = new URL("http://localhost:6080/page2.jsp");
                HttpURLConnection httpConnection = (HttpURLConnection) url.openConnection();
                httpConnection.setRequestMethod("GET");
                httpConnection.setDoOutput(true);
                httpConnection.connect();
                InputStream in = httpConnection.getInputStream();
                BufferedInputStream buffer = new BufferedInputStream(in);
                for (;;) {
                    int data = buffer.read();
                    // Check for EOF
                    if (data == -1) {
                        break;
                    } else {
                        out.print((char) data);
                    httpConnection.disconnect();
        %>Any thoughts or ideas are gladly appreciated, or if I'm goign about this all wrong let me know!

    BlueSmurf wrote:
    What security is being restricted with this design?You can only connect to the web server by using "localhost" and not using its real host name or ip address.
    So for example I want a web browser running on a windows machine to access page1.jsp from a linux machine running a web server and within page1 I want to make a http request to page2 running on a webserver on the windows machine and for example return the html from page2 into page1.
    So far I've tried the scriplet in the above code which makes a call to localhost, but it makes a call to the wrong localhost, rather than localhost being the machine im running the browser in, localhost is machine that the web page is running on. I've also thought about using iframes, any thoughts on this approach?

  • Behaviour of Service (MqActive and http-requests)

    Hello,
    I have a servlet which runs an mq-active listener and get input by http. Now my question: what is important about threads and concurrency ? - There could be the case, that the mq-active-listener gets an Message while there is an http-request. Should I start for each request of mq-active a new Thread?
    thanks for you answer,
    dak
    Message was edited by:
    dakger

    Hi David, 
    Thanks for correctly guessing our longer term plans.  It's good to know this won't be a problem in the future.
    However, that doesn't answer my original question, which is a bit more pressing than waiting until we have migrated.  If it can't be done, it can't be done, and we'll just bear that in mind when responding to failover events.  But I would prefer
    a definitive "no, it can't" rather than a speculative "no".  
    Regards, 
    Simon

  • Java and Http posting through Peoplesoft.

    Hello everyone, not sure if you can help, but any input or ideas would be appreciated because I ran out of ideas.
    I created a java file that connects to a xyhtos server (WebDAV connection). The reason of this project is to be able to upload files to the xythos repository via peoplesoft pages. Uploading the files is fine and works great.
    My problem is getting a ticket from it. (A ticket is a string that is appended in the url of the document that is being requested without having the user login to xythos). To get such ticket I need to send login information to the server via a post method. The userid/password needs to be sent through a string that is base64Encode.
    When I execute this method the xythos server does not receive login information.
    Now here is the strange part, if I execute the same Java program from a Unix command line, with the same parameters, it performs beautifully.
    I'm wondering if there is something extra that I need to do when running this java program through PIA. Or if the peoplesoft server needs to be configured a certain way to allow such methods.
    If you need me to be more specific or anything that could help you help me, please post. I'm desperate.
    Thank you.

    HI Jim, thank you for replying.
    Unfortunately I can't tell exactly how it's posting because I'm using a package created by another department I work with. If I need to upload a file, delete a file, create directories, all of that is fine. The only trouble is requesting a ticket from xythos. I think for that function it is doing an http post, but not positive. The response I get from the server is
    <html><title>Error 401</title><body>
    Error: 401
    <BR><H1>Forbidden</H1><BR>That action is not authorized. Please ensure that you are authenticated.<BR>
    <p><p></p></p>
    </body></html>
    I just don't understand why through the command line of unix it works and PIA it doesn't. Very strange.

  • NTLM and Http request

    can anyone tell me how to do proxy authetication if NTLM authorization is involved...i wrote a java client that is behind MS Proxy server and hence facing problem in establishing connection with sites...i am getting UnknownHost Exception when i try to call conn.connect() i think it's due to NTLM protocol..Can any one help me in this.
    Thanks in advance
    mano

    Here is the solution for NTLM auth http://www.luigidragone.com/networking/ntlm.html
    You may need to change it to support auth on MS proxy...

  • Java and HTTP

    I have programmed an interface program and i wish to use Java to send a search request with 1 or more search strings to a particular URL and retrieve the search results(if any) from the website for my interface program to manipulate and display it on screen to the user. This request and retrieval of search results is supposed to be transparent to the user. Does anyone knows if this is possible? And if it is, which Java API should i look into?

    do you want to create a application accessible through the web? then the previous poster is correct.
    If you want to connect to an application (of your own or someone else) from your java application you want to look at java.net.HttpURLConnection
    regards
    Spieler

  • Only HTTPS requests are working for SOAP Sender and HTTP not working

    wHi Experts,
    We have enabled our HTTPS port ( SSL ) in NWA -- >> Security -- >> SSL and Key stores. So understanding is HTTPS port is now enabled on top of HTTP. So PI should be able to cater requests at both ports.
    Now, we have developed a synchronous SOAP to RFC scenario and downloaded WSDL file. This file has both links -
    a. http:<host>:<port>
    b. https:<host>:<port>
    We intend to make a PI system where both ports can work. Now questions.
    1. When we test web service exposed from PI using SOAPUI tool, only HTTPS works fine and gets the response back. If we try HTTP URL, an error is encountered - HTTTPS scheme is required.
    2. Is this whole understanding that both ports  ( HTTP, HTTPS ) should be able to operate simultaneously correct ? Or this is not at all possible ?
    3. In SOAP Sender, we tried selecting all 3 options - 1. HTTP 2. HTTPS without client authentication 3. HTTPS with client authentication.
       None of the options have any effect on testing, Each time, only HTTPS request works and HTTP doesn't.
    Can anyone please provide some hints for troubleshooting ?
    Thanks..
    regards,
    Rajagopal.

    The error "HTTPS scheme is required" is normally returned when the HTTP Security Level on the SOAP adapter is not set to "HTTP". I can see you have mentioned you have tried all these, maybe a cache refresh has gone wrong? Could try recreating the channel with just HTTP specified as security level and this should allow HTTP or HTTPS
    I assume you are using a different port number for  your HTTP and HTTPS requests from SOAP UI. Normally the HTTPS port is the same as the HTTP port number but the final zero changed to a 1 i.e. https://<host>:50001 instead of http://<host>:50000.
    You should be able to confirm both HTTP and HTTPS work OK by loading some of the system webpages in a browser over HTTP and over HTTPS i.e. http://<host>:<port>/nwa and https://<host>:<port>/nwa
    Chris

  • Clarification for HTTP and HTTPS Sender Adapter

    Hello together,
    after some investigating concering scenarios with HTTP and HTTPS sender there are still some points that are not absolutely clear for me.
    I know that it is not necessary to configure an HTTP sender communication channel. However if I want to enforce HTTPS sender communication I think I need to add an HTTP sender communication channel with security settings enabled as well as a sender agreement.
    To my understanding these settings are activated on the Adapter Engine (Java Stack), HTTP requests however call the ABAP stack directly. How does this work exactly?
    Thank you very much for your additional explanation.

    Hi,
    see below is the format for HTTP URL
    http://<hostname:port>/<path>?<query-string>
    now query straing can only have values as given in the below link
    http://help.sap.com/saphelp_nw2004s/helpdata/en/43/64db4daf9f30b4e10000000a11466f/content.htm
    a way around can be to specify the payload for &party or &agency or &schema(if you are not using them) but then XI should be able to identify them correctly(which i m not sure how it will do),secondly the length can be a constraint coz if you add the whole payload ,the URL will become really long.
    so i would suggest you not to use it but if you really have to,then explore it properly first and then only use
    plz reward points
    thnq

  • HTTP request using PL/SQL

    I've the following header and http request.
    POST http://deab/DexNETWebServices_4_0_0_4/LoginService.svc HTTP/1.1
    MIME-Version: 1.0
    Content-Type: multipart/related; type="application/xop+xml";start="<http://tempuri.org/0>";boundary="uuid:e4c19840-745d-45b2-90ca-12d71be4cfd9+id=1";start-info="application/soap+xml"
    VsDebuggerCausalityData: uIDPo5F/qXRc4YJImqB6Ard30cQAAAAAAjIXinpIVUulXLJOsSG7yyv7Lf2yHgpHlIxvc6oeqaAACQAA
    Host: deab
    Content-Length: 1017
    Expect: 100-continue
    Accept-Encoding: gzip, deflate
    Connection: Keep-Alive
    --uuid:e4c19840-745d-45b2-90ca-12d71be4cfd9+id=1
    Content-ID: <http://tempuri.org/0>
    Content-Transfer-Encoding: 8bit
    Content-Type: application/xop+xml;charset=utf-8;type="application/soap+xml"
    <s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing"><s:Header><a:Action s:mustUnderstand="1">http://tempuri.org/ILoginService/LoginByUserName</a:Action><a:MessageID>urn:uuid:cf410a05-23d4-4b92-a22c-329cbc19fbe7</a:MessageID><a:ReplyTo><a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address></a:ReplyTo><a:To s:mustUnderstand="1">http://deab/DexNETWebServices_4_0_0_4/LoginService.svc</a:To></s:Header><s:Body><LoginByUserName xmlns="http://tempuri.org/"><systemId>19e0ddb4-5fa5-41ee-b624-aea762865a6c</systemId><strName>FirmwareUpdateLogQueryWorker</strName><productId>0af39a3e-6549-485b-872f-b73413203998</productId><password>abc</password></LoginByUserName></s:Body></s:Envelope>
    --uuid:e4c19840-745d-45b2-90ca-12d71be4cfd9+id=1--
    I'm using the following code to set the header from PL/SQL.
    l_http_req := UTL_HTTP.begin_request ('http://deab/DexNETWebServices_4_0_0_4/LoginService.svc', 'POST', 'HTTP/1.1');
    UTL_HTTP.set_header (
             l_http_req,
             'Content-Type',
             'multipart/related; type="application/xop+xml";start="<http://tempuri.org/0>";boundary="uuid:e4c19840-745d-45b2-90ca-12d71be4cfd9+id=1";start-info="application/soap+xml"');
    UTL_HTTP.set_header (l_http_req, 'Content-Length', LENGTH (l_request));
    But UTL_HTTP.get_response returns the error 400 Bad Request. How do I set MIME-Version and VsDebuggerCausalityData from the header?
    Thank you for your help on this.

    Here is the complete code that returns the 400 Bad Request error. Thanks for your help.
    DECLARE
       l_request         CLOB;
       l_http_req        UTL_HTTP.req;
       l_http_resp       UTL_HTTP.resp;
       v_buffer          VARCHAR2 (32767);
       p_status_code     NUMBER (9);
       p_error_message   VARCHAR2 (32767);
       p_response        CLOB;
    BEGIN
       l_request :=
             '--uuid:e4c19840-745d-45b2-90ca-12d71be4cfd9+id=1
    Content-ID: <http://tempuri.org/0>
    Content-Transfer-Encoding: 8bit
    Content-Type: application/xop+xml;charset=utf-8;type="application/soap+xml"
    <s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing"><s:Header><a:Action s:mustUnderstand="1">http://tempuri.org/ILoginService/LoginByUserName</a:Action><a:MessageID>urn:uuid:cf410a05-23d4-4b92-a22c-329cbc19fbe7</a:MessageID><a:ReplyTo><a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address></a:ReplyTo><a:To s:mustUnderstand="1">http://deab/DexNETWebServices_4_0_0_4/LoginService.svc</a:To></s:Header><s:Body><LoginByUserName xmlns="http://tempuri.org/"><systemId>'
          || '19e0ddb4-5fa5-41ee-b624-aea762865a6c'
          || '</systemId><strName>'
          || 'FirmwareUpdateLogQueryWorker'
          || '</strName><productId>'
          || '0af39a3e-6549-485b-872f-b73413203998'
          || '</productId><password>'
          || 'abc'
          || '</password></LoginByUserName></s:Body></s:Envelope>
    --uuid:e4c19840-745d-45b2-90ca-12d71be4cfd9+id=1--';
       DBMS_OUTPUT.put_line ('request ' || l_request);
       l_http_req :=
          UTL_HTTP.begin_request (
             'http://deab/DexNETWebServices_4_0_0_4/LoginService.svc',
             'POST',
             'HTTP/1.1');
       UTL_HTTP.set_header (
          l_http_req,
          'Content-Type',
          'multipart/related; type="application/xop+xml";start="<http://tempuri.org/0>";boundary="uuid:e4c19840-745d-45b2-90ca-12d71be4cfd9+id=1";start-info="application/soap+xml"');
       UTL_HTTP.set_header (l_http_req, 'Content-Length', LENGTH (l_request));
       UTL_HTTP.set_header (l_http_req, 'MIME-Version', '1.0');
       UTL_HTTP.set_header (
          l_http_req,
          'VsDebuggerCausalityData',
          'uIDPo5F/qXRc4YJImqB6Ard30cQAAAAAAjIXinpIVUulXLJOsSG7yyv7Lf2yHgpHlIxvc6oeqaAACQAA');
       UTL_HTTP.write_text (l_http_req, l_request);
       DBMS_LOB.createtemporary (p_response, FALSE);
       l_http_resp := UTL_HTTP.get_response (l_http_req);
       BEGIN
          LOOP
             UTL_HTTP.read_text (l_http_resp, v_buffer, 32767);
             DBMS_OUTPUT.put_line (v_buffer);
             DBMS_LOB.writeappend (p_response, LENGTH (v_buffer), v_buffer);
          END LOOP;
       EXCEPTION
          WHEN UTL_HTTP.end_of_body
          THEN
             NULL;
       END;
       UTL_HTTP.end_response (l_http_resp);
       p_status_code := l_http_resp.status_code;
       p_error_message := l_http_resp.reason_phrase;
       p_response := REPLACE (p_response, '&lt;', '<');
       p_response := REPLACE (p_response, '&gt;', '>');
       DBMS_OUTPUT.put_line (
          'Status: ' || p_status_code || '-' || p_error_message || ': ' || p_response);
    END;

  • Load Balance Reverse Poxy using ACE and HTTP Header Sticky

    Dear all,
    I have a reverse proxy that makes HTTP and HTTPS requests to an ACE.
    For implement persistence I want to configure HTTP HEADER Stickyness using the X-Forwarder-For information but I don't know:
    How to implement it ( I'l apreciate a little example about it).
    Which values I need for OFFSET and LENGHT fields.
    Can you help me please?
    Thanks a lot!!

    Hi Cesar.
    Thanks a lot for your answer but I think you misunderstand the question or I'm not explaninig very well
    I don't need to insert anything.
    The serverfarm X will be accesed by a reverse proxy. This reverse proxy already inserts the X-Forearder-From header, so the request from the reverse proxy comes with this header to the serverfarm X.
    The problem is that now, the serverfarm X sticky the client based on source IP. This is a wrong behavior becasue all the request comes form the same source (Reverse proxy) and all the load forwards to the same real IP address.
    This is because I want to change the sticky from source IP to HTTP header and looks for the X-Forwarder-For filed.
    Hop it will clarify the question!

  • Doubts about HTTPS requests and Java proxy

    Hello,
    I need help about SSL connections and Java.
    I'm developing a HTTP/S proxy with Java. To test my proxy, I use Firefox. I configure the proxy option in the browser. The proxy works good with HTTP requests, but with HTTPS requests doesn't work and I don't know why.
    I explain the steps that I do for a HTTPS request:
    * The browser sends a CONNECT message to the proxy.
    I check that the proxy receives the CONNECT request correctly.
    * The proxy establish a secure connection with the content server.
    I use an SSLSocket to connect with my content server, and the SSL handshake is succesful.
    * The proxy sends a 200 HTTP response to the client:
    I send
    HTTP/1.0 200 Connection established[CRLF]
    [CRLF]
    to the application client (Firefox)
    * The proxy sends/receive data to/from Firefox/content server
    I have a Socket between Firefox and my proxy, and a SSLSocket between my proxy and my content server. I use two threads to communicate the client and the server.
    Java code:
    //Thead server-->proxy-->application(Firefox)
    ThreadComm tpa = new ThreadComm(bis_serverSSL, bos_app);
    //Thread application(Firefox)-->proxy-->server
    ThreadComm tap = new ThreadComm(bis_app, bos_serverSSL);
    The "tpa" thread reads from the SSLSocket between the proxy and the server and sends data to the Socket between the proxy and Firefox.
    The "tap" thread reads from the Socket between the proxy and Firefox and sends data to the SSLSocket between the proxy and the server.
    This is the class ThreadComm:
    public class ThreadComm extends Thread{
        private BufferedInputStream bis = null;
        private BufferedOutputStream bos = null;
        public ThreadComm(BufferedInputStream bis, BufferedOutputStream bos) {
            this.bis = bis;
            this.bos = bos;
        @Override
        public void run() {
            int b = -1;
            FileOutputStream fos = null;
              do {
                   try {
                        b = bis.read();
                        System.out.print((char) b);
                        fos.write(b);
                        bos.write(b);
                        bos.flush();
                   } catch (Exception ex) {
                        Logger.getLogger(ThreadAplicacionProxy.class.getName()).log(Level.SEVERE, null, ex);
                        //b=-1;
              } while (b != -1);
        }But this doesn't work and I don't know why.      
    I have an Apache server with the mod_ssl enabled as content server, I can send requests (with Firefox) to the port 80(HTTP request) and 443(HTTPS request) without use my proxy and it works. If I use my proxy, HTTP request works but with HTTPS request doesn't work, I look the log of Apache and I see:
    [Tue Apr 27 17:32:03 2010] [info] Initial (No.1) HTTPS request received for child 62 (server localhost:443)
    [Tue Apr 27 17:32:03 2010] [error] [client 127.0.0.1] Invalid method in request \x80\x7f\x01\x03\x01
    [Tue Apr 27 17:32:03 2010] [debug] ssl_engine_kernel.c(1770): OpenSSL: Write: SSL negotiation finished successfully
    [Tue Apr 27 17:32:03 2010] [info] [client 127.0.0.1] Connection closed to child 62 with standard shutdown (server localhost:443)
    Why it say? Invalid method in request \x80\x7f\x01\x03\x01 , my proxy sends the data that the Firefox sends.
    I think than I have follow the explanations of [1] but doesn't work, I have problems in implementation in Java but I don't know where.
    I appreciate any suggestions.
    Thanks for your time.
    [1] http://www.web-cache.com/Writings/Internet-Drafts/draft-luotonen-web-proxy-tunneling-01.txt

    ejp, I have checked the socket between the proxy and server and ... You are right! , I was using the port 80 instead of the 443 (incredible mistake!, I'm sorry). I was convinced that I was using the port 443... Well, is a little step, but I still have not won the war :)
    If I see the log files of Apache, We can see that something goes wrong.
    localhost-access.log
    >
    127.0.0.1 - - [04/May/2010:17:44:48 +0200] "\x 80\x 7f\x01\x03\x01" 501 219
    >
    localhost-error.log
    >
    [Tue May 04 17:44:48 2010] [info] Initial (No.1) HTTPS request received for child 63 (server localhost:443)
    [Tue May 04 17:44:48 2010] [error] [client 127.0.0.1] Invalid method in request \x80\x7f\x01\x03\x01
    [Tue May 04 17:44:48 2010] [debug] ssl_engine_kernel.c(1770): OpenSSL: Write: SSL negotiation finished successfully
    [Tue May 04 17:44:48 2010] [info] [client 127.0.0.1] Connection closed to child 63 with standard shutdown (server localhost:443)
    >
    I think that this happens because Apache receives the data without decrypt, this is the reason because in the log we can see the "Invalid method in request \x80\x7f\x01\x03\x01". This supposition is true?
    ejp, you say that the "Termination is quite tricky." I have changed my code following yours suggestions (using the join and the shutdownOutput) but the threads don't die.
    I explain you what I do:
    (in time 1)
    I launch the thread (threadFirefoxToApache) that reads data from Firefox and sends to Apache.
    I launch the thread (threadApacheToFirefox) that reads data from Apache and sends to Firefox.
    (in time 2)
    threadFirefoxToApache sends the firts data to the server.
    threadApacheToFirefox is waiting that the server says something.
    (in time 3)
    threadFirefoxToApache is waiting that Firefox says something.
    threadApacheToFirefox sends data to Firefox.
    (in time 4)
    threadFirefoxToApache is waiting that Firefox says something.
    threadApacheToFirefox is waiting that Firefox says something.
    and they are waiting... and never finish.
    In time 2, these first data are encrypted. The server receives these data and It doesn't understand. In time 3, the server sends a HTTP response "501 Method Not Implemented", here there is a problem because this data must be encrypt. According to the documentation that I read, the proxy cannot "understand" this data but I can "understand" this data. What's happen?
    Firefox encrypt the data and send to the proxy. This It's correct.
    The proxy encrypt the data another time, because I use the SSLSocket to send the data to the server. Then the server receives the data encrypted two times, when decrypt the data gets the data encrypted one time. And this is the reason why the server doesn't understand the data that sends Firefox. It's correct? May be.
    Then If I want that the server receives the data encrypted one time I need to use the socketToServer, It's correct?
    I will supposed that yes. If I use the socketToServer, the proxy doesn't understand nothing, because the data received from the socketToServer are encrypted (I only see simbols), but the Apache log says that there is a problem with the version? (If I use the socketToServer the threads die)
    >
    [Tue May 04 19:55:42 2010] [debug] ssl_engine_kernel.c(1760): OpenSSL: Loop: SSLv3 read finished A
    [Tue May 04 19:55:42 2010] [debug] ssl_engine_kernel.c(1760): OpenSSL: Loop: SSLv3 write change cipher spec A
    [Tue May 04 19:55:42 2010] [debug] ssl_engine_kernel.c(1760): OpenSSL: Loop: SSLv3 write finished A
    [Tue May 04 19:55:42 2010] [debug] ssl_engine_kernel.c(1760): OpenSSL: Loop: SSLv3 flush data
    [Tue May 04 19:55:42 2010] [debug] ssl_engine_kernel.c(1756): OpenSSL: Handshake: done
    [Tue May 04 19:55:42 2010] [info] Connection: Client IP: 127.0.0.1, Protocol: TLSv1, Cipher: RC4-MD5 (128/128 bits)
    [Tue May 04 19:55:42 2010] [debug] ssl_engine_io.c(1817): OpenSSL: read 5/5 bytes from BIO#29bd910 [mem: 29ea0a8] (BIO dump follows)
    [Tue May 04 19:55:42 2010] [debug] ssl_engine_io.c(1750): -------------------------------------------------------------------------
    [Tue May 04 19:55:42 2010] [debug] ssl_engine_io.c(1789): | 0000: 80 7f 01 03 .... |
    [Tue May 04 19:55:42 2010] [debug] ssl_engine_io.c(1793): | 0005 - <SPACES/NULS>
    [Tue May 04 19:55:42 2010] [debug] ssl_engine_io.c(1795): ------------------------------------------------------------------------
    [Tue May 04 19:55:42 2010] [debug] ssl_engine_kernel.c(1770): OpenSSL: Write: SSL negotiation finished successfully
    [Tue May 04 19:55:42 2010] [info] [client 127.0.0.1] SSL library error 1 reading data
    [Tue May 04 19:55:42 2010] [info] SSL Library Error: 336130315 error:1408F10B:SSL routines:SSL3_GET_RECORD:wrong version number
    [Tue May 04 19:55:42 2010] [debug] ssl_engine_kernel.c(1770): OpenSSL: Write: SSL negotiation finished successfully
    [Tue May 04 19:55:42 2010] [info] [client 127.0.0.1] Connection closed to child 63 with standard shutdown (server localhost:443)
    >
    What option is the correct? I need use the SSLSocketToServer or socketToServer to send/read the data to/from the server?. Use the SSLSocket has sense because the data travel in a secure socket, but use the Socket also has sense because the data are encrypted and they are protected by this encription. It's complicated...

  • How to pass a HTTP request from a simple java class

    Is it possible to pass an HTTP request from a simple java class.if yes how?

    Is it possible to pass an HTTP request from a simple
    java class.if yes how?If you're talking about creating a HttpRequest object and passing it to a servlet, that would be a red flag to me that your design is flawed. You shouldn't have to do that - the application server (Tomcat, Weblogic, etc) should be the only thing that has to worry about creating that kind of object and passing it to you.

  • HTTP/1.1 and MINE --- request

    The following is an example of a HTTP Request, can anyone tell me if it is all right? if I use HTTP/1.1, what are the restriction I have to face if I use MINE 1.0? for example, any feature or function I have to omit.
    POST /RecipientServer/mailbox HTTP/1.1
    Date: Tue, 20 Dec 2000 08:12:31 GMT
    Connection: Keep-Alive
    Host: www.xxx.com
    Content-Language: en, fr
    Content-Type: multipart/form-data; boundary=EBTpart;
    Content-Length: 3222
    --EBTpart
    Content-Disposition: form-data; name=�sender�
    12345678
    --EBTpart
    Content-Disposition: form-data; name=�user_id�
    aUser
    --EBTpart
    Content-Disposition: form-data; name=�user_password�
    aPassword
    --EBTpart
    Content-Disposition: form-data; name=�request_type�
    Upload
    --EBTpart
    Content-Disposition: form-data; name=�ebt_document�; filename=�transaction.xml�
    Content-Type: application/octet-stream
    MIME-Version: 1.0
    Content-Type: multipart/encrypted; boundary=�=--�;
    protocol="application/pgp-encrypted"
    --=--
    Content-Type: pgp-encrypted
    Version: 1
    --=--
    Content-Type: application/octet-stream
    -----BEGIN PGP MESSAGE-----
    Version: 2.6.2
    hIwDY32hYGCE8MkBA/wOu7d45aUxF4Q0RKJprD3v5Z9K1YcRJ2fve87lMlDlx4OjeW4GDdBfLbJE7VUpp13N19GL8e/AqbyyjHH4aS0YoTk10QQ9nnRvjY8nZL3MPXSZg9VGQxFeGqzykzmykU6A26MSMexR4ApeeON6xzZWfo+0yOqAq6lb46wsvldZ96YA AABH78hyX7YX4uT1tNCWEIIBoqqvCeIMpp7UQ2IzBrXg6GtukS8NxbukLeamqVW31yt21DYOjuLzcMNe/JNsD9vDVCvOOG3OCi8=
    =zzaA
    -----END PGP MESSAGE-----
    can anyone tell me where I can find any samples of http request or response?
    thank you for your help.

    Check out HTTPClient. It's a set of classes that can be used to create POST requests (including file uploads) and has builtin support for many MIME types. It's available at http://www.innovation.ch/java/HTTPClient/

  • HTTP request failed. Error code: "503". Service Unavailable in RWB and Cache Refresh

    Dear Experts,,
    We have MDM and PI in our landscape. We are using MDM Adapter for the integration between the two.
    When we try to run the T Code SXMB_IFR, we are getting HTTP request failed error. i.e., “Error Code: 503 -- Service Unavailable”. And also the RWB communication channel is not working because of this error and we are unable to refresh the cache too because of this error.
    We have checked from MDM side, and messages are flowing from ready folder but not coming into PI. We had monitored the messages using
    SXMB_MONI.
    We have restarted the Java Server but it’s taking too much time to restart around 12 to 15 hours & we checked after that but still facing the same issue.
    Could you please help me to figure out this issue.
    Thank you for your support in advance.
    Thanks and Regards,
    Priti.

    Hi Priti,
    You can check the suggestion of Jyothi Anagani
    Because of J2EE application com.sap.aii.af.ms.app not active
             The problem is that not all J2EE services can be started by the J2EE. i.e Start the Visual Administrator and select Server->Services->Deploy in the tree on the left. On the right-hand side, choose the Runtime tab page. You see a tree in the right window with all applications if you select the APPLICATION radio button. Check if they are running, otherwise choose Start. Usually the J2EE engine starts all services automatically.
    Runtime Workbench "503 Service Unavailable" Error After JSPM SP Update
    Regards,
    Nabendu.

Maybe you are looking for

  • Microsoft plug in deployment errors on grid control

    Hi, I keep getting errors when deploy microsoft_sqlserver_Databse plug in to grid control server. "The preferred credentials are not set for "server name"". I set the credential for microsoft SQL server on preference page, however, i still get same e

  • Ipod replacement program: headphones ' compatibility

    Hello, I partecipated to the IPod nano replacement program and Friday I received the new IPod (only the IPod, without headphones and the USB device): it's a 6G ipod nano touch. Little problem: the headphones of my old 1g ipod nano don't work with the

  • How do i colour fill the spaces between my line work

    I have drawn an image using various shapes and lines how do i fill the space in between sections with colour without it just filling the rectangle shape? Ive drawn this dragon and need colour it in what is the easiest way to do it as they are all ind

  • Transaction and Process or sub-Process Automation

    I am undertaking a market survey of business process and in particular transaction or sub process automation in the SAP landscape. I am particularly interested in talking to SAP users who are operationally focused or people who are involved in busine

  • Exporting as DT movie option

    Curious, will exporting 1080i footage via the export as QT movie to 720p properly downrez the footage to 720p?