You are viewing a plain text version of this content. The canonical link for it is here.
Posted to rampart-dev@ws.apache.org by Amila Suriarachchi <am...@gmail.com> on 2010/03/09 13:57:13 UTC

Removing ListnerManager.defaultConfigurationContext

hi,

 The ListnerManager.defaultConfigurationContext is used as an easy way to
access the configuration context object within any place of the Axis2
container. But this would cause some security issues if we try to run
multiple Axis2 instances in a single JVM. (For an example using Axis2 in an
Multitenancy environment would cause problems with this).


 ListnerManager.defaultConfigurationContext is used in two places.

   1.

   getMyEPR method of the service Context class

   This method is only uses in isEquivalent method which does not have any
   usage. So it is safe to delete both methods.
   2.

   At the ServiceClient class to get the server Configuration context
   object.


 if (ListenerManager.defaultConfigurationContext == null) {

configContext = ConfigurationContextFactory.

createConfigurationContextFromFileSystem(null, null);

ListenerManager.defaultConfigurationContext = configContext;

createConfigCtx = true;

} else {

configContext = ListenerManager.defaultConfigurationContext;

}


 This code is to get a server configuration context if a user invokes a
service using service client at the skelton method. But here since
configuration context can be read from the message context it can be
replaced with this code.

 if (MessageContext.getCurrentMessageContext() == null) {

configContext = ConfigurationContextFactory.

createConfigurationContextFromFileSystem(null, null);

createConfigCtx = true;

} else {

configContext =
MessageContext.getCurrentMessageContext().getConfigurationContext();

}


 Here with I have attach a patch with do the fix.


 WDYT?


 Thanks,

Amila.


-- 
Amila Suriarachchi
WSO2 Inc.
blog: http://amilachinthaka.blogspot.com/

Re: Removing ListnerManager.defaultConfigurationContext

Posted by Amila Suriarachchi <am...@gmail.com>.
On Tue, Mar 9, 2010 at 7:40 PM, Deepal jayasinghe <de...@gmail.com> wrote:

> Amila,
>
> MessageContext.getCurrentMessageContext() only work at Server side and
> only after MessaeReceiver, so you cannot use this at the client side.
>

At client side  any way ListnerManager.defaultConfigurationContext is null.
Please see
the commit message[1] you have done. According to that the only requirement
is to
access the server configuration context when a client running inside a
server.

Lets do this change since there is no apparent problem with that. if a
something happens
which can not fix with this change lets revert it.

thanks,
Amila.


And also we cannot assume that user is going to invoke with a
> MessageContext when he use ServiceClient APIs (I agree in the case of
> OperationClient it does and that is why you do not have this issue with
> generated code).
>

[1] http://svn.apache.org/viewvc?view=revision&revision=378210

>
> -Deepal
> >
> > hi,
> >
> > The ListnerManager.defaultConfigurationContext is used as an easy way
> > to access the configuration context object within any place of the
> > Axis2 container. But this would cause some security issues if we try
> > to run multiple Axis2 instances in a single JVM. (For an example using
> > Axis2 in an Multitenancy environment would cause problems with this).
> >
> >
> > ListnerManager.defaultConfigurationContext is used in two places.
> >
> >   1.
> >
> >       getMyEPR method of the service Context class
> >
> >       This method is only uses in isEquivalent method which does not
> >       have any usage. So it is safe to delete both methods.
> >
> >   2.
> >
> >       At the ServiceClient class to get the server Configuration
> >       context object.
> >
> > if (ListenerManager.defaultConfigurationContext == null) {
> >
> > configContext = ConfigurationContextFactory.
> >
> > createConfigurationContextFromFileSystem(null, null);
> >
> > ListenerManager.defaultConfigurationContext = configContext;
> >
> > createConfigCtx = true;
> >
> > } else {
> >
> > configContext = ListenerManager.defaultConfigurationContext;
> >
> > }
> >
> >
> > This code is to get a server configuration context if a user invokes a
> > service using service client at the skelton method. But here since
> > configuration context can be read from the message context it can be
> > replaced with this code.
> >
> > if (MessageContext.getCurrentMessageContext() == null) {
> >
> > configContext = ConfigurationContextFactory.
> >
> > createConfigurationContextFromFileSystem(null, null);
> >
> > createConfigCtx = true;
> >
> > } else {
> >
> > configContext =
> > MessageContext.getCurrentMessageContext().getConfigurationContext();
> >
> > }
> >
> >
> > Here with I have attach a patch with do the fix.
> >
> >
> > WDYT?
> >
> >
> > Thanks,
> >
> > Amila.
> >
> >
> >
> > --
> > Amila Suriarachchi
> > WSO2 Inc.
> > blog: http://amilachinthaka.blogspot.com/
> > ------------------------------------------------------------------------
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
> > For additional commands, e-mail: java-dev-help@axis.apache.org
>
>
> --
> Thank you!
>
>
> http://blogs.deepal.org
> http://deepal.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-dev-help@axis.apache.org
>
>


-- 
Amila Suriarachchi
WSO2 Inc.
blog: http://amilachinthaka.blogspot.com/

Re: Removing ListnerManager.defaultConfigurationContext

Posted by Amila Suriarachchi <am...@gmail.com>.
On Tue, Mar 9, 2010 at 7:40 PM, Deepal jayasinghe <de...@gmail.com> wrote:

