Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. The ASF licenses this file to You
* under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License. For additional information regarding
* copyright in this work, please see the NOTICE file in the top level
* directory of this distribution.
*/
package org.apache.abdera.protocol.server.context;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.activation.MimeType;
import org.apache.abdera.i18n.text.Localizer;
import org.apache.abdera.i18n.text.Rfc2047Helper;
import org.apache.abdera.i18n.text.UrlEncoding;
import org.apache.abdera.i18n.text.CharUtils.Profile;
import org.apache.abdera.protocol.server.ResponseContext;
import org.apache.abdera.protocol.util.AbstractResponse;
import org.apache.abdera.util.EntityTag;
import org.apache.abdera.writer.Writer;
public abstract class AbstractResponseContext extends AbstractResponse implements ResponseContext {
protected static final String[] EMPTY = new String[0];
protected int status = 0;
protected String status_text = null;
protected Writer writer = null;
protected boolean binary = false;
protected Map headers = null;
public ResponseContext setBinary(boolean binary) {
this.binary = binary;
return this;
}
public boolean isBinary() {
return binary;
}
public ResponseContext removeHeader(String name) {
Map headers = getHeaders();
headers.remove(name);
return this;
}
public ResponseContext setEncodedHeader(String name, String charset, String value) {
return setHeader(name, Rfc2047Helper.encode(value, charset));
}
public ResponseContext setEncodedHeader(String name, String charset, String... vals) {
Object[] evals = new Object[vals.length];
for (int n = 0; n < vals.length; n++) {
evals[n] = Rfc2047Helper.encode(vals[n], charset);
}
return setHeader(name, evals);
}
public ResponseContext setEscapedHeader(String name, Profile profile, String value) {
return setHeader(name, UrlEncoding.encode(value, profile.filter()));
}
public ResponseContext setHeader(String name, Object value) {
return setHeader(name, new Object[] {value});
}
public ResponseContext setHeader(String name, Object... vals) {
Map headers = getHeaders();
List