Is forcing Http tunneling mode possible ?

Hello,
in order to make some tests between 2 PC on the same intranet, I would like to know if it's possible to force RMI to use http tunneling, and to choose the mode : http-to-port or http-to-cgi ?
If possible, please tell me how.
Many thanks in advance.
C. BREZAK

RMI depends on custom socket factories (sun.rmi.transport.proxy.RMIHttpToPortSocketFactory, sun.rmi.transport.proxy.RMIHttpToCGISocketFactory) for carrying out the HTTP tunneling of RMI request if normal way of establishing a connection with the remote object fails. If no particular RMI socket factory is set in RMI application, RMI runtime chooses the RMIMasterSocketFactory() for creating client and server sockets. This socket factory maintains a list of socket factories which should be tried in order in establishing a successful connection with the remote object. This list includes RMIDirectSocketFacotry and HTTP tunneling socket factories mentioned above if http.proxyHost proerty is set.
You can force HTTP tunneling by explicitly setting default socket factory (RMISocketFactory.setSocketFactory(...)) to sun.rmi.transport.proxy.RMIHttpToPortSocketFactory in the client application. If this fails you can try setting default socket factory to RMIHttpToCGISocketFactory. It may not be possible trying these two options in the same instance of the program, because setSocketFactory() does not allow you to change the already defined default factory to the new one. This may not be elegant solution.
-- Srinath Mandalapu

