Search in sources :

Example 1 with HTTPSRequest

use of APJP.HTTP11.HTTPSRequest in project apjp by jvansteirteghem.

the class HTTPSServerWorker method process.

public void process() throws Exception {
    InputStream inputSSLSocketInputStream = inputSSLSocket.getInputStream();
    OutputStream inputSSLSocketOutputStream = inputSSLSocket.getOutputStream();
    HTTPSRequests httpsRequests = HTTPSRequests.getHTTPSRequests();
    HTTPRequestMessage httpRequestMessage1 = new HTTPRequestMessage(inputSSLSocketInputStream);
    httpRequestMessage1.read();
    HTTPMessageHeader httpRequestMessage1Header1 = httpRequestMessage1.getHTTPMessageHeader("");
    if (httpRequestMessage1Header1 == null) {
        keepAlive = false;
        return;
    }
    String httpRequestMessage1Header1Value1 = httpRequestMessage1Header1.getValue();
    if (httpRequestMessage1Header1Value1.equalsIgnoreCase("")) {
        keepAlive = false;
        return;
    }
    processHTTPRequestMessage(httpRequestMessage1);
    HTTPResponseMessage httpResponseMessage1 = null;
    try {
        HTTPSRequest httpsRequest1 = httpsRequests.createHTTPSRequest(httpRequestMessage1);
        httpsRequest1.open();
        try {
            httpResponseMessage1 = httpsRequest1.getHTTPResponseMessage();
            processHTTPResponseMessage(httpResponseMessage1);
            HTTPMessageHeader[] httpResponseMessage1Headers1 = httpResponseMessage1.getHTTPMessageHeaders();
            HTTPMessageHeader httpResponseMessage1Header1 = httpResponseMessage1Headers1[0];
            String httpResponseMessage1Header1Key1 = httpResponseMessage1Header1.getKey();
            String httpResponseMessage1Header1Value1 = httpResponseMessage1Header1.getValue();
            inputSSLSocketOutputStream.write((httpResponseMessage1Header1Value1 + "\r\n").getBytes());
            for (int i = 1; i < httpResponseMessage1Headers1.length; i = i + 1) {
                httpResponseMessage1Header1 = httpResponseMessage1Headers1[i];
                httpResponseMessage1Header1Key1 = httpResponseMessage1Header1.getKey();
                httpResponseMessage1Header1Value1 = httpResponseMessage1Header1.getValue();
                inputSSLSocketOutputStream.write((httpResponseMessage1Header1Key1 + ": " + httpResponseMessage1Header1Value1 + "\r\n").getBytes());
            }
            inputSSLSocketOutputStream.write(("\r\n").getBytes());
            httpResponseMessage1.read(inputSSLSocketOutputStream);
        } catch (Exception e) {
            throw e;
        } finally {
            try {
                httpsRequest1.close();
            } catch (Exception e) {
            }
        }
    } catch (Exception e) {
        logger.log(2, "HTTPS_SERVER_WORKER/PROCESS: EXCEPTION", e);
        if (httpResponseMessage1 == null) {
            String[] httpRequestMessage1Header1Values1 = httpRequestMessage1Header1Value1.split(" ");
            String httpRequestMessage1Header1Value2 = httpRequestMessage1Header1Values1[0];
            if (!httpRequestMessage1Header1Value2.equalsIgnoreCase("GET")) {
                throw new HTTPSServerException("HTTPS_SERVER_WORKER/PROCESS: REQUEST/METHOD != \"GET\", REQUEST/METHOD == \"" + httpRequestMessage1Header1Value2 + "\"");
            }
            HTTPMessageHeader httpRequestMessage1Header2 = httpRequestMessage1.getHTTPMessageHeader("If-Range");
            if (httpRequestMessage1Header2 != null) {
                String httpRequestMessage1Header2Value1 = httpRequestMessage1Header2.getValue();
                throw new HTTPSServerException("HTTPS_SERVER_WORKER/PROCESS: REQUEST/IF_RANGE != \"\", REQUEST/IF_RANGE == \"" + httpRequestMessage1Header2Value1 + "\"");
            }
            HTTPMessageHeader httpRequestMessage1Header3 = httpRequestMessage1.getHTTPMessageHeader("Range");
            if (httpRequestMessage1Header3 != null) {
                String httpRequestMessage1Header3Value1 = httpRequestMessage1Header3.getValue();
                throw new HTTPSServerException("HTTPS_SERVER_WORKER/PROCESS: REQUEST/RANGE != \"\", REQUEST/RANGE == \"" + httpRequestMessage1Header3Value1 + "\"");
            }
            httpRequestMessage1Header1Values1[0] = "HEAD";
            httpRequestMessage1Header1Value1 = httpRequestMessage1Header1Values1[0];
            for (int i = 1; i < httpRequestMessage1Header1Values1.length; i = i + 1) {
                httpRequestMessage1Header1Value1 = httpRequestMessage1Header1Value1 + " " + httpRequestMessage1Header1Values1[i];
            }
            httpRequestMessage1Header1.setValue(httpRequestMessage1Header1Value1);
            HTTPSRequest httpsRequest1 = httpsRequests.createHTTPSRequest(httpRequestMessage1);
            httpsRequest1.open();
            try {
                httpResponseMessage1 = httpsRequest1.getHTTPResponseMessage();
            } catch (Exception e2) {
                throw e2;
            } finally {
                try {
                    httpsRequest1.close();
                } catch (Exception e2) {
                }
            }
            HTTPMessageHeader httpResponseMessage1Header1 = httpResponseMessage1.getHTTPMessageHeader("Accept-Ranges");
            if (httpResponseMessage1Header1 == null) {
                throw new HTTPSServerException("HTTPS_SERVER_WORKER/PROCESS: RESPONSE/ACCEPT_RANGES != \"bytes\", RESPONSE/ACCEPT_RANGES == \"\"");
            }
            String httpResponseMessage1Header1Value1 = httpResponseMessage1Header1.getValue();
            if (!httpResponseMessage1Header1Value1.equalsIgnoreCase("bytes")) {
                throw new HTTPSServerException("HTTPS_SERVER_WORKER/PROCESS: RESPONSE/ACCEPT_RANGES != \"bytes\", RESPONSE/ACCEPT_RANGES == \"" + httpResponseMessage1Header1Value1 + "\"");
            }
            processHTTPResponseMessage(httpResponseMessage1);
            HTTPMessageHeader[] httpResponseMessage1Headers1 = httpResponseMessage1.getHTTPMessageHeaders();
            HTTPMessageHeader httpResponseMessage1Header2 = httpResponseMessage1Headers1[0];
            String httpResponseMessage1Header2Key1 = httpResponseMessage1Header2.getKey();
            String httpResponseMessage1Header2Value1 = httpResponseMessage1Header2.getValue();
            inputSSLSocketOutputStream.write((httpResponseMessage1Header2Value1 + "\r\n").getBytes());
            for (int i = 1; i < httpResponseMessage1Headers1.length; i = i + 1) {
                httpResponseMessage1Header2 = httpResponseMessage1Headers1[i];
                httpResponseMessage1Header2Key1 = httpResponseMessage1Header2.getKey();
                httpResponseMessage1Header2Value1 = httpResponseMessage1Header2.getValue();
                inputSSLSocketOutputStream.write((httpResponseMessage1Header2Key1 + ": " + httpResponseMessage1Header2Value1 + "\r\n").getBytes());
            }
            inputSSLSocketOutputStream.write(("\r\n").getBytes());
            HTTPMessageHeader httpResponseMessage1Header3 = httpResponseMessage1.getHTTPMessageHeader("Content-Length");
            int httpResponseMessage1Header3Value1 = 0;
            if (httpResponseMessage1Header3 != null) {
                try {
                    httpResponseMessage1Header3Value1 = new Integer(httpResponseMessage1Header3.getValue());
                } catch (Exception e2) {
                }
            }
            httpRequestMessage1Header1Values1[0] = "GET";
            httpRequestMessage1Header1Value1 = httpRequestMessage1Header1Values1[0];
            for (int i = 1; i < httpRequestMessage1Header1Values1.length; i = i + 1) {
                httpRequestMessage1Header1Value1 = httpRequestMessage1Header1Value1 + " " + httpRequestMessage1Header1Values1[i];
            }
            httpRequestMessage1Header1.setValue(httpRequestMessage1Header1Value1);
            long i = 0;
            long j = 1048576;
            if (j > httpResponseMessage1Header3Value1 - 1) {
                j = httpResponseMessage1Header3Value1 - 1;
            }
            while (i < httpResponseMessage1Header3Value1 - 1) {
                HTTPMessageHeader httpRequestMessage1Header4 = httpRequestMessage1.getHTTPMessageHeader("Range");
                if (httpRequestMessage1Header4 != null) {
                    httpRequestMessage1.removeHTTPMessageHeader(httpRequestMessage1Header4);
                }
                httpRequestMessage1.addHTTPMessageHeader(new HTTPMessageHeader("Range", "bytes=" + i + "-" + j));
                HTTPResponseMessage httpResponseMessage2 = null;
                int k = 1;
                while (k <= 5) {
                    try {
                        HTTPSRequest httpsRequest2 = httpsRequests.createHTTPSRequest(httpRequestMessage1);
                        httpsRequest2.open();
                        try {
                            httpResponseMessage2 = httpsRequest2.getHTTPResponseMessage();
                            HTTPMessageHeader httpResponseMessage2Header1 = httpResponseMessage2.getHTTPMessageHeader("Content-Range");
                            if (httpResponseMessage2Header1 == null) {
                                throw new HTTPSServerException("HTTPS_SERVER_WORKER/PROCESS: RESPONSE/CONTENT_RANGE != \"bytes " + i + "-" + j + "/" + httpResponseMessage1Header3Value1 + "\", RESPONSE/CONTENT_RANGE == \"\"");
                            }
                            String httpResponseMessage2Header1Value1 = httpResponseMessage2Header1.getValue();
                            if (!httpResponseMessage2Header1Value1.equalsIgnoreCase("bytes " + i + "-" + j + "/" + httpResponseMessage1Header3Value1)) {
                                throw new HTTPSServerException("HTTPS_SERVER_WORKER/PROCESS: RESPONSE/CONTENT_RANGE != \"bytes " + i + "-" + j + "/" + httpResponseMessage1Header3Value1 + "\", RESPONSE/CONTENT_RANGE == \"" + httpResponseMessage2Header1Value1 + "\"");
                            }
                            httpResponseMessage2.read(inputSSLSocketOutputStream);
                        } catch (Exception e2) {
                            throw e;
                        } finally {
                            try {
                                httpsRequest2.close();
                            } catch (Exception e2) {
                            }
                        }
                        k = 5;
                    } catch (Exception e2) {
                        logger.log(2, "HTTPS_SERVER_WORKER/PROCESS: EXCEPTION", e2);
                        if (k == 5) {
                            throw new HTTPSServerException("HTTPS_SERVER_WORKER/PROCESS");
                        }
                    }
                    k = k + 1;
                }
                i = j + 1;
                j = j + 1 + 1048576;
                if (j > httpResponseMessage1Header3Value1 - 1) {
                    j = httpResponseMessage1Header3Value1 - 1;
                }
            }
        }
    }
}
Also used : HTTPRequestMessage(APJP.HTTP11.HTTPRequestMessage) HTTPSRequest(APJP.HTTP11.HTTPSRequest) InputStream(java.io.InputStream) OutputStream(java.io.OutputStream) HTTPMessageHeader(APJP.HTTP11.HTTPMessageHeader) HTTPSRequests(APJP.HTTP11.HTTPSRequests) HTTPResponseMessage(APJP.HTTP11.HTTPResponseMessage)

