tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sean K <sk92...@gmail.com>
Subject Re: Accessing Connector from within Servlet
Date Thu, 16 Oct 2014 20:32:42 GMT
Thank you Felix!



On Tue, Oct 14, 2014 at 6:14 AM, Felix Schumacher <
felix.schumacher@internetallee.de> wrote:

> Am 13.10.2014 um 18:20 schrieb Sean K:
>
>> Hi,
>> I am new to the tomcat user group but have been using tomcat for some
>> years.
>>
>> My situation is odd -- the customer wants the product to remove an
>> external
>> JAR which requires me to make the SSL mutual connection manually, and then
>> post the Soap message.
>>
>> So far I have been successful in doing that.
>>
>> However, this overall solution is installed on different computer
>> locations, I need to allow this to work flexibly.   Right now, I have hard
>> coded the path to the TrustStore and KeyStore so that my code can access
>> those and use the password which I know, so that my HttpClient side code
>> to
>> build the correct SSL connection to the external SSL server.  (This is a
>> mutual peer authenticated SSL connection).
>>
>>  From the ServletContext or when the java servlet starts (where my
>> httpclient component runs witihin), I need to get access to the tomcat
>> connector, and determine the attributes of it.  I guess one brute force
>> method is to get the environment variable for catalina.home or
>> catalina.base and then scan for the conf/server.xml and parse that.... But
>> I figure there must be a cleaner and better way.
>>
> You can't and shouldn't access container internals from the official api's,
> which ServletContext and HttpServlet are.
>
> If I understood you right, you want to access the attributes from tomcat
> internal components to read the filename/path and passwords to reuse
> the keystore for your client, which happens to live inside a servlet.
>
> I believe your are better off, when you give your servlet its own keystore
> and configure the filename/path and credentials in a more conventional way
> with environment or context variables.
>
> If you do insist on getting the parameters from tomcat internal
> components, you
> could try using tomcat internal components like a Valve.
>
>>
>> I also scanned the objects that are acessible from the Response, Request,
>> or ServletContext.  None of them seem to point to the Connector in a way
>> that I can inspect it, or get current properties of it.   For example,
>> within the org.apache.catalina.connector.ResponseFacade, I noticed that
>> its
>> embedded object of HttpResponse is protected but it has the Connector.
>> Seems like I need to hack that to get that Connector info.
>>
>> There must be a better way.
>>
> I think the better way is to configure your components independently.
>
> Regards
>  Felix
>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>


-- 
Sean

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message