本文整理匯總了Java中javax.servlet.http.HttpServletResponse.setIntHeader方法的典型用法代碼示例。如果您正苦於以下問題:Java HttpServletResponse.setIntHeader方法的具體用法?Java HttpServletResponse.setIntHeader怎麽用?Java HttpServletResponse.setIntHeader使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.servlet.http.HttpServletResponse
的用法示例。
在下文中一共展示了HttpServletResponse.setIntHeader方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: doNotCache
import javax.servlet.http.HttpServletResponse; //導入方法依賴的package包/類
/**
* Sets headers so that the response is never cached.
* @param response the response on which to set the headers.
* @throws NullPointerException if the argument is {@code null}.
*/
public static void doNotCache(HttpServletResponse response) {
requireNonNull(response, "response");
response.setHeader(CacheControl, new StringJoiner(", ")
.add(NoStore)
.add(NoCache)
.add(MustRevalidate)
.toString());
response.setHeader(Pragma, NoCache);
response.setIntHeader(Expires, 0);
}
示例2: doResponseRedirectOrNotModifiedLogic
import javax.servlet.http.HttpServletResponse; //導入方法依賴的package包/類
protected boolean doResponseRedirectOrNotModifiedLogic(HttpServletRequest servletRequest, HttpServletResponse servletResponse,
HttpResponse proxyResponse, int statusCode) throws ServletException, IOException {
// Check if the proxy response is a redirect
// The following code is adapted from org.tigris.noodle.filters.CheckForRedirect
if (statusCode >= HttpServletResponse.SC_MULTIPLE_CHOICES /* 300 */
&& statusCode < HttpServletResponse.SC_NOT_MODIFIED /* 304 */) {
Header locationHeader = proxyResponse.getLastHeader(HttpHeaders.LOCATION);
if (locationHeader == null) {
throw new ServletException(
"Received status code: " + statusCode + " but no " + HttpHeaders.LOCATION + " header was found in the response");
}
// Modify the redirect to go to this proxy servlet rather that the proxied host
String locStr = rewriteUrlFromResponse(servletRequest, locationHeader.getValue());
servletResponse.sendRedirect(locStr);
return true;
}
// 304 needs special handling. See:
// http://www.ics.uci.edu/pub/ietf/http/rfc1945.html#Code304
// We get a 304 whenever passed an 'If-Modified-Since'
// header and the data on disk has not changed; server
// responds w/ a 304 saying I'm not going to send the
// body because the file has not changed.
if (statusCode == HttpServletResponse.SC_NOT_MODIFIED) {
servletResponse.setIntHeader(HttpHeaders.CONTENT_LENGTH, 0);
servletResponse.setStatus(HttpServletResponse.SC_NOT_MODIFIED);
return true;
}
return false;
}
示例3: handleRequest
import javax.servlet.http.HttpServletResponse; //導入方法依賴的package包/類
@RequestMapping(method = RequestMethod.GET)
public void handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {
User user = securityService.getCurrentUser(request);
TransferStatus status = null;
try {
status = statusService.createDownloadStatus(playerService.getPlayer(request, response, false, false));
MediaFile mediaFile = getMediaFile(request);
Integer playlistId = ServletRequestUtils.getIntParameter(request, "playlist");
String playerId = request.getParameter("player");
int[] indexes = request.getParameter("i") == null ? null : ServletRequestUtils.getIntParameters(request, "i");
if (mediaFile != null) {
response.setIntHeader("ETag", mediaFile.getId());
response.setHeader("Accept-Ranges", "bytes");
}
HttpRange range = HttpRange.valueOf(request.getHeader("Range"));
if (range != null) {
response.setStatus(HttpServletResponse.SC_PARTIAL_CONTENT);
LOG.info("Got HTTP range: " + range);
}
if (mediaFile != null) {
if (!securityService.isFolderAccessAllowed(mediaFile, user.getUsername())) {
response.sendError(HttpServletResponse.SC_FORBIDDEN,
"Access to file " + mediaFile.getId() + " is forbidden for user " + user.getUsername());
return;
}
if (mediaFile.isFile()) {
downloadFile(response, status, mediaFile.getFile(), range);
} else {
List<MediaFile> children = mediaFileService.getChildrenOf(mediaFile, true, false, true);
String zipFileName = FilenameUtils.getBaseName(mediaFile.getPath()) + ".zip";
File coverArtFile = indexes == null ? mediaFile.getCoverArtFile() : null;
downloadFiles(response, status, children, indexes, coverArtFile, range, zipFileName);
}
} else if (playlistId != null) {
List<MediaFile> songs = playlistService.getFilesInPlaylist(playlistId);
Playlist playlist = playlistService.getPlaylist(playlistId);
downloadFiles(response, status, songs, null, null, range, playlist.getName() + ".zip");
} else if (playerId != null) {
Player player = playerService.getPlayerById(playerId);
PlayQueue playQueue = player.getPlayQueue();
playQueue.setName("Playlist");
downloadFiles(response, status, playQueue.getFiles(), indexes, null, range, "download.zip");
}
} finally {
if (status != null) {
statusService.removeDownloadStatus(status);
securityService.updateUserByteCounts(user, 0L, status.getBytesTransfered(), 0L);
}
}
}
示例4: displayTable
import javax.servlet.http.HttpServletResponse; //導入方法依賴的package包/類
@Override
protected void displayTable(HttpServletResponse response) throws SQLException, IOException {
response.setIntHeader("Refresh", 5);
// Append table that lists all persons
List<LOD> resultList = lodDAO.selectAllEntries();
response.getWriter().println(
"<p><center><table width=70% border=\"1\"><tr><th colspan=\"1\"></th>" + "<th colspan=\"3\">" + (resultList.isEmpty() ? "" : resultList.size() + " ")
+ "Employees in the EPM-BPC team</th>"
+ "<th colspan=\"3\">" + "Smart Sorted</th></tr>");
if (resultList.isEmpty()) {
response.getWriter().println("<tr><td colspan=\"4\">Database is empty</td></tr>");
} else {
response.getWriter().println("<tr><th>#</th><th>Name</th><th>Assign</th><th>Remove</th><th>Amount</th><th>Total</th><th>AVG Q-DAY</th></tr>");
}
IXSSEncoder xssEncoder = XSSEncoder.getInstance();
int index = 1;
Collections.sort(resultList);
// Add [EPM_QM_ASSIGNED] button
response.getWriter().println("<p><center> Click here → <input type=\"submit\" onclick=\"return window.prompt('Copy to clipboard: ','[EPM_QM_ASSIGNED]')\" value=\"[EPM_QM_ASSIGNED]\"></center></p>");
int lodIncidents = 0;
for (LOD lod : resultList) {
// John L = 7, Julie = 8
if (lod.getId() == 7 || lod.getId()== 8) {
// Calculate incident number
lodIncidents += lod.getLod();
// Get score
String score = "0";
DecimalFormat df = new DecimalFormat("#.###");
if (lod.getName().equals("John L")) {
score = df.format(((double)lod.getSum()) / (QueueDays.hash.get(lod.getName())*0.5));
} else {
score = df.format(((double)lod.getSum()) / QueueDays.hash.get(lod.getName()));
}
String pop = lod.getName() + " has been +1, please go for assign.";
String link = "<td><center><form action=\"" + LINKNAME + "?Id="+ lod.getId() + "&operation=add\" method=\"post\">" + "<input type=\"submit\" onclick=\"return window.prompt('" + pop + " Copy to clipboard: Ctrl+C, Enter','" + lod.getiNumber() + "')\" value=\"Add\" />" + "</form></center></td>";
if (lod.getSum() < FIXEDVALUE) {
response.getWriter().println("<tr><td height=\"30\"><center>" + (index++) + "</center></td>");
if (index == 2) {
response.getWriter().println("<td height=\"30\"><center><mark><b>" + xssEncoder.encodeHTML(lod.getName()+" ("+lod.getiNumber()+")") + "</b></mark></center></td>");
} else {
response.getWriter().println("<td height=\"30\"><center>" + xssEncoder.encodeHTML(lod.getName()+" ("+lod.getiNumber()+")") + "</center></td>");
}
response.getWriter().println(link);
response.getWriter().println("<td><center><form action=\"" + LINKNAME + "?Id="+ lod.getId() + "&operation=decrease\" method=\"post\">" + "<input type=\"submit\" value=\"Delete\" />" + "</form></center></td>");
response.getWriter().println("<td height=\"30\"><center>" + lod.getLod() + "</center></td>");
response.getWriter().println("<td height=\"30\"><center>" + lod.getSum() + "</center></td>" + "<td height=\"30\"><center>" + score + "</center></td>");
} else {
response.getWriter().println("<tr><td height=\"30\"><center>" + (index++) + "</center></td>");
response.getWriter().println("<td height=\"30\"><center>" + xssEncoder.encodeHTML(lod.getName() + ": UNAVAILABLE") + "</center></td>");
response.getWriter().println("<td><center>"+ xssEncoder.encodeHTML("N/A") + "</center></td>");
response.getWriter().println("<td><center>"+ xssEncoder.encodeHTML("N/A") + "</center></td>");
response.getWriter().println("<td height=\"30\"><center>" + lod.getLod() + "</center></td>");
response.getWriter().println("<td height=\"30\"><center>" + (lod.getSum()-FIXEDVALUE) + "</center></td>");
}
response.getWriter().println("</tr>");
}
}
response.getWriter().println("</table></center></p>");
response.getWriter().println("<p><center>LOD has <mark>" + lodIncidents + "</mark> incidents" + "</center></p>");
response.getWriter().println("</body>");
// Home button
response.getWriter().println("<p><center><form action=\"" + "nw" + "\" method=\"get\">" + "<input type=\"submit\" value=\"Return to Home\" />" + "</form></center></p>");
}
示例5: displayTable
import javax.servlet.http.HttpServletResponse; //導入方法依賴的package包/類
@Override
protected void displayTable(HttpServletResponse response) throws SQLException, IOException {
response.setIntHeader("Refresh", 5);
// Append table that lists all persons
List<FC> resultList = fcDAO.selectAllEntries();
response.getWriter().println(
"<p><center><table width=70% border=\"1\"><tr><th colspan=\"1\"></th>" + "<th colspan=\"3\">" + (resultList.isEmpty() ? "" : resultList.size() + " ")
+ "Employees in the EPM-BPC team</th>"
+ "<th colspan=\"3\">" + "Smart Sorted</th></tr>");
if (resultList.isEmpty()) {
response.getWriter().println("<tr><td colspan=\"4\">Database is empty</td></tr>");
} else {
response.getWriter().println("<tr><th>#</th><th>Name</th><th>Assign</th><th>Remove</th><th>Amount</th><th>Total</th><th>AVG Q-DAY</th></tr>");
}
IXSSEncoder xssEncoder = XSSEncoder.getInstance();
int index = 1;
Collections.sort(resultList);
// Add [[EPM_QM_ASSIGNED] assign] button
response.getWriter().println("<p><center> Click here → <input type=\"submit\" onclick=\"return window.prompt('Copy to clipboard: ','[EPM_QM_ASSIGNED]')\" value=\"[EPM_QM_ASSIGNED]\"></center></p>");
int fcIncidents = 0;
for (FC fc : resultList) {
// Marc = 10, Yvonne = 13
if (fc.getId() == 10 || fc.getId()== 13) {
// Calculate incident number
fcIncidents += fc.getFc();
// Get score
String score = "0";
DecimalFormat df = new DecimalFormat("#.###");
if (fc.getName().equals("Yvonne")) {
score = df.format(((double)fc.getSum()) / (QueueDays.hash.get(fc.getName())*0.75));
} else {
score = df.format(((double)fc.getSum()) / QueueDays.hash.get(fc.getName()));
}
String pop = fc.getName() + " has been +1, please go for assign.";
String link = "<td><center><form action=\"" + LINKNAME + "?Id="+ fc.getId() + "&operation=add\" method=\"post\">" + "<input type=\"submit\" onclick=\"return window.prompt('" + pop + " Copy to clipboard: Ctrl+C, Enter','" + fc.getiNumber() + "')\" value=\"Add\" />" + "</form></center></td>";
if (fc.getSum() < FIXEDVALUE) {
response.getWriter().println("<tr><td height=\"30\"><center>" + (index++) + "</center></td>");
if (index == 2) {
response.getWriter().println("<td height=\"30\"><center><mark><b>" + xssEncoder.encodeHTML(fc.getName()+" ("+fc.getiNumber()+")") + "</b></mark></center></td>");
} else {
response.getWriter().println("<td height=\"30\"><center>" + xssEncoder.encodeHTML(fc.getName()+" ("+fc.getiNumber()+")") + "</center></td>");
}
response.getWriter().println(link);
response.getWriter().println("<td><center><form action=\"" + LINKNAME + "?Id="+ fc.getId() + "&operation=decrease\" method=\"post\">" + "<input type=\"submit\" value=\"Delete\" />" + "</form></center></td>");
response.getWriter().println("<td height=\"30\"><center>" + fc.getFc() + "</center></td>");
response.getWriter().println("<td height=\"30\"><center>" + fc.getSum() + "</center></td>" + "<td height=\"30\"><center>" + score + "</center></td>");
} else {
response.getWriter().println("<tr><td height=\"30\"><center>" + (index++) + "</center></td>");
response.getWriter().println("<td height=\"30\"><center>" + xssEncoder.encodeHTML(fc.getName() + ": UNAVAILABLE") + "</center></td>");
response.getWriter().println("<td><center>"+ xssEncoder.encodeHTML("N/A") + "</center></td>");
response.getWriter().println("<td><center>"+ xssEncoder.encodeHTML("N/A") + "</center></td>");
response.getWriter().println("<td height=\"30\"><center>" + fc.getFc() + "</center></td>");
response.getWriter().println("<td height=\"30\"><center>" + (fc.getSum()-FIXEDVALUE) + "</center></td>");
}
response.getWriter().println("</tr>");
}
}
response.getWriter().println("</table></center></p>");
response.getWriter().println("<p><center>FC has <mark>" + fcIncidents + "</mark> incidents" + "</center></p>");
response.getWriter().println("</body>");
// Home button
response.getWriter().println("<p><center><form action=\"" + "nw" + "\" method=\"get\">" + "<input type=\"submit\" value=\"Return to Home\" />" + "</form></center></p>");
}
示例6: displayTable
import javax.servlet.http.HttpServletResponse; //導入方法依賴的package包/類
@Override
protected void displayTable(HttpServletResponse response) throws SQLException, IOException {
response.setIntHeader("Refresh", 5);
// Append table that lists all persons
List<SA> resultList = saDAO.selectAllEntries();
response.getWriter().println(
"<p><center><table width=70% border=\"1\"><tr><th colspan=\"1\"></th>" + "<th colspan=\"3\">" + (resultList.isEmpty() ? "" : resultList.size() + " ")
+ "Entries in the Database</th>"
+ "<th colspan=\"3\">" + "Smart Sorted</th></tr>");
if (resultList.isEmpty()) {
response.getWriter().println("<tr><td colspan=\"4\">Database is empty</td></tr>");
} else {
response.getWriter().println("<tr><th>#</th><th>Name</th><th>Assign</th><th>Remove</th><th>Amount</th><th>Total</th><th>AVG Q-DAY</th></tr>");
}
IXSSEncoder xssEncoder = XSSEncoder.getInstance();
int index = 1;
Collections.sort(resultList);
// Add [EPM_QM_ASSIGNED] button
response.getWriter().println("<p><center> Click here → <input type=\"submit\" onclick=\"return window.prompt('Copy to clipboard: ','[EPM_QM_ASSIGNED]')\" value=\"[EPM_QM_ASSIGNED]\"></center></p>");
int saIncidents = 0;
for (SA sa : resultList) {
// Hitomi = 5, JohnH = 6
if (sa.getId() == 5 || sa.getId()== 6) {
// Calculate incident number
saIncidents += sa.getSa();
// Get score
String score = "0";
DecimalFormat df = new DecimalFormat("#.###");
score = df.format(((double)sa.getSum()) / QueueDays.hash.get(sa.getName()));
String pop = sa.getName() + " has been +1, please go for assign.";
String link = "<td><center><form action=\"" + LINKNAME + "?Id="+ sa.getId() + "&operation=add\" method=\"post\">" + "<input type=\"submit\" onclick=\"return window.prompt('" + pop + " Copy to clipboard: Ctrl+C, Enter','" + sa.getiNumber() + "')\" value=\"Add\" />" + "</form></center></td>";
if (sa.getSum() < FIXEDVALUE) {
response.getWriter().println("<tr><td height=\"30\"><center>" + (index++) + "</center></td>");
if (index == 2) {
response.getWriter().println("<td height=\"30\"><center><mark><b>" + xssEncoder.encodeHTML(sa.getName()+" ("+sa.getiNumber()+")") + "</b></mark></center></td>");
} else {
response.getWriter().println("<td height=\"30\"><center>" + xssEncoder.encodeHTML(sa.getName()+" ("+sa.getiNumber()+")") + "</center></td>");
}
response.getWriter().println(link);
response.getWriter().println("<td><center><form action=\"" + LINKNAME + "?Id="+ sa.getId() + "&operation=decrease\" method=\"post\">" + "<input type=\"submit\" value=\"Delete\" />" + "</form></center></td>");
response.getWriter().println("<td height=\"30\"><center>" + sa.getSa() + "</center></td>");
response.getWriter().println("<td height=\"30\"><center>" + sa.getSum() + "</center></td>" + "<td height=\"30\"><center>" + score + "</center></td>");
} else {
response.getWriter().println("<tr><td height=\"30\"><center>" + (index++) + "</center></td>");
response.getWriter().println("<td height=\"30\"><center>" + xssEncoder.encodeHTML(sa.getName() + ": UNAVAILABLE") + "</center></td>");
response.getWriter().println("<td><center>"+ xssEncoder.encodeHTML("N/A") + "</center></td>");
response.getWriter().println("<td><center>"+ xssEncoder.encodeHTML("N/A") + "</center></td>");
response.getWriter().println("<td height=\"30\"><center>" + sa.getSa() + "</center></td>");
response.getWriter().println("<td height=\"30\"><center>" + (sa.getSum()-FIXEDVALUE) + "</center></td>");
}
response.getWriter().println("</tr>");
}
}
response.getWriter().println("</table></center></p>");
response.getWriter().println("<p><center>SA has <mark>" + saIncidents + "</mark> incidents" + "</center></p>");
response.getWriter().println("</body>");
// Home button
response.getWriter().println("<p><center><form action=\"" + "nw" + "\" method=\"get\">" + "<input type=\"submit\" value=\"Return to Home\" />" + "</form></center></p>");
}
示例7: displayTable
import javax.servlet.http.HttpServletResponse; //導入方法依賴的package包/類
@Override
protected void displayTable(HttpServletResponse response) throws SQLException, IOException {
response.setIntHeader("Refresh", 5);
// Append table that lists all persons
List<PCM> resultList = pcmDAO.selectAllEntries();
response.getWriter().println(
"<p><center><table width=70% border=\"1\"><tr><th colspan=\"1\"></th>" + "<th colspan=\"3\">" + (resultList.isEmpty() ? "" : resultList.size() + " ")
+ "Employees in the EPM-BPC team</th>"
+ "<th colspan=\"3\">" + "Smart Sorted</th></tr>");
if (resultList.isEmpty()) {
response.getWriter().println("<tr><td colspan=\"4\">Database is empty</td></tr>");
} else {
response.getWriter().println("<tr><th>#</th><th>Name</th><th>Assign</th><th>Remove</th><th>Amount</th><th>Total</th><th>AVG Q-DAY</th></tr>");
}
IXSSEncoder xssEncoder = XSSEncoder.getInstance();
int index = 1;
Collections.sort(resultList);
// Add [EPM_QM_ASSIGNED] button
response.getWriter().println("<p><center> Click here → <input type=\"submit\" onclick=\"return window.prompt('Copy to clipboard: ','[EPM_QM_ASSIGNED]')\" value=\"[EPM_QM_ASSIGNED]\"></center></p>");
int pcmIncidents = 0;
for (PCM pcm : resultList) {
// April = 3, John H = 6
if (pcm.getId() == 3 || pcm.getId()== 6) {
// Calculate incident number
pcmIncidents += pcm.getPcm();
// Get score
String score = "0";
DecimalFormat df = new DecimalFormat("#.###");
score = df.format(((double)pcm.getSum()) / QueueDays.hash.get(pcm.getName()));
String pop = pcm.getName() + " has been +1, please go for assign.";
String link = "<td><center><form action=\"" + LINKNAME + "?Id="+ pcm.getId() + "&operation=add\" method=\"post\">" + "<input type=\"submit\" onclick=\"return window.prompt('" + pop + " Copy to clipboard: Ctrl+C, Enter','" + pcm.getiNumber() + "')\" value=\"Add\" />" + "</form></center></td>";
if (pcm.getSum() < FIXEDVALUE) {
response.getWriter().println("<tr><td height=\"30\"><center>" + (index++) + "</center></td>");
if (index == 2) {
response.getWriter().println("<td height=\"30\"><center><mark><b>" + xssEncoder.encodeHTML(pcm.getName()+" ("+pcm.getiNumber()+")") + "</b></mark></center></td>");
} else {
response.getWriter().println("<td height=\"30\"><center>" + xssEncoder.encodeHTML(pcm.getName()+" ("+pcm.getiNumber()+")") + "</center></td>");
}
response.getWriter().println(link);
response.getWriter().println("<td><center><form action=\"" + LINKNAME + "?Id="+ pcm.getId() + "&operation=decrease\" method=\"post\">" + "<input type=\"submit\" value=\"Delete\" />" + "</form></center></td>");
response.getWriter().println("<td height=\"30\"><center>" + pcm.getPcm() + "</center></td>");
response.getWriter().println("<td height=\"30\"><center>" + pcm.getSum() + "</center></td>" + "<td height=\"30\"><center>" + score + "</center></td>");
} else {
response.getWriter().println("<tr><td height=\"30\"><center>" + (index++) + "</center></td>");
response.getWriter().println("<td height=\"30\"><center>" + xssEncoder.encodeHTML(pcm.getName() + ": UNAVAILABLE") + "</center></td>");
response.getWriter().println("<td><center>"+ xssEncoder.encodeHTML("N/A") + "</center></td>");
response.getWriter().println("<td><center>"+ xssEncoder.encodeHTML("N/A") + "</center></td>");
response.getWriter().println("<td height=\"30\"><center>" + pcm.getPcm() + "</center></td>");
response.getWriter().println("<td height=\"30\"><center>" + (pcm.getSum()-FIXEDVALUE) + "</center></td>");
}
response.getWriter().println("</tr>");
}
}
response.getWriter().println("</table></center></p>");
response.getWriter().println("<p><center>PCM has <mark>" + pcmIncidents + "</mark> incidents" + "</center></p>");
response.getWriter().println("</body>");
// Home button
response.getWriter().println("<p><center><form action=\"" + "nw" + "\" method=\"get\">" + "<input type=\"submit\" value=\"Return to Home\" />" + "</form></center></p>");
}
示例8: displayTable
import javax.servlet.http.HttpServletResponse; //導入方法依賴的package包/類
@Override
protected void displayTable(HttpServletResponse response) throws SQLException, IOException {
response.setIntHeader("Refresh", 5);
// Append table that lists all persons
List<DSM> resultList = dsmDAO.selectAllEntries();
response.getWriter().println(
"<p><center><table width=70% border=\"1\"><tr><th colspan=\"1\"></th>" + "<th colspan=\"3\">" + (resultList.isEmpty() ? "" : resultList.size() + " ")
+ "Employees in the EPM-BPC team</th>"
+ "<th colspan=\"3\">" + "Smart Sorted</th></tr>");
if (resultList.isEmpty()) {
response.getWriter().println("<tr><td colspan=\"4\">Database is empty</td></tr>");
} else {
response.getWriter().println("<tr><th>#</th><th>Name</th><th>Assign</th><th>Remove</th><th>Amount</th><th>Total</th><th>AVG Q-DAY</th></tr>");
}
IXSSEncoder xssEncoder = XSSEncoder.getInstance();
int index = 1;
Collections.sort(resultList);
// Add [qm assign] button
response.getWriter().println("<p><center> Click here → <input type=\"submit\" onclick=\"return window.prompt('Copy to clipboard: ','[EPM_QM_ASSIGNED]')\" value=\"[EPM_QM_ASSIGNED]\"></center></p>");
int dsmIncidents = 0;
for (DSM dsm : resultList) {
// Graham = 4, Marc = 10
if (dsm.getId() == 4 || dsm.getId()==10) {
// Calculate incident number
dsmIncidents += dsm.getDsm();
// Get score
String score = "0";
DecimalFormat df = new DecimalFormat("#.###");
score = df.format(((double)dsm.getSum()) / QueueDays.hash.get(dsm.getName()));
String pop = dsm.getName() + " has been +1, please go for assign.";
String link = "<td><center><form action=\"" + LINKNAME + "?Id="+ dsm.getId() + "&operation=add\" method=\"post\">" + "<input type=\"submit\" onclick=\"return window.prompt('" + pop + " Copy to clipboard: Ctrl+C, Enter','" + dsm.getiNumber() + "')\" value=\"Add\" />" + "</form></center></td>";
if (dsm.getSum() < FIXEDVALUE) {
response.getWriter().println("<tr><td height=\"30\"><center>" + (index++) + "</center></td>");
if (index == 2) {
response.getWriter().println("<td height=\"30\"><center><mark><b>" + xssEncoder.encodeHTML(dsm.getName()+" ("+dsm.getiNumber()+")") + "</b></mark></center></td>");
} else {
response.getWriter().println("<td height=\"30\"><center>" + xssEncoder.encodeHTML(dsm.getName()+" ("+dsm.getiNumber()+")") + "</center></td>");
}
response.getWriter().println(link);
response.getWriter().println("<td><center><form action=\"" + LINKNAME + "?Id="+ dsm.getId() + "&operation=decrease\" method=\"post\">" + "<input type=\"submit\" value=\"Delete\" />" + "</form></center></td>");
response.getWriter().println("<td height=\"30\"><center>" + dsm.getDsm() + "</center></td>");
response.getWriter().println("<td height=\"30\"><center>" + dsm.getSum() + "</center></td>" + "<td height=\"30\"><center>" + score + "</center></td>");
} else {
response.getWriter().println("<tr><td height=\"30\"><center>" + (index++) + "</center></td>");
response.getWriter().println("<td height=\"30\"><center>" + xssEncoder.encodeHTML(dsm.getName() + ": UNAVAILABLE") + "</center></td>");
response.getWriter().println("<td><center>"+ xssEncoder.encodeHTML("N/A") + "</center></td>");
response.getWriter().println("<td><center>"+ xssEncoder.encodeHTML("N/A") + "</center></td>");
response.getWriter().println("<td height=\"30\"><center>" + dsm.getDsm() + "</center></td>");
response.getWriter().println("<td height=\"30\"><center>" + (dsm.getSum()-FIXEDVALUE) + "</center></td>");
}
response.getWriter().println("</tr>");
}
}
response.getWriter().println("</table></center></p>");
response.getWriter().println("<p><center>DSM has <mark>" + dsmIncidents + "</mark> incidents" + "</center></p>");
response.getWriter().println("</body>");
// Home button
response.getWriter().println("<p><center><form action=\"" + "nw" + "\" method=\"get\">" + "<input type=\"submit\" value=\"Return to Home\" />" + "</form></center></p>");
}
示例9: displayTable
import javax.servlet.http.HttpServletResponse; //導入方法依賴的package包/類
@Override
protected void displayTable(HttpServletResponse response) throws SQLException, IOException {
response.setIntHeader("Refresh", 5);
// Append table that lists all persons
List<SM> resultList = smDAO.selectAllEntries();
response.getWriter().println(
"<p><center><table width=70% border=\"1\"><tr><th colspan=\"1\"></th>" + "<th colspan=\"3\">" + (resultList.isEmpty() ? "" : resultList.size() + " ")
+ "Employees in the EPM-BPC team</th>"
+ "<th colspan=\"3\">" + "Smart Sorted</th></tr>");
if (resultList.isEmpty()) {
response.getWriter().println("<tr><td colspan=\"4\">Database is empty</td></tr>");
} else {
response.getWriter().println("<tr><th>#</th><th>Name</th><th>Assign</th><th>Remove</th><th>Amount</th><th>Total</th><th>AVG Q-DAY</th></tr>");
}
IXSSEncoder xssEncoder = XSSEncoder.getInstance();
int index = 1;
Collections.sort(resultList);
// Add [EPM_QM_ASSIGNED] button
response.getWriter().println("<p><center> Click here → <input type=\"submit\" onclick=\"return window.prompt('Copy to clipboard: ','[EPM_QM_ASSIGNED]')\" value=\"[EPM_QM_ASSIGNED]\"></center></p>");
int smIncidents = 0;
for (SM sm : resultList) {
// Graham = 4, Stefan = 12
if (sm.getId() == 4 || sm.getId()==12) {
// Calculate incident number
smIncidents += sm.getSm();
// Get score
String score = "0";
DecimalFormat df = new DecimalFormat("#.###");
score = df.format(((double)sm.getSum()) / QueueDays.hash.get(sm.getName()));
String pop = sm.getName() + " has been +1, please go for assign.";
String link = "<td><center><form action=\"" + LINKNAME + "?Id="+ sm.getId() + "&operation=add\" method=\"post\">" + "<input type=\"submit\" onclick=\"return window.prompt('" + pop + " Copy to clipboard: Ctrl+C, Enter','" + sm.getiNumber() + "')\" value=\"Add\" />" + "</form></center></td>";
if (sm.getSum() < FIXEDVALUE) {
response.getWriter().println("<tr><td height=\"30\"><center>" + (index++) + "</center></td>");
if (index == 2) {
response.getWriter().println("<td height=\"30\"><center><mark><b>" + xssEncoder.encodeHTML(sm.getName()+" ("+sm.getiNumber()+")") + "</b></mark></center></td>");
} else {
response.getWriter().println("<td height=\"30\"><center>" + xssEncoder.encodeHTML(sm.getName()+" ("+sm.getiNumber()+")") + "</center></td>");
}
response.getWriter().println(link);
response.getWriter().println("<td><center><form action=\"" + LINKNAME + "?Id="+ sm.getId() + "&operation=decrease\" method=\"post\">" + "<input type=\"submit\" value=\"Delete\" />" + "</form></center></td>");
response.getWriter().println("<td height=\"30\"><center>" + sm.getSm() + "</center></td>");
response.getWriter().println("<td height=\"30\"><center>" + sm.getSum() + "</center></td>" + "<td height=\"30\"><center>" + score + "</center></td>");
} else {
response.getWriter().println("<tr><td height=\"30\"><center>" + (index++) + "</center></td>");
response.getWriter().println("<td height=\"30\"><center>" + xssEncoder.encodeHTML(sm.getName() + ": UNAVAILABLE") + "</center></td>");
response.getWriter().println("<td><center>"+ xssEncoder.encodeHTML("N/A") + "</center></td>");
response.getWriter().println("<td><center>"+ xssEncoder.encodeHTML("N/A") + "</center></td>");
response.getWriter().println("<td height=\"30\"><center>" + sm.getSm() + "</center></td>");
response.getWriter().println("<td height=\"30\"><center>" + (sm.getSum()-FIXEDVALUE) + "</center></td>");
}
response.getWriter().println("</tr>");
}
}
response.getWriter().println("</table></center></p>");
response.getWriter().println("<p><center>SM has <mark>" + smIncidents + "</mark> incidents" + "</center></p>");
response.getWriter().println("</body>");
// Home button
response.getWriter().println("<p><center><form action=\"" + "nw" + "\" method=\"get\">" + "<input type=\"submit\" value=\"Return to Home\" />" + "</form></center></p>");
}
示例10: displayTable
import javax.servlet.http.HttpServletResponse; //導入方法依賴的package包/類
@Override
protected void displayTable(HttpServletResponse response) throws SQLException, IOException {
response.setIntHeader("Refresh", 5);
// Append table that lists all persons
List<MS> resultList = msDAO.selectAllEntries();
response.getWriter().println(
"<p><center><table width=70% border=\"1\"><tr><th colspan=\"1\"></th>" + "<th colspan=\"3\">" + (resultList.isEmpty() ? "" : resultList.size() + " ")
+ "engineers in the EPM-BPC team</th>"
+ "<th colspan=\"3\">" + "Smart Sorted</th></tr>");
if (resultList.isEmpty()) {
response.getWriter().println("<tr><td colspan=\"4\">Database is empty</td></tr>");
} else {
response.getWriter().println("<tr><th>#</th><th>Name</th><th>Assign</th><th>Remove</th><th>Amount</th><th>Total</th><th>AVG Q-DAY</th></tr>");
}
IXSSEncoder xssEncoder = XSSEncoder.getInstance();
int index = 1;
Collections.sort(resultList);
// Add [EPM_QM_ASSIGNED] button
response.getWriter().println("<p><center> Click here → <input type=\"submit\" onclick=\"return window.prompt('Copy to clipboard: ','[EPM_QM_ASSIGNED]')\" value=\"[EPM_QM_ASSIGNED]\"></center></p>");
int msIncidents = 0;
for (MS ms : resultList) {
// Graham = 4, Stefan = 12, April = 3, John L = 7
if (ms.getId() == 4 || ms.getId()== 12 || ms.getId()== 3 || ms.getId()== 7) {
// Calculate incident number
msIncidents += ms.getMs();
// Get score
String score = "0";
DecimalFormat df = new DecimalFormat("#.###");
if (ms.getName().equals("John L")) {
score = df.format(((double)ms.getSum()) / (QueueDays.hash.get(ms.getName())*0.5));
} else {
score = df.format(((double)ms.getSum()) / QueueDays.hash.get(ms.getName()));
}
String pop = ms.getName() + " has been +1, please go for assign.";
String link = "<td><center><form action=\"" + LINKNAME + "?Id="+ ms.getId() + "&operation=add\" method=\"post\">" + "<input type=\"submit\" onclick=\"return window.prompt('" + pop + " Copy to clipboard: Ctrl+C, Enter','" + ms.getiNumber() + "')\" value=\"Add\" />" + "</form></center></td>";
if (ms.getSum() < FIXEDVALUE) {
response.getWriter().println("<tr><td height=\"30\"><center>" + (index++) + "</center></td>");
if (index == 2) {
response.getWriter().println("<td height=\"30\"><center><mark><b>" + xssEncoder.encodeHTML(ms.getName()+" ("+ms.getiNumber()+")") + "</b></mark></center></td>");
} else {
response.getWriter().println("<td height=\"30\"><center>" + xssEncoder.encodeHTML(ms.getName()+" ("+ms.getiNumber()+")") + "</center></td>");
}
response.getWriter().println(link); response.getWriter().println("<td><center><form action=\"" + LINKNAME + "?Id="+ ms.getId() + "&operation=decrease\" method=\"post\">" + "<input type=\"submit\" value=\"Delete\" />" + "</form></center></td>");
response.getWriter().println("<td height=\"30\"><center>" + ms.getMs() + "</center></td>");
response.getWriter().println("<td height=\"30\"><center>" + ms.getSum() + "</center></td>" + "<td height=\"30\"><center>" + score + "</center></td>");
} else {
response.getWriter().println("<tr><td height=\"30\"><center>" + (index++) + "</center></td>");
response.getWriter().println("<td height=\"30\"><center>" + xssEncoder.encodeHTML(ms.getName() + ": UNAVAILABLE") + "</center></td>");
response.getWriter().println("<td><center>"+ xssEncoder.encodeHTML("N/A") + "</center></td>");
response.getWriter().println("<td><center>"+ xssEncoder.encodeHTML("N/A") + "</center></td>");
response.getWriter().println("<td height=\"30\"><center>" + ms.getMs() + "</center></td>");
response.getWriter().println("<td height=\"30\"><center>" + (ms.getSum()-FIXEDVALUE) + "</center></td>");
}
response.getWriter().println("</tr>");
}
}
response.getWriter().println("</table></center></p>");
response.getWriter().println("<p><center>MS has <mark>" + msIncidents + "</mark> incidents" + "</center></p>");
response.getWriter().println("</body>");
// Home button
response.getWriter().println("<p><center><form action=\"" + "nw" + "\" method=\"get\">" + "<input type=\"submit\" value=\"Return to Home\" />" + "</form></center></p>");
}
示例11: displayTable
import javax.servlet.http.HttpServletResponse; //導入方法依賴的package包/類
@Override
protected void displayTable(HttpServletResponse response) throws SQLException, IOException {
response.setIntHeader("Refresh", 5);
// Append table that lists all persons
List<RTC> resultList = rtcDAO.selectAllEntries();
response.getWriter().println(
"<p><center><table width=70% border=\"1\"><tr><th colspan=\"1\"></th>" + "<th colspan=\"3\">" + (resultList.isEmpty() ? "" : resultList.size() + " ")
+ "Employees in the EPM-BPC team</th>"
+ "<th colspan=\"3\">" + "Smart Sorted</th></tr>");
if (resultList.isEmpty()) {
response.getWriter().println("<tr><td colspan=\"4\">Database is empty</td></tr>");
} else {
response.getWriter().println("<tr><th>#</th><th>Name</th><th>Assign</th><th>Remove</th><th>Amount</th><th>Total</th><th>AVG Q-DAY</th></tr>");
}
IXSSEncoder xssEncoder = XSSEncoder.getInstance();
int index = 1;
Collections.sort(resultList);
// Add [EPM_QM_ASSIGNED] button
response.getWriter().println("<p><center> Click here → <input type=\"submit\" onclick=\"return window.prompt('Copy to clipboard: ','[EPM_QM_ASSIGNED]')\" value=\"[EPM_QM_ASSIGNED]\"></center></p>");
int rtcIncidents = 0;
for (RTC rtc : resultList) {
// JohnH = 6, Stefan = 12, Leila = 9, Julie = 8, Alex = 1, Graham = 4
if (rtc.getId() == 6 || rtc.getId()== 12
|| rtc.getId() == 9 || rtc.getId()== 8
|| rtc.getId() == 1 || rtc.getId()== 4) {
// Calculate incident number
rtcIncidents += rtc.getRtc();
// Get score
String score = "0";
DecimalFormat df = new DecimalFormat("#.###");
score = df.format(((double)rtc.getSum()) / QueueDays.hash.get(rtc.getName()));
String pop = rtc.getName() + " has been +1, please go for assign.";
String link = "<td><center><form action=\"" + LINKNAME + "?Id="+ rtc.getId() + "&operation=add\" method=\"post\">" + "<input type=\"submit\" onclick=\"return window.prompt('" + pop + " Copy to clipboard: Ctrl+C, Enter','" + rtc.getiNumber() + "')\" value=\"Add\" />" + "</form></center></td>";
if (rtc.getSum() < FIXEDVALUE) {
response.getWriter().println("<tr><td height=\"30\"><center>" + (index++) + "</center></td>");
if (index == 2) {
response.getWriter().println("<td height=\"30\"><center><mark><b>" + xssEncoder.encodeHTML(rtc.getName()+" ("+rtc.getiNumber()+")") + "</b></mark></center></td>");
} else {
response.getWriter().println("<td height=\"30\"><center>" + xssEncoder.encodeHTML(rtc.getName()+" ("+rtc.getiNumber()+")") + "</center></td>");
}
response.getWriter().println(link);
response.getWriter().println("<td><center><form action=\"" + LINKNAME + "?Id="+ rtc.getId() + "&operation=decrease\" method=\"post\">" + "<input type=\"submit\" value=\"Delete\" />" + "</form></center></td>");
response.getWriter().println("<td height=\"30\"><center>" + rtc.getRtc() + "</center></td>");
response.getWriter().println("<td height=\"30\"><center>" + rtc.getSum() + "</center></td>" + "<td height=\"30\"><center>" + score + "</center></td>");
} else {
response.getWriter().println("<tr><td height=\"30\"><center>" + (index++) + "</center></td>");
response.getWriter().println("<td height=\"30\"><center>" + xssEncoder.encodeHTML(rtc.getName() + ": UNAVAILABLE") + "</center></td>");
response.getWriter().println("<td><center>"+ xssEncoder.encodeHTML("N/A") + "</center></td>");
response.getWriter().println("<td><center>"+ xssEncoder.encodeHTML("N/A") + "</center></td>");
response.getWriter().println("<td height=\"30\"><center>" + rtc.getRtc() + "</center></td>");
response.getWriter().println("<td height=\"30\"><center>" + (rtc.getSum()-FIXEDVALUE) + "</center></td>");
}
response.getWriter().println("</tr>");
}
}
response.getWriter().println("</table></center></p>");
response.getWriter().println("<p><center>RTC has <mark>" + rtcIncidents + "</mark> incidents" + "</center></p>");
response.getWriter().println("</body>");
// Home button
response.getWriter().println("<p><center><form action=\"" + "nw" + "\" method=\"get\">" + "<input type=\"submit\" value=\"Return to Home\" />" + "</form></center></p>");
}