/** * sets the content type to be sent back to the browser * * @param type the type to be sent to the browser (i.e. "text/html") */ public void setContentType(final String type) { setHeader("Content-Type", type); }
/** sets the content type to be sent back to the browser * @param type the type to be sent to the browser (i.e. "text/html") */ public void setContentType(String type){ setHeader("Content-Type", type); }
/** * sets the content type to be sent back to the browser * * @param type the type to be sent to the browser (i.e. "text/html") */ @Override public void setContentType(final String type) { setHeader("Content-Type", type); }
@Override public void addDateHeader(final String s, final long l) { setHeader(s, Long.toString(l)); }
@Override public void setIntHeader(final String s, final int i) { setHeader(s, Integer.toString(i)); }
@Override public void addHeader(final String s, final String s1) { Collection<String> list = headers.get(s); if (list == null) { setHeader(s, s1); } else { list.add(s1); } }
@Override public void addCookie(final Cookie cookie) { setHeader(cookie.getName(), cookie.getValue()); }
/** Creates a new HttpResponseImpl with user provided parameters * @param code the HTTP Response code, see <a href="http://www.ietf.org/rfc/rfc2616.txt">http://www.ietf.org/rfc/rfc2616.txt</a> * for these codes * @param responseString the response string to be sent back * @param contentType the content type to be sent back */ protected HttpResponseImpl(int code, String responseString, String contentType){ this.responseString = responseString; this.code = code; // Default headers setHeader("Server", getServerName()); setHeader("Connection","close"); setHeader("Content-Type",contentType); // create the body. initBody(); }
/** * Creates a new HttpResponseImpl with user provided parameters * * @param code the HTTP Response code, see <a href="http://www.ietf.org/rfc/rfc2616.txt">http://www.ietf.org/rfc/rfc2616.txt</a> * for these codes * @param responseString the response string to be sent back * @param contentType the content type to be sent back */ protected HttpResponseImpl(final int code, final String responseString, final String contentType) { this.responseString = responseString; this.code = code; // Default headers setHeader("Server", getServerName()); setHeader("Connection", "close"); setHeader("Content-Type", contentType); // create the body. initBody(); }
/** * Creates a new HttpResponseImpl with user provided parameters * * @param code the HTTP Response code, see <a href="http://www.ietf.org/rfc/rfc2616.txt">http://www.ietf.org/rfc/rfc2616.txt</a> * for these codes * @param responseString the response string to be sent back * @param contentType the content type to be sent back */ protected HttpResponseImpl(final int code, final String responseString, final String contentType) { this.responseString = responseString; this.code = code; // Default headers setHeader("Server", getServerName()); setHeader("Connection", "close"); setHeader("Content-Type", contentType); // create the body. initBody(); }
private void setCookieHeader() { if (request == null) { return; } final HttpSession session = request.getSession(false); if (session == null) { return; } setHeader(HttpRequest.HEADER_SET_COOKIE, SessionManager.EJBSESSIONID + '=' + session.getId() + "; Path=/"); }
@Override public void sendRedirect(final String path) throws IOException { if (commited) { throw new IllegalStateException("response already committed"); } resetBuffer(); try { setStatus(SC_FOUND); setHeader("Location", base() + toEncoded(path)); } catch (final IllegalArgumentException e) { setStatus(SC_NOT_FOUND); } }