You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Sagi Mann (JIRA)" <ji...@apache.org> on 2007/12/18 15:20:43 UTC

[jira] Created: (HTTPCLIENT-720) HttpClient Resource Adapter (JCA1.5)

HttpClient Resource Adapter (JCA1.5)
------------------------------------

                 Key: HTTPCLIENT-720
                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-720
             Project: HttpComponents HttpClient
          Issue Type: New Feature
          Components: Contrib
    Affects Versions: 3.1 Final
         Environment: JCA1.5-compliant application server
            Reporter: Sagi Mann
            Priority: Minor
             Fix For: 3.1 Final


Allow Java Enterprise applications (J2EE/JEE) to use HttpClient, by providing HttpClient as a standard Resource Adapter (JCA 1.5)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] Commented: (HTTPCLIENT-720) HttpClient Resource Adapter (JCA1.5)

Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCLIENT-720?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12552842 ] 

Oleg Kalnichevski commented on HTTPCLIENT-720:
----------------------------------------------

Commons have a reasonable set of guidelines for submitting patches:

http://commons.apache.org/patches.html

Oleg

> HttpClient Resource Adapter (JCA1.5)
> ------------------------------------
>
>                 Key: HTTPCLIENT-720
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-720
>             Project: HttpComponents HttpClient
>          Issue Type: New Feature
>          Components: Contrib
>    Affects Versions: 3.1 Final
>         Environment: JCA1.5-compliant application server
>            Reporter: Sagi Mann
>            Priority: Minor
>         Attachments: HttpClientRA.zip, HttpClientRA.zip
>
>
> Allow Java Enterprise applications (J2EE/JEE) to use HttpClient, by providing HttpClient as a standard Resource Adapter (JCA 1.5)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] Resolved: (HTTPCLIENT-720) HttpClient Resource Adapter (JCA1.5)

Posted by "Ortwin Glück (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HTTPCLIENT-720?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ortwin Glück resolved HTTPCLIENT-720.
-------------------------------------

       Resolution: Invalid
    Fix Version/s:     (was: 3.1 Final)

> HttpClient Resource Adapter (JCA1.5)
> ------------------------------------
>
>                 Key: HTTPCLIENT-720
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-720
>             Project: HttpComponents HttpClient
>          Issue Type: New Feature
>          Components: Contrib
>    Affects Versions: 3.1 Final
>         Environment: JCA1.5-compliant application server
>            Reporter: Sagi Mann
>            Priority: Minor
>         Attachments: HttpClientRA.zip
>
>
> Allow Java Enterprise applications (J2EE/JEE) to use HttpClient, by providing HttpClient as a standard Resource Adapter (JCA 1.5)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] Commented: (HTTPCLIENT-720) HttpClient Resource Adapter (JCA1.5)

Posted by "Sagi Mann (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCLIENT-720?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12552826 ] 

Sagi Mann commented on HTTPCLIENT-720:
--------------------------------------

Oleg,

Understood, thanks for the feedback. If there are any published
guidelines as to what/how new contributers should contribute to HC,
I'd appreciate a reference. I'll have a look at the links you sent and
will modify whatever's necessary. Since I assume next update will
contain changes to all source files, my next .zip will contain all
sources (but without the netbeans dependencies). I will also recreate
the build.xml to be independent of netbeans.

Again, as I noted in the beginning, this is a preliminary version that
Roland Weber recommended I attach to a JIRA issue, after some users on
the mailing list showed interest. Naturally, I'll do what is necessary
to raise the quality of the deliverables - which is why any feedback
is appreciated.

thanks again,

Sagi Mann


> HttpClient Resource Adapter (JCA1.5)
> ------------------------------------
>
>                 Key: HTTPCLIENT-720
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-720
>             Project: HttpComponents HttpClient
>          Issue Type: New Feature
>          Components: Contrib
>    Affects Versions: 3.1 Final
>         Environment: JCA1.5-compliant application server
>            Reporter: Sagi Mann
>            Priority: Minor
>         Attachments: HttpClientRA.zip, HttpClientRA.zip
>
>
> Allow Java Enterprise applications (J2EE/JEE) to use HttpClient, by providing HttpClient as a standard Resource Adapter (JCA 1.5)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] Reopened: (HTTPCLIENT-720) HttpClient Resource Adapter (JCA1.5)

Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HTTPCLIENT-720?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Oleg Kalnichevski reopened HTTPCLIENT-720:
------------------------------------------


Sagi,

Contributing to an open-source project is not always that easy. I'll do my best to find time to work with you to make sure your code meets the standards of the project. So, for a start, please submit _only_ relevant files you want to be checked into the code repository, not the whole NetBeans shabang. I would very much prefer all code contributions to be in the unified diff format [1] produced against the SVN trunk [2]. Secondly, please remove all commented out dead code. The smaller the patch, the easier it is to review, the higher the changes it will be accepted.

Oleg

