本文整理汇总了Java中org.seasar.struts.util.ResponseUtil类的典型用法代码示例。如果您正苦于以下问题:Java ResponseUtil类的具体用法?Java ResponseUtil怎么用?Java ResponseUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ResponseUtil类属于org.seasar.struts.util包,在下文中一共展示了ResponseUtil类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getJson
import org.seasar.struts.util.ResponseUtil; //导入依赖的package包/类
@Execute(validator = false)
public String getJson() {
List<TParty> tPartyList = tPartyService.findAllForCalender();
List<FullCalenderDto> calList = new ArrayList<FullCalenderDto>();
if (tPartyList.size() > 0) {
for (TParty tParty : tPartyList) {
calList.add(new FullCalenderDto(tParty));
}
}
String json = JSON.encode(calList);
ResponseUtil.write(json, "application/json");
return null;
}
示例2: index
import org.seasar.struts.util.ResponseUtil; //导入依赖的package包/类
/**
* provide user's icon.
* @return null
* @throws IOException #{@link PublicStorage#open()}
*/
@Execute(validator = false, urlPattern = "{userCd}")
public String index() throws IOException {
if (!StringUtil.isEmpty(userIconForm.userCd)) {
final UserOperations uo = Services.get(UserOperations.class);
try {
final User user = uo.getUser(userIconForm.userCd);
if (user == null) return null;
final String path = user.getAttachPath();
final PublicStorage storage = new PublicStorage(path);
try (final InputStream is = storage.open()) {
ResponseUtil.download(user.getAttachId(), is);
}
} catch (final IMBoxException | IOException e) {
Logger.getLogger()
.debug("Error occured while fetching icon. userCd: " + userIconForm.userCd, e);
response.sendError(HttpServletResponse.SC_NOT_FOUND);
}
}
return null;
}
示例3: url
import org.seasar.struts.util.ResponseUtil; //导入依赖的package包/类
/**
* URLを計算します。
*
* @param input
* 入力値
* @return エスケープした結果
*/
public static String url(String input) {
String contextPath = RequestUtil.getRequest().getContextPath();
StringBuilder sb = new StringBuilder();
if (contextPath.length() > 1) {
sb.append(contextPath);
}
if (StringUtil.isEmpty(input)) {
sb.append(ActionUtil.calcActionPath());
} else if (!input.startsWith("/")) {
sb.append(ActionUtil.calcActionPath()).append(input);
} else {
String[] names = StringUtil.split(input, "/");
S2Container container = SingletonS2ContainerFactory.getContainer();
StringBuilder sb2 = new StringBuilder(50);
String input2 = input;
for (int i = 0; i < names.length; i++) {
if (container.hasComponentDef(sb2 + names[i] + "Action")) {
String actionPath = RoutingUtil.getActionPath(names, i);
String paramPath = RoutingUtil.getParamPath(names, i + 1);
if (StringUtil.isEmpty(paramPath)) {
input2 = actionPath + "/";
break;
}
}
sb2.append(names[i] + "_");
}
sb.append(input2);
}
return ResponseUtil.getResponse().encodeURL(sb.toString());
}
示例4: download
import org.seasar.struts.util.ResponseUtil; //导入依赖的package包/类
@Execute(validator = false)
public String download() {
try {
ResponseUtil.download(new String("memberUpload.csv".getBytes("Shift_JIS"), "Shift_JIS"),
"hname,mail,id,pw".getBytes());
} catch (IOException e) {
throw new IORuntimeException(e);
}
return null;
}
示例5: logout
import org.seasar.struts.util.ResponseUtil; //导入依赖的package包/类
/**
* <p>~/quickstart/auth/logout</p>
* @return リクエスト転送先情報
*/
@Execute(validator = false)
public String logout() {
if (this.request.getSession(false) != null) {
this.request.getSession(false).invalidate();
}
ResponseUtil.write("Bye!", "text/plain", "UTF-8");
return null;
}
示例6: download
import org.seasar.struts.util.ResponseUtil; //导入依赖的package包/类
@Execute(validator = false)
public String download() {
try {
ResponseUtil.download(new String(
"サンプル.txt".getBytes("Shift_JIS"),
"ISO-8859-1"), "こんにちは".getBytes("Shift_JIS"));
} catch (IOException e) {
throw new IORuntimeException(e);
}
return null;
}
示例7: hello
import org.seasar.struts.util.ResponseUtil; //导入依赖的package包/类
@Execute(validator = false)
public String hello() {
ResponseUtil.write("こんにちは");
return null;
}