> Amila,
>
> MessageContext.getCurrentMessageContext() only work at Server side and
> only after MessaeReceiver, so you cannot use this at the client side.
>

At client side  any way ListnerManager.defaultConfigurationContext is null.
Please see
the commit message[1] you have done. According to that the only requirement
is to
access the server configuration context when a client running inside a
server.

Lets do this change since there is no apparent problem with that. if a
something happens
which can not fix with this change lets revert it.

thanks,
Amila.


And also we cannot assume that user is going to invoke with a
> MessageContext when he use ServiceClient APIs (I agree in the case of
> OperationClient it does and that is why you do not have this issue with
> generated code).
>

[1] http://svn.apache.org/viewvc?view=revision&revision=378210

>
> -Deepal
> >
> > hi,
> >
> > The ListnerManager.defaultConfigurationContext is used as an easy way
> > to access the configuration context object within any place of the
> > Axis2 container. But this would cause some security issues if we try
> > to run multiple Axis2 instances in a single JVM. (For an example using
> > Axis2 in an Multitenancy environment would cause problems with this).
> >
> >
> > ListnerManager.defaultConfigurationContext is used in two places.
> >
> >   1.
> >
> >       getMyEPR method of the service Context class
> >
> >       This method is only uses in isEquivalent method which does not
> >       have any usage. So it is safe to delete both methods.
> >
> >   2.
> >
> >       At the ServiceClient class to get the server Configuration
> >       context object.
> >
> > if (ListenerManager.defaultConfigurationContext == null) {
> >
> > configContext = ConfigurationContextFactory.
> >
> > createConfigurationContextFromFileSystem(null, null);
> >
> > ListenerManager.defaultConfigurationContext = configContext;
> >
> > createConfigCtx = true;
> >
> > } else {
> >
> > configContext = ListenerManager.defaultConfigurationContext;
> >
> > }
> >
> >
> > This code is to get a server configuration context if a user invokes a
> > service using service client at the skelton method. But here since
> > configuration context can be read from the message context it can be
> > replaced with this code.
> >
> > if (MessageContext.getCurrentMessageContext() == null) {
> >
> > configContext = ConfigurationContextFactory.
> >
> > createConfigurationContextFromFileSystem(null, null);
> >
> > createConfigCtx = true;
> >
> > } else {
> >
> > configContext =
> > MessageContext.getCurrentMessageContext().getConfigurationContext();
> >
> > }
> >
> >
> > Here with I have attach a patch with do the fix.
> >
> >
> > WDYT?
> >
> >
> > Thanks,
> >
> > Amila.
> >
> >
> >
> > --
> > Amila Suriarachchi
> > WSO2 Inc.
> > blog: http://amilachinthaka.blogspot.com/
> > ------------------------------------------------------------------------
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
> > For additional commands, e-mail: java-dev-help@axis.apache.org
>
>
> --
> Thank you!
>
>
> http://blogs.deepal.org
> http://deepal.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-dev-help@axis.apache.org
>
>


-- 
Amila Suriarachchi
WSO2 Inc.
blog: http://amilachinthaka.blogspot.com/

Re: Removing ListnerManager.defaultConfigurationContext

Posted by Amila Suriarachchi <am...@gmail.com>.
On Tue, Mar 9, 2010 at 7:40 PM, Deepal jayasinghe <de...@gmail.com> wrote:

> Amila,
>
> MessageContext.getCurrentMessageContext() only work at Server side and
> only after MessaeReceiver, so you cannot use this at the client side.
>

At client side  any way ListnerManager.defaultConfigurationContext is null.
Please see
the commit message[1] you have done. According to that the only requirement
is to
access the server configuration context when a client running inside a
server.

Lets do this change since there is no apparent problem with that. if a
something happens
which can not fix with this change lets revert it.

thanks,
Amila.


And also we cannot assume that user is going to invoke with a
> MessageContext when he use ServiceClient APIs (I agree in the case of
> OperationClient it does and that is why you do not have this issue with
> generated code).
>

[1] http://svn.apache.org/viewvc?view=revision&revision=378210

>
> -Deepal
> >
> > hi,
> >
> > The ListnerManager.defaultConfigurationContext is used as an easy way
> > to access the configuration context object within any place of the
> > Axis2 container. But this would cause some security issues if we try
> > to run multiple Axis2 instances in a single JVM. (For an example using
> > Axis2 in an Multitenancy environment would cause problems with this).
> >
> >
> > ListnerManager.defaultConfigurationContext is used in two places.
> >
> >   1.
> >
> >       getMyEPR method of the service Context class
> >
> >       This method is only uses in isEquivalent method which does not
> >       have any usage. So it is safe to delete both methods.
> >
> >   2.
> >
> >       At the ServiceClient class to get the server Configuration
> >       context object.
> >
> > if (ListenerManager.defaultConfigurationContext == null) {
> >
> > configContext = ConfigurationContextFactory.
> >
> > createConfigurationContextFromFileSystem(null, null);
> >
> > ListenerManager.defaultConfigurationContext = configContext;
> >
> > createConfigCtx = true;
> >
> > } else {
> >
> > configContext = ListenerManager.defaultConfigurationContext;
> >
> > }
> >
> >
> > This code is to get a server configuration context if a user invokes a
> > service using service client at the skelton method. But here since
> > configuration context can be read from the message context it can be
> > replaced with this code.
> >
> > if (MessageContext.getCurrentMessageContext() == null) {
> >
> > configContext = ConfigurationContextFactory.
> >
> > createConfigurationContextFromFileSystem(null, null);
> >
> > createConfigCtx = true;
> >
> > } else {
> >
> > configContext =
> > MessageContext.getCurrentMessageContext().getConfigurationContext();
> >
> > }
> >
> >
> > Here with I have attach a patch with do the fix.
> >
> >
> > WDYT?
> >
> >
> > Thanks,
> >
> > Amila.
> >
> >
> >
> > --
> > Amila Suriarachchi
> > WSO2 Inc.
> > blog: http://amilachinthaka.blogspot.com/
> > ------------------------------------------------------------------------
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
> > For additional commands, e-mail: java-dev-help@axis.apache.org
>
>
> --
> Thank you!
>
>
> http://blogs.deepal.org
> http://deepal.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-dev-help@axis.apache.org
>
>


