You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by "Romain Manni-Bucau (JIRA)" <ji...@apache.org> on 2013/02/06 07:31:13 UTC

[jira] [Closed] (TOMEE-757) UriInfo given by embedded CXF-RS uses wrong port on AJP connections

     [ https://issues.apache.org/jira/browse/TOMEE-757?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Romain Manni-Bucau closed TOMEE-757.
------------------------------------

    Resolution: Invalid

It is what is required by the spec (you can check it here http://jcp.org/en/jsr/detail?id=311)

The goal is to differentiate instances IMO.

In your case you know the target ip/port so you dont need UriInfo, isnt it?
                
> UriInfo given by embedded CXF-RS uses wrong port on AJP connections
> -------------------------------------------------------------------
>
>                 Key: TOMEE-757
>                 URL: https://issues.apache.org/jira/browse/TOMEE-757
>             Project: TomEE
>          Issue Type: Improvement
>    Affects Versions: 1.5.1
>         Environment: TomEE JAX-RS 1.5.1 on Java 1.7.0_11 64-bit, proxied through Apache httpd 2.2.23 and mod_jk 1.2.37 using AJP, running on Debian stable
>            Reporter: Chet Hosey
>            Priority: Minor
>
> The UriInfo object provided by @Context injection under JAX-RS provides URIs based on the Tomcat server.xml configuration. The host name can be changed from "localhost" by changing the virtual host configuration. However there's no clear way to change the port number returned by the UriInfo methods, other than to change the actual HTTP connector port in server.xml to the desired value.
> This has the unfortunate result that each TomEE instance would have to listen on its own IP address to get the port numbers to match, if the calculated URIs need to be consistent across instances. And each TomEE instance would also need elevated privileges to bind to port 80, if that is the desired URI port.
> In my mind the least surprising behavior would be to match the values available via a @Context HttpServletRequest object, such as getServerName() and getServerPort(), at least for AJP connections.
> Below is sample output from UriInfo, HttpHeaders, and HttpServletRequest objects passed to a JAX-RS method:
>    uriInfo.getAbsolutePath(): http://localhost:8080/sample-app-1.0-SNAPSHOT/
>    uriInfo.getBaseUri(): http://localhost:8080/sample-app-1.0-SNAPSHOT
>    uriInfo.getRequestUri(): http://localhost:8080/sample-app-1.0-SNAPSHOT/
>    httpServletRequest.getLocalAddr(): 1.2.3.4
>    httpServletRequest.getLocalName(): www.example.com
>    httpServletRequest.getLocalPort(): 80
>    httpServletRequest.getServerName(): www.example.com
>    httpServletRequest.getServerPort(): 80
>    host:
>        www.example.com

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira