Object storeData) {
if (BridgeUtil.isPortletRequest() && !specialResource(resource)) {
Object response = context.getExternalContext().getResponse();
if (response instanceof MimeResponse) {
MimeResponse mimeResponse = (MimeResponse) response;
ResourceURL resourceURL = PlatformUtil
.createResourceURL(mimeResponse);
FacesResourceContext resourceContext = new FacesResourceContext(
context);
resourceContext.setResourceData(storeData);
if (resource.isCacheable(resourceContext)) {
try {
// resourceURL.setCacheability(ResourceURL.FULL);
} catch (IllegalStateException e) {
// Ignore that, use default cache level.
}
}
StringBuffer uri = new StringBuffer(RFRES);// ResourceServlet.DEFAULT_SERVLET_PATH).append("/");
uri.append(resource.getKey());
// append serialized data as Base-64 encoded request string.
if (storeData != null) {
try {
byte[] objectData;
if (storeData instanceof byte[]) {
objectData = (byte[]) storeData;
uri.append(DATA_BYTES_SEPARATOR);
} else {
ByteArrayOutputStream dataSteram = new ByteArrayOutputStream(
1024);
ObjectOutputStream objStream = new ObjectOutputStream(
dataSteram);
objStream.writeObject(storeData);
objStream.flush();
objStream.close();
dataSteram.close();
objectData = dataSteram.toByteArray();
uri.append(DATA_SEPARATOR);
}
byte[] dataArray = encrypt(objectData);
uri.append(new String(dataArray, "ISO-8859-1"));
// / byte[] objectData = dataSteram.toByteArray();
// / uri.append("?").append(new
// String(Base64.encodeBase64(objectData),
// / "ISO-8859-1"));
} catch (Exception e) {
// Ignore errors, log it
log.log(Level.SEVERE,
Messages.getMessage(Messages.QUERY_STRING_BUILDING_ERROR),
e);
}
}
resourceURL.setResourceID(uri.toString());
return resourceURL.toString().replaceAll("\\&\\;", "&");
} else {
return PortletExternalContextImpl.RESOURCE_URL_DO_NOTHITG;
}
} else {
return getDefaultUri(resource, context, storeData);