Jakarta Commons HTTP Client problem

Hi,
This one's for anyone with knowledge of the Jakarta Commons HTTPClient 2.0 Beta 2.
I'm trying to make an HTTP GET request with all the Cookies on one header line.
For some reason the request is built with each cookie on a separate line.
I've looked at the source for HttpMethodBase where I saw that this depends on whether it is in strictMode. So, I set it to strictMode first.
Doesn't seem to make any difference though.
Here's my code. Can someone tell me where I've gone wrong.
HttpClient client = new HttpClient();
HttpState state = client.getState();
state.setCookiePolicy(CookiePolicy.COMPATIBILITY);
state.addCookie(new Cookie("www.foo.com","foo","1","/",null,true));
state.addCookie(new Cookie("www.foo.com","baa","2","/",null,true));
GetMethod method = new GetMethod(url);
method.setStrictMode(true);
int statusCode = client.executeMethod(method);
// ...Hope someone can help.
Thanks.

after reading through the source it appears that HttpClient.strictMode overrides whatever the setting is in HttpMethod.strictMode.
see HttpClient.executeMethod(HostConfiguration hostConfiguration,
HttpMethod method)
in this method is ....
method.setStrictMode(strictMode);
so try this in your code instead of method.setStrictMode(true).
client.setStrictMode( true );

Similar Messages

  • What has changed in HTTP Client VIs from LV2010 to LV2010 SP1

    Hi all,
    It appears to be a major internal undocumented change for HTTP Client VIs between LV2010 and LV2010 SP1. In LV2010, the client VIs used a dll called "ni_httpClient.dll", but in LV2010 SP1 it is not used any more, probably used pure LabVIEW solution. There was a bug in HTTP PostMultipart, since it couldn't be executed twice, needed to disconnect and connect to get it work again. However, in LV2010 SP1, they have done some changes, since this VI now returns a header stating it using HTTP 1.0 and not HTTP 1.1 as "old" LV2010 did. I've also had problems in LV2010 SP1 that if the server doesn't reply anymore the HTTP Client VIs hangs and I need to kill LabVIEW.exe process. In LV2010, there was a timeout. I've tried to set different time out between 10 and 10000. No difference. I know that there has been a bug in LV2010, since time out was in s and not ms as the controls says. Don't know if they have fixed this in SP1, it seems to be an infinite timeout...
    Anybody has an experience of HTTP Client problems between LV2010 and LV2010 SP1?
    Thanks,
    Mattias

    Hi,
    I found what has changed from LV2010 to LV2010SP1
    * ni_httpClient.dll is now included in the runtime engine (that was why I though they didn't use the ni_httpClient.dll anymore, but that is not the fact. It's not included in the builds anymore though)
    * ni_httpClient.dll is version 1.1.0f14 in Lv2010 and version 1.1.0f0 in LV2010SP1. They have stepped back??? Why?
    In Lv2011, ni_httpClient.dll is version 1.2.0f0. Maybe I can try this and see what happens.
    Thanks,
    Mattias

  • Jakarta Commons FileUpload ; Internet Explorer Problem

    Hi all,
    Environment:
    Tomcat 5 ;Apache 2; JDK 1.5.0; Jakarta Commons Fileupload 1.0
    OS: Windoze XP
    Previously I've used jakarta commons fileupload package to succussfully to upload a file.
    However, I am trying to check the content type of the file and throw an exception if its not a jpeg file. The following code works great when I use firefox. But it fails when I use Internet Explorer!
    When I supply an existing jpg file on my desktop as the input to the HTML form, the code works fine. However if I enter a non-existing jpg filename, I get a "HTTP 500 Internal Server Error"! I expect to get the "Wrong content type!" message (which my JSP throws as an exception and should be caught by the error page). This problem happens only with Internet Explorer. With firefox, I get the "Wrong Content Type" message as expected.
    What could be the problem? Please advise.
    Thanks
    Joe.
    Code follows......
    /************** file-upload.html *************/
    <!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>File Upload</title>
    <script type="text/javascript" language="JavaScript">
    <!--
    function fileTypeCheck() {
         var fileName = document.uploadForm.pic.value;
         if (fileName == "") {
              alert ("Please select a file to upload!");
              return false;
         var indexOfExt = fileName.lastIndexOf (".");
         if (indexOfExt < 0) {
              alert('You can only upload a .jpg/.jpeg/.gif file!');
              return false;
         var ext = fileName.substring(indexOfExt);
         ext = ext.toLowerCase();
         if (ext != '.jpg' && ext != 'jpeg') {
             alert('You selected a ' + ext + ' file;  Please select a .jpg/.jpeg file instead!');
              return false;
         return true;
    //--></script>
    </head>
    <form action="uploadPhoto.jsp" enctype="multipart/form-data" method="post" name="uploadForm" onSubmit="return fileTypeCheck();">
         <input type="file" accept="image/jpeg,image/gif" name="pic" size="50" />
         <br />
         <input type="submit" value="Send" />
    </form>
    <body>
    </body>
    </html>
    /*************** photoUpload.jsp **************/
    <%@ page language="java" session="false" import="org.apache.commons.fileupload.*, java.util.*" isErrorPage="false" errorPage="uploadPhotoError.jsp" %>
    <%!
    public void processUploadedFile(FileItem item, ServletResponse response) throws Exception {
         try {
              // Process a file upload
                  String contentType = item.getContentType();
              if (! contentType.equals("image/jpeg") && ! contentType.equals("image/pjpeg")) {
                   throw new FileUploadException("Wrong content type!");
         } catch (Exception ex) {
              throw ex;
    %>
    <%
    // Check that we have a file upload requeste
    boolean isMultipart = FileUpload.isMultipartContent(request);
    // Create a new file upload handler
    DiskFileUpload upload = new DiskFileUpload();
    // Parse the request
    List /* FileItem */ items = upload.parseRequest(request);
    // Process the uploaded items
    Iterator iter = items.iterator();
    while (iter.hasNext()) {
        FileItem item = (FileItem) iter.next();
        if (! item.isFormField()) {
            processUploadedFile(item, response);
    %>
    <html>
    <head>
    </head>
    <body>
    File uploaded succesfully! Thank you!
    </body>
    </html>
    /******** uploadPhotoError.jsp ****/
    <%@ page language="java" session="false" isErrorPage="true" %>
    <html>
    <head>
    </head>
    <body>
    <%
    out.println(exception.getMessage());
    %>
    </body>
    </html>

    I just found out that the problem that I have mentioned in my previous post has nothing to do with Jakarta Commons Fileupload. It happens whenever I try throwing an exception. And it happens only when I use Internet Explorer
    Thanks,
    Joe
    See the code below...
    /**** throw-error.jsp ***/
    <%@ page language="java" session="false" isErrorPage="false" errorPage="catch-error.jsp" %>
    <%
    throw new Exception("Catch this!");
    %>
    /****** catch-error.jsp ****/
    <%@ page language="java" session="false" isErrorPage="true" %>
    <html>
    <head>
    </head>
    <body>
    <%
    out.println(exception.getMessage());
    %>
    </body>

  • Problem while using HTTP Client

    Hi,
    We are working on a HTTP-XI-SOAP synchronous scenario.
    When we test the interface through test tool in RWB, it is working fine.
    But when we tried the same using SAPPIHTTPClient, we are getting error in SXMB_MONI:
    <SAP:Code area="HTTP">ADAPTER.HTTP_EXCEPTION</SAP:Code>
    <SAP:AdditionalText>HTTP 500 Internal Server Error</SAP:AdditionalText>
    <faultstring>content-type of the request should be text/xml</faultstring>
    The difference we noticed is that, when we tested through RWB, the content type is text/xml (Payloads->MainDocument ( text/xml ) ), but when we tested through the HTTP client, the content type is application/xml (Payloads->MainDocument ( application/xml )).
    So, if thats the problem, how do I set the content type to "text/xml" while sending the request message through HTTP client?
    Thanks in advance,
    Prasanna

    I went through these notes and I think these are not relevant.
    My interface is working perfectly fine when I test it from the test tool of RWB.
    I am getting this error when I trigger the interface from the HTTP client.
    How to I change/set the payload content type?

  • Problem with jakarta commons email

    i am using in addition to the javamail libary the jakarta commons libary.
    do anyone of you havee anyxpieriences with this libary??
    here is my code for send a simple mail:
    String host=null;
            SimpleEmail email = new SimpleEmail();
            try {
                 host=DbJdbc.getSetting("SmptHost");
                try {
                    email.setHostName(host);
                    email.addTo(emailadress);
                   email.setFrom("[email protected]");
                    email.setSubject("Ears mail scheduler");
                    email.setMsg("test");
                    email.setAuthentication("test","test");
                    email.send();
                } catch (EmailException eex) {
                LoggerLars.log("[SendMail] : Error" + eex.getMessage(),4);
                throw new Exception(eex.getMessage());
            } catch  (Exception ex) {
                LoggerLars.log("[SendMail] Exception in Sendmail: "+ex.getMessage(),4);  
         }i am working with the bea weblogic 8.1.3 and i get an error that the catch parameter is not an java.lang.throwable.
    so the try/catch construct doesn't work....did anyone got the same problem?? i don't see any programming fault in the code, i simple copied is from the jakarta websites howto.

    problem solved!!!
    i just had to restart bea und to update the libaries!! thx

  • Problems with HTTP Client Authentication in jdev 10.1.2.17.84.

    Hi,
    I've told HTTP Client Authentication doesn't work in jdev 10.1.2.17.84. I need users to be authenticated using a certificate so I'm trying several workarounds but none seems to be valid. Any help?
    Thanks.
    Luis Serrano.

    been there done that.. ive decompiled the oc4j code, debuged down to the core... its big waste of my time... :(
    my advice to you is to leave it.. if you do not plan to use oracle ldap sso or xml provider you can do nothing... your hands are tied... they hardcoded everything and if you want more than classic "username & password" custom login module you will have to change oc4j...
    there is no point to make a custom loginmodule which utilize a client certificate because oracle JAZN do not suport that type of login module!
    just implement a login filter and manage authentication and authorization yourself... just like steve muench did in his java store demo - he didnt use JAZN... :)
    anyway current approach do not allow you to leverage JAAS in ADF model layer so why bother to have that in the view/controller layer anyway...
    and if i understood correctly oracle plans big changes in this area in the next jdeveloper release, and they alredy said that custom login modules would be depreciated in the next releases...

  • Apache Jakarta Commons FileUpload misleading message

    I have a JSP page doing file upload using commons FileUpload package. The code looks like this:
    <%
    DiskFileUpload upload = new DiskFileUpload();
    List items = upload.parseRequest(request);
    Iterator itr = items.iterator();
    while(itr.hasNext()) {
         FileItem item = (FileItem) itr.next();
         // check if the current item is a form field or an uploaded file
         if(item.isFormField()) {
              String fieldName = item.getFieldName();
              if(fieldName.equals("name"))
                   request.setAttribute("msg", "Thank You: " + item.getString());
         } else {
              File fullFile = new File(item.getName());
              File savedFile = new File("c:\\tmp\\",     fullFile.getName());
              item.write(savedFile);
    %>
    The JSP successfully uploaded the files but it still show me HTTP Status 404 - c:\tmp (Access is denied).
    What's wrong with my code? Thank you.

    I just found out that the problem that I have mentioned in my previous post has nothing to do with Jakarta Commons Fileupload. It happens whenever I try throwing an exception. And it happens only when I use Internet Explorer
    Thanks,
    Joe
    See the code below...
    /**** throw-error.jsp ***/
    <%@ page language="java" session="false" isErrorPage="false" errorPage="catch-error.jsp" %>
    <%
    throw new Exception("Catch this!");
    %>
    /****** catch-error.jsp ****/
    <%@ page language="java" session="false" isErrorPage="true" %>
    <html>
    <head>
    </head>
    <body>
    <%
    out.println(exception.getMessage());
    %>
    </body>
    </html>

  • Jakarta Commons Lang 1.01 vs. 2.0?

    I looked through the newsgroup, but didn't see this question come up.
    Currently, the latest version of the Jakarta Commons Lang package is 2.0,
    though Kodo 3.2.4 includes 1.0.1. Are there any known problems or
    incompatibilities with using Lang 2.0 with Kodo 3.2.4? We'd like to only
    include the Lang 2.0 package in our application.
    Also, the link in the documentation (Appendix F) to the Jakarta pages are
    broken:
    http://jakarta.apache.org/commons/collections.html should be
    http://jakarta.apache.org/commons/collections/
    http://jakarta.apache.org/commons/lang.html should be
    http://jakarta.apache.org/commons/lang/
    and
    http://jakarta.apache.org/commons/pool.html should be
    http://jakarta.apache.org/commons/pool/
    (basically, replace the .html with a /).
    ;ted

    There are no known incompatibilities, but in Kodo 3, we're actually
    repackaging all our open-source dependencies to get away from random
    appearances of incompatibilities.
    -Patrick
    Ted M. Young wrote:
    I looked through the newsgroup, but didn't see this question come up.
    Currently, the latest version of the Jakarta Commons Lang package is 2.0,
    though Kodo 3.2.4 includes 1.0.1. Are there any known problems or
    incompatibilities with using Lang 2.0 with Kodo 3.2.4? We'd like to only
    include the Lang 2.0 package in our application.
    Also, the link in the documentation (Appendix F) to the Jakarta pages are
    broken:
    http://jakarta.apache.org/commons/collections.html should be
    http://jakarta.apache.org/commons/collections/
    http://jakarta.apache.org/commons/lang.html should be
    http://jakarta.apache.org/commons/lang/
    and
    http://jakarta.apache.org/commons/pool.html should be
    http://jakarta.apache.org/commons/pool/
    (basically, replace the .html with a /).
    ;ted

  • Please no jakarta-commons-collections-3.1.jar in Kodo 3.2!!

    As far as I know jakarta-commons-collections-3.1.jar is not backward
    compatible with 2.x version of jakarta collections. Many things (such as
    Struts) are shipped with collections 2.1 and might not work with 3.1
    collections. Is it possible to keep 2.1 collections in Kodo. And eventually
    get rid of it all together if possible! IMHO jakarta collections (and lang?)
    libraries are bad dependency since they can't keep it backward compatible
    and went through 3 versions of it in short time

    Use servlet filter to clean up your PMs
    1. Create Disposable interface
    2. Create PMHolder which implement Disposable and make sure when you create
    instance of PMHolder you attach it to http request as an attribute (I
    suggest passing request as parameter to PMHolder constructor and
    autoregister new instance with the request)
    3. Create filter which inspects all request attributes and call
    Disposable.close() on all attributes which implement Disposable
    It will let you create PMs lazily in your struts forms and not to worry
    about closing them and it will let you to use PMs directly in your JSPs if
    you have to again without worry about leaks
    "Tim Holloway" <[email protected]> wrote in message
    news:[email protected]...
    Abe White wrote:
    http://jakarta.apache.org/commons/collections/compatibility.html
    Also commons beanutil have a new version which can run against both 2.1and
    3.x codebases. I think there is lots of confusion in thius area. We
    trued
    our struts apps with 3.1 collections they seem to be ok.
    Thanks for the link! It's particularly good to hear that struts seems towork
    with 3.1.If it didn't, I'd be in deep trouble. I've got a major webapp using Struts
    1.1 which I rewrote using KodoJDO. The only tricky part was allowing for
    pages that would gather data from 4 or 5 places (some of them collections)
    and push them out to the view, since I needed to release the Persistence
    Manager in the Struts Action Processor or I'd either have to put logic on
    the JSPs or leak Persistence Managers.
    // Disconnect display data from PM so we can close PM.
    pm.makeTransient(info);
    pm.makeTransient(info.getOfacMain());
    pm.makeTransientAll(info.getOfacMain().getOfacAddress());
    pm.makeTransientAll(info.getOfacMain().getOfacAlias());
    pm.makeTransient(info.getOfacSourceData());
    pm.close();
    I did have issues about a large browse set, but Stephen Kim set me on the
    right track on that one.
    Kodo 3.2 Beta didn't have any Struts-related problems either.
    Tim Holloway
    EverBank

  • ITMS and Jakarta Commons-HttpClient crazy frequent in log

    I'm seeing blocks like this several times an hour in my web log for one of my sites that hosts a few podcasts. In fact, Apple IPs makes of the bulk of clients (7-8 of the top 10) that access my site. Why?
    17.251.0.227 - - [17/Mar/2010:07:52:49 -0700] "HEAD /podcasts/studies.php HTTP/1.1" 200 - "-" "iTMS"
    17.251.0.232 - - [17/Mar/2010:07:52:49 -0700] "HEAD /podcasts/studies.php HTTP/1.1" 200 - "-" "iTMS"
    17.251.0.227 - - [17/Mar/2010:07:52:49 -0700] "GET /podcasts/studies.php HTTP/1.1" 200 22160 "-" "iTMS"
    17.251.0.224 - - [17/Mar/2010:07:52:49 -0700] "GET /podcasts/studies.php HTTP/1.1" 200 22160 "-" "Jakarta Commons-HttpClient/3.0"
    17.251.0.225 - - [17/Mar/2010:07:54:02 -0700] "HEAD /podcasts/videopodcast.php HTTP/1.1" 200 - "-" "iTMS"
    17.251.0.224 - - [17/Mar/2010:07:54:02 -0700] "HEAD /podcasts/videopodcast.php HTTP/1.1" 200 - "-" "iTMS"
    17.251.0.228 - - [17/Mar/2010:07:54:02 -0700] "GET /podcasts/videopodcast.php HTTP/1.1" 200 22499 "-" "iTMS"
    17.251.0.231 - - [17/Mar/2010:07:54:02 -0700] "GET /podcasts/videopodcast.php HTTP/1.1" 200 22499 "-" "Jakarta Commons-HttpClient/3.0"

    no bites

  • Is there a way to detect a bad http client handle before it locks up LabVIEW?

    The attached VI demonstrates a simple way to hang LabVIEW such that the only way to recover full use of it is to kill the LabVIEW process. LabVIEW version is 11.0.1f2 and this problem will occur in both WinXP and Win7.
    Is there a way to detect when an HTTP Client Handle refnum is stale and should not be used?
    Is this a known bug?
    Attachments:
    Hang after Bad HTTP Client Handle.vi ‏15 KB

    Have you tried the bad reference comparator?
    Mike...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

  • Error while creating Sales Order From HTTP Client

    Hi,
    I have a scenario, wherein I need to create SO from HTTP client (an HTML page). I paste my xml source data in the payload area and send the message. I get back this response:
    Result:
    <?xml version="1.0" encoding="UTF-8"?>
    <ns1:Deep_RFCResponse_MT xmlns:ns1="http://mindtree.com/xi/m1004968"><SALESDOCUMENT><SALESORDERNO></SALESORDERNO></SALESDOCUMENT><RETURN><item><TYPE>E</TYPE><ID>V1</ID><MESSAGE>Sales document type OR is not defined</MESSAGE></item></RETURN></ns1:Deep_RFCResponse_MT>
    I am supposed to get a SO no. here, but I get this message.
    Whereas if I give same data at  back end (in SAP system) the SO no is created successfully!
    Can anybody tell me where am I going wrong, if I am?
    Thank you,
    Cheers,
    Deepak.

    Hi  Prateek.
    You were right.....
    The problem was with the data that I was passing. I was passing OR as the document type, which internally was being converted to TA.
    It was creating the SO successfully because I was using the transaction se37 and this is where OR was converted to TA.
    But if we use va01 to create the SO, we get this error.
    Thank you....
    Points!! definitely
    Cheers,
    Deepak.
    Edited by: Deepak MS on Mar 13, 2008 5:20 AM

  • Uploading a file to server using servlet (Without using Jakarta Commons)

    Hi,
    I was trying to upload a file to server using servlet, but i need to do that without the help of anyother API packages like Jakarta Commons Upload. If any class for retrieval is necessary, how can i write my own code to upload from client machine?.
    From
    Velu

    <p>Why put such a restriction on the solution? Whats wrong about using that library?
    The uploading bit is easy - you put a <input type="file"> component on the form, and set it to be method="post" and enctype="multipart/form-data"
    Reading the input stream at the other end - thats harder - which is why they wrote a library for it. </p>
    why i gave the restriction is that, i have a question that <code>'can't we implement the same upload'</code>
    I was with the view that the same can be implemented by our own code right?

  • Sending Msg From HTTP client to XI through JMS Adapter using WebSphereMQ

    Hello
    I am trying to send some msg from Http client
    I configured JMS adapter as receiver
    Transport Protocol :WEBsphereMQ JMS provider
    Message  protocol :JMS1.x
    I have given the Ip  address  of my machine where I installed WEB Sphere MQ
    Server Port :1416
    Transport Protocol :WebSphere MQ
    JMS compliant: JMS-compliant
    In SXMB_MONI
    Http client sends message without any error.
    But while tracing I got message
    <Trace level="1" type="T">Async barrier reached. Bye-bye !</Trace>
    Can anybody tell me the solution..
    Thnaks

    Hi,
      I have not directly faced this but i may suggest ,
    1. What do you see in sxmb_moni, do you have a queue problem?
    2. see this File-to-File Scenario Stopped Working  the reply from Shravan and the last message.
    <i>The XBTO que was the problem. I deleted all LUWs in it and now new transactions are working again</i>
    3. You may also use this /people/sap.user72/blog/2005/11/29/xi-how-to-re-process-failed-xi-messages-automatically
    Regards,
    Anirban.

  • HTTP Receiver Adapter - HTTP client code 110 reason error when sending

    Hi,
    I am getting the following error when using the HTTP adapter as a receiver to perform an HTTP Post in a destination system :
    <?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>XIAdapter</SAP:Category>
      <SAP:Code area="PLAINHTTP_ADAPTER">ATTRIBUTE_CLIENT</SAP:Code>
      <SAP:P1>110</SAP:P1>
      <SAP:P2 />
      <SAP:P3 />
      <SAP:P4 />
      <SAP:AdditionalText />
      <SAP:ApplicationFaultMessage namespace="" />
      <SAP:Stack>HTTP client code 110 reason</SAP:Stack>
      <SAP:Retry>N</SAP:Retry>
      </SAP:Error>
    Does anyone know what causes this error and more importantly how to trace it ?
    Cheers
    Colin.

    hi Colin,
    Check in SMICM if your HTTP service is running.  Also in RFC destination one of the parameter (SSL client Certificate) might be wrong which could also cause this problem.
    Also check this thread:-
    XI Error when upgraded to SP14 (Error Code 110) CLIENT_RECEIVE_FAILED
    Have a look into this SAP Note - 897583
    Regards.
    Praveen

Maybe you are looking for

  • Publishing .index Vs .swf  How to make my file look like the .swf Question

    Hi, I currenly have a site published where the domain is reading www.mysite.com/index.html  (example) When I view this site the image is not centered and when I expand it in different browers it does not look good. When I view the site by looking at

  • Macbook pro wont start. grey screen then shuts off

    I have been having some problems with my macbook when my battery would die and i would plug it in and try to turn it back on it would take forever to start back up. Sometimes i woudl have to unplug, take out the battery then put them back in and zap

  • Help Needed With Scrollbar and Content

    I'm having a difficult time with the Scrollbar component. I'm trying to have a scrollbar set up to navigate a text field or a MC of a text field. I managed to get it functioning within the desired frame, however when I jump to another frame, that ver

  • In which table can I find the tcode, username and data of login ?

    Hello, I would like to know which tcode and when specific users use. And therefore I have  question: In which table can I find the the tcode, username and data and time of login ? Rgds Stenwa

  • Guidelines for 0HR_PA_PA_1Datasource in BI 7.0

    Hi Experts, I want to use the HR Headcount Datasource 0HR_PA_PA_1,as in previous versions we need to make changes according to the note  336229,we are using BI 7.0 and ECC 6.0 do I still need to make the changes according to the note please suggest m