Example 2 with HTTPSRequest

use of APJP.HTTP11.HTTPSRequest in project apjp by jvansteirteghem.

the class HTTPSServerWorker method process.

public void process() throws Exception {
    InputStream inputSSLSocketInputStream = inputSSLSocket.getInputStream();
    OutputStream inputSSLSocketOutputStream = inputSSLSocket.getOutputStream();
    HTTPSRequests httpsRequests = HTTPSRequests.getHTTPSRequests();
    HTTPRequestMessage httpRequestMessage1 = new HTTPRequestMessage(inputSSLSocketInputStream);
    httpRequestMessage1.read();
    HTTPMessageHeader httpRequestMessage1Header1 = httpRequestMessage1.getHTTPMessageHeader("");
    if (httpRequestMessage1Header1 == null) {
        keepAlive = false;
        return;
    }
    String httpRequestMessage1Header1Value1 = httpRequestMessage1Header1.getValue();
    if (httpRequestMessage1Header1Value1.equalsIgnoreCase("")) {
        keepAlive = false;
        return;
    }
    processHTTPRequestMessage(httpRequestMessage1);
    HTTPResponseMessage httpResponseMessage1 = null;
    try {
        HTTPSRequest httpsRequest1 = httpsRequests.createHTTPSRequest(httpRequestMessage1);
        httpsRequest1.open();
        try {
            httpResponseMessage1 = httpsRequest1.getHTTPResponseMessage();
            processHTTPResponseMessage(httpResponseMessage1);
            HTTPMessageHeader[] httpResponseMessage1Headers1 = httpResponseMessage1.getHTTPMessageHeaders();
            HTTPMessageHeader httpResponseMessage1Header1 = httpResponseMessage1Headers1[0];
            String httpResponseMessage1Header1Key1 = httpResponseMessage1Header1.getKey();
            String httpResponseMessage1Header1Value1 = httpResponseMessage1Header1.getValue();
            inputSSLSocketOutputStream.write((httpResponseMessage1Header1Value1 + "\r\n").getBytes());
            for (int i = 1; i < httpResponseMessage1Headers1.length; i = i + 1) {
                httpResponseMessage1Header1 = httpResponseMessage1Headers1[i];
                httpResponseMessage1Header1Key1 = httpResponseMessage1Header1.getKey();
                httpResponseMessage1Header1Value1 = httpResponseMessage1Header1.getValue();
                inputSSLSocketOutputStream.write((httpResponseMessage1Header1Key1 + ": " + httpResponseMessage1Header1Value1 + "\r\n").getBytes());
            }
            inputSSLSocketOutputStream.write(("\r\n").getBytes());
            httpResponseMessage1.read(inputSSLSocketOutputStream);
        } catch (Exception e) {
            throw e;
        } finally {
            try {
                httpsRequest1.close();
            } catch (Exception e) {
            }
        }
    } catch (Exception e) {
        logger.log(2, "HTTPS_SERVER_WORKER/PROCESS: EXCEPTION", e);
        if (httpResponseMessage1 == null) {
            String[] httpRequestMessage1Header1Values1 = httpRequestMessage1Header1Value1.split(" ");
            String httpRequestMessage1Header1Value2 = httpRequestMessage1Header1Values1[0];
            if (!httpRequestMessage1Header1Value2.equalsIgnoreCase("GET")) {
                throw new HTTPSServerException("HTTPS_SERVER_WORKER/PROCESS: REQUEST/METHOD != \"GET\", REQUEST/METHOD == \"" + httpRequestMessage1Header1Value2 + "\"");
            }
            HTTPMessageHeader httpRequestMessage1Header2 = httpRequestMessage1.getHTTPMessageHeader("If-Range");
            if (httpRequestMessage1Header2 != null) {
                String httpRequestMessage1Header2Value1 = httpRequestMessage1Header2.getValue();
                throw new HTTPSServerException("HTTPS_SERVER_WORKER/PROCESS: REQUEST/IF_RANGE != \"\", REQUEST/IF_RANGE == \"" + httpRequestMessage1Header2Value1 + "\"");
            }
            HTTPMessageHeader httpRequestMessage1Header3 = httpRequestMessage1.getHTTPMessageHeader("Range");
            if (httpRequestMessage1Header3 != null) {
                String httpRequestMessage1Header3Value1 = httpRequestMessage1Header3.getValue();
                throw new HTTPSServerException("HTTPS_SERVER_WORKER/PROCESS: REQUEST/RANGE != \"\", REQUEST/RANGE == \"" + httpRequestMessage1Header3Value1 + "\"");
            }
            httpRequestMessage1Header1Values1[0] = "HEAD";
            httpRequestMessage1Header1Value1 = httpRequestMessage1Header1Values1[0];
            for (int i = 1; i < httpRequestMessage1Header1Values1.length; i = i + 1) {
                httpRequestMessage1Header1Value1 = httpRequestMessage1Header1Value1 + " " + httpRequestMessage1Header1Values1[i];
            }
            httpRequestMessage1Header1.setValue(httpRequestMessage1Header1Value1);
            HTTPSRequest httpsRequest1 = httpsRequests.createHTTPSRequest(httpRequestMessage1);
            httpsRequest1.open();
            try {
                httpResponseMessage1 = httpsRequest1.getHTTPResponseMessage();
            } catch (Exception e2) {
                throw e2;
            } finally {
                try {
                    httpsRequest1.close();
                } catch (Exception e2) {
                }
            }
            HTTPMessageHeader httpResponseMessage1Header1 = httpResponseMessage1.getHTTPMessageHeader("Accept-Ranges");
            if (httpResponseMessage1Header1 == null) {
                throw new HTTPSServerException("HTTPS_SERVER_WORKER/PROCESS: RESPONSE/ACCEPT_RANGES != \"bytes\", RESPONSE/ACCEPT_RANGES == \"\"");
            }
            String httpResponseMessage1Header1Value1 = httpResponseMessage1Header1.getValue();
            if (!httpResponseMessage1Header1Value1.equalsIgnoreCase("bytes")) {
                throw new HTTPSServerException("HTTPS_SERVER_WORKER/PROCESS: RESPONSE/ACCEPT_RANGES != \"bytes\", RESPONSE/ACCEPT_RANGES == \"" + httpResponseMessage1Header1Value1 + "\"");
            }
            processHTTPResponseMessage(httpResponseMessage1);
            HTTPMessageHeader[] httpResponseMessage1Headers1 = httpResponseMessage1.getHTTPMessageHeaders();
            HTTPMessageHeader httpResponseMessage1Header2 = httpResponseMessage1Headers1[0];
            String httpResponseMessage1Header2Key1 = httpResponseMessage1Header2.getKey();
            String httpResponseMessage1Header2Value1 = httpResponseMessage1Header2.getValue();
            inputSSLSocketOutputStream.write((httpResponseMessage1Header2Value1 + "\r\n").getBytes());
            for (int i = 1; i < httpResponseMessage1Headers1.length; i = i + 1) {
                httpResponseMessage1Header2 = httpResponseMessage1Headers1[i];
                httpResponseMessage1Header2Key1 = httpResponseMessage1Header2.getKey();
                httpResponseMessage1Header2Value1 = httpResponseMessage1Header2.getValue();
                inputSSLSocketOutputStream.write((httpResponseMessage1Header2Key1 + ": " + httpResponseMessage1Header2Value1 + "\r\n").getBytes());
            }
            inputSSLSocketOutputStream.write(("\r\n").getBytes());
            HTTPMessageHeader httpResponseMessage1Header3 = httpResponseMessage1.getHTTPMessageHeader("Content-Length");
            int httpResponseMessage1Header3Value1 = 0;
            if (httpResponseMessage1Header3 != null) {
                try {
                    httpResponseMessage1Header3Value1 = new Integer(httpResponseMessage1Header3.getValue());
                } catch (Exception e2) {
                }
            }
            httpRequestMessage1Header1Values1[0] = "GET";
            httpRequestMessage1Header1Value1 = httpRequestMessage1Header1Values1[0];
            for (int i = 1; i < httpRequestMessage1Header1Values1.length; i = i + 1) {
                httpRequestMessage1Header1Value1 = httpRequestMessage1Header1Value1 + " " + httpRequestMessage1Header1Values1[i];
            }
            httpRequestMessage1Header1.setValue(httpRequestMessage1Header1Value1);
            long i = 0;
            long j = 1048576;
            if (j > httpResponseMessage1Header3Value1 - 1) {
                j = httpResponseMessage1Header3Value1 - 1;
            }
            while (i < httpResponseMessage1Header3Value1 - 1) {
                HTTPMessageHeader httpRequestMessage1Header4 = httpRequestMessage1.getHTTPMessageHeader("Range");
                if (httpRequestMessage1Header4 != null) {
                    httpRequestMessage1.removeHTTPMessageHeader(httpRequestMessage1Header4);
                }
                httpRequestMessage1.addHTTPMessageHeader(new HTTPMessageHeader("Range", "bytes=" + i + "-" + j));
                HTTPResponseMessage httpResponseMessage2 = null;
                int k = 1;
                while (k <= 5) {
                    try {
                        HTTPSRequest httpsRequest2 = httpsRequests.createHTTPSRequest(httpRequestMessage1);
                        httpsRequest2.open();
                        try {
                            httpResponseMessage2 = httpsRequest2.getHTTPResponseMessage();
                            HTTPMessageHeader httpResponseMessage2Header1 = httpResponseMessage2.getHTTPMessageHeader("Content-Range");
                            if (httpResponseMessage2Header1 == null) {
                                throw new HTTPSServerException("HTTPS_SERVER_WORKER/PROCESS: RESPONSE/CONTENT_RANGE != \"bytes " + i + "-" + j + "/" + httpResponseMessage1Header3Value1 + "\", RESPONSE/CONTENT_RANGE == \"\"");
                            }
                            String httpResponseMessage2Header1Value1 = httpResponseMessage2Header1.getValue();
                            if (!httpResponseMessage2Header1Value1.equalsIgnoreCase("bytes " + i + "-" + j + "/" + httpResponseMessage1Header3Value1)) {
                                throw new HTTPSServerException("HTTPS_SERVER_WORKER/PROCESS: RESPONSE/CONTENT_RANGE != \"bytes " + i + "-" + j + "/" + httpResponseMessage1Header3Value1 + "\", RESPONSE/CONTENT_RANGE == \"" + httpResponseMessage2Header1Value1 + "\"");
                            }
                            httpResponseMessage2.read(inputSSLSocketOutputStream);
                        } catch (Exception e2) {
                            throw e;
                        } finally {
                            try {
                                httpsRequest2.close();
                            } catch (Exception e2) {
                            }
                        }
                        k = 5;
                    } catch (Exception e2) {
                        logger.log(2, "HTTPS_SERVER_WORKER/PROCESS: EXCEPTION", e2);
                        if (k == 5) {
                            throw new HTTPSServerException("HTTPS_SERVER_WORKER/PROCESS");
                        }
                    }
                    k = k + 1;
                }
                i = j + 1;
                j = j + 1 + 1048576;
                if (j > httpResponseMessage1Header3Value1 - 1) {
                    j = httpResponseMessage1Header3Value1 - 1;
                }
            }
        }
    }
}
Also used : HTTPRequestMessage(APJP.ANDROID.HTTP11.HTTPRequestMessage) HTTPSRequest(APJP.ANDROID.HTTP11.HTTPSRequest) InputStream(java.io.InputStream) OutputStream(java.io.OutputStream) HTTPMessageHeader(APJP.ANDROID.HTTP11.HTTPMessageHeader) HTTPSRequests(APJP.ANDROID.HTTP11.HTTPSRequests) HTTPResponseMessage(APJP.ANDROID.HTTP11.HTTPResponseMessage)

