當前位置: 首頁>>代碼示例>>Java>>正文


Java ServletActionContext.getResponse方法代碼示例

本文整理匯總了Java中org.apache.struts2.ServletActionContext.getResponse方法的典型用法代碼示例。如果您正苦於以下問題:Java ServletActionContext.getResponse方法的具體用法?Java ServletActionContext.getResponse怎麽用?Java ServletActionContext.getResponse使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.struts2.ServletActionContext的用法示例。


在下文中一共展示了ServletActionContext.getResponse方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getForfeitInfoById

import org.apache.struts2.ServletActionContext; //導入方法依賴的package包/類
public String  getForfeitInfoById(){
	HttpServletResponse response = ServletActionContext.getResponse();
	response.setContentType("application/json;charset=utf-8");
	ForfeitInfo forfeitInfo = new ForfeitInfo();
	forfeitInfo.setBorrowId(borrowId);
	ForfeitInfo  newForfeitInfo = forfeitService.getForfeitInfoById(forfeitInfo);
	JsonConfig jsonConfig = new JsonConfig();
	jsonConfig.setJsonPropertyFilter(new PropertyFilter() {
	    public boolean apply(Object obj, String name, Object value) {
		if(obj instanceof Authorization||name.equals("authorization") || obj instanceof Set || name.equals("borrowInfos")){	
			return true;
		}else{
			return false;
		}
	   }
	});
	
	
	JSONObject jsonObject = JSONObject.fromObject(newForfeitInfo,jsonConfig);
	try {
		response.getWriter().print(jsonObject);
	} catch (IOException e) {
		throw new RuntimeException(e.getMessage());
	}
	return null;
}
 
開發者ID:cckevincyh,項目名稱:LibrarySystem,代碼行數:27,代碼來源:ForfeitAction.java

示例2: getBorrowInfoById

import org.apache.struts2.ServletActionContext; //導入方法依賴的package包/類
/**
 * 根據借閱id查詢該借閱信息
 * @return
 */
public String getBorrowInfoById(){
	HttpServletResponse response = ServletActionContext.getResponse();
	response.setContentType("application/json;charset=utf-8");
	BorrowInfo info = new BorrowInfo();
	info.setBorrowId(borrowId);
	BorrowInfo newInfo = borrowService.getBorrowInfoById(info);
	JsonConfig jsonConfig = new JsonConfig();
	jsonConfig.setJsonPropertyFilter(new PropertyFilter() {
	    public boolean apply(Object obj, String name, Object value) {
		if(obj instanceof Authorization||name.equals("authorization") || obj instanceof Set || name.equals("borrowInfos")){	
			return true;
		}else{
			return false;
		}
	   }
	});
	
	
	JSONObject jsonObject = JSONObject.fromObject(newInfo,jsonConfig);
	try {
		response.getWriter().print(jsonObject);
	} catch (IOException e) {
		throw new RuntimeException(e.getMessage());
	}
	return null;
}
 
開發者ID:cckevincyh,項目名稱:LibrarySystem,代碼行數:31,代碼來源:BorrowManageAction.java

示例3: getUrl

import org.apache.struts2.ServletActionContext; //導入方法依賴的package包/類
/**
 * 獲取小說介紹頁URL
 * 
 * @return 小說介紹頁URL
 */
public String getUrl() {
    HttpServletResponse response = ServletActionContext.getResponse();
    String url = response.encodeURL(InfoAction.URL + "?subdir=" + getSubdir() + "&articleno=" + getArticleno());

    if (YiDuConstants.yiduConf.getBoolean(YiDuConfig.ENABLE_PINYINURL, false)) {
        url = response.encodeURL(InfoAction.URL + "?pinyin=" + getPinyin());
    }
    return url;
}
 
開發者ID:luckyyeah,項目名稱:YiDu-Novel,代碼行數:15,代碼來源:TArticle.java

示例4: getLastChapterUrl

import org.apache.struts2.ServletActionContext; //導入方法依賴的package包/類
/**
 * 獲取最新章節URL
 * 
 * @return 最新章節URL
 */
public String getLastChapterUrl() {

    HttpServletResponse response = ServletActionContext.getResponse();
    String url = response.encodeURL(ReaderAction.URL + "?subdir=" + getSubdir() + "&articleno=" + getArticleno()
            + "&chapterno=" + getLastchapterno());

    if (YiDuConstants.yiduConf.getBoolean(YiDuConfig.ENABLE_PINYINURL, false)) {
        url = response.encodeURL(ReaderAction.URL + "?pinyin=" + getPinyin() + "&chapterno=" + getLastchapterno());
    }
    return url;
}
 
開發者ID:luckyyeah,項目名稱:YiDu-Novel,代碼行數:17,代碼來源:BookcaseDTO.java

