有一个接口,里面实现了若干的类,这时有一个类实现了这个接口,重写了里面的一些方法,但是有一些方法不重写,也没有在类中重新申明这个方法,这样竟然不会报错?????
解决方案 »
- 关于一个类调用另外一个类的方法的问题.
- Exception in thread "main" java.lang.NullPointerException 各位大大帮忙看一下吧
- java 继承 instanceof 问题
- 关于java编程思想的一个源代码
- 2007年最新技术
- 怎样在java代码中登陆一个网站?
- java.net.URL url = getClass().getResource(s);中的getClass(),和getResource(s)是什么意思啊?
- ★★★!!对面的大虾看过来!!★★★
- 简单问题:类与对象的区别?
- 我下了JB 企业版 不知如何安装?
- 关于JAVA聊天程序
- 如何能打开jsp就直接执行action
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* 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.
*/
package org.apache.catalina;
import java.security.Principal;
import java.util.Locale;
import javax.servlet.http.Cookie;
/**
* An <b>HttpRequest</b> is the Catalina internal facade for an
* <code>HttpServletRequest</code> that is to be processed, in order to
* produce the corresponding <code>HttpResponse</code>.
*
* @author Craig R. McClanahan
* @version $Revision: 466595 $ $Date: 2006-10-21 23:24:41 +0100 (Sat, 21 Oct 2006) $
*/public interface HttpRequest extends Request {
// --------------------------------------------------------- Public Methods
/**
* Add a Cookie to the set of Cookies associated with this Request.
*
* @param cookie The new cookie
*/
public void addCookie(Cookie cookie);
/**
* Add a Header to the set of Headers associated with this Request.
*
* @param name The new header name
* @param value The new header value
*/
public void addHeader(String name, String value);
/**
* Add a Locale to the set of preferred Locales for this Request. The
* first added Locale will be the first one returned by getLocales().
*
* @param locale The new preferred Locale
*/
public void addLocale(Locale locale);
/**
* Add a parameter name and corresponding set of values to this Request.
* (This is used when restoring the original request on a form based
* login).
*
* @param name Name of this request parameter
* @param values Corresponding values for this request parameter
*/
public void addParameter(String name, String values[]);
/**
* Clear the collection of Cookies associated with this Request.
*/
public void clearCookies();
/**
* Clear the collection of Headers associated with this Request.
*/
public void clearHeaders();
/**
* Clear the collection of Locales associated with this Request.
*/
public void clearLocales();
/**
* Clear the collection of parameters associated with this Request.
*/
public void clearParameters();
/**
* Set the authentication type used for this request, if any; otherwise
* set the type to <code>null</code>. Typical values are "BASIC",
* "DIGEST", or "SSL".
*
* @param type The authentication type used
*/
public void setAuthType(String type); /**
* Set the context path for this Request. This will normally be called
* when the associated Context is mapping the Request to a particular
* Wrapper.
*
* @param path The context path
*/
public void setContextPath(String path);
/**
* Set the HTTP request method used for this Request.
*
* @param method The request method
*/
public void setMethod(String method);
/**
* Set the query string for this Request. This will normally be called
* by the HTTP Connector, when it parses the request headers.
*
* @param query The query string
*/
public void setQueryString(String query);
/**
* Set the path information for this Request. This will normally be called
* when the associated Context is mapping the Request to a particular
* Wrapper.
*
* @param path The path information
*/
public void setPathInfo(String path);
/**
* Set a flag indicating whether or not the requested session ID for this
* request came in through a cookie. This is normally called by the
* HTTP Connector, when it parses the request headers.
*
* @param flag The new flag
*/
public void setRequestedSessionCookie(boolean flag);
/**
* Set the requested session ID for this request. This is normally called
* by the HTTP Connector, when it parses the request headers.
*
* @param id The new session id
*/
public void setRequestedSessionId(String id);
/**
* Set a flag indicating whether or not the requested session ID for this
* request came in through a URL. This is normally called by the
* HTTP Connector, when it parses the request headers.
*
* @param flag The new flag
*/
public void setRequestedSessionURL(boolean flag);
/**
* Set the unparsed request URI for this Request. This will normally be
* called by the HTTP Connector, when it parses the request headers.
*
* @param uri The request URI
*/
public void setRequestURI(String uri);
/**
* Set the decoded request URI.
*
* @param uri The decoded request URI
*/
public void setDecodedRequestURI(String uri);
/**
* Get the decoded request URI.
*
* @return the URL decoded request URI
*/
public String getDecodedRequestURI();
/**
* Set the servlet path for this Request. This will normally be called
* when the associated Context is mapping the Request to a particular
* Wrapper.
*
* @param path The servlet path
*/
public void setServletPath(String path);
/**
* Set the Principal who has been authenticated for this Request. This
* value is also used to calculate the value to be returned by the
* <code>getRemoteUser()</code> method.
*
* @param principal The user Principal
*/
public void setUserPrincipal(Principal principal);
}
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* 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.
*/
package org.apache.catalina.connector;
import java.security.Principal;
import java.util.Locale;
import javax.servlet.http.Cookie;
import org.apache.catalina.HttpRequest;
/**
* Abstract convenience class that wraps a Catalina-internal <b>HttpRequest</b>
* object. By default, all methods are delegated to the wrapped request,
* but subclasses can override individual methods as required to provide the
* functionality that they require.
*
* @author Craig R. McClanahan
* @version $Revision: 466595 $ $Date: 2006-10-21 23:24:41 +0100 (Sat, 21 Oct 2006) $
* @deprecated
*/public abstract class HttpRequestWrapper
extends RequestWrapper
implements HttpRequest {
// ----------------------------------------------------------- Constructors
/**
* Construct a wrapper for the specified request.
*
* @param request The request to be wrapped
*/
public HttpRequestWrapper(HttpRequest request) { super(request); }
// --------------------------------------------------------- Public Methods
/**
* Add a Cookie to the set of Cookies associated with this Request.
*
* @param cookie The new cookie
*/
public void addCookie(Cookie cookie) { ((HttpRequest) request).addCookie(cookie); }
/**
* Add a Header to the set of Headers associated with this Request.
*
* @param name The new header name
* @param value The new header value
*/
public void addHeader(String name, String value) { ((HttpRequest) request).addHeader(name, value); }
/**
* Add a Locale to the set of preferred Locales for this Request. The
* first added Locale will be the first one returned by getLocales().
*
* @param locale The new preferred Locale
*/
public void addLocale(Locale locale) { ((HttpRequest) request).addLocale(locale); }
/**
* Clear the collection of Cookies associated with this Request.
*/
public void clearCookies() { ((HttpRequest) request).clearCookies(); }
/**
* Clear the collection of Headers associated with this Request.
*/
public void clearHeaders() { ((HttpRequest) request).clearHeaders(); }
/**
* Clear the collection of Locales associated with this Request.
*/
public void clearLocales() { ((HttpRequest) request).clearLocales(); }
/**
* Set the authentication type used for this request, if any; otherwise
* set the type to <code>null</code>. Typical values are "BASIC",
* "DIGEST", or "SSL".
*
* @param type The authentication type used
*/
public void setAuthType(String type) { ((HttpRequest) request).setAuthType(type); }
/**
* Set the context path for this Request. This will normally be called
* when the associated Context is mapping the Request to a particular
* Wrapper.
*
* @param path The context path
*/
public void setContextPath(String path) { ((HttpRequest) request).setContextPath(path); }
/**
* Set the HTTP request method used for this Request.
*
* @param method The request method
*/
public void setMethod(String method) { ((HttpRequest) request).setMethod(method); }
/**
* Set the query string for this Request. This will normally be called
* by the HTTP Connector, when it parses the request headers.
*
* @param query The query string
*/
public void setQueryString(String query) { ((HttpRequest) request).setQueryString(query); }
/**
* Set the path information for this Request. This will normally be called
* when the associated Context is mapping the Request to a particular
* Wrapper.
*
* @param path The path information
*/
public void setPathInfo(String path) { ((HttpRequest) request).setPathInfo(path); }
/**
* Set a flag indicating whether or not the requested session ID for this
* request came in through a cookie. This is normally called by the
* HTTP Connector, when it parses the request headers.
*
* @param flag The new flag
*/
public void setRequestedSessionCookie(boolean flag) { ((HttpRequest) request).setRequestedSessionCookie(flag); }
/**
* Set the requested session ID for this request. This is normally called
* by the HTTP Connector, when it parses the request headers.
*
* @param id The new session id
*/
public void setRequestedSessionId(String id) { ((HttpRequest) request).setRequestedSessionId(id); }
/**
* Set a flag indicating whether or not the requested session ID for this
* request came in through a URL. This is normally called by the
* HTTP Connector, when it parses the request headers.
*
* @param flag The new flag
*/
public void setRequestedSessionURL(boolean flag) { ((HttpRequest) request).setRequestedSessionURL(flag); }
/**
* Set the unparsed request URI for this Request. This will normally be
* called by the HTTP Connector, when it parses the request headers.
*
* @param uri The request URI
*/
public void setRequestURI(String uri) { ((HttpRequest) request).setRequestURI(uri); }
/**
* Set the servlet path for this Request. This will normally be called
* when the associated Context is mapping the Request to a particular
* Wrapper.
*
* @param path The servlet path
*/
public void setServletPath(String path) { ((HttpRequest) request).setServletPath(path); }
/**
* Set the Principal who has been authenticated for this Request. This
* value is also used to calculate the value to be returned by the
* <code>getRemoteUser()</code> method.
*
* @param principal The user Principal
*/
public void setUserPrincipal(Principal principal) { ((HttpRequest) request).setUserPrincipal(principal); }
}HttpRequestWrapper类竟然可以不用去重写一下HttpRequest声明的方法,最算没有重写,也没有重新申明一下接口里面的方法,这是啥情况阿????