Similar Messages

  • How to force HTTP:ORMI Tunnelling from JDEV?

    Hi,
    I deployed successfully ADF BC as EJB on OC4J and I have tested them using BC4J tester of JDEV.
    I setup a SWING ADF small grid and want to force the HTTP tunneling...
    How can I do that??
    Thanks in advance
    JO

    Weblogic 10.3 generated client use HTTP 1.1 protocol

  • Http tunneling (t3 over http) doesn't work!!  (examples too)

    Hi,
    I'm trying to get http tunneling (t3 connection over http protocol) to work. I
    ran some examples included with Weblogic that try establishing that connection
    (PingTest, HelloApplet, SimpleT3Client), as well as my own test program, and they
    all give an error similar to this :
    Couldn't get a reference to server. Exception :
    javax.naming.CommunicationException. Root exception is java.net.ConnectException:
    No server found at HTTP://<IP>:<port>
    at weblogic.rjvm.RJVMFinder.findOrCreate(RJVMFinder.java:161) at weblogic.rjvm.ServerURL.findOrCreateRJVM(ServerURL.java:200)
    at weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLInitialContextFactoryDelegate.java,
    Compiled Code) at weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLInitialContextFactoryDelegate.java:148)
    at weblogic.jndi.WLInitialContextFactory.getInitialContext(WLInitialContextFactory.java:123)
    at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:671) at
    javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:242) at javax.naming.InitialContext.init(InitialContext.java:218)
    at javax.naming.InitialContext.<init>(InitialContext.java:194)
    (I replaced the actual Ip and port with <IP> and <port>).
    Now, the server is started and working at that ip and port - it services web http
    requests correctly, etc. Regular T3 connection (not over http) also works with
    it.
    Does anyone know the reason for this problem and/or how to fix it?
    Thanks, Leonid Portnoy

    It appears that one has to use the "Java Plugin" for this mode to work. The
    question is does the version of plugin need to be "in sync" with the JVM
    version on the server. ?.
    /rk
    "Adomas Svirskas" <[email protected]> wrote in message
    news:[email protected]...
    >
    It seems that the solution is to have these two lines in the
    properties file:
    weblogic.httpd.enable=true
    weblogic.httpd.tunnelingenabled=true
    Now it works.
    Thanks,
    Adomas
    "Adomas Svirskas" <[email protected]> wrote:
    Hi Leonid,
    Have you found a solution for this? I have these problems too.
    Thanks,
    Adomas
    "Leonid Portnoy" <[email protected]> wrote:
    Hi,
    I'm trying to get http tunneling (t3 connection over http protocol)to
    work. I
    ran some examples included with Weblogic that try establishing thatconnection
    (PingTest, HelloApplet, SimpleT3Client), as well as my own test program,
    and they
    all give an error similar to this :
    Couldn't get a reference to server. Exception :
    javax.naming.CommunicationException. Root exception is
    java.net.ConnectException:
    No server found at HTTP://<IP>:<port>
    at weblogic.rjvm.RJVMFinder.findOrCreate(RJVMFinder.java:161) atweblogic.rjvm.ServerURL.findOrCreateRJVM(ServerURL.java:200)
    atweblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLInitialCon
    textFactoryDelegate.java,
    Compiled Code) atweblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLInitialCon
    textFactoryDelegate.java:148)
    atweblogic.jndi.WLInitialContextFactory.getInitialContext(WLInitialContextFact
    ory.java:123)
    atjavax.naming.spi.NamingManager.getInitialContext(NamingManager.java:671)
    at
    javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:242)
    at javax.naming.InitialContext.init(InitialContext.java:218)
    at javax.naming.InitialContext.<init>(InitialContext.java:194)
    (I replaced the actual Ip and port with <IP> and <port>).
    Now, the server is started and working at that ip and port - it services
    web http
    requests correctly, etc. Regular T3 connection (not over http) alsoworks
    with
    it.
    Does anyone know the reason for this problem and/or how to fix it?
    Thanks, Leonid Portnoy

  • HTTP tunneling is disabled in weblogic 9.2

    I have restarted my weblogic server on last saturday, after that i am getting the following exception continuously.
    ####<Jun 5, 2010 11:27:44 PM MEST> <Info> <ServletContext-/bea_wls_internal> <aberdeen> <IAEABEADMP> <[ACTIVE] ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)'> <<anonymous>> <> <> <1275773264990> <000000> <HTTPCl
    ntLogin: Login rejected with code: 'Failed', reason: java.net.ProtocolException: HTTP tunneling is disabled
    at weblogic.rjvm.http.HTTPServerJVMConnection.acceptJVMConnection(HTTPServerJVMConnection.java:88)
    at weblogic.rjvm.http.TunnelLoginServlet.service(TunnelLoginServlet.java:80)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
    at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:283)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:175)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3244)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
    at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2010)
    at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:1916)
    at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1366)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:181)
    In my weblogic server, i am not changed any configuration file, and i can see the HTTP tunneling flag is false (default value).
    Can any one tell why the reason for getting this exception.
    Since i have not changed any configiguration file and i am restarting the server every saturday, this is the first time i got this error.
    Please help to identify the possible reason for this error.?
    Oracle forums suggest that for resolving this just enable the HTTP tunneling flag in weblogic console.

    Thanks for you response manish.
    Once again i have gone throught the log file. Transactions are rollbacked but the cache is not cleaned. i contacted some of friends who is working in weblogic, even thought they are not able to find the solution.
    some guys are saying clean or flush ejb cache is container task. but the container not cleaning the ejb cache.
    Please any body give some solution for me it is very ugent.

  • HTTP-Tunneling through Apache Plug-in

    Hello,
    has anybody experience with HTTP-Tunneling of requests to a WLS
    4.5.1SP13 through an Apache-Webserver?
    I'm not able to configure the apache plug-in from weblogic to act as a
    reverse proxy for requests coming from a
    Java Client Application.
    Any Hints available?
    Remo

    "Jong Lee" <[email protected]> wrote in message
    news:3a4a9efa$[email protected]..
    >
    Remo Schnidrig <[email protected]> wrote:
    Hello Jong,
    HTTP tunneling will append ".tun" to your request.
    For apache, you can use "MatchExpression" to proxy the mime type.
    i.e: add the following line to your httpd.conf
    MatchExpression *.tunThat is functioning. Thank you very much.
    Another question:
    What about HTTPS-Tunneling through an Apache-Server?
    How can I get everything through?
    Thank you
    Remo
    We don't support https from the bridge to the server yet.
    JongWhat about using HTTPS-Tunneling between our Java client and the WLS
    Stronghold plug-in and HTTP-Tunneling between the plug-in and the WLS?
    If this is possible, how do I have to setup the stronghold?
    Remo

  • After removing force https can I get Firefox to quit redirecting me from google classic to google SSL?

    I was using Force https, and have since removed it. I am being redirected, however, to google SSL and cannot load the google classic page. I do not want to use SSL (https://encrypted.google.com). How do I get Firefox to direct me to the correct website as I enter it (www.google.com)? I have tried clearing my cache and cookies, as well as reading suggestions on google's forums. Help please? Thanks!

    Sounds like you picked up some re-direct Malware.
    Install, update, and run these programs in this order. They are listed in order of efficacy.<br />'''''(Not all programs detect the same Malware, so you may need to run them all to solve your problem.)''''' <br />These programs are all free for personal use, but some have limited functionality in the "free mode" - but those are features you really don't need to find and remove the problem that you have.<br />
    ''Note: If your Malware infection is bad enough and you are mis-directed to URL's other than what is posted, you may have to use a different PC to download these programs and use a USB stick to transfer them to the afflicted PC.''
    Malwarebytes' Anti-Malware - [http://www.malwarebytes.org/mbam.php] <br />
    SuperAntispyware - [http://www.superantispyware.com/] <br />
    AdAware - [http://www.lavasoftusa.com/software/adaware/] <br />
    Spybot Search & Destroy - [http://www.safer-networking.org/en/index.html] <br />
    Windows Defender: Home Page - [http://www.microsoft.com/windows/products/winfamily/defender/default.mspx]<br />
    Also, if you have a search engine re-direct problem, see this:<br />
    http://deletemalware.blogspot.com/2010/02/remove-google-redirect-virus.html
    If these don't find it or can't clear it, post in one of these forums for specialized malware removal help: <br />
    [http://www.spywarewarrior.com/index.php] <br />
    [http://forum.aumha.org/] <br />
    [http://www.spywareinfoforum.com/] <br />
    [http://bleepingcomputer.com]

  • HTTP Tunneling and Load Balancing with Weblogic Server 6.1

    We use T3 for Java client to application server communication (Weblogic Server
    6.1) and keep the session open for the life of the client. We many customers
    using this with load balancers and all works fine. We have just started to use
    BEA's HTTP tunneling and I have a question concerning how this will work with
    load balancers. Since the single T3 connection has been replaced with a series
    of stateless HTTP connections, does the BEA tunneling code put session information
    in the HTTP header? If so, what information does it place in the header. If
    it does we should be able to use that to make sure that the load balancer always
    sends HTTP requests with that session to the same application server.
    Thanks!
    Rick

    Rick,
    You may want to look at the Alteon and F5 configuration we have on edocs.
    Take a look at the following URLs for a possible solution
    http://edocs.bea.com/wls/docs61/cluster/alteon.html#591902
    http://edocs.bea.com/wls/docs61/cluster/bigip.html#591902
    Chuck Nelson
    DRE
    BEA Technical Support

  • JMS over HTTP, HTTP tunneling, imqhttp, Glassfish, Open MQ

    Hi,
    I want to run JMS over HTTP, because of firewalls.
    My environment:
    - Windows 7 64 bits
    - Java EE 6 SDK (Glassfish 3, installer java_ee_sdk-6u4-jdk7-windows-x64.exe)
    Following instructions (Oracle GlassFish Server Message Queue Administration Guide, HTTP/HTTPS Support), I have done as follows:
    1.- modified default.properties (in my case file D:\usr\Glassfish3\mq\lib\props\broker\default.properties) by adding "httpjms" to imq.service.activelist, so I have:
    # List of active services, started at startup
    imq.service.activelist=jms,admin,httpjms
    2.- modified server.policy file (in my case D:\usr\Glassfish3\glassfish\domains\domain1\config\server.policy) by adding at the end:
    grant codeBase "file:${com.sun.aas.installRoot}/glassfish/domains/domain1/applications/imqhttp/-" {
    permission java.net.SocketPermission "*",
    "connect,accept,resolve";
    3.- I then, using the Glassfish Admin Console (listening on port 4848), deployed the application packaged in the imqhttp.war WAR file (this WAR file taken from D:\usr\Glassfish3\mq\lib), using "imqhttp" as Context Root name.
    4.- I then invoke URL http://127.0.0.1:8080/imqhttp/tunnel and get the following return:
    HTTP tunneling servlet ready.
    Servlet Start Time : Wed Jul 04 19:28:01 CEST 2012
    Accepting TCP connections from brokers on port : 7675
    Total available brokers = 1
    Broker List :
    ANTEC:imqbroker
    Importantly: I had to reboot everything, including Windows to get the broker listed in the broker list.
    ...uh !!???!! ...it just shows that posting to discussion groups and sharing is great... yesterday, I could not get this working, I had nothing in my Broker list, and a bunch of exceptions when trying to publish a message... I swear I re-started Glassfish many times... now it's working all right, and the only thing I've done meantime is to reboot the PC...
    In any case, I keep the post, it might be of help to someone.
    Later
    Varus

    To have the new setting of broker property imq.service.activelist take effect, if EMBEDDED (default) jms-service is used, the GlassFish server needs to be restarted; otherwise, the broker process needs to be restarted. If the JMS service (EMBEDDED mode) in the GlassFish server has not been started (due to GlassFish JMS lazy init - default), run 'asadmin jms-ping' will start the embedded broker in GlassFish server.

  • IPSec tunnel mode vs self-encapsulation ESP

    Hello
    I need to develop some server application which should communicate with thousands of independent external clients through IPSec in tunnel mode.
    Configuration of IPSec must be done dynamically from application.
    There is a requirement to have the same source/destination IP address in the inner and in outer IP headers, tunnel must start and ends within the server and within each client.
    Is there any way to activate IPSec in tunnel mode without tunnel configuration?
    In Solaris documents I see that there is possibility to activate self-encapsulation ESP mode.
    Is this mode is the same as IPSec in tunnel mode?
    If answer is yes, then is it possible to activate this mode system-wide, but not per-socket?
    Thanks.

    Additionally to some proprietary data connections we need to provide FTP server for clients over these IPSec connections.
    Standard Solaris ftp server will be used.
    Will IPSec with ESP in transport mode over NAT give us such possibility?
    As far as I know FTP encapsulates IP addresses during it's work, so we think that only ESP tunnelling can provide normal working of FTP over NAT.
    Is it possible to configure such kind of tunnel in Solaris as described in my first mail?
    "There is a requirement to have the same source/destination IP address in the inner and in outer IP headers, tunnel must start and ends within the server and within each client."
    Thanks

  • HTTP tunneling and servlet sessions

              I am exploring the use of http tunneling to pass serialized java objects between a swing app
              and a weblogic servlet. The basic mechanism works fine but I have been unable to maintain a session
              across requests.
              Does anyone have any ideas or (hopefully) some sample code?
              TIA Bill
              

    Rick,
    You may want to look at the Alteon and F5 configuration we have on edocs.
    Take a look at the following URLs for a possible solution
    http://edocs.bea.com/wls/docs61/cluster/alteon.html#591902
    http://edocs.bea.com/wls/docs61/cluster/bigip.html#591902
    Chuck Nelson
    DRE
    BEA Technical Support

  • Http tunnelling not working with virtual host

    Hi,
    We have recently migrated our application from OC4J server to the Weblogic 11g server. There is one EJB client module which connects using t3 protocol. We are trying to use Http Tunneling for it. The server setup consists of two machines (machine1.global.com and machine2.global.com) in clustered mode. A virtual host cbs.global.com is configured to load balance across the above 2 two machine. Also Apache HTTP Server plugin is used for handling the web tier.
    For enabling tunneling, we have checked the 'Enable HTTP Tunneling' check box in the server. Also in the Httpd.conf file, we have added a block for
    <Location /HTTPClnt>
    SetHandler weblogic-handler
    </Location>
    If we give the initial context url as http://machine1.global.com:7005 or http://machine2.global.com, then it is working fine. But when we give the virtual host names - http://cbs.global.com or http://cbs.global.com:7005, it is not working. This application needs to be accessed outside the company network, so we cannot directly give the machine names and have to make it work using virtual host.
    Please advise whether any other settings need to be done for enabling the tunnelling for virtual hosts.
    Highly appreciate your help in this regard.
    Best Regards,
    Jaison
    Edited by: user13152776 on Aug 29, 2011 7:00 PM

    Thanks Peter for the reply.
    We are having multiple managed servers configured to multiple ports - 7003, 7005, 7007, etc. Please find below the mod_wl_ohs.conf file
    # NOTE : This is a template to configure mod_weblogic.
    LoadModule weblogic_module "${ORACLE_HOME}/ohs/modules/mod_wl_ohs.so"
    # This empty block is needed to save mod_wl related configuration from EM to this file when changes are made at the Base Virtual Host Level
    <IfModule weblogic_module>
    # WebLogicHost <WEBLOGIC_HOST>
    # WebLogicPort <WEBLOGIC_PORT>
    # Debug ON
    # WLLogFile /app/oracle/middleware/user_projects/domains/base_domain/ClusterLogs/weblogic.log
    # MatchExpression *.jsp
    # Dev Cluster Configuration - Port 7003
    <Location />
    SetHandler weblogic-handler
    WebLogicCluster nooslux050d.gl.2wglobal.com:7003,nooslux051d.gl.2wglobal.com:7003
    Debug ON
    WLLogFile /app/oracle/middleware/user_projects/domains/base_domain/ClusterLogs/devcluster.log
    MatchExpression *
    </Location>
    <Location /intApp>
    SetHandler weblogic-handler
    WebLogicCluster nooslux050d.gl.2wglobal.com:7003,nooslux051d.gl.2wglobal.com:7003
    Debug ON
    WLLogFile /app/oracle/middleware/user_projects/domains/base_domain/ClusterLogs/devcluster.log
    MatchExpression *
    </Location>
    # Ocean Cluster Configuration - Port 7005
    <Location /CQS>
    SetHandler weblogic-handler
    WebLogicCluster nooslux050d.gl.2wglobal.com:7005,nooslux051d.gl.2wglobal.com:7005
    Debug ON
    WLLogFile /app/oracle/middleware/user_projects/domains/base_domain/ClusterLogs/oceancluster.log
    MatchExpression *
    </Location>
    # Websi Cluster Configuration - Port 7007
    <Location /si>
    SetHandler weblogic-handler
    WebLogicCluster nooslux050d.gl.2wglobal.com:7007,nooslux051d.gl.2wglobal.com:7007
    Debug ON
    WLLogFile /app/oracle/middleware/user_projects/domains/base_domain/ClusterLogs/websicluster.log
    MatchExpression *
    </Location>
    </IfModule>
    Best Regards,
    Jaison

  • For http tunnel

    hi dear to all
    i am new to http tunneling.
    i want to know how should i confignure the SSL between the webserver to database server. because i want to send/receiver the data from database. i want to know how should i configure the ssl in sever? is there any options for that? what r the softwares required for that? if it is not possible manually if write the code for SSL ; is it possible to keep between server and database. if u have the code please provide me.
    thank u
    regards
    krishna

    Hi krishna,
    Why do you need to tunnel from App Server to Database?
    Dont you use JDBC???
    If not, are you using some kind of protocol to access data from Database? I know people use SOAP Messages in Web Services to access Database.
    Please let us know what is your real requirement for us to understand your architecture more and give possible options.
    Thanks and regards,
    Pazhanikanthan. P

  • Force to Disk Mode didnt work. What now?

    Tried multiple times to force to disc mode. Keep getting sad face/exclamaiton errror. What now? How much does it cost to have apple fix it at a shop?

    Hello cnjmills,
    It sounds like your iPod has the sad face with an exclamation point on it, and you cannot put it into Disk mode. The following article outlines what to do next:
    iPod displays a sad iPod icon
    http://support.apple.com/kb/ts1373
    If you cannot force your iPod into disk mode and restore it, then your iPod is in need of service. Set up an iPod Service Request or make a reservation at the Genius Bar before visiting your local Apple Retail Store. To make a reservation:
    Go to http://www.apple.com/retail/storelist/.
    Choose an Apple Store location.
    Click the Reserve link under Genius Bar.
    Choose iPod.
    Select your desired reservation date and time.
    Thank you for using Apple Support Communities.
    All the best,
    Sterling

  • Help needed in HTTP Tunneling - urgent

    Hi all,
    I urgently need a working code sample of a client which sends requests to a server that redirects the request to an RMI server via RMI servlet.
    Does any of you familiar of such a code sample?
    Thanks

    I'm sorry, but HTTP Tunneling is not working for me. I must have done something wrong.
    Let me describe my configuration:
    I have a server behind NAT router which connected to apache2 and tomcat 4.1 web servers. The apache2 and tomcat are not connected between them.
    I deployed war file on tomcat which contains the servlet for the HTTP Tunneling which its code is:
    public class RmiHttpTunnelerServlet extends HttpServlet
        public void init(ServletConfig config) throws ServletException
            super.init(config);
            System.out.println("Simplified RMI Servlet Handler loaded successfully.");
        public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
            try
                String queryString = req.getQueryString();
                String command, param;
                int delim = queryString.indexOf("=");
                if (delim == -1)
                    command = queryString;
                    param = "";
                else
                    command = queryString.substring(0, delim);
                    param = queryString.substring(delim + 1);
                if (command.equalsIgnoreCase("forward"))
                    try
                        ServletForwardCommand.execute(req, res, param);
                    catch (ServletClientException e)
                        returnClientError(res, "client error : " + e.getMessage( ));
                        e.printStackTrace();
                    catch (ServletServerException e)
                        returnServerError(res, "internal server error : " + e.getMessage());
                        e.printStackTrace();
                else
                    returnClientError(res, "invalid command: " + command);
            catch (Exception e)
                returnServerError(res, "internal error: " + e.getMessage());
                e.printStackTrace();
        public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
            returnClientError(res, "GET Operation not supported: Can only forward POST requests.");
        public void doPut(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
            returnClientError(res, "PUT Operation not supported: Can only forward POST requests.");
        public String getServletInfo()
            return "Simplified RMI Call Forwarding Servlet Servlet.<br>\n ";
        private static void returnClientError(HttpServletResponse res, String message) throws IOException
            res.sendError(HttpServletResponse.SC_BAD_REQUEST,
                          "<HTML><HEAD><TITLE>Java RMI Client Error < / TITLE > < / HEAD > < BODY > " +
                          "<H1>Java RMI Client Error</H1>" + message + "</BODY></HTML>");
            System.err.println(HttpServletResponse.SC_BAD_REQUEST + "Java RMI Client Error" + message);
        private static void returnServerError(HttpServletResponse res,
                                              String message) throws IOException
            res.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
                          "<HTML><HEAD>< TITLE > Java RMI Server Error < / TITLE > < / HEAD > < BODY > " +
                          "<H1>Java RMI Server Error < / H1 > " + message + " < / BODY > < / HTML > ");
            System.err.println(HttpServletResponse.SC_INTERNAL_SERVER_ERROR + "Java RMI Server Error : " + message);
        }There is also a utility class:
    public class ServletForwardCommand {
        public static void execute(HttpServletRequest request, HttpServletResponse response, String stringifiedPort)
            throws ServletClientException, ServletServerException, IOException {
            int port = convertStringToPort(stringifiedPort);
            Socket connectionToLocalServer = null;
            try {
                connectionToLocalServer = connectToLocalServer(port);
                forwardRequest(request, connectionToLocalServer);
                forwardResponse(response, connectionToLocalServer);
            } finally {
                if (null != connectionToLocalServer) {
                    connectionToLocalServer.close();
        private static int convertStringToPort(String stringfiedPort) throws ServletClientException {
            int returnValue;
            try {
                returnValue = Integer.parseInt(stringfiedPort);
            } catch (NumberFormatException e) {
                throw new ServletClientException("invalid port number: " + stringfiedPort);
            if (returnValue <= 0 || returnValue > 0xFFFF) {
                throw new ServletClientException("invalid port: " + returnValue);
            if (returnValue < 1024) {
                throw new ServletClientException("permission denied for port: " + returnValue);
            return returnValue;
        private static Socket connectToLocalServer(int port) throws ServletServerException {
            Socket returnValue;
            try {
                returnValue = new Socket(InetAddress.getLocalHost(), port);
            } catch (IOException e) {
                throw new ServletServerException("could not connect to " + "local port");
            return returnValue;
        private static void forwardRequest(HttpServletRequest request, Socket connectionToLocalServer)
            throws IOException, ServletClientException, ServletServerException {
            byte buffer[];
            DataInputStream clientIn = new DataInputStream(request.getInputStream());
            buffer = new byte[request.getContentLength()];
            try {
                clientIn.readFully(buffer);
            } catch (EOFException e) {
                throw new ServletClientException("unexpected EOF " + "reading request body");
            } catch (IOException e) {
                throw new ServletClientException("error reading request" + " body");
            DataOutputStream socketOut = null;
            // send to local server in HTTP
            try {
                socketOut = new DataOutputStream(connectionToLocalServer.getOutputStream());
                socketOut.writeBytes("POST / HTTP/1.0\r\n");
                socketOut.writeBytes("Content-length: " + request.getContentLength() + "\r\n\r\n");
                socketOut.write(buffer);
                socketOut.flush();
            } catch (IOException e) {
                throw new ServletServerException("error writing to server");
        private static void forwardResponse(HttpServletResponse response, Socket connectionToLocalServer)
            throws IOException, ServletClientException, ServletServerException {
            byte[] buffer;
            DataInputStream socketIn;
            try {
                socketIn = new DataInputStream(connectionToLocalServer.getInputStream());
            } catch (IOException e) {
                throw new ServletServerException("error reading from " + "server");
            String key = "Content-length:".toLowerCase();
            boolean contentLengthFound = false;
            String line;
            int responseContentLength = -1;
            do {
                try {
                    line = socketIn.readLine();
                } catch (IOException e) {
                    throw new ServletServerException("error reading from server");
                if (line == null) {
                    throw new ServletServerException("unexpected EOF reading server response");
                if (line.toLowerCase().startsWith(key)) {
                    responseContentLength = Integer.parseInt(line.substring(key.length()).trim());
                    contentLengthFound = true;
            while ((line.length() != 0) &&
                (line.charAt(0) != '\r') && (line.charAt(0) != '\n'));
            if (!contentLengthFound || responseContentLength < 0)
                throw new ServletServerException("missing or invalid content length in server response");
            buffer = new byte[responseContentLength];
            try {
                socketIn.readFully(buffer);
            } catch (EOFException e) {
                throw new ServletServerException("unexpected EOF reading server response");
            } catch (IOException e) {
                throw new ServletServerException("error reading from server");
            response.setStatus(HttpServletResponse.SC_OK);
            response.setContentType("application/octet-stream");
            response.setContentLength(buffer.length);
            try {
                OutputStream out = response.getOutputStream();
                out.write(buffer);
                out.flush();
            } catch (IOException e) {
                throw new ServletServerException("error writing response");
    }I checked also with packets monitoring tool, I couldn't see any http transportation.
    Any help will be appreciated.

  • How to force HTTPS on a page

    We have registration forms and other pages that collect personal details from users who are registering for the site or submitting other transactions (other than shopping cart purchases). By default these pages are delivered using HTTP under the main website.
    We need these pages to be secured using HTTPS. How can we force  HTTPS on these pages?
    Thanks,
    Colin

    Only way on BC is javascript
    eg:
    var secureURL = "yourdomain.worldsecuresystems.com";
    if ((window.location.protocol == "http:" || location.hostname != secureURL) && location.search.search("A=Template") == -1 && location.search.search("Preview") == -1) window.location = "https://"+secureURL+window.location.pathname;

Maybe you are looking for