示例5: getChapterListUrl

import org.apache.struts2.ServletActionContext; //導入方法依賴的package包/類
/**
 * 獲取章節列表URL
 * 
 * @return 分類列表URL
 */
public String getChapterListUrl() {
    HttpServletResponse response = ServletActionContext.getResponse();
    String url = response.encodeURL(ChapterListAction.URL + "?subdir=" + getSubdir() + "&articleno="
            + getArticleno());

    if (YiDuConstants.yiduConf.getBoolean(YiDuConfig.ENABLE_PINYINURL, false)) {
        url = response.encodeURL(ChapterListAction.URL + "?pinyin=" + getPinyin());
    }
    return url;
}
 
開發者ID:Chihpin,項目名稱:Yidu,代碼行數:16,代碼來源:TArticle.java

示例6: getAllBookTypes

import org.apache.struts2.ServletActionContext; //導入方法依賴的package包/類
/**
 * 得到圖書類型的集合
 * ajax請求該方法
 * 返回圖書類型集合的json對象
 * @return
 */
public String getAllBookTypes(){
	HttpServletResponse response = ServletActionContext.getResponse();
	response.setContentType("application/json;charset=utf-8");
	List<BookType> allBookTypes = bookTypeService.getAllBookTypes();
	
	
	
	String json = JSONArray.fromObject(allBookTypes).toString();//List------->JSONArray
	try {
		response.getWriter().print(json);
	} catch (IOException e) {
		throw new RuntimeException(e.getMessage());
	}
	return null;
}
 
開發者ID:cckevincyh,項目名稱:LibrarySystem,代碼行數:22,代碼來源:BookManageAction.java

示例7: getLastChapterUrl

import org.apache.struts2.ServletActionContext; //導入方法依賴的package包/類
/**
 * 獲取最新章節URL
 * 
 * @return 最新章節URL
 */
public String getLastChapterUrl() {
    HttpServletResponse response = ServletActionContext.getResponse();
    String url = response.encodeURL(ReaderAction.URL + "?subdir=" + getSubdir() + "&articleno=" + getArticleno()
            + "&chapterno=" + getLastchapterno());

    if (YiDuConstants.yiduConf.getBoolean(YiDuConfig.ENABLE_PINYINURL, false)) {
        url = response.encodeURL(ReaderAction.URL + "?pinyin=" + getPinyin() + "&chapterno=" + getLastchapterno());
    }
    return url;
}
 
開發者ID:Chihpin,項目名稱:Yidu,代碼行數:16,代碼來源:TArticle.java

示例8: getUrl

import org.apache.struts2.ServletActionContext; //導入方法依賴的package包/類
/**
 * 獲取章節列表URL
 * 
 * @return 分類列表URL
 */
public String getUrl() {
    HttpServletResponse response = ServletActionContext.getResponse();
    String url = response.encodeURL(ReaderAction.URL + "?subdir=" + getSubdir() + "&articleno=" + getArticleno()
            + "&chapterno=" + getChapterno());
    if (YiDuConstants.yiduConf.getBoolean(YiDuConfig.ENABLE_PINYINURL, false)) {
        url = response.encodeURL(ReaderAction.URL + "?pinyin=" + pinyin + "&chapterno=" + getChapterno());
    }
    return url;
}
 
開發者ID:Chihpin,項目名稱:Yidu,代碼行數:15,代碼來源:ChapterDTO.java

示例9: getInfoUrl

import org.apache.struts2.ServletActionContext; //導入方法依賴的package包/類
/**
 * 獲取最新章節URL
 * 
 * @return 最新章節URL
 */
public String getInfoUrl() {
    HttpServletResponse response = ServletActionContext.getResponse();
    String url = response.encodeURL(InfoAction.URL + "?subdir=" + getSubdir() + "&articleno=" + getArticleno());
    if (YiDuConstants.yiduConf.getBoolean(YiDuConfig.ENABLE_PINYINURL, false)) {
        url = response.encodeURL(InfoAction.URL + "?pinyin=" + getPinyin());
    }
    return url;
}
 
開發者ID:Chihpin,項目名稱:Yidu,代碼行數:14,代碼來源:BookcaseDTO.java

示例10: getUrl

import org.apache.struts2.ServletActionContext; //導入方法依賴的package包/類
/**
 * 獲取章節URL
 * 
 * @return 章節URL
 */
public String getUrl() {
    HttpServletResponse response = ServletActionContext.getResponse();
    String url = response.encodeURL(ReaderAction.URL + "?subdir=" + getSubdir() + "&articleno=" + getArticleno()
            + "&chapterno=" + getChapterno());

    return url;
}
 
