Skip to content

Commit

Permalink
Parameterize Jetty port and bind IP (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbool committed Nov 7, 2012
1 parent 4e86773 commit 7d90194
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/main/java/com/greenpas/support/jetty/JettyFactory.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.greenpas.support.jetty;

import java.net.InetSocketAddress;
import java.util.EnumSet;
import javax.servlet.DispatcherType;
import org.eclipse.jetty.server.Server;
Expand All @@ -18,8 +19,8 @@ public class JettyFactory implements ApplicationContextAware {

private WebApplicationContext applicationContext;

public Server jetty() {
Server server = new Server(8081);
public Server jetty(String bindAddress, int bindPort) {
Server server = new Server(new InetSocketAddress(bindAddress, bindPort));
ServletContextHandler ctx = new ServletContextHandler(null, "/");

XmlWebApplicationContext oauth2Context = new XmlWebApplicationContext();
Expand Down
5 changes: 3 additions & 2 deletions src/main/resources/application-context.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:sec="http://www.springframework.org/schema/security" xmlns:oauth2="http://www.springframework.org/schema/security/oauth2"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:context="http://www.springframework.org/schema/context" xmlns:c="http://www.springframework.org/schema/c"
xsi:schemaLocation="http://www.springframework.org/schema/security/oauth2 http://www.springframework.org/schema/security/spring-security-oauth2.xsd
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.1.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
Expand All @@ -13,7 +13,8 @@
location="classpath:application.properties,file:///etc/greenpas-oauth/greenpas-oauth.properties" />

<bean id="jettyFactory" class="com.greenpas.support.jetty.JettyFactory" />
<bean id="jetty" factory-bean="jettyFactory" factory-method="jetty" />
<bean id="jetty" factory-bean="jettyFactory" factory-method="jetty" c:bindAddress="${server.bind.ip}"
c:bindPort="${server.bind.port}" />

<sec:authentication-manager id="clientAuthenticationManager">
<sec:authentication-provider user-service-ref="clientDetailsUserService" />
Expand Down

0 comments on commit 7d90194

Please sign in to comment.