当前位置: 首页>>代码示例>>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;未经允许,请勿转载。