Erste server-Kontext Pfad beim starten der Anwendung

Ich versuche die server-URL (zB. http://www.mywebapp.com/myapp) aus dem ServletContext, wenn die Anwendung startet, ich Tue dies durch den Aufruf einer bean-Methode auf startup (mit @Startup) und das abrufen der servlet-Kontext,

@Startup
@Name("startupActions")
@Scope(ScopeType.APPLICATION)
public class StartupActionsBean implements StartupActions,
Serializable {

@Logger private Log log;

/**
 * 
 */
private static final long serialVersionUID = 1L;

@Create
@Override
public void create(){
    ServletContext sc = org.jboss.seam.contexts.ServletLifecycle.getServletContext();
    String context = sc.getContextPath();
    String serverInfo = sc.getServerInfo();
    log.debug("__________________START__________________");
    log.debug("Context Path: "+context);
    log.debug("Server Info: "+serverInfo);
}

//Cleanup methods
@Remove
@BypassInterceptors
@Override
public void cleanUp(){}
}

Dieser Arbeit ok, aber das ServletContext-Pfad leer ist, sieht die Ausgabe in der Konsole unten..

18:52:54,165 DEBUG [uk.co.app.actions.startup.StartupActionsBean] __________________START__________________
18:52:54,165 DEBUG [uk.co.app.actions.startup.StartupActionsBean] Context Path: 
18:52:54,165 DEBUG [uk.co.app.actions.startup.StartupActionsBean] Server Info: JBoss Web/3.0.0-CR1

Weiß jemand, wie man den contextpath durch diese oder andere Mittel?

ps. Verwendung von SEAM 2.2.2, Jboss AS6-Finale, Richfaces 3.3.3

InformationsquelleAutor DaveB | 2012-09-23
Schreibe einen Kommentar