You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Nate - Hotmail <nd...@hotmail.com> on 2007/03/19 17:54:32 UTC
service request location
Is there a way to find out where a client is making a request from, ie: localhost or somewhere else?
Thanks,
Nate
RE: service request location
Posted by Betsy Frey <BF...@SERENA.com>.
axis2-kernel-1.1.1.jar
-----Original Message-----
From: Nate - Hotmail [mailto:ndougla1@hotmail.com]
Sent: Tuesday, March 20, 2007 6:29 AM
To: axis-user@ws.apache.org
Subject: Re: service request location
What jar file is MessageContext part of?
Thanks,
Nate
----- Original Message -----
From: "Michele Mazzucco" <Mi...@ncl.ac.uk>
To: <ax...@ws.apache.org>
Sent: Monday, March 19, 2007 3:14 PM
Subject: Re: service request location
> The right call is MessageContext.getCurrentMessageContext().
> http://ws.apache.org/axis2/1_1_1/api/org/apache/axis2/context/
> MessageContext.html#getCurrentMessageContext()
>
> Michele
>
> On 19 Mar 2007, at 18:06, Nate - Hotmail wrote:
>
>> When I try to make the calls, I have the following error:
>> The method getCurrentContext() is undefined for the type
>> MessageContext.
>> I get this error within Eclipse.
>>
>> Thanks,
>>
>> Nate
>>
>> ----- Original Message ----- From: "Michele Mazzucco"
>> <Mi...@ncl.ac.uk>
>> To: "axis2" <ax...@ws.apache.org>
>> Sent: Monday, March 19, 2007 1:51 PM
>> Subject: Re: service request location
>>
>>
>>> On Mon, 2007-03-19 at 13:46 -0400, Nate - Hotmail wrote:
>>>> I guess the problem I have now is where do I make these calls? Do
I
>>>> put it in my service code?
>>>
>>> Yes.
>>> MessageContext msgContext = MessageContext.getCurrentContext();
>>> return a value != null when a message is received, i.e. you can
>>> call it
>>> while you are processing incoming requests.
>>>
>>> Michele
>>>
>>>
>>>
---------------------------------------------------------------------
>>> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>>> For additional commands, e-mail: axis-user-help@ws.apache.org
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>> For additional commands, e-mail: axis-user-help@ws.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org
**********************************************************************
This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message.
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org
Re: service request location
Posted by Nate - Hotmail <nd...@hotmail.com>.
What jar file is MessageContext part of?
Thanks,
Nate
----- Original Message -----
From: "Michele Mazzucco" <Mi...@ncl.ac.uk>
To: <ax...@ws.apache.org>
Sent: Monday, March 19, 2007 3:14 PM
Subject: Re: service request location
> The right call is MessageContext.getCurrentMessageContext().
> http://ws.apache.org/axis2/1_1_1/api/org/apache/axis2/context/
> MessageContext.html#getCurrentMessageContext()
>
> Michele
>
> On 19 Mar 2007, at 18:06, Nate - Hotmail wrote:
>
>> When I try to make the calls, I have the following error:
>> The method getCurrentContext() is undefined for the type
>> MessageContext.
>> I get this error within Eclipse.
>>
>> Thanks,
>>
>> Nate
>>
>> ----- Original Message ----- From: "Michele Mazzucco"
>> <Mi...@ncl.ac.uk>
>> To: "axis2" <ax...@ws.apache.org>
>> Sent: Monday, March 19, 2007 1:51 PM
>> Subject: Re: service request location
>>
>>
>>> On Mon, 2007-03-19 at 13:46 -0400, Nate - Hotmail wrote:
>>>> I guess the problem I have now is where do I make these calls? Do I
>>>> put it in my service code?
>>>
>>> Yes.
>>> MessageContext msgContext = MessageContext.getCurrentContext();
>>> return a value != null when a message is received, i.e. you can
>>> call it
>>> while you are processing incoming requests.
>>>
>>> Michele
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>>> For additional commands, e-mail: axis-user-help@ws.apache.org
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>> For additional commands, e-mail: axis-user-help@ws.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org
Re: service request location
Posted by Michele Mazzucco <Mi...@ncl.ac.uk>.
The right call is MessageContext.getCurrentMessageContext().
http://ws.apache.org/axis2/1_1_1/api/org/apache/axis2/context/
MessageContext.html#getCurrentMessageContext()
Michele
On 19 Mar 2007, at 18:06, Nate - Hotmail wrote:
> When I try to make the calls, I have the following error:
> The method getCurrentContext() is undefined for the type
> MessageContext.
> I get this error within Eclipse.
>
> Thanks,
>
> Nate
>
> ----- Original Message ----- From: "Michele Mazzucco"
> <Mi...@ncl.ac.uk>
> To: "axis2" <ax...@ws.apache.org>
> Sent: Monday, March 19, 2007 1:51 PM
> Subject: Re: service request location
>
>
>> On Mon, 2007-03-19 at 13:46 -0400, Nate - Hotmail wrote:
>>> I guess the problem I have now is where do I make these calls? Do I
>>> put it in my service code?
>>
>> Yes.
>> MessageContext msgContext = MessageContext.getCurrentContext();
>> return a value != null when a message is received, i.e. you can
>> call it
>> while you are processing incoming requests.
>>
>> Michele
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>> For additional commands, e-mail: axis-user-help@ws.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org
Re: service request location
Posted by Nate - Hotmail <nd...@hotmail.com>.
When I try to make the calls, I have the following error:
The method getCurrentContext() is undefined for the type MessageContext.
I get this error within Eclipse.
Thanks,
Nate
----- Original Message -----
From: "Michele Mazzucco" <Mi...@ncl.ac.uk>
To: "axis2" <ax...@ws.apache.org>
Sent: Monday, March 19, 2007 1:51 PM
Subject: Re: service request location
> On Mon, 2007-03-19 at 13:46 -0400, Nate - Hotmail wrote:
>> I guess the problem I have now is where do I make these calls? Do I
>> put it in my service code?
>
> Yes.
> MessageContext msgContext = MessageContext.getCurrentContext();
> return a value != null when a message is received, i.e. you can call it
> while you are processing incoming requests.
>
> Michele
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org
Re: service request location
Posted by Michele Mazzucco <Mi...@ncl.ac.uk>.
On Mon, 2007-03-19 at 13:46 -0400, Nate - Hotmail wrote:
> I guess the problem I have now is where do I make these calls? Do I
> put it in my service code?
Yes.
MessageContext msgContext = MessageContext.getCurrentContext();
return a value != null when a message is received, i.e. you can call it
while you are processing incoming requests.
Michele
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org
Re: service request location
Posted by Nate - Hotmail <nd...@hotmail.com>.
Thanks, but I am using Axis2. I have found the follwoing information:
MessageContext msgContext = MessageContext.getCurrentContext();
HttpServletRequest request = (HttpServletRequest) msgContext.getProperty
(HTTPConstants.MC_HTTP_SERVLETREQUEST);
String remoteAddr = request.getRemoteAddr();
I guess the problem I have now is where do I make these calls? Do I put it in my service code?
-- Nate
----- Original Message -----
From: Betsy Frey
To: axis-user@ws.apache.org ; Nate - Hotmail
Sent: Monday, March 19, 2007 1:05 PM
Subject: RE: service request location
In Axis 1.4, you can use code like this:
boolean isClientLocal = true;
MessageContext msgContext = MessageContext.getCurrentContext();
String remoteIP = msgContext.getStrProp(org.apache.axis.Constants.MC_REMOTE_ADDR);
if (!remoteIP.equals("127.0.0.1"))
{
InetAddress serverAddress = InetAddress.getLocalHost();
remoteAddress = InetAddress.getByName(remoteIP);
// See if the caller's IP address matches that of the server.
if (!serverAddress.equals(remoteAddress))
isClientLocal = false;
}
------------------------------------------------------------------------------
From: Nate - Hotmail [mailto:ndougla1@hotmail.com]
Sent: Monday, March 19, 2007 9:55 AM
To: axis-user@ws.apache.org
Subject: service request location
Is there a way to find out where a client is making a request from, ie: localhost or somewhere else?
Thanks,
Nate
**********************************************************************
This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message.
RE: service request location
Posted by Betsy Frey <BF...@SERENA.com>.
In Axis 1.4, you can use code like this:
boolean isClientLocal = true;
MessageContext msgContext =
MessageContext.getCurrentContext();
String remoteIP =
msgContext.getStrProp(org.apache.axis.Constants.MC_REMOTE_ADDR);
if (!remoteIP.equals("127.0.0.1"))
{
InetAddress serverAddress =
InetAddress.getLocalHost();
remoteAddress = InetAddress.getByName(remoteIP);
// See if the caller's IP address matches that of
the server.
if (!serverAddress.equals(remoteAddress))
isClientLocal = false;
}
________________________________
From: Nate - Hotmail [mailto:ndougla1@hotmail.com]
Sent: Monday, March 19, 2007 9:55 AM
To: axis-user@ws.apache.org
Subject: service request location
Is there a way to find out where a client is making a request from, ie:
localhost or somewhere else?
Thanks,
Nate
**********************************************************************
This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message.