本文整理汇总了Java中net.sourceforge.stripes.action.StreamingResolution类的典型用法代码示例。如果您正苦于以下问题:Java StreamingResolution类的具体用法?Java StreamingResolution怎么用?Java StreamingResolution使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
StreamingResolution类属于net.sourceforge.stripes.action包,在下文中一共展示了StreamingResolution类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: uploadFile
import net.sourceforge.stripes.action.StreamingResolution; //导入依赖的package包/类
@POST
@HandlesEvent("upload")
public Resolution uploadFile() {
String errorMsg = null;
if (upload != null) {
try {
mediaAsset = mediaAssetService.create(upload.getInputStream(), upload.getFileName());
mediaAsset.setGroup(GROUP_CMS);
mediaAssetService.update(mediaAsset);
filename = mediaAsset.getName().getStr();
} catch (IOException e) {
errorMsg = e.getMessage();
return new StreamingResolution("text/xml", errorMsg);
}
return view("ckeditor/file_select");
}
return new StreamingResolution("text/xml", "An unknown error has occurred!");
}
开发者ID:geetools,项目名称:geeCommerce-Java-Shop-Software-and-PIM,代码行数:22,代码来源:FileManagerCKEditorAction.java
示例2: get
import net.sourceforge.stripes.action.StreamingResolution; //导入依赖的package包/类
@Request("/get/{id}")
public Result get(@PathParam("id") Id id) {
MediaAsset mediaAsset = mediaAssetService.get(id);
MediaAssetFile file = mediaAsset.getFile();
StreamingResolution streamingResolution = new StreamingResolution(file.getMimeType(), file.getContent());
streamingResolution.setFilename(file.getName());
Result viewStr = Results.stream(file.getMimeType(), file.getContent());
if (!file.getMimeType().contains("image")) {
viewStr.filename(file.getName());
}
if (MimeType.APPLICATION_PDF.equals(file.getMimeType())) {
String downloadParam = getRequest().getParameter(FILE_DOWNLOAD);
if (downloadParam != null && "1".equals(downloadParam))
viewStr.attachment(true);
else
viewStr.attachment(false);
}
return viewStr;
}
开发者ID:geetools,项目名称:geeCommerce-Java-Shop-Software-and-PIM,代码行数:25,代码来源:MediaAssetController.java
示例3: renderContent
import net.sourceforge.stripes.action.StreamingResolution; //导入依赖的package包/类
public Resolution renderContent(String content) {
Configuration conf = FreemarkerHelper.newConfig(app.servletContext(), null);
try {
Template temp = new Template("templateName", new StringReader(content), conf);
// Template temp = conf.getTemplate(new
// StringBuilder(Templates.getWidgetsPath()).append("/").append(path).append(templateSuffix).toString());
StringWriter sw = new StringWriter();
temp.process(null, sw);
return new StreamingResolution("text/html", sw.toString());
} catch (IOException | TemplateException e) {
throw new RuntimeException(e);
}
}
开发者ID:geetools,项目名称:geeCommerce-Java-Shop-Software-and-PIM,代码行数:19,代码来源:BaseActionBean.java
示例4: getOnkiHttp
import net.sourceforge.stripes.action.StreamingResolution; //导入依赖的package包/类
@HandlesEvent("getOnkiHttp")
public Resolution getOnkiHttp() throws HttpException, IOException {
String json = "";
String language = getUserLocale().toLanguageTag().split("-")[0];
HttpClient httpClient = new HttpClient();
httpClient.getParams().setParameter("http.protocol.version", HttpVersion.HTTP_1_1);
httpClient.getParams().setParameter("http.protocol.content-charset", "UTF-8");
GetMethod get = new GetMethod("http://onki.fi/key-"+this.getOnkiAccessKey()+"/api/v2/http/onto/" + ontologyId + "/search?q=" + term + "&l=" + language);
httpClient.executeMethod(get);
if (get.getStatusCode() == 200) {
json = get.getResponseBodyAsString();
}
//logger.info("getOnkiHttp(): "+json);
return new StreamingResolution(MIME_JS, json);
}
开发者ID:mikkeliamk,项目名称:osa,代码行数:17,代码来源:IngestAction.java
示例5: removeFileFromUpload
import net.sourceforge.stripes.action.StreamingResolution; //导入依赖的package包/类
/**
* Removes original file from uploaded list so user can upload a new one
* incase they uploaded a wrong one at first.
*
* @return Success of removal
* @throws UnsupportedEncodingException
*/
@HandlesEvent("removeFileFromUpload")
public Resolution removeFileFromUpload() throws UnsupportedEncodingException {
File file = null;
String response = "";
String dir = this.getUploadDirectory(true);
fileToDelete = URLDecoder.decode(fileToDelete, "UTF-8");
file = new File(dir + fileToDelete);
if (file.canRead()) {
// Delete possible thumbnail image
new File(dir + "thumb_" + FilenameUtils.removeExtension(fileToDelete) + ".png").delete();
if (file.delete()) {
response = "true";
} else {
response = "false";
}
} else {
response = "false";
}
return new StreamingResolution(MIME_TEXT, response);
}
开发者ID:mikkeliamk,项目名称:osa,代码行数:30,代码来源:IngestAction.java
示例6: deleteWatchedFolder
import net.sourceforge.stripes.action.StreamingResolution; //导入依赖的package包/类
/**
* Deletes watched given folder
*
* @return Success in text (true / false)
*/
@HandlesEvent("deleteWatchedFolder")
public Resolution deleteWatchedFolder() {
String ingestDir = this.getIngestDirectory(true);
File dir = new File(ingestDir + watchedFile);
String response = "";
try {
FileUtils.deleteDirectory(dir);
} catch (IOException e) {
response = "false";
e.printStackTrace();
return new StreamingResolution(MIME_TEXT, response);
}
response = "true";
return new StreamingResolution(MIME_TEXT, response);
}
开发者ID:mikkeliamk,项目名称:osa,代码行数:22,代码来源:IngestAction.java
示例7: getObjectBreadcrumb
import net.sourceforge.stripes.action.StreamingResolution; //导入依赖的package包/类
/**
* Creates a path to given object, including links to objects that are in
* the path
*
* @param pid Object whose path is to be created
* @return Path to given object in string format
*/
@HandlesEvent("getObjectBreadcrumb")
public Resolution getObjectBreadcrumb() {
FedoraBean fObject = Osa.fedoraManager.getObject(pid);
/*TODO:
* - check publicity level of the path-component
* - if name can not be shown, replace with text: confidential/restricted
* */
User user = this.getContext().getUser();
String path = "";
plainView = (plainView != null) ? true : false;
String publicityLevel = ((CaptureBean) fObject.getDataStream(FedoraBean.DATASTREAM_CAPTURE)).getPublicityLevel();
if (user.isAnonymous()) { //+
if (publicityLevel.equals("public")) {
path = Osa.searchManager.getObjectPath(pid, user, plainView);
} else {
path = "confidential/restricted";
}
} else {
path = Osa.searchManager.getObjectPath(pid, user, plainView);
}
return new StreamingResolution(MIME_TEXT, path);
}
开发者ID:mikkeliamk,项目名称:osa,代码行数:32,代码来源:IngestAction.java
示例8: showDatastream
import net.sourceforge.stripes.action.StreamingResolution; //导入依赖的package包/类
@HandlesEvent("showDatastream")
public Resolution showDatastream() throws MalformedURLException, IOException {
String username = Osa.fedoraManager.username;
String password = Osa.fedoraManager.password;
String credentials = username + ":" + password;
byte[] encoded = new Base64().encode(credentials.getBytes("UTF-8"));
String encoding = new String(encoded);
URL url = new URL(Osa.fedoraManager.baseUrl +link);
URLConnection conn = url.openConnection();
conn.setDoInput(true);
conn.setRequestProperty("Authorization", String.format("Basic %s", encoding));
InputStream is = conn.getInputStream();
DataInputStream in = new DataInputStream(is);
return new StreamingResolution("text/xml", in).setFilename("history.xml");
}
开发者ID:mikkeliamk,项目名称:osa,代码行数:17,代码来源:IngestAction.java
示例9: showLogFile
import net.sourceforge.stripes.action.StreamingResolution; //导入依赖的package包/类
@HandlesEvent("showLogFile")
public Resolution showLogFile() {
if (!isDocumentAdder()) {
return new ForwardResolution(ERROR_500);
}
FileInputStream fis = null;
DataInputStream dis = null;
File logFile = new File(this.getLogDirectory(logName,true)+ "/" +filename);
if (logFile.canRead()) {
try {
fis = new FileInputStream(logFile);
} catch (FileNotFoundException e) {
e.printStackTrace();
return new StreamingResolution(MIME_TEXT, new LocalizableMessage("error.filenotfound").getMessage(getUserLocale()));
}
dis = new DataInputStream(fis);
} else {
return new StreamingResolution(MIME_TEXT, new LocalizableMessage("error.filenotfound").getMessage(getUserLocale()));
}
// Force view in browser
StreamingResolution streamRes = new StreamingResolution(MIME_TEXT, dis).setAttachment(false);
streamRes.setCharacterEncoding("UTF-8");
return streamRes;
}
开发者ID:mikkeliamk,项目名称:osa,代码行数:27,代码来源:IngestAction.java
示例10: removeLogFile
import net.sourceforge.stripes.action.StreamingResolution; //导入依赖的package包/类
@HandlesEvent("removeLogFile")
public Resolution removeLogFile() {
String logDir = this.getLogDirectory(null, true);
File file = null;
HashMap<String, String> responseMap = new HashMap<String, String>();
for (String filename : watchedFiles) {
file = new File(logDir + "/" + filename);
if (file.canRead()) {
if (file.delete()) {
responseMap.put(file.getName(), "true");
} else {
responseMap.put(file.getName(), "false");
}
} else {
responseMap.put(file.getName(), "false");
}
}
return new StreamingResolution(MIME_JS, new flexjson.JSONSerializer().serialize(responseMap));
}
开发者ID:mikkeliamk,项目名称:osa,代码行数:23,代码来源:IngestAction.java
示例11: deleteRole
import net.sourceforge.stripes.action.StreamingResolution; //导入依赖的package包/类
@HandlesEvent("deleteRole")
public Resolution deleteRole () {
String dn = "";
String result = "";
for (String roleDn : entryDns) {
try {
dn = cleanUtf8Encoded(roleDn);
Osa.authManager.deleteEntry(dn, EntryType.ROLE);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
logger.info("deleted entry "+dn);
}
result = "success";
return new StreamingResolution(MIME_TEXT,result);
}
开发者ID:mikkeliamk,项目名称:osa,代码行数:17,代码来源:RoleAction.java
示例12: logout
import net.sourceforge.stripes.action.StreamingResolution; //导入依赖的package包/类
@HandlesEvent("logout")
public Resolution logout() {
HttpSession session = this.getContext().getRequest().getSession();
HttpServletResponse response = this.getContext().getResponse();
if (session != null) {
User user = (User) session.getAttribute("user");
if (user != null) {
Osa.dbManager.get("sql").removeCurrentuser(user.getDn());
}
session.removeAttribute("user");
session.invalidate();
}
response.setDateHeader("Expires",-1);
response.setHeader("Cache-Control","no-store");
response.setHeader("Cache-Control","no-cache"); //HTTP 1.1
response.setHeader("Pragma","no-cache"); //HTTP 1.0
response.setContentType("text/html");
return new StreamingResolution(MIME_TEXT, INDEX.replaceAll("/", ""));
}
开发者ID:mikkeliamk,项目名称:osa,代码行数:26,代码来源:LogoutAction.java
示例13: createGroupTable
import net.sourceforge.stripes.action.StreamingResolution; //导入依赖的package包/类
@HandlesEvent("createGroupTable")
public Resolution createGroupTable() {
Vector<String> groups = Osa.authManager.getGroups(getUserOrganizationName());
Collections.sort(groups);
String json = "";
json = "{" +
"\"sEcho\": "+sEcho+"," +
"\"iTotalRecords\": "+groups.size()+"," +
"\"iTotalDisplayRecords\": " +groups.size()+",";
json += "\"aaData\": [";
for (String group : groups) {
json += "[";
json += "\""+group+"\"";
json += "],";
}
if (groups.size() > 0) {
json = json.substring(0, json.length()-1);
}
json += "]}";
return new StreamingResolution(MIME_JS, json);
}
开发者ID:mikkeliamk,项目名称:osa,代码行数:25,代码来源:GroupAction.java
示例14: deleteUser
import net.sourceforge.stripes.action.StreamingResolution; //导入依赖的package包/类
@HandlesEvent("deleteUser")
public Resolution deleteUser() {
String dn = "";
String result = "";
for (String usrDn : entryDns) {
try {
dn = cleanUtf8Encoded(usrDn);
Osa.authManager.deleteEntry(dn, EntryType.USER);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
logger.info("deleted entry "+dn);
}
result = "success";
return new StreamingResolution(MIME_TEXT,result);
}
开发者ID:mikkeliamk,项目名称:osa,代码行数:18,代码来源:UserAction.java
示例15: facetOptions
import net.sourceforge.stripes.action.StreamingResolution; //导入依赖的package包/类
@HandlesEvent("getAjaxBrowseOptions")
public Resolution facetOptions() throws Exception {
search = getContext().getSearch();
try {
search = Osa.searchManager.search(search, this.getContext().getUser(), this.getContext().getUser().getOrganization());
jsonFacetValues = new HashMap<String, Object>();
for (String key : search.getFacets().keySet()) {
jsonFacetValues.put(key, search.getFacets().get(key).toString());
}
if (search.getFacetFilters() != null) {
jsonFacetValues.put("getFacetFilters", new flexjson.JSONSerializer().deepSerialize(search.getFacetFilters().entrySet().toString()));
}
jsonFacetValues.put("NumberOfResults", search.getTotalSize());
jsonOptions = new flexjson.JSONSerializer().deepSerialize(jsonFacetValues);
return new StreamingResolution("application/json", jsonOptions);
} catch (Exception e) {
logger.error(e);
return null;
}
}
开发者ID:mikkeliamk,项目名称:osa,代码行数:23,代码来源:AdvancedBrowseAction.java
示例16: getJsonMarkers
import net.sourceforge.stripes.action.StreamingResolution; //导入依赖的package包/类
public Resolution getJsonMarkers(){
JSONObject result = new JSONObject();
JSONArray markers = new JSONArray();
loadObjects();
configureLocation(result);
for( Marker marker : map.getMarkers() ){
JSONObject m = new JSONObject();
m.put("title",marker.getTitle());
m.put("description",marker.getDescription());
m.put("lat",marker.getPosition().getLat());
m.put("lon",marker.getPosition().getLon());
m.put("url",marker.getReadUrl());
markers.put(m);
}
result.put("markers",markers);
return new StreamingResolution("application/json", result.toString());
}
开发者ID:ManyDesigns,项目名称:Portofino,代码行数:22,代码来源:MapAction.java
示例17: getDatas4AreaComplaint
import net.sourceforge.stripes.action.StreamingResolution; //导入依赖的package包/类
@HandlesEvent("getDatas4AreaComplaint")
public Resolution getDatas4AreaComplaint() {
String sql = "SELECT c_x, c_y, c_value, c_x_label, c_y_label FROM(\n"
+ "(SELECT c_region3 c_x,'未投诉客户量' c_y,COUNT(0) c_value,'未投诉客户量' c_x_label,c_region3 c_y_label\n"
+ "FROM t_customer \n"
+ "WHERE c_region3 IN (\n"
+ "SELECT c_region3 FROM t_customer_complaint cc\n"
+ "INNER JOIN t_customer c ON cc.c_customer_id= c.c_id\n"
+ ") AND c_id NOT IN (\n"
+ "SELECT c_customer_id FROM t_customer_complaint \n"
+ ") AND 1=1\n"
+ "GROUP BY c_region3)\n"
+ "UNION ALL\n"
+ "(SELECT c_region3 c_x,'投诉客户量' c_y,COUNT(cc.c_customer_id+cc.c_complaint_id) c_value,'投诉客户量' c_x_label,c_region3 c_y_label FROM t_customer_complaint cc\n"
+ "INNER JOIN t_customer c ON cc.c_customer_id=c.c_id\n"
+ "INNER JOIN t_dict_complaint d ON d.c_id=cc.c_complaint_id\n" + "WHERE 1=1\n"
+ "GROUP BY c.c_region3\n" + ")\n" + ") mm\n" + "ORDER BY mm.c_y ,mm.c_x ,mm. c_value DESC";
result = DataUtils.getChartJsonData(sql, context.getRequest());
return new StreamingResolution("text", new StringReader(result));
}
开发者ID:hongliangpan,项目名称:manydesigns.cn,代码行数:22,代码来源:DataProvider.java
示例18: getDatas4CustomerMap
import net.sourceforge.stripes.action.StreamingResolution; //导入依赖的package包/类
public Resolution getDatas4CustomerMap() {
String sql = "SELECT c_x,c_y,c_value FROM\n" + "(\n"
+ "SELECT c_region3 c_x,'用户量' c_y ,count(0) c_value FROM t_customer\n"
+ "WHERE 1=1 GROUP BY c_region3\n" + "UNION ALL\n"
+ "SELECT c_region3 c_x, '投诉客户量' c_y, COUNT( cc.c_customer_id + cc.c_complaint_id ) c_value\n"
+ " FROM t_customer_complaint cc INNER JOIN t_customer c ON cc.c_customer_id = c.c_id \n"
+ "INNER JOIN t_dict_complaint d ON d.c_id = cc.c_complaint_id WHERE 1 = 1 GROUP BY c.c_region3\n"
+ ") t\n" + "ORDER BY c_x,c_y";
sql = "SELECT c_x, c_y, c_value, c_x_label, c_y_label FROM(\n"
+ "(SELECT c_region3 c_x,'未投诉客户量' c_y,COUNT(0) c_value,'未投诉客户量' c_x_label,c_region3 c_y_label\n"
+ "FROM t_customer \n"
+ "WHERE c_id NOT IN (\n"
+ "SELECT c_customer_id FROM t_customer_complaint \n"
+ ") AND 1=1\n"
+ "GROUP BY c_region3)\n"
+ "UNION ALL\n"
+ "(SELECT c_region3 c_x,'投诉客户量' c_y,COUNT(cc.c_customer_id+cc.c_complaint_id) c_value,'投诉客户量' c_x_label,c_region3 c_y_label FROM t_customer_complaint cc\n"
+ "INNER JOIN t_customer c ON cc.c_customer_id=c.c_id\n"
+ "INNER JOIN t_dict_complaint d ON d.c_id=cc.c_complaint_id\n" + "WHERE 1=1\n"
+ "GROUP BY c.c_region3\n" + ")\n" + ") mm\n" + "ORDER BY mm.c_y ,mm.c_x ,mm. c_value DESC";
result = DataUtils.getChartJsonData(sql, context.getRequest());
return new StreamingResolution("text", new StringReader(result));
}
开发者ID:hongliangpan,项目名称:manydesigns.cn,代码行数:25,代码来源:DataProvider.java
示例19: exportPdf
import net.sourceforge.stripes.action.StreamingResolution; //导入依赖的package包/类
@Button(list = "crud-read", key = "commons.exportPdf", order = 8)
public Resolution exportPdf() {
try {
final File tmpFile = File.createTempFile("export." + crudConfiguration.getName(), ".read.pdf");
exportReadPdf(tmpFile);
FileInputStream fileInputStream = new FileInputStream(tmpFile);
return new StreamingResolution("application/pdf", fileInputStream) {
@Override
protected void stream(HttpServletResponse response) throws Exception {
super.stream(response);
if (!tmpFile.delete()) {
logger.warn("Temporary file {} could not be deleted", tmpFile.getAbsolutePath());
}
}
}.setFilename(crudConfiguration.getReadTitle() + ".pdf");
} catch (Exception e) {
logger.error("PDF export failed", e);
SessionMessages.addErrorMessage(getMessage("commons.export.failed"));
// return new RedirectResolution(getDispatch().getOriginalPath());
return new RedirectResolution(getReturnUrl());
}
}
开发者ID:hongliangpan,项目名称:manydesigns.cn,代码行数:24,代码来源:CrudAction4ItsProject.java
示例20: list
import net.sourceforge.stripes.action.StreamingResolution; //导入依赖的package包/类
public Resolution list() {
List<Karateka> karatekas = Stripersist.getEntityManager().createQuery("FROM Karateka order by surname,name").getResultList();
final JSONArray array = new JSONArray();
for (Karateka k : karatekas) {
try {
JSONObject jsonKarateka = k.toJSON();
array.put(jsonKarateka);
} catch (Exception e) {
log.warn("Failed to make JSONObject of karateka with id: " + k.getId());
}
}
return new StreamingResolution("application/json") {
@Override
public void stream(HttpServletResponse response) throws Exception {
response.getWriter().print(array.toString());
}
};
}
开发者ID:rbraam,项目名称:vanenapp,代码行数:19,代码来源:KaratekaActionBean.java
注:本文中的net.sourceforge.stripes.action.StreamingResolution类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论