/** * Return the value for the specified header, or <code>null</code> if this * header has not been set. If more than one value was added for this * name, only the first is returned; use getHeaderValues() to retrieve all * of them. * * @param name Header name to look up */ public String getHeader(String name) { return response.getMimeHeaders().getHeader(name); }
/** * Return an array of all the header values associated with the * specified header name, or an zero-length array if there are no such * header values. * * @param name Header name to look up */ public String[] getHeaderValues(String name) { Enumeration e = response.getMimeHeaders().values(name); Vector result = new Vector(); while (e.hasMoreElements()) { result.addElement(e.nextElement()); } String[] resultArray = new String[result.size()]; result.copyInto(resultArray); return resultArray; }
/** * Return an array of all the header values associated with the * specified header name, or an zero-length array if there are no such * header values. * * @param name Header name to look up */ public String[] getHeaderValues(String name) { checkResponse(); final Enumeration<String> e = response.getMimeHeaders().values(name); final Collection<String> result = new LinkedList<String>(); while (e.hasMoreElements()) { result.add(e.nextElement()); } return result.toArray(new String[result.size()]); }
/** * Return an array of all the header values associated with the * specified header name, or an zero-length array if there are no such * header values. * * @param name Header name to look up */ public String[] getHeaderValues(String name) { checkResponse(); Enumeration e = response.getMimeHeaders().values(name); Vector result = new Vector(); while (e.hasMoreElements()) { result.addElement(e.nextElement()); } String[] resultArray = new String[result.size()]; result.copyInto(resultArray); return resultArray; }
/** * Return the value for the specified header, or <code>null</code> if this * header has not been set. If more than one value was added for this * name, only the first is returned; use getHeaderValues() to retrieve all * of them. * * @param name Header name to look up */ public String getHeader(String name) { checkResponse(); return response.getMimeHeaders().getHeader(name); }
/** * Return the value for the specified header, or <code>null</code> if this * header has not been set. If more than one value was added for this * name, only the first is returned; use getHeaderValues() to retrieve all * of them. * * @param name Header name to look up */ public String getHeader(String name) { checkResponse(); return response.getMimeHeaders().getHeader(name); }
/** * Return an array of all the header names set for this response, or * a zero-length array if no headers have been set. */ public String[] getHeaderNames() { MimeHeaders headers = response.getMimeHeaders(); int n = headers.size(); String[] result = new String[n]; for (int i = 0; i < n; i++) { result[i] = headers.getName(i).toString(); } return result; }
/** * Alternate constructor. */ public InternalOutputBuffer(Response response, int headerBufferSize) { this.response = response; headers = response.getMimeHeaders(); buf = new byte[headerBufferSize]; outputStreamOutputBuffer = new OutputStreamOutputBuffer(); filterLibrary = new OutputFilter[0]; activeFilters = new OutputFilter[0]; lastActiveFilter = -1; socketBuffer = new ByteChunk(); socketBuffer.setByteOutputChannel(this); committed = false; finished = false; }
/** * Alternate constructor. */ public InternalOutputBuffer(Response response, int headerBufferSize) { this.response = response; headers = response.getMimeHeaders(); buf = new byte[headerBufferSize]; outputStreamOutputBuffer = new OutputStreamOutputBuffer(); filterLibrary = new OutputFilter[0]; activeFilters = new OutputFilter[0]; lastActiveFilter = -1; socketBuffer = new ByteChunk(); socketBuffer.setByteOutputChannel(this); committed = false; finished = false; }
/** * Alternate constructor. */ public InternalOutputBuffer(Response response, int headerBufferSize) { this.response = response; headers = response.getMimeHeaders(); buf = new byte[headerBufferSize]; outputStreamOutputBuffer = new OutputStreamOutputBuffer(); filterLibrary = new OutputFilter[0]; activeFilters = new OutputFilter[0]; lastActiveFilter = -1; socketBuffer = new ByteChunk(); socketBuffer.setByteOutputChannel(this); committed = false; finished = false; }
/** * Return an array of all the header names set for this response, or * a zero-length array if no headers have been set. */ public String[] getHeaderNames() { checkResponse(); MimeHeaders headers = response.getMimeHeaders(); int n = headers.size(); String[] result = new String[n]; for (int i = 0; i < n; i++) { result[i] = headers.getName(i).toString(); } return result; }
/** * Return an array of all the header names set for this response, or * a zero-length array if no headers have been set. */ public String[] getHeaderNames() { checkResponse(); MimeHeaders headers = response.getMimeHeaders(); int n = headers.size(); String[] result = new String[n]; for (int i = 0; i < n; i++) { result[i] = headers.getName(i).toString(); } return result; }
protected void sendHeaders() { // Build the response header outputBuffer.sendStatus(); MimeHeaders headers = response.getMimeHeaders(); int size = headers.size(); for (int i = 0; i < size; i++) { outputBuffer.sendHeader(headers.getName(i), headers.getValue(i)); } outputBuffer.endHeaders(); }
/** * Intercept the request and decide if we cache the static resource. If the * static resource is already cached, return it. */ public int handle(Request req, int handlerCode) throws IOException{ if (fileCache == null) { return Interceptor.CONTINUE; } if (handlerCode == Interceptor.RESPONSE_PROCEEDED && fileCache.isEnabled()){ String docroot = SelectorThread.getSelector( socketChannel.socket().getLocalAddress(), socketChannel.socket().getLocalPort()).getWebAppRootPath(); String uri = req.requestURI().toString(); fileCache.add(FileCache.DEFAULT_SERVLET_NAME,docroot, uri, req.serverName().toString(), req.getResponse().getMimeHeaders(), false); } else if (handlerCode == Interceptor.REQUEST_LINE_PARSED) { if (fileCache.sendCache(req)){ return Interceptor.BREAK; } } return Interceptor.CONTINUE; }
request.getParameters().setLimit(getMaxRequestParameters()); response = createResponse(); response.getMimeHeaders().setMaxNumHeaders(getMaxResponseHeaders()); response.setHook(this);
/** * Alternate constructor. */ public SocketChannelOutputBuffer(Response response, int sendBufferSize, boolean useSocketBuffer) { super(); this.useSocketBuffer = useSocketBuffer; if (sendBufferSize > maxBufferedBytes){ maxBufferedBytes = sendBufferSize; } this.response = response; headers = response.getMimeHeaders(); outputStreamOutputBuffer = new OutputStreamOutputBuffer(); filterLibrary = new OutputFilter[0]; activeFilters = new OutputFilter[0]; lastActiveFilter = -1; committed = false; finished = false; if (!useSocketBuffer){ outputStream = new NIOOutputStream(); outputByteBuffer = createByteBuffer(sendBufferSize); } else { buf = new byte[sendBufferSize]; socketBuffer = new ByteChunk(); socketBuffer.setByteOutputChannel(this); } }
uri, req.serverName().toString(), req.getResponse().getMimeHeaders(), false); } else { uri, req.serverName().toString(), req.getResponse().getMimeHeaders(), false);
response.getMimeHeaders().getValue("Content-Encoding");
/** * Intercept the request and decide if we cache the static resource. If the * static resource is already cached, return it. */ public int handle(Request req, int handlerCode) throws IOException{ if (fileCache == null) return Interceptor.CONTINUE; if (handlerCode == Interceptor.RESPONSE_PROCEEDED && fileCache.isEnabled()){ String docroot = SelectorThread.getWebAppRootPath(); MessageBytes mb = req.requestURI(); String uri = req.requestURI().toString(); fileCache.add(FileCache.DEFAULT_SERVLET_NAME,docroot,uri, req.getResponse().getMimeHeaders(),false); } else if (handlerCode == Interceptor.REQUEST_LINE_PARSED) { ByteChunk requestURI = req.requestURI().getByteChunk(); if (fileCache.sendCache(requestURI.getBytes(), requestURI.getStart(), requestURI.getLength(), socketChannel, keepAlive(req))){ return Interceptor.BREAK; } } return Interceptor.CONTINUE; }
response.getMimeHeaders().getValue("Content-Encoding");