You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2017/07/02 13:07:50 UTC

[Bug 61171] Add port offset attribute (portOffset?) to Server configuration in server.xml

https://bz.apache.org/bugzilla/show_bug.cgi?id=61171

--- Comment #5 from Pradip Bhattacharya <pr...@gmail.com> ---
port offset is a good thing to have, can help a lot in having multiple
installations/resolving port conflicts.

I have tried to implement it by adding portOffset attribute in Server element.

Below is the change in server.xml, portOffset as the new attribute:

<Server port="8005" shutdown="SHUTDOWN" portOffset="1000">
...
</Server>

Added getter/setter method portOffset in org.apache.catalina.Server interface.
So StandardServer now has a member variable portOffset, and its respective
getter/setter functions.

Now in order to update all the port/redirectPort numbers mentioned in the
server.xml, I have created a Rule, i.e. AddPortOffsetRule, which is applied
after values of all the attributes have been set in the target(current) object.

For example, in Catalina::createStartDigester function,
after digester.addSetProperties("Server"); is called,
a new is being invoked by adding the below line
digester.addRule("Server", new AddPortOffsetRule("port"));

Similarly for Connector, below 2 rules are added to update port numbers:
digester.addRule("Server/Service/Connector",new AddPortOffsetRule("port"));
digester.addRule("Server/Service/Connector",new
AddPortOffsetRule("redirectPort"));

This way the port related member variables are again updated using the port
offset.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org