[1] http://en.wikipedia.org/wiki/Diff#Unified_format 
[2] https://svn.apache.org/repos/asf/httpcomponents/oac.hc3x/trunk/

> HttpClient Resource Adapter (JCA1.5)
> ------------------------------------
>
>                 Key: HTTPCLIENT-720
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-720
>             Project: HttpComponents HttpClient
>          Issue Type: New Feature
>          Components: Contrib
>    Affects Versions: 3.1 Final
>         Environment: JCA1.5-compliant application server
>            Reporter: Sagi Mann
>            Priority: Minor
>         Attachments: HttpClientRA.zip, HttpClientRA.zip
>
>
> Allow Java Enterprise applications (J2EE/JEE) to use HttpClient, by providing HttpClient as a standard Resource Adapter (JCA 1.5)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] Resolved: (HTTPCLIENT-720) HttpClient Resource Adapter (JCA1.5)

Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HTTPCLIENT-720?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Oleg Kalnichevski resolved HTTPCLIENT-720.
------------------------------------------

    Resolution: Won't Fix

Closing as won't fix

Oleg

> HttpClient Resource Adapter (JCA1.5)
> ------------------------------------
>
>                 Key: HTTPCLIENT-720
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-720
>             Project: HttpComponents HttpClient
>          Issue Type: New Feature
>          Components: Contrib
>    Affects Versions: 3.1 Final
>         Environment: JCA1.5-compliant application server
>            Reporter: Sagi Mann
>            Priority: Minor
>         Attachments: HttpClientRA.zip, HttpClientRA.zip
>
>
> Allow Java Enterprise applications (J2EE/JEE) to use HttpClient, by providing HttpClient as a standard Resource Adapter (JCA 1.5)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] Commented: (HTTPCLIENT-720) HttpClient Resource Adapter (JCA1.5)

Posted by "Ortwin Glück (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCLIENT-720?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12552805 ] 

Ortwin Glück commented on HTTPCLIENT-720:
-----------------------------------------

Sagi, this doesn't make sense to me. The code completely consumes the response (so the caller can not obtain it). Then the code fails to call releaseConnection(). Also there is no documentation on the interfaces that would give hints to correct use of the API. To me this looks like highly prone to resource leaks - the least you want in an application server:

    public void close() throws ResourceException {
        if (logger().isDebugEnabled())
            logger().debug("Closing");
        //todo: how to delegate close to the underlying managedConnection?
        getManagedConnection().close();
        setManagedConnection(null);
    }
    
    public HttpMethod getHttpMethod() { return getManagedConnection().getHttpMethod(); }
    
    public int execute() throws ResourceException {
        try {
            int rc = getManagedConnection().getHttpClientRaMcf().getHttpClientRa().
                    getHttpClient().executeMethod(getHttpMethod());
            while (getHttpMethod().getResponseBodyAsStream().read() != -1);
            return rc;
        } catch (Throwable ex) {
            throw new ResourceException("Failed to execute", ex);
        }
    }
    
Then the code uses some undocumented system properties: com.retailermade.rqms.httpcra.proxy.user etc.

errm... and what is that exactly supposed to be: if ("nt".compareToIgnoreCase("") == 0) {

I am not sure how much sense it makes to access HttpClient over the resource adapter API anyway. For me it would make the most sense to share a global Http connection pool among different EJBs. But this code doesn't even attempt to use the multithreaded connection manager, so it isn't even thread-safe!

All in all it looks like you have tried to solve a very specific problem for a project. But what you have submitted here is far from a reusable generic component. I highly discourage anyone from directly using this piece of code.

> HttpClient Resource Adapter (JCA1.5)
> ------------------------------------
>
>                 Key: HTTPCLIENT-720
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-720
>             Project: HttpComponents HttpClient
>          Issue Type: New Feature
>          Components: Contrib
>    Affects Versions: 3.1 Final
>         Environment: JCA1.5-compliant application server
>            Reporter: Sagi Mann
>            Priority: Minor
>             Fix For: 3.1 Final
>
>         Attachments: HttpClientRA.zip
>
>
> Allow Java Enterprise applications (J2EE/JEE) to use HttpClient, by providing HttpClient as a standard Resource Adapter (JCA 1.5)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] Commented: (HTTPCLIENT-720) HttpClient Resource Adapter (JCA1.5)

Posted by "Sagi Mann (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCLIENT-720?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12552817 ] 

Sagi Mann commented on HTTPCLIENT-720:
--------------------------------------

A few more notes:
* This code has not yet been tested with muti-threaded connection manager, will do this next.
* usage from within EJB 3.0:

@Stateless
public class MyEJBean {

    @Resource(mappedName="ra/HttpClientConnectionFactory") // or whatever the registered pool name is
    HttpClientRaConnectionFactory hcf;

   void doSth() {
                   try {
                           HttpClientRaConnection con = hcf.getConnection(url, "get");
                           try {
                                  int rc = con.execute();
                                  // do something interesting with the response:
                                  while (con.getHttpMethod().getResponseBodyAsStream().read() != -1);
                                  if (rc != HttpStatus.SC_OK) { /* nasty  log message */ }
                           } finally { con.close(); }
                   } catch (Exception ex) {
                            // yet another nasty log message
                   }
   }

}