Example 3 with HTTPSRequest

use of APJP.HTTP11.HTTPSRequest in project apjp by jvansteirteghem.

the class HTTPSServlet method doPost.

public void doPost(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws ServletException, IOException {
    try {
        httpServletResponse.setStatus(200);
        for (int i = 0; i < APJP_REMOTE_HTTPS_SERVER_RESPONSE_PROPERTY_KEY.length; i = i + 1) {
            if (APJP_REMOTE_HTTPS_SERVER_RESPONSE_PROPERTY_KEY[i].equalsIgnoreCase("") == false) {
                httpServletResponse.addHeader(APJP_REMOTE_HTTPS_SERVER_RESPONSE_PROPERTY_KEY[i], APJP_REMOTE_HTTPS_SERVER_RESPONSE_PROPERTY_VALUE[i]);
            }
        }
        SecretKeySpec secretKeySpec = new SecretKeySpec(APJP_KEY.getBytes(), "ARCFOUR");
        Cipher inputStreamCipher = Cipher.getInstance("ARCFOUR");
        inputStreamCipher.init(Cipher.DECRYPT_MODE, secretKeySpec);
        CipherInputStream httpRequestInputStream = new CipherInputStream(httpServletRequest.getInputStream(), inputStreamCipher);
        Cipher outputStreamCipher = Cipher.getInstance("ARCFOUR");
        outputStreamCipher.init(Cipher.ENCRYPT_MODE, secretKeySpec);
        CipherOutputStream httpResponseOutputStream = new CipherOutputStream(httpServletResponse.getOutputStream(), outputStreamCipher);
        HTTPRequestMessage httpRequestMessage1 = new HTTPRequestMessage(httpRequestInputStream);
        httpRequestMessage1.read();
        HTTPSRequest httpsRequest1 = new HTTPSRequest(httpRequestMessage1);
        httpsRequest1.open();
        try {
            HTTPResponseMessage httpResponseMessage1 = httpsRequest1.getHTTPResponseMessage();
            HTTPMessageHeader[] httpResponseMessage1Headers1 = httpResponseMessage1.getHTTPMessageHeaders();
            HTTPMessageHeader httpResponseMessage1Header1 = httpResponseMessage1Headers1[0];
            String httpResponseMessage1Header1Key1 = httpResponseMessage1Header1.getKey();
            String httpResponseMessage1Header1Value1 = httpResponseMessage1Header1.getValue();
            httpResponseOutputStream.write((httpResponseMessage1Header1Value1 + "\r\n").getBytes());
            for (int i = 1; i < httpResponseMessage1Headers1.length; i = i + 1) {
                httpResponseMessage1Header1 = httpResponseMessage1Headers1[i];
                httpResponseMessage1Header1Key1 = httpResponseMessage1Header1.getKey();
                httpResponseMessage1Header1Value1 = httpResponseMessage1Header1.getValue();
                httpResponseOutputStream.write((httpResponseMessage1Header1Key1 + ": " + httpResponseMessage1Header1Value1 + "\r\n").getBytes());
            }
            httpResponseOutputStream.write(("\r\n").getBytes());
            httpResponseMessage1.read(httpResponseOutputStream);
        } catch (Exception e) {
            throw e;
        } finally {
            try {
                httpsRequest1.close();
            } catch (Exception e) {
            }
        }
    } catch (Exception e) {
        logger.log(Level.INFO, "EXCEPTION", e);
        httpServletResponse.setStatus(500);
    }
}
Also used : HTTPRequestMessage(APJP.HTTP11.HTTPRequestMessage) CipherOutputStream(javax.crypto.CipherOutputStream) HTTPSRequest(APJP.HTTP11.HTTPSRequest) CipherInputStream(javax.crypto.CipherInputStream) SecretKeySpec(javax.crypto.spec.SecretKeySpec) HTTPResponseMessage(APJP.HTTP11.HTTPResponseMessage) Cipher(javax.crypto.Cipher) HTTPMessageHeader(APJP.HTTP11.HTTPMessageHeader) ServletException(javax.servlet.ServletException) IOException(java.io.IOException)

Aggregations

HTTPMessageHeader (APJP.HTTP11.HTTPMessageHeader)2 HTTPRequestMessage (APJP.HTTP11.HTTPRequestMessage)2 HTTPResponseMessage (APJP.HTTP11.HTTPResponseMessage)2 HTTPSRequest (APJP.HTTP11.HTTPSRequest)2 InputStream (java.io.InputStream)2 OutputStream (java.io.OutputStream)2 HTTPMessageHeader (APJP.ANDROID.HTTP11.HTTPMessageHeader)1 HTTPRequestMessage (APJP.ANDROID.HTTP11.HTTPRequestMessage)1 HTTPResponseMessage (APJP.ANDROID.HTTP11.HTTPResponseMessage)1 HTTPSRequest (APJP.ANDROID.HTTP11.HTTPSRequest)1 HTTPSRequests (APJP.ANDROID.HTTP11.HTTPSRequests)1 HTTPSRequests (APJP.HTTP11.HTTPSRequests)1 IOException (java.io.IOException)1 Cipher (javax.crypto.Cipher)1 CipherInputStream (javax.crypto.CipherInputStream)1 CipherOutputStream (javax.crypto.CipherOutputStream)1 SecretKeySpec (javax.crypto.spec.SecretKeySpec)1 ServletException (javax.servlet.ServletException)1