-- 
Amila Suriarachchi
WSO2 Inc.
blog: http://amilachinthaka.blogspot.com/

Re: Removing ListnerManager.defaultConfigurationContext

Posted by Amila Suriarachchi <am...@gmail.com>.
On Tue, Mar 9, 2010 at 7:40 PM, Deepal jayasinghe <de...@gmail.com> wrote:

> Amila,
>
> MessageContext.getCurrentMessageContext() only work at Server side and
> only after MessaeReceiver, so you cannot use this at the client side.
>

At client side  any way ListnerManager.defaultConfigurationContext is null.
Please see
the commit message[1] you have done. According to that the only requirement
is to
access the server configuration context when a client running inside a
server.

Lets do this change since there is no apparent problem with that. if a
something happens
which can not fix with this change lets revert it.

thanks,
Amila.


And also we cannot assume that user is going to invoke with a
> MessageContext when he use ServiceClient APIs (I agree in the case of
> OperationClient it does and that is why you do not have this issue with
> generated code).
>

[1] http://svn.apache.org/viewvc?view=revision&revision=378210

>
> -Deepal
> >
> > hi,
> >
> > The ListnerManager.defaultConfigurationContext is used as an easy way
> > to access the configuration context object within any place of the
> > Axis2 container. But this would cause some security issues if we try
> > to run multiple Axis2 instances in a single JVM. (For an example using
> > Axis2 in an Multitenancy environment would cause problems with this).
> >
> >
> > ListnerManager.defaultConfigurationContext is used in two places.
> >
> >   1.
> >
> >       getMyEPR method of the service Context class
> >
> >       This method is only uses in isEquivalent method which does not
> >       have any usage. So it is safe to delete both methods.
> >
> >   2.
> >
> >       At the ServiceClient class to get the server Configuration
> >       context object.
> >
> > if (ListenerManager.defaultConfigurationContext == null) {
> >
> > configContext = ConfigurationContextFactory.
> >
> > createConfigurationContextFromFileSystem(null, null);
> >
> > ListenerManager.defaultConfigurationContext = configContext;
> >
> > createConfigCtx = true;
> >
> > } else {
> >
> > configContext = ListenerManager.defaultConfigurationContext;
> >
> > }
> >
> >
> > This code is to get a server configuration context if a user invokes a
> > service using service client at the skelton method. But here since
> > configuration context can be read from the message context it can be
> > replaced with this code.
> >
> > if (MessageContext.getCurrentMessageContext() == null) {
> >
> > configContext = ConfigurationContextFactory.
> >
> > createConfigurationContextFromFileSystem(null, null);
> >
> > createConfigCtx = true;
> >
> > } else {
> >
> > configContext =
> > MessageContext.getCurrentMessageContext().getConfigurationContext();
> >
> > }
> >
> >
> > Here with I have attach a patch with do the fix.
> >
> >
> > WDYT?
> >
> >
> > Thanks,
> >
> > Amila.
> >
> >
> >
> > --
> > Amila Suriarachchi
> > WSO2 Inc.
> > blog: http://amilachinthaka.blogspot.com/
> > ------------------------------------------------------------------------
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
> > For additional commands, e-mail: java-dev-help@axis.apache.org
>
>
> --
> Thank you!
>
>
> http://blogs.deepal.org
> http://deepal.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-dev-help@axis.apache.org
>
>


-- 
Amila Suriarachchi
WSO2 Inc.
blog: http://amilachinthaka.blogspot.com/

Re: Removing ListnerManager.defaultConfigurationContext

Posted by Amila Suriarachchi <am...@gmail.com>.
On Tue, Mar 9, 2010 at 7:40 PM, Deepal jayasinghe <de...@gmail.com> wrote:

> Amila,
>
> MessageContext.getCurrentMessageContext() only work at Server side and
> only after MessaeReceiver, so you cannot use this at the client side.
>

At client side  any way ListnerManager.defaultConfigurationContext is null.
Please see
the commit message[1] you have done. According to that the only requirement
is to
access the server configuration context when a client running inside a
server.

Lets do this change since there is no apparent problem with that. if a
something happens
which can not fix with this change lets revert it.

thanks,
Amila.


And also we cannot assume that user is going to invoke with a
> MessageContext when he use ServiceClient APIs (I agree in the case of
> OperationClient it does and that is why you do not have this issue with
> generated code).
>

