You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Rian J Stockbower <rs...@gmail.com> on 2013/11/17 21:00:57 UTC

Is there a way to get a JAX-RS service to bind to all valid URLs for a host?

Apache Tika has a JAX-RS web service that's configured to listen on
localhost, and that's it. It can be re-compiled to listen for a specific
hostname, but that's not very useful if you're looking to deploy an
arbitrary number of Tika endpoints (as I am).

I tried swapping the setAddress() call with a value that was computed at
runtime, but that was unsuccessful. In a perfect world, I'd like Tika to
listen on all valid interfaces.
- localhost
- 127.0.0.1
- hostname
- hostname.domain.tld
- ip address
- whatever else I've forgotten

I've looked at the docs, and it looks like you can only set one address for
JAX-RS web services(?):

http://cxf.apache.org/docs/http-binding.html

1) Is there a simple workaround for this problem?
2) If not, it looks like the only thing to do is to convert the JAX-RS
service to a JAX-WS service. Is that correct? Or is there something else
that can done?

What is the best way to approach fixing this problem?

Thanks,
-Rian

Re: Is there a way to get a JAX-RS service to bind to all valid URLs for a host?

Posted by Sergey Beryozkin <sb...@gmail.com>.
On 17/11/13 21:05, Rian J Stockbower wrote:
> I don't use CXF in standalone mode, as far as I know. To use the Tika
> JAX-RS service, I download Tika 1.4, run mvn install, and then invoke the
> service.
>
> I'm not sure where/how CXF is pulled into the mix.
>
> That being said...
>
> I changed the line in TikaServerCLI.java to use 0.0.0.0 instead of
> localhost, and recompiled. It fixed the problem. It now responds on
> localhost, 127.0.0.7, hostname, hostname.domain.tld,
>
> http://svn.apache.org/repos/asf/tika/trunk/tika-server/src/main/java/org/apache/tika/server/TikaServerCli.java
>
> I'll see about getting that change back into the Tika trunk.
Sounds good, I guess it is a matter of adding a 'host' option to the 
list. Please attach a patch and I can apply it (I should be able to)

I've also created
https://issues.apache.org/jira/browse/TIKA-1197

Sergey

>
> -Rian
>
>
> On Sun, Nov 17, 2013 at 3:54 PM, Sergey Beryozkin <sb...@gmail.com>wrote:
>
>> Hi Rian
>>
>> If you use CXF in a standalone mode, where you set an absolute address,
>> then something like "http://0.0.0.0/tika" should do. As I've already
>> commented at TIKA-1196, please try the latest released CXF, example, CXF
>> 2.7.7.
>> Let us know please how it goes for you
>> Thanks, Sergey
>>
>>
>> On 17/11/13 20:02, Rian J Stockbower wrote:
>>
>>> Here's the Tika ticket associated with my question:
>>>
>>> https://issues.apache.org/jira/browse/TIKA-1196
>>>
>>> -Rian
>>>
>>>
>>> On Sun, Nov 17, 2013 at 3:00 PM, Rian J Stockbower <rstockbower@gmail.com
>>>> wrote:
>>>
>>>   Apache Tika has a JAX-RS web service that's configured to listen on
>>>> localhost, and that's it. It can be re-compiled to listen for a specific
>>>> hostname, but that's not very useful if you're looking to deploy an
>>>> arbitrary number of Tika endpoints (as I am).
>>>>
>>>> I tried swapping the setAddress() call with a value that was computed at
>>>> runtime, but that was unsuccessful. In a perfect world, I'd like Tika to
>>>> listen on all valid interfaces.
>>>> - localhost
>>>> - 127.0.0.1
>>>> - hostname
>>>> - hostname.domain.tld
>>>> - ip address
>>>> - whatever else I've forgotten
>>>>
>>>> I've looked at the docs, and it looks like you can only set one address
>>>> for JAX-RS web services(?):
>>>>
>>>> http://cxf.apache.org/docs/http-binding.html
>>>>
>>>> 1) Is there a simple workaround for this problem?
>>>> 2) If not, it looks like the only thing to do is to convert the JAX-RS
>>>> service to a JAX-WS service. Is that correct? Or is there something else
>>>> that can done?
>>>>
>>>> What is the best way to approach fixing this problem?
>>>>
>>>> Thanks,
>>>> -Rian
>>>>
>>>>
>>>
>>
>> --
>> Sergey Beryozkin
>>
>> Talend Community Coders
>> http://coders.talend.com/
>>
>> Blog: http://sberyozkin.blogspot.com
>>
>


Re: Is there a way to get a JAX-RS service to bind to all valid URLs for a host?

Posted by Rian J Stockbower <rs...@gmail.com>.
I don't use CXF in standalone mode, as far as I know. To use the Tika
JAX-RS service, I download Tika 1.4, run mvn install, and then invoke the
service.

I'm not sure where/how CXF is pulled into the mix.

That being said...

I changed the line in TikaServerCLI.java to use 0.0.0.0 instead of
localhost, and recompiled. It fixed the problem. It now responds on
localhost, 127.0.0.7, hostname, hostname.domain.tld,

http://svn.apache.org/repos/asf/tika/trunk/tika-server/src/main/java/org/apache/tika/server/TikaServerCli.java

I'll see about getting that change back into the Tika trunk.

-Rian