開發者ID:Chihpin,項目名稱:Yidu,代碼行數:13,代碼來源:TChapter.java

示例11: getTagList

import org.apache.struts2.ServletActionContext; //導入方法依賴的package包/類
/**
 * 獲取小說tag的URL
 * 
 * @return 小說介紹頁拚音形式的URL
 */
public List<TagDTO> getTagList() {
    List<String> tags = Utils.getKeyWords(getArticlename());
    List<TagDTO> tagList = new ArrayList<TagDTO>();
    HttpServletResponse response = ServletActionContext.getResponse();
    for (String tag : tags) {
        TagDTO tagdto = new TagDTO();
        tagdto.setTag(tag);
        tagdto.setUrl(response.encodeURL(ArticleListAction.URL + "?tag=" + tag));
        tagList.add(tagdto);
    }
    return tagList;
}
 
開發者ID:luckyyeah,項目名稱:YiDu-Novel,代碼行數:18,代碼來源:TArticle.java

示例12: initResponseHeader

import org.apache.struts2.ServletActionContext; //導入方法依賴的package包/類
/**
 * 分析並設置contentType與headers.
 */
private static HttpServletResponse initResponseHeader(final String contentType, final String... headers) {
    //分析headers參數
    String encoding = DEFAULT_ENCODING;
    boolean noCache = DEFAULT_NOCACHE;
    for (String header : headers) {
        String headerName = StringUtils.substringBefore(header, ":");
        String headerValue = StringUtils.substringAfter(header, ":");

        if (StringUtils.equalsIgnoreCase(headerName, HEADER_ENCODING)) {
            encoding = headerValue;
        } else if (StringUtils.equalsIgnoreCase(headerName, HEADER_NOCACHE)) {
            noCache = Boolean.parseBoolean(headerValue);
        } else {
            throw new IllegalArgumentException(headerName + "不是一個合法的header類型");
        }
    }

    HttpServletResponse response = ServletActionContext.getResponse();

    //設置headers參數
    String fullContentType = contentType + ";charset=" + encoding;
    response.setContentType(fullContentType);
    if (noCache) {
        ServletUtils.setDisableCacheHeader(response);
    }

    return response;
}
 
開發者ID:dragon-yuan,項目名稱:Ins_fb_pictureSpider_WEB,代碼行數:32,代碼來源:BaseUtils.java

示例13: getBookType

import org.apache.struts2.ServletActionContext; //導入方法依賴的package包/類
/**
 * 得到圖書類型
 * ajax請求該方法
 * 返回圖書類型集合的json對象
 * @return
 */
public String getBookType(){
	HttpServletResponse response = ServletActionContext.getResponse();
	response.setContentType("application/json;charset=utf-8");
	BookType bookType = new BookType();
	bookType.setTypeId(id);
	BookType newType = bookTypeService.getBookTypeById(bookType);
	
	JsonConfig jsonConfig = new JsonConfig();

	jsonConfig.setJsonPropertyFilter(new PropertyFilter() {
	    public boolean apply(Object obj, String name, Object value) {
		if(obj instanceof Set||name.equals("books")){//過濾掉集合
			return true;
		}else{
			return false;
		}
	   }
	});
	
	
	JSONObject jsonObject = JSONObject.fromObject(newType,jsonConfig);
	try {
		response.getWriter().print(jsonObject);
	} catch (IOException e) {
		throw new RuntimeException(e.getMessage());
	}
	return null;
}
 
開發者ID:cckevincyh,項目名稱:LibrarySystem,代碼行數:35,代碼來源:BookTypeManageAction.java

示例14: getAddVoteUrl

import org.apache.struts2.ServletActionContext; //導入方法依賴的package包/類
/**
 * 獲取推薦小說URL
 * 
 * @return 推薦小說URL
 */
public String getAddVoteUrl() {
    HttpServletResponse response = ServletActionContext.getResponse();
    return response.encodeURL(VoteAction.URL + "?articleno=" + getArticleno());
}
 
開發者ID:Chihpin,項目名稱:Yidu,代碼行數:10,代碼來源:TArticle.java

示例15: getPreChapterThumbnailUrl

import org.apache.struts2.ServletActionContext; //導入方法依賴的package包/類
/**
 * 獲取下一章章節URL
 * 
 * @return 上一章章節URL
 */
public String getPreChapterThumbnailUrl() {
    HttpServletResponse response = ServletActionContext.getResponse();
    return response.encodeURL(ReaderAction.URL + "?chapterno=" + getPreChapterno());
}
 
開發者ID:luckyyeah,項目名稱:YiDu-Novel,代碼行數:10,代碼來源:ChapterDTO.java


注:本文中的org.apache.struts2.ServletActionContext.getResponse方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。