> HttpClient Resource Adapter (JCA1.5)
> ------------------------------------
>
>                 Key: HTTPCLIENT-720
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-720
>             Project: HttpComponents HttpClient
>          Issue Type: New Feature
>          Components: Contrib
>    Affects Versions: 3.1 Final
>         Environment: JCA1.5-compliant application server
>            Reporter: Sagi Mann
>            Priority: Minor
>         Attachments: HttpClientRA.zip, HttpClientRA.zip
>
>
> Allow Java Enterprise applications (J2EE/JEE) to use HttpClient, by providing HttpClient as a standard Resource Adapter (JCA 1.5)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] Updated: (HTTPCLIENT-720) HttpClient Resource Adapter (JCA1.5)

Posted by "Sagi Mann (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HTTPCLIENT-720?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sagi Mann updated HTTPCLIENT-720:
---------------------------------

    Attachment: HttpClientRA.zip

Updated RA source code and binaries.
changes include:
* Configuration documentation in the HttpClientResourceAdapter class
* "nt".equals("") fixed
* Consumption of http response is removed from HttpClientRaConnectionImpl
* fixed: proxy password configuration is read from the 'user' property instead of the 'password' property.


> HttpClient Resource Adapter (JCA1.5)
> ------------------------------------
>
>                 Key: HTTPCLIENT-720
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-720
>             Project: HttpComponents HttpClient
>          Issue Type: New Feature
>          Components: Contrib
>    Affects Versions: 3.1 Final
>         Environment: JCA1.5-compliant application server
>            Reporter: Sagi Mann
>            Priority: Minor
>         Attachments: HttpClientRA.zip, HttpClientRA.zip
>
>
> Allow Java Enterprise applications (J2EE/JEE) to use HttpClient, by providing HttpClient as a standard Resource Adapter (JCA 1.5)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] Commented: (HTTPCLIENT-720) HttpClient Resource Adapter (JCA1.5)

Posted by "Sagi Mann (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCLIENT-720?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12552808 ] 

Sagi Mann commented on HTTPCLIENT-720:
--------------------------------------

Clarifications:
1. the goal IS to provide some global http connection pool. But: bare in mind that basic Java http connections do not provide proxy support, security features, etc. So, this is an attempt to make all of those features (already supported by HttpClient) available to EJB's. Improvement suggestions to existing code will be appreciated...

2. you're right about the properties com.retailermade.... I should update & document this

3. correct about the consumption of the response. Actually, I should have left it to the application. The stream consuption routine (i.e. while(... != -1) thing) should be removed. Instead, the EJB should call:

myconnection.execute();
while (myconnection.getHttpMethod().getResponseBodyAsStream().read() != -1); 



> HttpClient Resource Adapter (JCA1.5)
> ------------------------------------
>
>                 Key: HTTPCLIENT-720
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-720
>             Project: HttpComponents HttpClient
>          Issue Type: New Feature
>          Components: Contrib
>    Affects Versions: 3.1 Final
>         Environment: JCA1.5-compliant application server
>            Reporter: Sagi Mann
>            Priority: Minor
>         Attachments: HttpClientRA.zip
>
>
> Allow Java Enterprise applications (J2EE/JEE) to use HttpClient, by providing HttpClient as a standard Resource Adapter (JCA 1.5)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] Updated: (HTTPCLIENT-720) HttpClient Resource Adapter (JCA1.5)

Posted by "Sagi Mann (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HTTPCLIENT-720?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sagi Mann updated HTTPCLIENT-720:
---------------------------------

    Attachment: HttpClientRA.zip

HttpClientRA is an experimental implementation of an HttpClient Resource Adapter (JCA1.5). The .zip file contains a NetBeans 5.5.1 project. Note that some of the referenced JDK/library locations may need to be adjusted, depending on who opens this project.

the /dist directory contains a ready-to-deploy .rar file, and a ready-to-use HttpClientRA-spec.jar file, for EJB's that need the interfaces for accessing the RA.

See deployment notes.txt for an example on how to deply on SJSAS9.1.

Note build.txt contains a post-jar target to create the .rar and spec.jar.


> HttpClient Resource Adapter (JCA1.5)
> ------------------------------------
>
>                 Key: HTTPCLIENT-720
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-720
>             Project: HttpComponents HttpClient
>          Issue Type: New Feature
>          Components: Contrib
>    Affects Versions: 3.1 Final
>         Environment: JCA1.5-compliant application server
>            Reporter: Sagi Mann
>            Priority: Minor
>             Fix For: 3.1 Final
>
>         Attachments: HttpClientRA.zip
>
>
> Allow Java Enterprise applications (J2EE/JEE) to use HttpClient, by providing HttpClient as a standard Resource Adapter (JCA 1.5)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org