[1] http://svn.apache.org/viewvc?view=revision&revision=378210

>
> -Deepal
> >
> > hi,
> >
> > The ListnerManager.defaultConfigurationContext is used as an easy way
> > to access the configuration context object within any place of the
> > Axis2 container. But this would cause some security issues if we try
> > to run multiple Axis2 instances in a single JVM. (For an example using
> > Axis2 in an Multitenancy environment would cause problems with this).
> >
> >
> > ListnerManager.defaultConfigurationContext is used in two places.
> >
> >   1.
> >
> >       getMyEPR method of the service Context class
> >
> >       This method is only uses in isEquivalent method which does not
> >       have any usage. So it is safe to delete both methods.
> >
> >   2.
> >
> >       At the ServiceClient class to get the server Configuration
> >       context object.
> >
> > if (ListenerManager.defaultConfigurationContext == null) {
> >
> > configContext = ConfigurationContextFactory.
> >
> > createConfigurationContextFromFileSystem(null, null);
> >
> > ListenerManager.defaultConfigurationContext = configContext;
> >
> > createConfigCtx = true;
> >
> > } else {
> >
> > configContext = ListenerManager.defaultConfigurationContext;
> >
> > }
> >
> >
> > This code is to get a server configuration context if a user invokes a
> > service using service client at the skelton method. But here since
> > configuration context can be read from the message context it can be
> > replaced with this code.
> >
> > if (MessageContext.getCurrentMessageContext() == null) {
> >
> > configContext = ConfigurationContextFactory.
> >
> > createConfigurationContextFromFileSystem(null, null);
> >
> > createConfigCtx = true;
> >
> > } else {
> >
> > configContext =
> > MessageContext.getCurrentMessageContext().getConfigurationContext();
> >
> > }
> >
> >
> > Here with I have attach a patch with do the fix.
> >
> >
> > WDYT?
> >
> >
> > Thanks,
> >
> > Amila.
> >
> >
> >
> > --
> > Amila Suriarachchi
> > WSO2 Inc.
> > blog: http://amilachinthaka.blogspot.com/
> > ------------------------------------------------------------------------
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
> > For additional commands, e-mail: java-dev-help@axis.apache.org
>
>
> --
> Thank you!
>
>
> http://blogs.deepal.org
> http://deepal.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-dev-help@axis.apache.org
>
>


-- 
Amila Suriarachchi
WSO2 Inc.
blog: http://amilachinthaka.blogspot.com/

Re: Removing ListnerManager.defaultConfigurationContext

Posted by Deepal jayasinghe <de...@gmail.com>.
Amila,

MessageContext.getCurrentMessageContext() only work at Server side and
only after MessaeReceiver, so you cannot use this at the client side.
And also we cannot assume that user is going to invoke with a
MessageContext when he use ServiceClient APIs (I agree in the case of
OperationClient it does and that is why you do not have this issue with
generated code).

-Deepal
>
> hi,
>
> The ListnerManager.defaultConfigurationContext is used as an easy way
> to access the configuration context object within any place of the
> Axis2 container. But this would cause some security issues if we try
> to run multiple Axis2 instances in a single JVM. (For an example using
> Axis2 in an Multitenancy environment would cause problems with this).
>
>
> ListnerManager.defaultConfigurationContext is used in two places.
>
>   1.
>
>       getMyEPR method of the service Context class
>
>       This method is only uses in isEquivalent method which does not
>       have any usage. So it is safe to delete both methods.
>
>   2.
>
>       At the ServiceClient class to get the server Configuration
>       context object.
>
> if (ListenerManager.defaultConfigurationContext == null) {
>
> configContext = ConfigurationContextFactory.
>
> createConfigurationContextFromFileSystem(null, null);
>
> ListenerManager.defaultConfigurationContext = configContext;
>
> createConfigCtx = true;
>
> } else {
>
> configContext = ListenerManager.defaultConfigurationContext;
>
> }
>
>
> This code is to get a server configuration context if a user invokes a
> service using service client at the skelton method. But here since
> configuration context can be read from the message context it can be
> replaced with this code.
>
> if (MessageContext.getCurrentMessageContext() == null) {
>
> configContext = ConfigurationContextFactory.
>
> createConfigurationContextFromFileSystem(null, null);
>
> createConfigCtx = true;
>
> } else {
>
> configContext =
> MessageContext.getCurrentMessageContext().getConfigurationContext();
>
> }
>
>
> Here with I have attach a patch with do the fix.
>
>
> WDYT?
>
>
> Thanks,
>
> Amila.
>
>
>
> -- 
> Amila Suriarachchi
> WSO2 Inc.
> blog: http://amilachinthaka.blogspot.com/
> ------------------------------------------------------------------------
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-dev-help@axis.apache.org


-- 
Thank you!


http://blogs.deepal.org
http://deepal.org


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


Re: Removing ListnerManager.defaultConfigurationContext

Posted by Deepal jayasinghe <de...@gmail.com>.
Amila,

