i am running my web application using maven jetty plugin.
I can access my web application either through localhost
, ip
or server name
.
But let say i want to access my application using application name.
eg.
http://ip:port/login/login.jsp
http://servername:port/login/login.jsp
I want it something like, no port or ip.
http://applicationname/login/login.jsp
pom.xml
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>8.1.9.v20130131</version>
<configuration>
<connectors>
<connector implementation="org.eclipse.jetty.server.bio.SocketConnector">
<port>port</port>
</connector>
</connectors>
<stopPort>18080</stopPort>
<scanIntervalSeconds>0</scanIntervalSeconds>
<webXml>target/classes/WEB-INF/web.xml</webXml>
<!-- <webApp> <contextPath>/</contextPath> </webApp> -->
</configuration>
</plugin>
Not sure if it can be done using maven-jetty-plugin or other. Jetty is a servlet container which is running in a operating system and listening on a specified port for http requests. This cannot be changed.
However to achieve what you need you can modify hosts file (linux: /etc/hosts
; windows: %SystemRoot%\System32\drivers\etc\hosts
). Take a look at https://en.wikipedia.org/wiki/Hosts_(file).
Your hosts configuration could like like:
127.0.0.1 applicationname
Keep in mind that you cannot define the port name. Also keep in mind that this is not your application configuration but configuration of host where you're hosting your app.