On Sun, Nov 17, 2013 at 3:54 PM, Sergey Beryozkin <sb...@gmail.com>wrote:

> Hi Rian
>
> If you use CXF in a standalone mode, where you set an absolute address,
> then something like "http://0.0.0.0/tika" should do. As I've already
> commented at TIKA-1196, please try the latest released CXF, example, CXF
> 2.7.7.
> Let us know please how it goes for you
> Thanks, Sergey
>
>
> On 17/11/13 20:02, Rian J Stockbower wrote:
>
>> Here's the Tika ticket associated with my question:
>>
>> https://issues.apache.org/jira/browse/TIKA-1196
>>
>> -Rian
>>
>>
>> On Sun, Nov 17, 2013 at 3:00 PM, Rian J Stockbower <rstockbower@gmail.com
>> >wrote:
>>
>>  Apache Tika has a JAX-RS web service that's configured to listen on
>>> localhost, and that's it. It can be re-compiled to listen for a specific
>>> hostname, but that's not very useful if you're looking to deploy an
>>> arbitrary number of Tika endpoints (as I am).
>>>
>>> I tried swapping the setAddress() call with a value that was computed at
>>> runtime, but that was unsuccessful. In a perfect world, I'd like Tika to
>>> listen on all valid interfaces.
>>> - localhost
>>> - 127.0.0.1
>>> - hostname
>>> - hostname.domain.tld
>>> - ip address
>>> - whatever else I've forgotten
>>>
>>> I've looked at the docs, and it looks like you can only set one address
>>> for JAX-RS web services(?):
>>>
>>> http://cxf.apache.org/docs/http-binding.html
>>>
>>> 1) Is there a simple workaround for this problem?
>>> 2) If not, it looks like the only thing to do is to convert the JAX-RS
>>> service to a JAX-WS service. Is that correct? Or is there something else
>>> that can done?
>>>
>>> What is the best way to approach fixing this problem?
>>>
>>> Thanks,
>>> -Rian
>>>
>>>
>>
>
> --
> Sergey Beryozkin
>
> Talend Community Coders
> http://coders.talend.com/
>
> Blog: http://sberyozkin.blogspot.com
>

Re: Is there a way to get a JAX-RS service to bind to all valid URLs for a host?

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi Rian

If you use CXF in a standalone mode, where you set an absolute address, 
then something like "http://0.0.0.0/tika" should do. As I've already 
commented at TIKA-1196, please try the latest released CXF, example, CXF 
2.7.7.
Let us know please how it goes for you
Thanks, Sergey

On 17/11/13 20:02, Rian J Stockbower wrote:
> Here's the Tika ticket associated with my question:
>
> https://issues.apache.org/jira/browse/TIKA-1196
>
> -Rian
>
>
> On Sun, Nov 17, 2013 at 3:00 PM, Rian J Stockbower <rs...@gmail.com>wrote:
>
>> Apache Tika has a JAX-RS web service that's configured to listen on
>> localhost, and that's it. It can be re-compiled to listen for a specific
>> hostname, but that's not very useful if you're looking to deploy an
>> arbitrary number of Tika endpoints (as I am).
>>
>> I tried swapping the setAddress() call with a value that was computed at
>> runtime, but that was unsuccessful. In a perfect world, I'd like Tika to
>> listen on all valid interfaces.
>> - localhost
>> - 127.0.0.1
>> - hostname
>> - hostname.domain.tld
>> - ip address
>> - whatever else I've forgotten
>>
>> I've looked at the docs, and it looks like you can only set one address
>> for JAX-RS web services(?):
>>
>> http://cxf.apache.org/docs/http-binding.html
>>
>> 1) Is there a simple workaround for this problem?
>> 2) If not, it looks like the only thing to do is to convert the JAX-RS
>> service to a JAX-WS service. Is that correct? Or is there something else
>> that can done?
>>
>> What is the best way to approach fixing this problem?
>>
>> Thanks,
>> -Rian
>>
>


-- 
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Blog: http://sberyozkin.blogspot.com

Re: Is there a way to get a JAX-RS service to bind to all valid URLs for a host?

Posted by Rian J Stockbower <rs...@gmail.com>.
Here's the Tika ticket associated with my question:

https://issues.apache.org/jira/browse/TIKA-1196

-Rian


On Sun, Nov 17, 2013 at 3:00 PM, Rian J Stockbower <rs...@gmail.com>wrote:

> Apache Tika has a JAX-RS web service that's configured to listen on
> localhost, and that's it. It can be re-compiled to listen for a specific
> hostname, but that's not very useful if you're looking to deploy an
> arbitrary number of Tika endpoints (as I am).
>
> I tried swapping the setAddress() call with a value that was computed at
> runtime, but that was unsuccessful. In a perfect world, I'd like Tika to
> listen on all valid interfaces.
> - localhost
> - 127.0.0.1
> - hostname
> - hostname.domain.tld
> - ip address
> - whatever else I've forgotten
>
> I've looked at the docs, and it looks like you can only set one address
> for JAX-RS web services(?):
>
> http://cxf.apache.org/docs/http-binding.html
>
> 1) Is there a simple workaround for this problem?
> 2) If not, it looks like the only thing to do is to convert the JAX-RS
> service to a JAX-WS service. Is that correct? Or is there something else
> that can done?
>
> What is the best way to approach fixing this problem?
>
> Thanks,
> -Rian
>