At the client side when you create the ServiceClient inside a service
(let's say inside Tomcat) we use this approach to get the server's
configuration context. There are some other instances also, however I
cannot remember all of them now. I strongly suggest you to find an
alternative approach to solve this problem in Multitenancy environment,
as I mentioned before though I cannot remember why I introduced this
static variable there were number of reasons.

One way to solve is to have a axis2.xml option.

-Deepal
>
> hi,
>
> The ListnerManager.defaultConfigurationContext is used as an easy way
> to access the configuration context object within any place of the
> Axis2 container. But this would cause some security issues if we try
> to run multiple Axis2 instances in a single JVM. (For an example using
> Axis2 in an Multitenancy environment would cause problems with this).
>
>
> ListnerManager.defaultConfigurationContext is used in two places.
>
>   1.
>
>       getMyEPR method of the service Context class
>
>       This method is only uses in isEquivalent method which does not
>       have any usage. So it is safe to delete both methods.
>
>   2.
>
>       At the ServiceClient class to get the server Configuration
>       context object.
>
> if (ListenerManager.defaultConfigurationContext == null) {
>
> configContext = ConfigurationContextFactory.
>
> createConfigurationContextFromFileSystem(null, null);
>
> ListenerManager.defaultConfigurationContext = configContext;
>
> createConfigCtx = true;
>
> } else {
>
> configContext = ListenerManager.defaultConfigurationContext;
>
> }
>
>
> This code is to get a server configuration context if a user invokes a
> service using service client at the skelton method. But here since
> configuration context can be read from the message context it can be
> replaced with this code.
>
> if (MessageContext.getCurrentMessageContext() == null) {
>
> configContext = ConfigurationContextFactory.
>
> createConfigurationContextFromFileSystem(null, null);
>
> createConfigCtx = true;
>
> } else {
>
> configContext =
> MessageContext.getCurrentMessageContext().getConfigurationContext();
>
> }
>
>
> Here with I have attach a patch with do the fix.
>
>
> WDYT?
>
>
> Thanks,
>
> Amila.
>
>
>
> -- 
> Amila Suriarachchi
> WSO2 Inc.
> blog: http://amilachinthaka.blogspot.com/
> ------------------------------------------------------------------------
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-dev-help@axis.apache.org


-- 
Thank you!


http://blogs.deepal.org
http://deepal.org


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


Re: Removing ListnerManager.defaultConfigurationContext

Posted by Deepal jayasinghe <de...@gmail.com>.
Amila,

MessageContext.getCurrentMessageContext() only work at Server side and
only after MessaeReceiver, so you cannot use this at the client side.
And also we cannot assume that user is going to invoke with a
MessageContext when he use ServiceClient APIs (I agree in the case of
OperationClient it does and that is why you do not have this issue with
generated code).

-Deepal
>
> hi,
>
> The ListnerManager.defaultConfigurationContext is used as an easy way
> to access the configuration context object within any place of the
> Axis2 container. But this would cause some security issues if we try
> to run multiple Axis2 instances in a single JVM. (For an example using
> Axis2 in an Multitenancy environment would cause problems with this).
>
>
> ListnerManager.defaultConfigurationContext is used in two places.
>
>   1.
>
>       getMyEPR method of the service Context class
>
>       This method is only uses in isEquivalent method which does not
>       have any usage. So it is safe to delete both methods.
>
>   2.
>
>       At the ServiceClient class to get the server Configuration
>       context object.
>
> if (ListenerManager.defaultConfigurationContext == null) {
>
> configContext = ConfigurationContextFactory.
>
> createConfigurationContextFromFileSystem(null, null);
>
> ListenerManager.defaultConfigurationContext = configContext;
>
> createConfigCtx = true;
>
> } else {
>
> configContext = ListenerManager.defaultConfigurationContext;
>
> }
>
>
> This code is to get a server configuration context if a user invokes a
> service using service client at the skelton method. But here since
> configuration context can be read from the message context it can be
> replaced with this code.
>
> if (MessageContext.getCurrentMessageContext() == null) {
>
> configContext = ConfigurationContextFactory.
>
> createConfigurationContextFromFileSystem(null, null);
>
> createConfigCtx = true;
>
> } else {
>
> configContext =
> MessageContext.getCurrentMessageContext().getConfigurationContext();
>
> }
>
>
> Here with I have attach a patch with do the fix.
>
>
> WDYT?
>
>
> Thanks,
>
> Amila.
>
>
>
> -- 
> Amila Suriarachchi
> WSO2 Inc.
> blog: http://amilachinthaka.blogspot.com/
> ------------------------------------------------------------------------
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-dev-help@axis.apache.org


-- 
Thank you!


http://blogs.deepal.org
http://deepal.org


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


Re: Removing ListnerManager.defaultConfigurationContext

Posted by Deepal jayasinghe <de...@gmail.com>.
Amila,

At the client side when you create the ServiceClient inside a service
(let's say inside Tomcat) we use this approach to get the server's
configuration context. There are some other instances also, however I
cannot remember all of them now. I strongly suggest you to find an
alternative approach to solve this problem in Multitenancy environment,
as I mentioned before though I cannot remember why I introduced this
static variable there were number of reasons.

One way to solve is to have a axis2.xml option.

-Deepal
>
> hi,
>
> The ListnerManager.defaultConfigurationContext is used as an easy way
> to access the configuration context object within any place of the
> Axis2 container. But this would cause some security issues if we try
> to run multiple Axis2 instances in a single JVM. (For an example using
> Axis2 in an Multitenancy environment would cause problems with this).
>
>
> ListnerManager.defaultConfigurationContext is used in two places.
>
>   1.
>
>       getMyEPR method of the service Context class
>
>       This method is only uses in isEquivalent method which does not
>       have any usage. So it is safe to delete both methods.
>
>   2.
>
>       At the ServiceClient class to get the server Configuration
>       context object.
>
> if (ListenerManager.defaultConfigurationContext == null) {
>
> configContext = ConfigurationContextFactory.
>
> createConfigurationContextFromFileSystem(null, null);
>
> ListenerManager.defaultConfigurationContext = configContext;
>
> createConfigCtx = true;
>
> } else {
>
> configContext = ListenerManager.defaultConfigurationContext;
>
> }
>
>
> This code is to get a server configuration context if a user invokes a
> service using service client at the skelton method. But here since
> configuration context can be read from the message context it can be
> replaced with this code.
>
> if (MessageContext.getCurrentMessageContext() == null) {
>
> configContext = ConfigurationContextFactory.
>
> createConfigurationContextFromFileSystem(null, null);
>
> createConfigCtx = true;
>
> } else {
>
> configContext =
> MessageContext.getCurrentMessageContext().getConfigurationContext();
>
> }
>
>
> Here with I have attach a patch with do the fix.
>
>
> WDYT?
>
>
> Thanks,
>
> Amila.
>
>
>
> -- 
> Amila Suriarachchi
> WSO2 Inc.
> blog: http://amilachinthaka.blogspot.com/
> ------------------------------------------------------------------------
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-dev-help@axis.apache.org


-- 
Thank you!


http://blogs.deepal.org
http://deepal.org


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


Re: Removing ListnerManager.defaultConfigurationContext

Posted by Deepal jayasinghe <de...@gmail.com>.
Amila,

MessageContext.getCurrentMessageContext() only work at Server side and
only after MessaeReceiver, so you cannot use this at the client side.
And also we cannot assume that user is going to invoke with a
MessageContext when he use ServiceClient APIs (I agree in the case of
OperationClient it does and that is why you do not have this issue with
generated code).

-Deepal
>
> hi,
>
> The ListnerManager.defaultConfigurationContext is used as an easy way
> to access the configuration context object within any place of the
> Axis2 container. But this would cause some security issues if we try
> to run multiple Axis2 instances in a single JVM. (For an example using
> Axis2 in an Multitenancy environment would cause problems with this).
>
>
> ListnerManager.defaultConfigurationContext is used in two places.
>
>   1.
>
>       getMyEPR method of the service Context class
>
>       This method is only uses in isEquivalent method which does not
>       have any usage. So it is safe to delete both methods.
>
>   2.
>
>       At the ServiceClient class to get the server Configuration
>       context object.
>
> if (ListenerManager.defaultConfigurationContext == null) {
>
> configContext = ConfigurationContextFactory.
>
> createConfigurationContextFromFileSystem(null, null);
>
> ListenerManager.defaultConfigurationContext = configContext;
>
> createConfigCtx = true;
>
> } else {
>
> configContext = ListenerManager.defaultConfigurationContext;
>
> }
>
>
> This code is to get a server configuration context if a user invokes a
> service using service client at the skelton method. But here since
> configuration context can be read from the message context it can be
> replaced with this code.
>
> if (MessageContext.getCurrentMessageContext() == null) {
>
> configContext = ConfigurationContextFactory.
>
> createConfigurationContextFromFileSystem(null, null);
>
> createConfigCtx = true;
>
> } else {
>
> configContext =
> MessageContext.getCurrentMessageContext().getConfigurationContext();
>
> }
>
>
> Here with I have attach a patch with do the fix.
>
>
> WDYT?
>
>
> Thanks,
>
> Amila.
>
>
>
> -- 
> Amila Suriarachchi
> WSO2 Inc.
> blog: http://amilachinthaka.blogspot.com/
> ------------------------------------------------------------------------
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-dev-help@axis.apache.org


-- 
Thank you!


http://blogs.deepal.org
http://deepal.org


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


Re: Removing ListnerManager.defaultConfigurationContext

Posted by Deepal jayasinghe <de...@gmail.com>.
Amila,

MessageContext.getCurrentMessageContext() only work at Server side and
only after MessaeReceiver, so you cannot use this at the client side.
And also we cannot assume that user is going to invoke with a
MessageContext when he use ServiceClient APIs (I agree in the case of
OperationClient it does and that is why you do not have this issue with
generated code).

-Deepal
>
> hi,
>
> The ListnerManager.defaultConfigurationContext is used as an easy way
> to access the configuration context object within any place of the
> Axis2 container. But this would cause some security issues if we try
> to run multiple Axis2 instances in a single JVM. (For an example using
> Axis2 in an Multitenancy environment would cause problems with this).
>
>
> ListnerManager.defaultConfigurationContext is used in two places.
>
>   1.
>
>       getMyEPR method of the service Context class
>
>       This method is only uses in isEquivalent method which does not
>       have any usage. So it is safe to delete both methods.
>
>   2.
>
>       At the ServiceClient class to get the server Configuration
>       context object.
>
> if (ListenerManager.defaultConfigurationContext == null) {
>
> configContext = ConfigurationContextFactory.
>
> createConfigurationContextFromFileSystem(null, null);
>
> ListenerManager.defaultConfigurationContext = configContext;
>
> createConfigCtx = true;
>
> } else {
>
> configContext = ListenerManager.defaultConfigurationContext;
>
> }
>
>
> This code is to get a server configuration context if a user invokes a
> service using service client at the skelton method. But here since
> configuration context can be read from the message context it can be
> replaced with this code.
>
> if (MessageContext.getCurrentMessageContext() == null) {
>
> configContext = ConfigurationContextFactory.
>
> createConfigurationContextFromFileSystem(null, null);
>
> createConfigCtx = true;
>
> } else {
>
> configContext =
> MessageContext.getCurrentMessageContext().getConfigurationContext();
>
> }
>
>
> Here with I have attach a patch with do the fix.
>
>
> WDYT?
>
>
> Thanks,
>
> Amila.
>
>
>
> -- 
> Amila Suriarachchi
> WSO2 Inc.
> blog: http://amilachinthaka.blogspot.com/
> ------------------------------------------------------------------------
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-dev-help@axis.apache.org


-- 
Thank you!


http://blogs.deepal.org
http://deepal.org


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


Re: Removing ListnerManager.defaultConfigurationContext

Posted by Deepal jayasinghe <de...@gmail.com>.
Amila,

At the client side when you create the ServiceClient inside a service
(let's say inside Tomcat) we use this approach to get the server's
configuration context. There are some other instances also, however I
cannot remember all of them now. I strongly suggest you to find an
alternative approach to solve this problem in Multitenancy environment,
as I mentioned before though I cannot remember why I introduced this
static variable there were number of reasons.

One way to solve is to have a axis2.xml option.

-Deepal
>
> hi,
>
> The ListnerManager.defaultConfigurationContext is used as an easy way
> to access the configuration context object within any place of the
> Axis2 container. But this would cause some security issues if we try
> to run multiple Axis2 instances in a single JVM. (For an example using
> Axis2 in an Multitenancy environment would cause problems with this).
>
>
> ListnerManager.defaultConfigurationContext is used in two places.
>
>   1.
>
>       getMyEPR method of the service Context class
>
>       This method is only uses in isEquivalent method which does not
>       have any usage. So it is safe to delete both methods.
>
>   2.
>
>       At the ServiceClient class to get the server Configuration
>       context object.
>
> if (ListenerManager.defaultConfigurationContext == null) {
>
> configContext = ConfigurationContextFactory.
>
> createConfigurationContextFromFileSystem(null, null);
>
> ListenerManager.defaultConfigurationContext = configContext;
>
> createConfigCtx = true;
>
> } else {
>
> configContext = ListenerManager.defaultConfigurationContext;
>
> }
>
>
> This code is to get a server configuration context if a user invokes a
> service using service client at the skelton method. But here since
> configuration context can be read from the message context it can be
> replaced with this code.
>
> if (MessageContext.getCurrentMessageContext() == null) {
>
> configContext = ConfigurationContextFactory.
>
> createConfigurationContextFromFileSystem(null, null);
>
> createConfigCtx = true;
>
> } else {
>
> configContext =
> MessageContext.getCurrentMessageContext().getConfigurationContext();
>
> }
>
>
> Here with I have attach a patch with do the fix.
>
>
> WDYT?
>
>
> Thanks,
>
> Amila.
>
>
>
> -- 
> Amila Suriarachchi
> WSO2 Inc.
> blog: http://amilachinthaka.blogspot.com/
> ------------------------------------------------------------------------
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-dev-help@axis.apache.org


-- 
Thank you!


http://blogs.deepal.org
http://deepal.org


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


Re: Removing ListnerManager.defaultConfigurationContext

Posted by Deepal jayasinghe <de...@gmail.com>.
Amila,

At the client side when you create the ServiceClient inside a service
(let's say inside Tomcat) we use this approach to get the server's
configuration context. There are some other instances also, however I
cannot remember all of them now. I strongly suggest you to find an
alternative approach to solve this problem in Multitenancy environment,
as I mentioned before though I cannot remember why I introduced this
static variable there were number of reasons.

One way to solve is to have a axis2.xml option.

-Deepal
>
> hi,
>
> The ListnerManager.defaultConfigurationContext is used as an easy way
> to access the configuration context object within any place of the
> Axis2 container. But this would cause some security issues if we try
> to run multiple Axis2 instances in a single JVM. (For an example using
> Axis2 in an Multitenancy environment would cause problems with this).
>
>
> ListnerManager.defaultConfigurationContext is used in two places.
>
>   1.
>
>       getMyEPR method of the service Context class
>
>       This method is only uses in isEquivalent method which does not
>       have any usage. So it is safe to delete both methods.
>
>   2.
>
>       At the ServiceClient class to get the server Configuration
>       context object.
>
> if (ListenerManager.defaultConfigurationContext == null) {
>
> configContext = ConfigurationContextFactory.
>
> createConfigurationContextFromFileSystem(null, null);
>
> ListenerManager.defaultConfigurationContext = configContext;
>
> createConfigCtx = true;
>
> } else {
>
> configContext = ListenerManager.defaultConfigurationContext;
>
> }
>
>
> This code is to get a server configuration context if a user invokes a
> service using service client at the skelton method. But here since
> configuration context can be read from the message context it can be
> replaced with this code.
>
> if (MessageContext.getCurrentMessageContext() == null) {
>
> configContext = ConfigurationContextFactory.
>
> createConfigurationContextFromFileSystem(null, null);
>
> createConfigCtx = true;
>
> } else {
>
> configContext =
> MessageContext.getCurrentMessageContext().getConfigurationContext();
>
> }
>
>
> Here with I have attach a patch with do the fix.
>
>
> WDYT?
>
>
> Thanks,
>
> Amila.
>
>
>
> -- 
> Amila Suriarachchi
> WSO2 Inc.
> blog: http://amilachinthaka.blogspot.com/
> ------------------------------------------------------------------------
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-dev-help@axis.apache.org


-- 
Thank you!


http://blogs.deepal.org
http://deepal.org


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


Re: Removing ListnerManager.defaultConfigurationContext

Posted by Deepal jayasinghe <de...@gmail.com>.
Amila,

At the client side when you create the ServiceClient inside a service
(let's say inside Tomcat) we use this approach to get the server's
configuration context. There are some other instances also, however I
cannot remember all of them now. I strongly suggest you to find an
alternative approach to solve this problem in Multitenancy environment,
as I mentioned before though I cannot remember why I introduced this
static variable there were number of reasons.

One way to solve is to have a axis2.xml option.

-Deepal
>
> hi,
>
> The ListnerManager.defaultConfigurationContext is used as an easy way
> to access the configuration context object within any place of the
> Axis2 container. But this would cause some security issues if we try
> to run multiple Axis2 instances in a single JVM. (For an example using
> Axis2 in an Multitenancy environment would cause problems with this).
>
>
> ListnerManager.defaultConfigurationContext is used in two places.
>
>   1.
>
>       getMyEPR method of the service Context class
>
>       This method is only uses in isEquivalent method which does not
>       have any usage. So it is safe to delete both methods.
>
>   2.
>
>       At the ServiceClient class to get the server Configuration
>       context object.
>
> if (ListenerManager.defaultConfigurationContext == null) {
>
> configContext = ConfigurationContextFactory.
>
> createConfigurationContextFromFileSystem(null, null);
>
> ListenerManager.defaultConfigurationContext = configContext;
>
> createConfigCtx = true;
>
> } else {
>
> configContext = ListenerManager.defaultConfigurationContext;
>
> }
>
>
> This code is to get a server configuration context if a user invokes a
> service using service client at the skelton method. But here since
> configuration context can be read from the message context it can be
> replaced with this code.
>
> if (MessageContext.getCurrentMessageContext() == null) {
>
> configContext = ConfigurationContextFactory.
>
> createConfigurationContextFromFileSystem(null, null);
>
> createConfigCtx = true;
>
> } else {
>
> configContext =
> MessageContext.getCurrentMessageContext().getConfigurationContext();
>
> }
>
>
> Here with I have attach a patch with do the fix.
>
>
> WDYT?
>
>
> Thanks,
>
> Amila.
>
>
>
> -- 
> Amila Suriarachchi
> WSO2 Inc.
> blog: http://amilachinthaka.blogspot.com/
> ------------------------------------------------------------------------
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-dev-help@axis.apache.org


-- 
Thank you!


http://blogs.deepal.org
http://deepal.org


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


Re: Removing ListnerManager.defaultConfigurationContext

Posted by Deepal jayasinghe <de...@gmail.com>.
Amila,

MessageContext.getCurrentMessageContext() only work at Server side and
only after MessaeReceiver, so you cannot use this at the client side.
And also we cannot assume that user is going to invoke with a
MessageContext when he use ServiceClient APIs (I agree in the case of
OperationClient it does and that is why you do not have this issue with
generated code).

-Deepal
>
> hi,
>
> The ListnerManager.defaultConfigurationContext is used as an easy way
> to access the configuration context object within any place of the
> Axis2 container. But this would cause some security issues if we try
> to run multiple Axis2 instances in a single JVM. (For an example using
> Axis2 in an Multitenancy environment would cause problems with this).
>
>
> ListnerManager.defaultConfigurationContext is used in two places.
>
>   1.
>
>       getMyEPR method of the service Context class
>
>       This method is only uses in isEquivalent method which does not
>       have any usage. So it is safe to delete both methods.
>
>   2.
>
>       At the ServiceClient class to get the server Configuration
>       context object.
>
> if (ListenerManager.defaultConfigurationContext == null) {
>
> configContext = ConfigurationContextFactory.
>
> createConfigurationContextFromFileSystem(null, null);
>
> ListenerManager.defaultConfigurationContext = configContext;
>
> createConfigCtx = true;
>
> } else {
>
> configContext = ListenerManager.defaultConfigurationContext;
>
> }
>
>
> This code is to get a server configuration context if a user invokes a
> service using service client at the skelton method. But here since
> configuration context can be read from the message context it can be
> replaced with this code.
>
> if (MessageContext.getCurrentMessageContext() == null) {
>
> configContext = ConfigurationContextFactory.
>
> createConfigurationContextFromFileSystem(null, null);
>
> createConfigCtx = true;
>
> } else {
>
> configContext =
> MessageContext.getCurrentMessageContext().getConfigurationContext();
>
> }
>
>
> Here with I have attach a patch with do the fix.
>
>
> WDYT?
>
>
> Thanks,
>
> Amila.
>
>
>
> -- 
> Amila Suriarachchi
> WSO2 Inc.
> blog: http://amilachinthaka.blogspot.com/
> ------------------------------------------------------------------------
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-dev-help@axis.apache.org


-- 
Thank you!


http://blogs.deepal.org
http://deepal.org


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