org.beigesoft.android.ajetty.FactoryWebAppClassLoaderAndroid Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of a-jetty Show documentation
Show all versions of a-jetty Show documentation
A-Jetty for Android. It is Jetty 9.2 adapted for Android
configured as minimum server with WebAppDeployer that can deploy ordinal WAR (JSP/JSTL must be pre-compiled into servlets by A-Tomcat).
It's only for tests purposes. It doesn't comply to the latest Android policy (loading executable binaries from outside)!
package org.beigesoft.android.ajetty;
/*
* Copyright (c) 2016 Beigesoft ™
*
* Licensed under the GNU General Public License (GPL), Version 2.0
* (the "License");
* you may not use this file except in compliance with the License.
*
* You may obtain a copy of the License at
*
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html
*/
import android.content.Context;
import org.eclipse.jetty.webapp.WebAppClassLoader;
import org.beigesoft.afactory.IFactoryParam;
/**
* Factory of WebAppClassLoaderAndroid.
*
* @author Yury Demidenko
*/
public class FactoryWebAppClassLoaderAndroid
implements
IFactoryParam {
/**
* Android context.
**/
private final Context context;
/**
* Setter for context.
* @param pContext reference
**/
public FactoryWebAppClassLoaderAndroid(final Context pContext) {
this.context = pContext;
}
/**
* Create a bean with abstract params.
* @param pParam parameter
* @return M request(or) scoped bean
*/
@Override
public final WebAppClassLoaderAndroid create(
final WebAppClassLoader.Context pContext) throws Exception {
WebAppClassLoaderAndroid result = new WebAppClassLoaderAndroid(pContext);
result.setOptimizedDirectory(this.context.getFilesDir().getAbsolutePath());
result.init();
return result;
}
}