CONNECT method in HTTP request

Hi,
I'm writing a proxy which at the moment, basically receives request from the browser and creates a socket which forwards it to the requested server/url and send the response back to the browser.
I'm having a problem loading http://gmail.google.com. The request gets redirected (302 Moved Temporarily) twice and at the third time, the browser sends the following request.
Request
CONNECT www.google.com:443 HTTP/1.0
pragma:  no-cache
proxy-connection:  Keep-Alive
host:  www.google.com
content-length:  0How am I suppose to handle this request? Do I create a Socket which connects to www.google.com at port 80 and then send the request header over? Or do I create the Socket with port 443?

CONNECT command is used when it wants to open another connection. it is similar to secure protocol https. so what i think is you have to open another connection to google and port is 443. but different between connect and GET/POST menthod will send the request header to the server. but connect method will not send any request header but it will transfer some data through that connection. data can be anything like encrypted information, binary file and so on.

Similar Messages

  • Taleo Connect Client http request

    Hi guys,
    I'm trying to use Taleo connect client to post http request with the following template:
    POST /way HTTP/1.0
    Host: host
    Content-type: application/x-www-form-urlencoded
    Content-length: request_length
    Accept: */*
    type=type&username=username&password=passwordAccording to user guide: +"Custom HTTP headers are supported through the use of advanced parameters. A parameter having the prefix Header: followed by the name of the header as the name of the parameter can be defined. For example, to define the Content-type the parameter name will be Header:Content-type."+ I have inserted following specification (please read as a table);
    Name Value
    Header: Method POST /way HTTP/1.0
    Header:Host
    Header:Content-type application/x-www-form-urlencoded
    Header: Content-length request_length
    Header: Accept */*
    type=type&username=username&password=password
    Could anyone help me and tell me if it's on the good way or explain me what should i correct?
    Thank you
    N.

    CONNECT command is used when it wants to open another connection. it is similar to secure protocol https. so what i think is you have to open another connection to google and port is 443. but different between connect and GET/POST menthod will send the request header to the server. but connect method will not send any request header but it will transfer some data through that connection. data can be anything like encrypted information, binary file and so on.

  • How to post multiple http requests using a single http connection in java

    I am using the httpurlconnection class and it allows only to post one request on a connection. I require to post multiple http requests by opening a single connection. Code examples please. Thanx in advance.

    Hi
    I found this article through Google. I hope it helps a little
    http://www.developer.com/tech/article.php/761521
    D

  • Missing option to change HTTP request method on iView level

    Dear all,
    I am trying to implement an iView using the ApplicationIntegrator. Unfortunately I am getting the error message "Request Method POST is not allowed". I found this nice weblog where you have the option on the iView level to change the HTTP request method to "GET". Unfortunately I do not have this parameter.
    I am on EP6.0 SP 9.
    I really appreciate your help and will reward points.
    Thanks,
    Jens

    I'm not sure I fully follow what the problem is, or I'm misreading the issue.
    Just to be clear, you are in Active Directory Domains & Trusts console, you did a click on "Active Directory Domains and Trusts," and then you are saying on the left pane you are not seeing the "Raise Forest Functional Level"
    option, such as the following screenshot shows?
    I assume there is currently only one domain in the forest.
    Was there at any time another domain that was removed, such as a child domain or an additional domain tree, there was removed?
    What's the Schema version? To find it, run this without the quotes:
    "dsquery * cn=schema,cn=configuration,dc=domainname,dc=local -scope base -attr objectVersion"
    Schema Version Matrix:
    ============================
    Version 13 = Windows Server 2000
    Version 30 = Windows Server 2003 RTM, Windows Server 2003 with Service Pack 1, Windows Server 2003 with Service Pack 2
    Version 31 = Windows Server 2003 R2
    Version 44 = Windows Server 2008
    Version 47 = Windows Server 2008 R2
    Version 56 = Windows Server 2012 RTM
    Version 69 = Windows Server 2012 R2
    Late Edit:
    See the following link for a similar discussion:
    Unable to raise forest functional level
    https://social.technet.microsoft.com/Forums/windowsserver/en-US/1d777261-ea53-4301-9541-3ea037245986/unable-to-raise-forest-functional-level?forum=winserverDS
    Ace Fekay
    MVP, MCT, MCSE 2012, MCITP EA & MCTS Windows 2008/R2, Exchange 2013, 2010 EA & 2007, MCSE & MCSA 2003/2000, MCSA Messaging 2003
    Microsoft Certified Trainer
    Microsoft MVP - Directory Services
    Complete List of Technical Blogs: http://www.delawarecountycomputerconsulting.com/technicalblogs.php
    This posting is provided AS-IS with no warranties or guarantees and confers no rights.

  • Business Service with multiple HTTP Request Methods

    hi all -
    I'm new to OSB and trying to prototype a solution. I have a service provider that exposes a number of HTTP operations (GET/PUT/POST/DELETE). It's a JAX-RS implementation.
    I was looking to create 1 proxy service and 1 business service for that service provider. But, within my business service, I must chose a 'HTTP Request Method' and it allows only 1 type (either GET, PUT, POST, DELETE). So, I have something working, but only for a single type (POST in my prototype). I figure I could create more proxy and business services for the other HTTP Request Methods, but I'm not sure if this is the correct approach (design/architecture).
    My other thought was to create a proxy service to front the service provider, but looking at the documentation, it looks like there should be a business service for each proxy service. If it's possible to use a proxy service without a business service to mediate the service provider, where would I add my URLs for the service provider in the proxy service.
    My apologies on the 2 part architecture/design question. I thought the group would help with getting me started.
    thanks jim

    Hi,
    Frankly I dont know too much on this topic but following links may help you:
    http://help.sap.com/saphelp_nw04/helpdata/en/25/dda73e5b7a424de10000000a114084/frameset.htm
    Troubleshooting ICF: http://help.sap.com/saphelp_nw04/helpdata/en/80/b2dd3a6dac703be10000000a11405a/content.htm
    Possibly experts in this forum will be able to help you:  Application Server->Internet Transaction Server (ITS)
    Regards,
    Gourav

  • Http Request through URL Connection?

    Hi ,
    Iam using an Applet (under JRE 1.3.0). Iam trying to send a Http Request using URL Connection. It is working fine . However, if the response time of the server is more than 3 minutes , the Response is not coming back to the server and the Applet is in a loop trying to read from the Server. I have observed that the request is sent to the server and it is processed successfully.
    When I test it in my local devp. machine it is working fine till 15 minutes which is my requirement.
    Can anybody suggest what should be the possible reasons and any workaround for it?
    Regards,
    TejoKiran.Y

    Iam copying the code fragments for the Applet Iam using . Is it a problem with the code? I heard that the URLConnection never times out . How is that it is not able to read the Response?
    <CODE >
    <HttpMessage>
    public class HttpMessage {
    URL servlet = null;
    Hashtable headers = null;
    public HttpMessage(URL servlet) {
    this.servlet = servlet;
    public InputStream sendGetMessage(Properties args) throws IOException {
    String argString = ""; // default
    if (args != null) {
    argString = "?" + toEncodedString(args);
    URL url = new URL(servlet.toExternalForm() + argString);
    // Turn off caching
    URLConnection con = url.openConnection();
    con.setUseCaches(false);
    // Send headers
    sendHeaders(con);
    return con.getInputStream();
    private void sendHeaders(URLConnection con) {
    if (headers != null) {
    Enumeration enum = headers.keys();
    while (enum.hasMoreElements()) {
    String name = (String) enum.nextElement();
    String value = (String) headers.get(name);
    con.setRequestProperty(name, value);
    </HttpMssage>
    <Code used to Read the Response.>
                        URL url = new URL(getDocumentBase(),"/ccls/test/delay.jsp");
                        HttpMessage msg = new HttpMessage(url);
                        InputStream in = msg.sendGetMessage(null);
                             char[] buff = new char[2048];
                             int bytesRead;
                             int ch;
                             StringBuffer sbtextbox = new StringBuffer("");
                             DataInputStream data = new DataInputStream(
                                                           new BufferedInputStream(in));
                             String line;
                        while ((line = data.readLine()) != null) {
                                  sbtextbox.append(line+"\r\n");
    </Code used to Read the Response.>
    </CODE>

  • Empty HTTP request received in SAP RFC test connection type G

    Hi all,
      While checking the RFC connection i am getting error,
    response_line               HTTP/1.0 500 Empty HTTP request received
    server_protocol             HTTP/1.0
    status_code                 500
    status_reason               Empty HTTP request received
    Please let me know if this is right.

    Hi,
      We are trying to connect to an external server. So, we are using Connection Type as G.
    RFC connection Test status is 500.
    But in our case, Idoc is getting generated but it is in the XI Box, throwing the below error,
    <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
    - <!-- Call Adapter
    -->
    - <SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="1">
    <SAP:Category>XIServer</SAP:Category>
    <SAP:Code area="SECURITY">SECURITY_VERIFY_ERROR</SAP:Code>
    <SAP:P1>Check Signature</SAP:P1>
    <SAP:P2 />
    <SAP:P3 />
    <SAP:P4 />
    <SAP:AdditionalText>Signature error Error while valdiating the digital signature. Theerror was com.sap.security.core.ws.wss.NoSecurityHeaderException No wsse:Security header has been defined for role soap:finalActor. Please verify the</SAP:AdditionalText>
    <SAP:ApplicationFaultMessage namespace="" />
    <SAP:Stack>Error during message security handling in inbound channel: Security profile 'Check Signature'</SAP:Stack>
    <SAP:Retry>M</SAP:Retry>
    </SAP:Error>
    Since the RFC is working now, we were not able to find what is the issue. Even SSL certificates are valid.

  • The proxy allows everyone to perform CONNECT HTTP requests

    Hey there.. I ran a vulnerability scan on my server and it came back with this.
    Vulnerability description
    The remote proxy server can be used to send CONNECT requests.
    The proxy allows everyone to perform CONNECT HTTP requests to arbitrary ports, such as:
    CONNECT www.domain.com:25
    This may allow attackers to bypass your firewall and connect to sensitive ports like 23 (telnet), 25 (sendmail) using the proxy.
    A spammer may be using your proxy to send bulk email.
    This vulnerability affects Server.
    The impact of this vulnerability
    Firewall bypass, possible information disclosure
    Attack details
    The proxy server is running on TCP port 80.
    How to fix this vulnerability
    Restrict proxy access to valid users and/or hosts. Deny CONNECT requests
    In the web area of the server admin, under settings and proxy I have "Control Access To Proxy" checked and Allowed Domain has domain.com but after another scan it keeps telling me that theres an issue with the proxy can someone please help?
    thanx
    James

    First thought: Where are you running the scan from?
    If you're running it from within your network then the scanner falls into the range of systems that can use the proxy, and therefore would be able to open arbitrary CONNECTions.
    You'd need to test from outside your network to see if this really is an issue on your server.

  • Example program: Executing an HTTP Request - Connectivity - SAP Library

    To add a comment, please log in or register on the top of this page and choose Reply. Please write your comment in English.
    You can also go back to the SAP help page.

    Hi,
    The examples are calling a browser but that is not what we are looking for. What we are looking for is (via ABAP) to send our http request and receive back the anwser. They (http://ec.europa.eu/taxation_customs/vies/) provide the SOAP message (WSDL : (http://ec.europa.eu/taxation_customs/vies/api/checkVatPort?wsdl). My question is if it is possible witout using XI and yes how? If I understand it correctly is should be possible via ABAP (example program RSWF_TEST_HTTP), but if I create my own program I get the message HTTP-Receive: RC=400  ICM_HTTP_CONNECTION_FAILED. Maybe the ABAP code is correct, but maybe I should change some settings or configure something else.
    Jan

  • When my swf in a html page connected with a socket server other http requests were blocked, how to resolve?

    I have used php to write a socket server(text chat server),
    then I use xmlsocket to write a client, I put this swf file in my html page, erverything of this client swf were ok: ervery clients could send or receive messages, but the other http request in this html page was unable to send(or receive) data from webserver,
    webserver and chat server were on the same server,
    and I have tried to use socket to instead if xmlsocket in my flash, but the new swf can only work in flash cs3, but it couldn't work in html page as the chat server can't send the security xml file to this swf, and I have also use Security.loadPolicyFile("http://192.168.139.128/crossdomain.xml"); to load security file, but it took none effect.
    Is there anyone can suggest me ?
    That's very kind of you!

    Hi Franco,
    Yes, I solved that by reinstalling Java 6 Update 21.
    There are three versions for Solaris namely, SPARC, x64 and x86. Our platform is SPARC and I think System admin has installed the wrong version instead of installing SPARC version of Java.
    After installing SPARC version of Java this got resolved. And I confirmed everything is fine by running a small program as below. You can run this program from command line using the -d64 flag. If the installation is wrong you will get the same exception as I mentioned.
    public class Analyzer {
          public static void main(String args[]) throws Exception{
               InputStream fin = new FileInputStream(args[0]);
               int iSize = fin.available();
               byte mvIn[] = new byte[iSize];
               fin.read(mvIn,0,iSize);
               fin.close();
               String strText = new String(mvIn);
               PrintStream fout = new PrintStream(new FileOutputStream(args[0]+".csv"));
               fout.println("Before,After,Seconds");
               Pattern p = Pattern.compile("\\[(?:Full |)GC (\\d*)K->(\\d*)K\\(\\d*K\\), ([\\d.]*) secs\\]");
               Matcher m = p.matcher(strText);
               while(m.find()){
                    fout.println(m.group(1)+ "," + m.group(2) + "," + m.group(3));
               fout.close();
    }Hope this helps.
    Regards,
    Prabhu

  • Creation of shopping cart through HTTP request

    Hello all, I am trying to create a shopping cart through a HTTP request.
    The URL I am managing is the same that the one that the Web Service BBPSC01 uses.
    Using the following code I cannot connect to the server in background, the error "This browser is not supported" is launched.
    In addition to this, I can open the URL successfully via R/3 when executing online.
    Help very appreciated!
    Thanks.
    data declarations
    DATA: client TYPE REF TO if_http_client.
    DATA: host      TYPE string VALUE 'host',
          host2      TYPE string,
          service   TYPE string VALUE '8000',
          path      TYPE string VALUE '/sap/bc/gui/sap/its/bbpsc01/?sap-client=020&sap-language=EN',
          errortext TYPE string. "used for error handling
    DATA: dest(13) TYPE c.
    dest = 'ZPORTAL_CESTA'.
    CALL METHOD cl_http_client=>create_by_destination
      EXPORTING
        destination              = dest
      IMPORTING
        client                   = client
      EXCEPTIONS
        destination_not_found    = 1
        internal_error           = 2
        argument_not_found       = 3
        destination_no_authority = 4
        plugin_not_active        = 5
        OTHERS                   = 6.
    IF sy-subrc NE 0.
      WRITE: / 'Create failed, subrc = ', sy-subrc.
      EXIT.
    ENDIF.
    set http method POST
    CALL METHOD client->request->set_method(
      if_http_request=>co_request_method_post ).
    client->request->set_version(
         if_http_request=>co_protocol_version_1_1 ).
    client->request->set_header_field( name = '~request_method'
    value = 'GET' ).
    set request uri (/<path>[?<querystring>])
    DATA uri TYPE string.
    uri = path.
    cl_http_utility=>set_request_uri( request = client->request
                                      uri     = uri ).
    FIN: conectamos el final de la peticion
    Send
    DATA timeout TYPE i.
    CALL METHOD client->send
      EXPORTING
        timeout                    = timeout
      EXCEPTIONS
        http_communication_failure = 1
        http_invalid_state         = 2
        http_processing_failed     = 3
        OTHERS                     = 4.
    IF sy-subrc NE 0.
      DATA: subrc TYPE sy-subrc.
      CALL METHOD client->get_last_error
        IMPORTING
          code    = subrc
          MESSAGE = errortext.
      WRITE: / 'communication_error( send )',
             / 'code: ', subrc,
             / 'message: ', errortext.
      EXIT.
    ENDIF.
    CALL METHOD client->receive
      EXCEPTIONS
        http_communication_failure = 1
        http_invalid_state         = 2
        http_processing_failed     = 3
        OTHERS                     = 4.
    IF sy-subrc NE 0.
      CALL METHOD client->get_last_error
        IMPORTING
          code    = subrc
          MESSAGE = errortext.
      WRITE: / 'communication_error( receive )',
             / 'code: ', subrc, 'message: '.
      EXIT.
    ENDIF.
    DATA return_str TYPE string.
    return_str = client->response->get_cdata( ).
    close
    CALL METHOD client->close
      EXCEPTIONS
        http_invalid_state = 1
        OTHERS             = 2.
    DATA html_control TYPE REF TO cl_gui_html_viewer.
    DATA container   TYPE REF TO cl_gui_custom_container.
    DATA html_table TYPE TABLE OF char255.
    Create container for HTML viewer
    CREATE OBJECT container
      EXPORTING
        container_name              = 'CONTAINER'
      EXCEPTIONS
        cntl_error                  = 1
        cntl_system_error           = 2
        create_error                = 3
        lifetime_error              = 4
        lifetime_dynpro_dynpro_link = 5.
    IF sy-subrc NE 0.
      MESSAGE e208(00)
         WITH 'The control HTML_CONTAINER could not be created'.
    ENDIF.
    CREATE OBJECT html_control
      EXPORTING
        parent = container.
    CALL FUNCTION 'CONVERT_STRING_TO_TABLE'
      EXPORTING
        i_string         = return_str
        i_tabline_length = 255
      TABLES
        et_table         = html_table.
    DATA: l_doc_url(255) TYPE c.
    CALL METHOD html_control->load_data
      EXPORTING
        type         = 'text'
        subtype      = 'html'
      IMPORTING
        assigned_url = l_doc_url
      CHANGING
        data_table   = html_table.
    CALL METHOD html_control->show_url
      EXPORTING
        url = l_doc_url.

    Dear Poster
    Your thread has had no response since it's creation over
    2 weeks ago, therefore, I recommend that you either:
    - Rephrase the question.
    - Provide additional Information to prompt a response.
    - Close the thread if the answer is already known.
    Thank you for your compliance in this regard.
    Jason Boggans
    SAP SRM SDN Moderator

  • Is there a restriction on length of Http request posted to a Iplanet Web Server ?

    I am submitting an Http Request by POST method to my server. The request will be received and forwarded by Iplanet Web Server to a clustered Weblogic environment, which will then be handled by Java Servlets. The problem I am facing is that when the length of the request shoots up to around 2000 bytes, NES doesn't receive and forward the request to Weblogic. There is no fixed cut-off for the length, it keeps fluctuating.
    I observed the following after hitting the server hundreds of times with Http Requests that vary in length.
    1) If length of Request is below 1500 bytes, request always goes through successfully.
    2) In a range of 1500 bytes to 2000 bytes, request fails most of the times. (Around 80 %)
    3) Requests with length above 2000K invariably fail, though it just worked for a 2.4K request on one occasion (out of some 100 hits)
    Note that by "length of request", I mean the data I post through Http Request (I just have a single parameter in Http request having the literal "XML" as key and a well formed XML document as value. That is equivalent to submitting a HTML form just having a text area called "XML" containing a XML document. )
    I presume that the length of actual Http Request is slightly greater than that of XML (probably by around 100 bytes).
    My Iplanet documentation says that the upper limit on the length of a POST Http Request is 64 K, which is way above the value (2-3 K) at which I am facing the problem.

    Hi Ganesh
    Did you check the HTTP Persistent timeout of your server? Check the value which has been set up by default. Try increasing the timeout value and try again.
    follow these steps it might solve your problem:
    (1)Goto Web Server Administration Server, select the server you want to manage.
    (2)Select Preference >> Perfomance Tuning.
    (3)set HTTP Persistent Connection Timeout to your choice (eg 180 sec for three minutes)(note : if you are posting large amount of data or file increase the value accordingly)
    (4) Apply changes and restart the server.
    *Setting the timeout to a lower value, however, may    prevent the transfer of large files as timeout does not refer to the time that the connection has been idle. For example, if you are using a 2400 baud modem, and the request timeout is set to 180 seconds, then the maximum file size that can be transferred before   the connection is closed is 432000 bits (2400 multiplied by 180)
    If this doesnot solve your problem notify me
    regards
    T.Raghulan
    [email protected]

  • How to Implement HTTP Request Status Code Processing

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

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

  • Invalid request for HTTP request from Java

    I've written the following code to retrieve data from HTTP url:
    byte [] buffer = new byte[1024];
                   URLConnection conn = src.openConnection();
                   //conn.setRequestProperty("Range", "bytes=" + (start + completed) + "-" + end);
                   //System.out.println("bytes=" + (start + completed) + "-" + end);
                   System.out.println("Response: " + ((HttpURLConnection)conn).getResponseCode());
                   BufferedInputStream bin = new BufferedInputStream(conn.getInputStream());
                   byte [] data = new byte[1024];
                   int readLen;
                   manager.addConnected();
                   while((readLen = bin.read(data)) != -1 && canContinue) {
                        dest.seek(start+completed);
                        dest.write(data, 0, readLen);
                        completed += readLen;
                        System.out.println(readLen + "\t" + completed);
                   dest.close();
                   System.out.println("Read: " + readLen);
              } catch(IOException e) {
                   manager.failConnection();
              }However, the response code printed is -1 and the following content is written to the file (dest is a random access file, you can ignore the seek(), it is needed when I start multi-threading).
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <HTML><HEAD><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
    <TITLE>ERROR: The requested URL could not be retrieved</TITLE>
    <STYLE type="text/css"><!--BODY{background-color:#ffffff;font-family:verdana,sans-serif}PRE{font-family:sans-serif}--></STYLE>
    </HEAD><BODY>
    <H1>ERROR</H1>
    <H2>The requested URL could not be retrieved</H2>
    <HR noshade size="1px">
    <P>
    While trying to process the request:
    <PRE>
    GET /ubuntu/pool/main/f/firefox/firefox_2.0.0.2+0dfsg-0ubuntu0.6.10_i386.deb HTTP/1.1
    User-Agent: Java/1.6.0
    Host: security.ubuntu.com
    Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
    Connection: keep-alive
    </PRE>
    <P>
    The following error was encountered:
    <UL>
    <LI>
    <STRONG>
    Invalid Request
    </STRONG>
    </UL>
    <P>
    Some aspect of the HTTP Request is invalid.  Possible problems:
    <UL>
    <LI>Missing or unknown request method
    <LI>Missing URL
    <LI>Missing HTTP Identifier (HTTP/1.0)
    <LI>Request is too large
    <LI>Content-Length missing for POST or PUT requests
    <LI>Illegal character in hostname; underscores are not allowed
    </UL>
    <P>Your cache administrator is <A HREF="mailto:root">root</A>.
    <BR clear="all">
    <HR noshade size="1px">
    <ADDRESS>
    Generated Fri, 16 Mar 2007 11:14:48 GMT by inet (squid/2.6.STABLE3)
    </ADDRESS>
    </BODY></HTML>Where does the problem lie? It failed for other URLs too. Can I establish more than one connection by invoking openURLConnection() on the same URL object?

    Ive run into this issue also. I need a way for a portlet to change to its maximized state for the purposes of user registration. Is there anyway this can be done? I know that sun jsp "Providers" which are shown on their example desktop, have some sort of maximized state that they can go into, but im not sure how to use this in a portlet.
    There seems to be very inconsistent support between the proprietary sun provider api, and the portlet api.

  • Scorm-based test causes too many Blackboard http requests

    We are looking into a problem with scorm-based tests and learning  modules created in Adobe Captivate. Viewing the scorm content in our Blackboard LMS generates ridiculous amounts of network traffic. A simple click in the scorm module triggers  anything between 10 and 100+ http-requests, even if no interaction with  the server is required. The same click sometimes results in 5 requests, other times in 50  requests or more.It's always a sequence of the same two requests, see below (only the max value in "Keep-Alive: timeout=10, max=98" counts down).
    If these scorm modules are taken by a group of students, the enormous amount of http requests put a lot of pressure on our Blackboard system, which results in a slow behaviour of the modules. Has anyone seen this behaviour and does anyone know of a way to prevent it?
    (below, part of the http headers collected with the Firefox Live HTTP Headers Add-on)
    https://...cc.kuleuven.be/courses/1/a-C112956-K/content/_7409447_1/SCORM_support/scorm_sup port.swf?invokeMethod=methodToExecute&lc_name=lc_name&param=tempVar|true
    GET /courses/1/a-C112956-K/content/_7409447_1/SCORM_support/scorm_support.swf?invokeMethod=me thodToExecute&lc_name=lc_name&param=tempVar|true HTTP/1.1    
    Host: ...cc.kuleuven.be    
    User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US;     rv:1.9.2.12) Gecko/20101026 Firefox/3.6.12    
    Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8    
    Accept-Language: en-us,en;q=0.5     Accept-Encoding: gzip,deflate    
    Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7    
    Keep-Alive: 115    
    Connection: keep-alive    
    Referer: https://...cc.kuleuven.be/courses/1/a-C112956-K/content/_7409447_1/ABT%20Excel%20Toets4.ht m    
    Cookie: JSESSIONID=2FFDF51EB1DFD4B73B539C63607A9177.root;     __utma=137656618.1128290341.1286972380....
    If-Modified-Since: Mon, 06 Dec 2010 17:40:03 GMT
    If-None-Match: W/"149-1291657203000"
    HTTP/1.1 304 Not Modified
    Date: Fri, 10 Dec 2010 09:00:13 GMT    
    Server: Apache/1.3.41 (Unix) mod_ssl/2.8.31 OpenSSL/0.9.8i mod_jk/1.2.27    
    X-Blackboard-appserver: ...cc.kuleuven.be    
    X-Blackboard-product: Blackboard Learn&#8482; 9.0.505.0    
    Set-Cookie: session_id=80EA2381B7970776B9C3202ADBDEC94E; Path=/    
    Set-Cookie: s_session_id=FB7D2433E54EFA941E49E6C79B536CDA; Path=/;     Secure    
    Etag: W/"149-1291657203000"    
    Content-Length: 0    
    Keep-Alive: timeout=10, max=100   
    Connection: Keep-Alive    
    Content-Type: text/plain; charset=iso-8859-1
    https://../courses/1/a-C112956-K/content/_7409447_1/SCORM_support/scorm_support.swf?invoke Method=methodToExecute&lc_name=lc_name&param=tempVar|true    
    GET /courses/1/a-C112956-K/content/_7409447_1/SCORM_support/scorm_support.swf?invokeMethod=me thodToExecute&lc_name=lc_name&param=tempVar|trueHTTP/1.1    
    Host: ...kuleuven.be    
    User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US;     rv:1.9.2.12) Gecko/20101026 Firefox/3.6.12    
    Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8    
    Accept-Language: en-us,en;q=0.5    
    Accept-Encoding: gzip,deflate    
    Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7    
    Keep-Alive: 115    
    Connection: keep-alive    
    Referer:     https://../courses/1/a-C112956-K/content/_7409447_1/ABT%20Excel%20Toets4.htm    
    Cookie: JSESSIONID=2FFDF51EB1DFD4B73B539C63607A9177.root;     __utma=137656618.1128290341.1286972380...
    If-Modified-Since: Mon, 06 Dec 2010 17:40:03 GMT    
    If-None-Match: W/"149-1291657203000"   
    HTTP/1.1 304 Not Modified    
    Date: Fri, 10 Dec 2010 09:00:13 GMT    
    Server: Apache/1.3.41 (Unix) mod_ssl/2.8.31 OpenSSL/0.9.8i mod_jk/1.2.27    
    X-Blackboard-appserver: ...cc.kuleuven.be    
    X-Blackboard-product: Blackboard Learn&#8482; 9.0.505.0    
    Set-Cookie: session_id=80EA2381B7970776B9C3202ADBDEC94E; Path=/    
    Set-Cookie: s_session_id=FB7D2433E54EFA941E49E6C79B536CDA; Path=/; Secure    
    Etag: W/"149-1291657203000"    
    Content-Length: 0    
    Keep-Alive: timeout=10, max=98    
    Connection: Keep-Alive    
    Content-Type: text/plain; charset=iso-8859-1

    Simply add the call to your exception hander. E.g.
    EXCEPTION
             WHEN OTHERS
             THEN
                   UTL_TCP.Close_All_Connections;
                   INSERT INTO excep_trans (P_WORD_EXP, UPDATE_TIME, COUNTER)
                     VALUES (VC1.RAW_VAL_TXT, SYSDATE, cnt);
    ..etc..
    END;Also consider using proper coding standards. There is NO modern day programming language standard that says to write (selective) reserved words in uppercase. Write in lowercase. Use camelcase and pascalcase for variable names and procedures/functions/methods. Restrict the use of uppercase to defining identifiers such as compiler macros or constants.
    Do yourself a favour and read, understand and apply the basic naming standards as detailed in .Net Guidelines for Names and Code Conventions for the Java Programming Language.

Maybe you are looking for

  • Ipod touch not recognised by anything!

    My daughters Gen 4 Ipod Touch (iOS unknown by me) will now not be recognised by any computer or any itunes. I've tried all of the suggestions on restoring and recovery. As soon as I plug it in with any cable (yes, I've tried a couple of different one

  • I upgraded to iphone 4s and installed iOS 6 but now my battery life is significantly reduced. What can I do to fix this problem?

    I upgraded to iphone 4s and installed iOS 6 but now my battery life is significantly reduced. What can I do to fix this problem? I restored my settings my I got the new phone but I think I heard that with the iOS 6 updated that can be an issue and it

  • Vendor Invoice input tax in sales

    Dear All, We are implementing SAP in legal industry and we came across a scenario where we need to bill the Hard Cost, that we are treating as a material in SD side and we are determining this material in SD through Resource related billing. We post

  • Diablo II ladder reset

    One of the things I regret in linux gaming is always being behind. I never used to miss the resets but using linux I'm WAY out of the loop as probably a lot of us are. the ladder reset on the 25th, We are late. GODSPEED FIENDS.

  • Virtual Key Figure in report giving  values

    Hi Gurus, I have created a Virtual Key Figure on a Multi Provide and completed all necessary user-exit coding. When I run the BEX report for a single material my Key Figure is populating correct values. But when I run the BEX report for multiple mate