use of org.glassfish.deployment.common.ModuleDescriptor in project Payara by payara.
the class WebTest method getAbstractArchiveUri.
protected String getAbstractArchiveUri(WebBundleDescriptor desc) {
String archBase = getVerifierContext().getAbstractArchive().getURI().toString();
final ModuleDescriptor moduleDescriptor = desc.getModuleDescriptor();
if (moduleDescriptor.isStandalone()) {
// it must be a stand-alone module; no such physical dir exists
return archBase;
} else {
return archBase + "/" + FileUtils.makeFriendlyFilename(moduleDescriptor.getArchiveUri());
}
}
use of org.glassfish.deployment.common.ModuleDescriptor in project Payara by payara.
the class WSClientTest method getAbstractArchiveUri.
protected String getAbstractArchiveUri(ServiceReferenceDescriptor desc) {
String archBase = getVerifierContext().getAbstractArchive().getURI().toString();
final ModuleDescriptor moduleDescriptor = desc.getBundleDescriptor().getModuleDescriptor();
if (moduleDescriptor.isStandalone()) {
// it must be a stand-alone module; no such physical dir exists
return archBase;
} else {
return archBase + "/" + FileUtils.makeFriendlyFilename(moduleDescriptor.getArchiveUri());
}
}
use of org.glassfish.deployment.common.ModuleDescriptor in project Payara by payara.
the class FacesConfigDescriptor method readFacesConfigDocument.
private void readFacesConfigDocument(WebBundleDescriptor webd) throws Exception {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
// TODO: Why are we turning off validation here?
factory.setValidating(false);
factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
DocumentBuilder builder = factory.newDocumentBuilder();
ModuleDescriptor moduleDesc = webd.getModuleDescriptor();
String archBase = context.getAbstractArchive().getURI().toString();
String uri = null;
if (moduleDesc.isStandalone()) {
uri = archBase;
} else {
uri = archBase + File.separator + FileUtils.makeFriendlyFilename(moduleDesc.getArchiveUri());
}
FileArchive arch = new FileArchive();
arch.open(URI.create(uri));
InputStream is = arch.getEntry(facesConfigFileName);
InputSource source = new InputSource(is);
try {
facesConfigDocument = builder.parse(source);
} finally {
try {
if (is != null)
is.close();
} catch (Exception e) {
}
}
}
use of org.glassfish.deployment.common.ModuleDescriptor in project Payara by payara.
the class TagLibFactory method createDocument.
/**
* Helper method to create the document object from the tld files specified
* by the location in web.xml of the war archive.
*
* @param location location of jsp tlds
* @param webd has all the information about the web.xml of the war archive
* @return document object created from tlds specified at the given location
* @throws IOException
* @throws SAXException
*/
private Document createDocument(String location, WebBundleDescriptor webd) throws IOException, SAXException {
Document document = null;
InputSource source = null;
if (// NOI18N
location.startsWith("/"))
location = location.substring(1);
else
// NOI18N
location = "WEB-INF/" + location;
ModuleDescriptor moduleDesc = webd.getModuleDescriptor();
String archBase = context.getAbstractArchive().getURI().getPath();
String uri = null;
if (moduleDesc.isStandalone()) {
uri = archBase;
} else {
uri = archBase + File.separator + FileUtils.makeFriendlyFilename(moduleDesc.getArchiveUri());
}
FileArchive arch = new FileArchive();
arch.open(uri);
InputStream is = arch.getEntry(location);
try {
// is can be null if wrong location of tld is specified in web.xml
if (is == null)
throw new IOException(smh.getLocalString(// NOI18N
getClass().getName() + ".exception1", // NOI18N
"Wrong tld [ {0} ] specified in the web.xml of [ {1} ]", new Object[] { location, moduleDesc.getArchiveUri() }));
source = new InputSource(is);
document = builder.parse(source);
} finally {
try {
if (is != null)
is.close();
} catch (Exception e) {
}
}
return document;
}
use of org.glassfish.deployment.common.ModuleDescriptor in project Payara by payara.
the class WebVerifier method getJspOutDir.
/**
* If precompilejsp is set in the backend then return the jspOutput
* directory set in the frameworkContext. Otherwise create a new unique
* directory and return it.
* @return the output directory where compiled JSPs will be put.
*/
private File getJspOutDir() {
// verificationContext.getJspOutDir() will be non-null only when the
// call is from deployment backend and precompilejsp is set
File jspOutDir = verifierFrameworkContext.getJspOutDir();
if (jspOutDir != null) {
ModuleDescriptor moduleDescriptor = webd.getModuleDescriptor();
if (moduleDescriptor.isStandalone())
return jspOutDir;
return new File(jspOutDir, FileUtils.makeFriendlyFilename(moduleDescriptor.getArchiveUri()));
}
SecureRandom random = new SecureRandom();
String prefix = System.getProperty("java.io.tmpdir") + File.separator + ".jspc";
do {
float f = random.nextFloat();
String outDirPath = new String(prefix + f);
File out = new File(outDirPath);
if (out.mkdirs())
return out;
} while (true);
}
Aggregations