Aller au contenu principal

How to get server host name and port from content creator

Commentaires

2 commentaires

  • Zendesk API User
    Author: mbergmann - 11/10/2021 21:43

    Hello Milos,

    please have a look at the ServerConfigurationAgent - I think that can help.

    A small example:

    import de.espirit.firstspirit.agency.ServerConfigurationAgent;

    import de.espirit.firstspirit.server.configuration.ServerProperties;

    ServerConfigurationAgent sca = context.requireSpecialist(ServerConfigurationAgent.TYPE);

    String hostname = sca.getServerProperty(ServerProperties.HOST).get();

    int port = sca.getServerProperty(ServerProperties.HTTP_PORT).get();

    You can find a list of more accessible properties here ​.

    Michael

    0
  • Zendesk API User
    Author: civca - 12/3/2021 10:35

    Hello Michael,

    Thank you for your suggestion. I did not get proper information trough ServerProperties.HOST and ServerProperties.PORT. (it returns localhost and 8000).

    But I found ServerProperties.URL from where I get java.net.URL object and then request getHost() and getPort().

    Best

    0

Vous devez vous connecter pour laisser un commentaire.