init
This commit is contained in:
@@ -0,0 +1,122 @@
|
||||
/*
|
||||
* 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.tomcat.util.descriptor.web;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
/**
|
||||
* Representation of a context initialization parameter that is configured
|
||||
* in the server configuration file, rather than the application deployment
|
||||
* descriptor. This is convenient for establishing default values (which
|
||||
* may be configured to allow application overrides or not) without having
|
||||
* to modify the application deployment descriptor itself.
|
||||
*
|
||||
* @author Craig R. McClanahan
|
||||
*/
|
||||
public class ApplicationParameter implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
// ------------------------------------------------------------- Properties
|
||||
|
||||
|
||||
/**
|
||||
* The description of this environment entry.
|
||||
*/
|
||||
private String description = null;
|
||||
|
||||
public String getDescription() {
|
||||
return this.description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The name of this application parameter.
|
||||
*/
|
||||
private String name = null;
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Does this application parameter allow overrides by the application
|
||||
* deployment descriptor?
|
||||
*/
|
||||
private boolean override = true;
|
||||
|
||||
public boolean getOverride() {
|
||||
return this.override;
|
||||
}
|
||||
|
||||
public void setOverride(boolean override) {
|
||||
this.override = override;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The value of this application parameter.
|
||||
*/
|
||||
private String value = null;
|
||||
|
||||
public String getValue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------- Public Methods
|
||||
|
||||
|
||||
/**
|
||||
* Return a String representation of this object.
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
|
||||
StringBuilder sb = new StringBuilder("ApplicationParameter[");
|
||||
sb.append("name=");
|
||||
sb.append(name);
|
||||
if (description != null) {
|
||||
sb.append(", description=");
|
||||
sb.append(description);
|
||||
}
|
||||
sb.append(", value=");
|
||||
sb.append(value);
|
||||
sb.append(", override=");
|
||||
sb.append(override);
|
||||
sb.append("]");
|
||||
return sb.toString();
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
26
java/org/apache/tomcat/util/descriptor/web/Constants.java
Normal file
26
java/org/apache/tomcat/util/descriptor/web/Constants.java
Normal file
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* 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.tomcat.util.descriptor.web;
|
||||
|
||||
public class Constants {
|
||||
|
||||
public static final String PACKAGE_NAME =
|
||||
Constants.class.getPackage().getName();
|
||||
|
||||
public static final String WEB_XML_LOCATION = "/WEB-INF/web.xml";
|
||||
|
||||
}
|
||||
162
java/org/apache/tomcat/util/descriptor/web/ContextEjb.java
Normal file
162
java/org/apache/tomcat/util/descriptor/web/ContextEjb.java
Normal file
@@ -0,0 +1,162 @@
|
||||
/*
|
||||
* 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.tomcat.util.descriptor.web;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Representation of an EJB resource reference for a web application, as
|
||||
* represented in a <code><ejb-ref></code> element in the
|
||||
* deployment descriptor.
|
||||
*
|
||||
* @author Craig R. McClanahan
|
||||
* @author Peter Rossbach (pero@apache.org)
|
||||
*/
|
||||
public class ContextEjb extends ResourceBase {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
// ------------------------------------------------------------- Properties
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* The name of the EJB home implementation class.
|
||||
*/
|
||||
private String home = null;
|
||||
|
||||
public String getHome() {
|
||||
return this.home;
|
||||
}
|
||||
|
||||
public void setHome(String home) {
|
||||
this.home = home;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The link to a J2EE EJB definition.
|
||||
*/
|
||||
private String link = null;
|
||||
|
||||
public String getLink() {
|
||||
return this.link;
|
||||
}
|
||||
|
||||
public void setLink(String link) {
|
||||
this.link = link;
|
||||
}
|
||||
|
||||
/**
|
||||
* The name of the EJB remote implementation class.
|
||||
*/
|
||||
private String remote = null;
|
||||
|
||||
public String getRemote() {
|
||||
return this.remote;
|
||||
}
|
||||
|
||||
public void setRemote(String remote) {
|
||||
this.remote = remote;
|
||||
}
|
||||
|
||||
|
||||
// --------------------------------------------------------- Public Methods
|
||||
|
||||
|
||||
/**
|
||||
* Return a String representation of this object.
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
|
||||
StringBuilder sb = new StringBuilder("ContextEjb[");
|
||||
sb.append("name=");
|
||||
sb.append(getName());
|
||||
if (getDescription() != null) {
|
||||
sb.append(", description=");
|
||||
sb.append(getDescription());
|
||||
}
|
||||
if (getType() != null) {
|
||||
sb.append(", type=");
|
||||
sb.append(getType());
|
||||
}
|
||||
if (home != null) {
|
||||
sb.append(", home=");
|
||||
sb.append(home);
|
||||
}
|
||||
if (remote != null) {
|
||||
sb.append(", remote=");
|
||||
sb.append(remote);
|
||||
}
|
||||
if (link != null) {
|
||||
sb.append(", link=");
|
||||
sb.append(link);
|
||||
}
|
||||
sb.append("]");
|
||||
return sb.toString();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = super.hashCode();
|
||||
result = prime * result + ((home == null) ? 0 : home.hashCode());
|
||||
result = prime * result + ((link == null) ? 0 : link.hashCode());
|
||||
result = prime * result + ((remote == null) ? 0 : remote.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (!super.equals(obj)) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
ContextEjb other = (ContextEjb) obj;
|
||||
if (home == null) {
|
||||
if (other.home != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!home.equals(other.home)) {
|
||||
return false;
|
||||
}
|
||||
if (link == null) {
|
||||
if (other.link != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!link.equals(other.link)) {
|
||||
return false;
|
||||
}
|
||||
if (remote == null) {
|
||||
if (other.remote != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!remote.equals(other.remote)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,129 @@
|
||||
/*
|
||||
* 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.tomcat.util.descriptor.web;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Representation of an application environment entry, as represented in
|
||||
* an <code><env-entry></code> element in the deployment descriptor.
|
||||
*
|
||||
* @author Craig R. McClanahan
|
||||
*/
|
||||
public class ContextEnvironment extends ResourceBase {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
// ------------------------------------------------------------- Properties
|
||||
|
||||
|
||||
/**
|
||||
* Does this environment entry allow overrides by the application
|
||||
* deployment descriptor?
|
||||
*/
|
||||
private boolean override = true;
|
||||
|
||||
public boolean getOverride() {
|
||||
return this.override;
|
||||
}
|
||||
|
||||
public void setOverride(boolean override) {
|
||||
this.override = override;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The value of this environment entry.
|
||||
*/
|
||||
private String value = null;
|
||||
|
||||
public String getValue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
|
||||
// --------------------------------------------------------- Public Methods
|
||||
|
||||
|
||||
/**
|
||||
* Return a String representation of this object.
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
|
||||
StringBuilder sb = new StringBuilder("ContextEnvironment[");
|
||||
sb.append("name=");
|
||||
sb.append(getName());
|
||||
if (getDescription() != null) {
|
||||
sb.append(", description=");
|
||||
sb.append(getDescription());
|
||||
}
|
||||
if (getType() != null) {
|
||||
sb.append(", type=");
|
||||
sb.append(getType());
|
||||
}
|
||||
if (value != null) {
|
||||
sb.append(", value=");
|
||||
sb.append(value);
|
||||
}
|
||||
sb.append(", override=");
|
||||
sb.append(override);
|
||||
sb.append("]");
|
||||
return sb.toString();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = super.hashCode();
|
||||
result = prime * result + (override ? 1231 : 1237);
|
||||
result = prime * result + ((value == null) ? 0 : value.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (!super.equals(obj)) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
ContextEnvironment other = (ContextEnvironment) obj;
|
||||
if (override != other.override) {
|
||||
return false;
|
||||
}
|
||||
if (value == null) {
|
||||
if (other.value != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!value.equals(other.value)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
212
java/org/apache/tomcat/util/descriptor/web/ContextHandler.java
Normal file
212
java/org/apache/tomcat/util/descriptor/web/ContextHandler.java
Normal file
@@ -0,0 +1,212 @@
|
||||
/*
|
||||
* 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.tomcat.util.descriptor.web;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
|
||||
|
||||
/**
|
||||
* Representation of a handler reference for a web service, as
|
||||
* represented in a <code><handler></code> element in the
|
||||
* deployment descriptor.
|
||||
*
|
||||
* @author Fabien Carrion
|
||||
*/
|
||||
public class ContextHandler extends ResourceBase {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
// ------------------------------------------------------------- Properties
|
||||
|
||||
|
||||
/**
|
||||
* The Handler reference class.
|
||||
*/
|
||||
private String handlerclass = null;
|
||||
|
||||
public String getHandlerclass() {
|
||||
return this.handlerclass;
|
||||
}
|
||||
|
||||
public void setHandlerclass(String handlerclass) {
|
||||
this.handlerclass = handlerclass;
|
||||
}
|
||||
|
||||
/**
|
||||
* A list of QName specifying the SOAP Headers the handler will work on.
|
||||
* -namespace and localpart values must be found inside the WSDL.
|
||||
*
|
||||
* A service-qname is composed by a namespaceURI and a localpart.
|
||||
*
|
||||
* soapHeader[0] : namespaceURI
|
||||
* soapHeader[1] : localpart
|
||||
*/
|
||||
private final HashMap<String, String> soapHeaders = new HashMap<>();
|
||||
|
||||
public Iterator<String> getLocalparts() {
|
||||
return soapHeaders.keySet().iterator();
|
||||
}
|
||||
|
||||
public String getNamespaceuri(String localpart) {
|
||||
return soapHeaders.get(localpart);
|
||||
}
|
||||
|
||||
public void addSoapHeaders(String localpart, String namespaceuri) {
|
||||
soapHeaders.put(localpart, namespaceuri);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a configured property.
|
||||
* @param name The property name
|
||||
* @param value The property value
|
||||
*/
|
||||
public void setProperty(String name, String value) {
|
||||
this.setProperty(name, (Object) value);
|
||||
}
|
||||
|
||||
/**
|
||||
* The soapRole.
|
||||
*/
|
||||
private final ArrayList<String> soapRoles = new ArrayList<>();
|
||||
|
||||
public String getSoapRole(int i) {
|
||||
return this.soapRoles.get(i);
|
||||
}
|
||||
|
||||
public int getSoapRolesSize() {
|
||||
return this.soapRoles.size();
|
||||
}
|
||||
|
||||
public void addSoapRole(String soapRole) {
|
||||
this.soapRoles.add(soapRole);
|
||||
}
|
||||
|
||||
/**
|
||||
* The portName.
|
||||
*/
|
||||
private final ArrayList<String> portNames = new ArrayList<>();
|
||||
|
||||
public String getPortName(int i) {
|
||||
return this.portNames.get(i);
|
||||
}
|
||||
|
||||
public int getPortNamesSize() {
|
||||
return this.portNames.size();
|
||||
}
|
||||
|
||||
public void addPortName(String portName) {
|
||||
this.portNames.add(portName);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------- Public Methods
|
||||
|
||||
|
||||
/**
|
||||
* Return a String representation of this object.
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
|
||||
StringBuilder sb = new StringBuilder("ContextHandler[");
|
||||
sb.append("name=");
|
||||
sb.append(getName());
|
||||
if (handlerclass != null) {
|
||||
sb.append(", class=");
|
||||
sb.append(handlerclass);
|
||||
}
|
||||
if (this.soapHeaders != null) {
|
||||
sb.append(", soap-headers=");
|
||||
sb.append(this.soapHeaders);
|
||||
}
|
||||
if (this.getSoapRolesSize() > 0) {
|
||||
sb.append(", soap-roles=");
|
||||
sb.append(soapRoles);
|
||||
}
|
||||
if (this.getPortNamesSize() > 0) {
|
||||
sb.append(", port-name=");
|
||||
sb.append(portNames);
|
||||
}
|
||||
if (this.listProperties() != null) {
|
||||
sb.append(", init-param=");
|
||||
sb.append(this.listProperties());
|
||||
}
|
||||
sb.append("]");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = super.hashCode();
|
||||
result = prime * result +
|
||||
((handlerclass == null) ? 0 : handlerclass.hashCode());
|
||||
result = prime * result +
|
||||
((portNames == null) ? 0 : portNames.hashCode());
|
||||
result = prime * result +
|
||||
((soapHeaders == null) ? 0 : soapHeaders.hashCode());
|
||||
result = prime * result +
|
||||
((soapRoles == null) ? 0 : soapRoles.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (!super.equals(obj)) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
ContextHandler other = (ContextHandler) obj;
|
||||
if (handlerclass == null) {
|
||||
if (other.handlerclass != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!handlerclass.equals(other.handlerclass)) {
|
||||
return false;
|
||||
}
|
||||
if (portNames == null) {
|
||||
if (other.portNames != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!portNames.equals(other.portNames)) {
|
||||
return false;
|
||||
}
|
||||
if (soapHeaders == null) {
|
||||
if (other.soapHeaders != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!soapHeaders.equals(other.soapHeaders)) {
|
||||
return false;
|
||||
}
|
||||
if (soapRoles == null) {
|
||||
if (other.soapRoles != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!soapRoles.equals(other.soapRoles)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
160
java/org/apache/tomcat/util/descriptor/web/ContextLocalEjb.java
Normal file
160
java/org/apache/tomcat/util/descriptor/web/ContextLocalEjb.java
Normal file
@@ -0,0 +1,160 @@
|
||||
/*
|
||||
* 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.tomcat.util.descriptor.web;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Representation of a local EJB resource reference for a web application, as
|
||||
* represented in a <code><ejb-local-ref></code> element in the
|
||||
* deployment descriptor.
|
||||
*
|
||||
* @author Craig R. McClanahan
|
||||
* @author Peter Rossbach (pero@apache.org)
|
||||
*/
|
||||
public class ContextLocalEjb extends ResourceBase {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
// ------------------------------------------------------------- Properties
|
||||
|
||||
/**
|
||||
* The name of the EJB home implementation class.
|
||||
*/
|
||||
private String home = null;
|
||||
|
||||
public String getHome() {
|
||||
return this.home;
|
||||
}
|
||||
|
||||
public void setHome(String home) {
|
||||
this.home = home;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The link to a J2EE EJB definition.
|
||||
*/
|
||||
private String link = null;
|
||||
|
||||
public String getLink() {
|
||||
return this.link;
|
||||
}
|
||||
|
||||
public void setLink(String link) {
|
||||
this.link = link;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The name of the EJB local implementation class.
|
||||
*/
|
||||
private String local = null;
|
||||
|
||||
public String getLocal() {
|
||||
return this.local;
|
||||
}
|
||||
|
||||
public void setLocal(String local) {
|
||||
this.local = local;
|
||||
}
|
||||
|
||||
|
||||
// --------------------------------------------------------- Public Methods
|
||||
|
||||
|
||||
/**
|
||||
* Return a String representation of this object.
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
|
||||
StringBuilder sb = new StringBuilder("ContextLocalEjb[");
|
||||
sb.append("name=");
|
||||
sb.append(getName());
|
||||
if (getDescription() != null) {
|
||||
sb.append(", description=");
|
||||
sb.append(getDescription());
|
||||
}
|
||||
if (getType() != null) {
|
||||
sb.append(", type=");
|
||||
sb.append(getType());
|
||||
}
|
||||
if (home != null) {
|
||||
sb.append(", home=");
|
||||
sb.append(home);
|
||||
}
|
||||
if (link != null) {
|
||||
sb.append(", link=");
|
||||
sb.append(link);
|
||||
}
|
||||
if (local != null) {
|
||||
sb.append(", local=");
|
||||
sb.append(local);
|
||||
}
|
||||
sb.append("]");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = super.hashCode();
|
||||
result = prime * result + ((home == null) ? 0 : home.hashCode());
|
||||
result = prime * result + ((link == null) ? 0 : link.hashCode());
|
||||
result = prime * result + ((local == null) ? 0 : local.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (!super.equals(obj)) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
ContextLocalEjb other = (ContextLocalEjb) obj;
|
||||
if (home == null) {
|
||||
if (other.home != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!home.equals(other.home)) {
|
||||
return false;
|
||||
}
|
||||
if (link == null) {
|
||||
if (other.link != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!link.equals(other.link)) {
|
||||
return false;
|
||||
}
|
||||
if (local == null) {
|
||||
if (other.local != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!local.equals(other.local)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
188
java/org/apache/tomcat/util/descriptor/web/ContextResource.java
Normal file
188
java/org/apache/tomcat/util/descriptor/web/ContextResource.java
Normal file
@@ -0,0 +1,188 @@
|
||||
/*
|
||||
* 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.tomcat.util.descriptor.web;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Representation of a resource reference for a web application, as
|
||||
* represented in a <code><resource-ref></code> element in the
|
||||
* deployment descriptor.
|
||||
*
|
||||
* @author Craig R. McClanahan
|
||||
* @author Peter Rossbach (pero@apache.org)
|
||||
*/
|
||||
public class ContextResource extends ResourceBase {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
// ------------------------------------------------------------- Properties
|
||||
|
||||
|
||||
/**
|
||||
* The authorization requirement for this resource
|
||||
* (<code>Application</code> or <code>Container</code>).
|
||||
*/
|
||||
private String auth = null;
|
||||
|
||||
public String getAuth() {
|
||||
return this.auth;
|
||||
}
|
||||
|
||||
public void setAuth(String auth) {
|
||||
this.auth = auth;
|
||||
}
|
||||
|
||||
/**
|
||||
* The sharing scope of this resource factory (<code>Shareable</code>
|
||||
* or <code>Unshareable</code>).
|
||||
*/
|
||||
private String scope = "Shareable";
|
||||
|
||||
public String getScope() {
|
||||
return this.scope;
|
||||
}
|
||||
|
||||
public void setScope(String scope) {
|
||||
this.scope = scope;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Is this resource known to be a singleton resource. The default value is
|
||||
* true since this is what users expect although the JavaEE spec implies
|
||||
* that the default should be false.
|
||||
*/
|
||||
private boolean singleton = true;
|
||||
|
||||
public boolean getSingleton() {
|
||||
return singleton;
|
||||
}
|
||||
|
||||
public void setSingleton(boolean singleton) {
|
||||
this.singleton = singleton;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The name of the zero argument method to be called when the resource is
|
||||
* no longer required to clean-up resources. This method must only speed up
|
||||
* the clean-up of resources that would otherwise happen via garbage
|
||||
* collection.
|
||||
*/
|
||||
private String closeMethod = null;
|
||||
private boolean closeMethodConfigured = false;
|
||||
|
||||
public String getCloseMethod() {
|
||||
return closeMethod;
|
||||
}
|
||||
|
||||
public void setCloseMethod(String closeMethod) {
|
||||
closeMethodConfigured = true;
|
||||
this.closeMethod = closeMethod;
|
||||
}
|
||||
|
||||
public boolean getCloseMethodConfigured() {
|
||||
return closeMethodConfigured;
|
||||
}
|
||||
|
||||
|
||||
// --------------------------------------------------------- Public Methods
|
||||
|
||||
|
||||
/**
|
||||
* Return a String representation of this object.
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
|
||||
StringBuilder sb = new StringBuilder("ContextResource[");
|
||||
sb.append("name=");
|
||||
sb.append(getName());
|
||||
if (getDescription() != null) {
|
||||
sb.append(", description=");
|
||||
sb.append(getDescription());
|
||||
}
|
||||
if (getType() != null) {
|
||||
sb.append(", type=");
|
||||
sb.append(getType());
|
||||
}
|
||||
if (auth != null) {
|
||||
sb.append(", auth=");
|
||||
sb.append(auth);
|
||||
}
|
||||
if (scope != null) {
|
||||
sb.append(", scope=");
|
||||
sb.append(scope);
|
||||
}
|
||||
sb.append("]");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = super.hashCode();
|
||||
result = prime * result + ((auth == null) ? 0 : auth.hashCode());
|
||||
result = prime * result +
|
||||
((closeMethod == null) ? 0 : closeMethod.hashCode());
|
||||
result = prime * result + ((scope == null) ? 0 : scope.hashCode());
|
||||
result = prime * result + (singleton ? 1231 : 1237);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (!super.equals(obj)) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
ContextResource other = (ContextResource) obj;
|
||||
if (auth == null) {
|
||||
if (other.auth != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!auth.equals(other.auth)) {
|
||||
return false;
|
||||
}
|
||||
if (closeMethod == null) {
|
||||
if (other.closeMethod != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!closeMethod.equals(other.closeMethod)) {
|
||||
return false;
|
||||
}
|
||||
if (scope == null) {
|
||||
if (other.scope != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!scope.equals(other.scope)) {
|
||||
return false;
|
||||
}
|
||||
if (singleton != other.singleton) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
/*
|
||||
* 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.tomcat.util.descriptor.web;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Representation of an application resource reference, as represented in
|
||||
* an <code><res-env-refy></code> element in the deployment descriptor.
|
||||
*
|
||||
* @author Craig R. McClanahan
|
||||
* @author Peter Rossbach (pero@apache.org)
|
||||
*/
|
||||
public class ContextResourceEnvRef extends ResourceBase {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
// ------------------------------------------------------------- Properties
|
||||
|
||||
/**
|
||||
* Does this environment entry allow overrides by the application
|
||||
* deployment descriptor?
|
||||
*/
|
||||
private boolean override = true;
|
||||
|
||||
public boolean getOverride() {
|
||||
return this.override;
|
||||
}
|
||||
|
||||
public void setOverride(boolean override) {
|
||||
this.override = override;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------- Public Methods
|
||||
|
||||
|
||||
/**
|
||||
* Return a String representation of this object.
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
|
||||
StringBuilder sb = new StringBuilder("ContextResourceEnvRef[");
|
||||
sb.append("name=");
|
||||
sb.append(getName());
|
||||
if (getType() != null) {
|
||||
sb.append(", type=");
|
||||
sb.append(getType());
|
||||
}
|
||||
sb.append(", override=");
|
||||
sb.append(override);
|
||||
sb.append("]");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = super.hashCode();
|
||||
result = prime * result + (override ? 1231 : 1237);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (!super.equals(obj)) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
ContextResourceEnvRef other = (ContextResourceEnvRef) obj;
|
||||
if (override != other.override) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,122 @@
|
||||
/*
|
||||
* 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.tomcat.util.descriptor.web;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Representation of a resource link for a web application, as
|
||||
* represented in a <code><ResourceLink></code> element in the
|
||||
* server configuration file.
|
||||
*
|
||||
* @author Remy Maucherat
|
||||
* @author Peter Rossbach (Peter Rossbach (pero@apache.org))
|
||||
*/
|
||||
public class ContextResourceLink extends ResourceBase {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
// ------------------------------------------------------------- Properties
|
||||
|
||||
/**
|
||||
* The global name of this resource.
|
||||
*/
|
||||
private String global = null;
|
||||
/**
|
||||
* The factory to be used for creating the object
|
||||
*/
|
||||
private String factory = null;
|
||||
|
||||
public String getGlobal() {
|
||||
return this.global;
|
||||
}
|
||||
|
||||
public void setGlobal(String global) {
|
||||
this.global = global;
|
||||
}
|
||||
|
||||
public String getFactory() {
|
||||
return factory;
|
||||
}
|
||||
|
||||
public void setFactory(String factory) {
|
||||
this.factory = factory;
|
||||
}
|
||||
// --------------------------------------------------------- Public Methods
|
||||
|
||||
|
||||
/**
|
||||
* Return a String representation of this object.
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
|
||||
StringBuilder sb = new StringBuilder("ContextResourceLink[");
|
||||
sb.append("name=");
|
||||
sb.append(getName());
|
||||
if (getType() != null) {
|
||||
sb.append(", type=");
|
||||
sb.append(getType());
|
||||
}
|
||||
if (getGlobal() != null) {
|
||||
sb.append(", global=");
|
||||
sb.append(getGlobal());
|
||||
}
|
||||
sb.append("]");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = super.hashCode();
|
||||
result = prime * result + ((factory == null) ? 0 : factory.hashCode());
|
||||
result = prime * result + ((global == null) ? 0 : global.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (!super.equals(obj)) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
ContextResourceLink other = (ContextResourceLink) obj;
|
||||
if (factory == null) {
|
||||
if (other.factory != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!factory.equals(other.factory)) {
|
||||
return false;
|
||||
}
|
||||
if (global == null) {
|
||||
if (other.global != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!global.equals(other.global)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
355
java/org/apache/tomcat/util/descriptor/web/ContextService.java
Normal file
355
java/org/apache/tomcat/util/descriptor/web/ContextService.java
Normal file
@@ -0,0 +1,355 @@
|
||||
/*
|
||||
* 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.tomcat.util.descriptor.web;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
|
||||
|
||||
/**
|
||||
* Representation of a web service reference for a web application, as
|
||||
* represented in a <code><service-ref></code> element in the
|
||||
* deployment descriptor.
|
||||
*
|
||||
* @author Fabien Carrion
|
||||
*/
|
||||
public class ContextService extends ResourceBase {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
// ------------------------------------------------------------- Properties
|
||||
|
||||
|
||||
/**
|
||||
* The WebService reference name.
|
||||
*/
|
||||
private String displayname = null;
|
||||
|
||||
public String getDisplayname() {
|
||||
return this.displayname;
|
||||
}
|
||||
|
||||
public void setDisplayname(String displayname) {
|
||||
this.displayname = displayname;
|
||||
}
|
||||
|
||||
/**
|
||||
* A large icon for this WebService.
|
||||
*/
|
||||
private String largeIcon = null;
|
||||
|
||||
public String getLargeIcon() {
|
||||
return this.largeIcon;
|
||||
}
|
||||
|
||||
public void setLargeIcon(String largeIcon) {
|
||||
this.largeIcon = largeIcon;
|
||||
}
|
||||
|
||||
/**
|
||||
* A small icon for this WebService.
|
||||
*/
|
||||
private String smallIcon = null;
|
||||
|
||||
public String getSmallIcon() {
|
||||
return this.smallIcon;
|
||||
}
|
||||
|
||||
public void setSmallIcon(String smallIcon) {
|
||||
this.smallIcon = smallIcon;
|
||||
}
|
||||
|
||||
/**
|
||||
* The fully qualified class name of the JAX-WS Service interface that the
|
||||
* client depends on.
|
||||
*/
|
||||
private String serviceInterface = null;
|
||||
|
||||
public String getInterface() {
|
||||
return serviceInterface;
|
||||
}
|
||||
|
||||
public void setInterface(String serviceInterface) {
|
||||
this.serviceInterface = serviceInterface;
|
||||
}
|
||||
|
||||
/**
|
||||
* Contains the location (relative to the root of
|
||||
* the module) of the web service WSDL description.
|
||||
*/
|
||||
private String wsdlfile = null;
|
||||
|
||||
public String getWsdlfile() {
|
||||
return this.wsdlfile;
|
||||
}
|
||||
|
||||
public void setWsdlfile(String wsdlfile) {
|
||||
this.wsdlfile = wsdlfile;
|
||||
}
|
||||
|
||||
/**
|
||||
* A file specifying the correlation of the WSDL definition
|
||||
* to the interfaces (Service Endpoint Interface, Service Interface).
|
||||
*/
|
||||
private String jaxrpcmappingfile = null;
|
||||
|
||||
public String getJaxrpcmappingfile() {
|
||||
return this.jaxrpcmappingfile;
|
||||
}
|
||||
|
||||
public void setJaxrpcmappingfile(String jaxrpcmappingfile) {
|
||||
this.jaxrpcmappingfile = jaxrpcmappingfile;
|
||||
}
|
||||
|
||||
/**
|
||||
* Declares the specific WSDL service element that is being referred to.
|
||||
* It is not specified if no wsdl-file is declared or if WSDL contains only
|
||||
* 1 service element.
|
||||
*
|
||||
* A service-qname is composed by a namespaceURI and a localpart.
|
||||
* It must be defined if more than 1 service is declared in the WSDL.
|
||||
*
|
||||
* serviceqname[0] : namespaceURI
|
||||
* serviceqname[1] : localpart
|
||||
*/
|
||||
private String[] serviceqname = new String[2];
|
||||
|
||||
public String[] getServiceqname() {
|
||||
return this.serviceqname;
|
||||
}
|
||||
|
||||
public String getServiceqname(int i) {
|
||||
return this.serviceqname[i];
|
||||
}
|
||||
|
||||
public String getServiceqnameNamespaceURI() {
|
||||
return this.serviceqname[0];
|
||||
}
|
||||
|
||||
public String getServiceqnameLocalpart() {
|
||||
return this.serviceqname[1];
|
||||
}
|
||||
|
||||
public void setServiceqname(String[] serviceqname) {
|
||||
this.serviceqname = serviceqname;
|
||||
}
|
||||
|
||||
public void setServiceqname(String serviceqname, int i) {
|
||||
this.serviceqname[i] = serviceqname;
|
||||
}
|
||||
|
||||
public void setServiceqnameNamespaceURI(String namespaceuri) {
|
||||
this.serviceqname[0] = namespaceuri;
|
||||
}
|
||||
|
||||
public void setServiceqnameLocalpart(String localpart) {
|
||||
this.serviceqname[1] = localpart;
|
||||
}
|
||||
|
||||
/**
|
||||
* Declares a client dependency on the container to resolving a Service Endpoint Interface
|
||||
* to a WSDL port. It optionally associates the Service Endpoint Interface with a
|
||||
* particular port-component.
|
||||
* @return the endpoint names
|
||||
*/
|
||||
public Iterator<String> getServiceendpoints() {
|
||||
return this.listProperties();
|
||||
}
|
||||
|
||||
public String getPortlink(String serviceendpoint) {
|
||||
return (String) this.getProperty(serviceendpoint);
|
||||
}
|
||||
|
||||
public void addPortcomponent(String serviceendpoint, String portlink) {
|
||||
if (portlink == null)
|
||||
portlink = "";
|
||||
this.setProperty(serviceendpoint, portlink);
|
||||
}
|
||||
|
||||
/**
|
||||
* A list of Handlers to use for this service-ref.
|
||||
*
|
||||
* The instantiation of the handler have to be done.
|
||||
*/
|
||||
private final HashMap<String, ContextHandler> handlers = new HashMap<>();
|
||||
|
||||
public Iterator<String> getHandlers() {
|
||||
return handlers.keySet().iterator();
|
||||
}
|
||||
|
||||
public ContextHandler getHandler(String handlername) {
|
||||
return handlers.get(handlername);
|
||||
}
|
||||
|
||||
public void addHandler(ContextHandler handler) {
|
||||
handlers.put(handler.getName(), handler);
|
||||
}
|
||||
|
||||
|
||||
// --------------------------------------------------------- Public Methods
|
||||
|
||||
|
||||
/**
|
||||
* Return a String representation of this object.
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
|
||||
StringBuilder sb = new StringBuilder("ContextService[");
|
||||
sb.append("name=");
|
||||
sb.append(getName());
|
||||
if (getDescription() != null) {
|
||||
sb.append(", description=");
|
||||
sb.append(getDescription());
|
||||
}
|
||||
if (getType() != null) {
|
||||
sb.append(", type=");
|
||||
sb.append(getType());
|
||||
}
|
||||
if (displayname != null) {
|
||||
sb.append(", displayname=");
|
||||
sb.append(displayname);
|
||||
}
|
||||
if (largeIcon != null) {
|
||||
sb.append(", largeIcon=");
|
||||
sb.append(largeIcon);
|
||||
}
|
||||
if (smallIcon != null) {
|
||||
sb.append(", smallIcon=");
|
||||
sb.append(smallIcon);
|
||||
}
|
||||
if (wsdlfile != null) {
|
||||
sb.append(", wsdl-file=");
|
||||
sb.append(wsdlfile);
|
||||
}
|
||||
if (jaxrpcmappingfile != null) {
|
||||
sb.append(", jaxrpc-mapping-file=");
|
||||
sb.append(jaxrpcmappingfile);
|
||||
}
|
||||
if (serviceqname[0] != null) {
|
||||
sb.append(", service-qname/namespaceURI=");
|
||||
sb.append(serviceqname[0]);
|
||||
}
|
||||
if (serviceqname[1] != null) {
|
||||
sb.append(", service-qname/localpart=");
|
||||
sb.append(serviceqname[1]);
|
||||
}
|
||||
if (this.getServiceendpoints() != null) {
|
||||
sb.append(", port-component/service-endpoint-interface=");
|
||||
sb.append(this.getServiceendpoints());
|
||||
}
|
||||
if (handlers != null) {
|
||||
sb.append(", handler=");
|
||||
sb.append(handlers);
|
||||
}
|
||||
sb.append("]");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = super.hashCode();
|
||||
result = prime * result +
|
||||
((displayname == null) ? 0 : displayname.hashCode());
|
||||
result = prime * result +
|
||||
((handlers == null) ? 0 : handlers.hashCode());
|
||||
result = prime *
|
||||
result +
|
||||
((jaxrpcmappingfile == null) ? 0 : jaxrpcmappingfile.hashCode());
|
||||
result = prime * result +
|
||||
((largeIcon == null) ? 0 : largeIcon.hashCode());
|
||||
result = prime * result +
|
||||
((serviceInterface == null) ? 0 : serviceInterface.hashCode());
|
||||
result = prime * result + Arrays.hashCode(serviceqname);
|
||||
result = prime * result +
|
||||
((smallIcon == null) ? 0 : smallIcon.hashCode());
|
||||
result = prime * result +
|
||||
((wsdlfile == null) ? 0 : wsdlfile.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (!super.equals(obj)) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
ContextService other = (ContextService) obj;
|
||||
if (displayname == null) {
|
||||
if (other.displayname != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!displayname.equals(other.displayname)) {
|
||||
return false;
|
||||
}
|
||||
if (handlers == null) {
|
||||
if (other.handlers != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!handlers.equals(other.handlers)) {
|
||||
return false;
|
||||
}
|
||||
if (jaxrpcmappingfile == null) {
|
||||
if (other.jaxrpcmappingfile != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!jaxrpcmappingfile.equals(other.jaxrpcmappingfile)) {
|
||||
return false;
|
||||
}
|
||||
if (largeIcon == null) {
|
||||
if (other.largeIcon != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!largeIcon.equals(other.largeIcon)) {
|
||||
return false;
|
||||
}
|
||||
if (serviceInterface == null) {
|
||||
if (other.serviceInterface != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!serviceInterface.equals(other.serviceInterface)) {
|
||||
return false;
|
||||
}
|
||||
if (!Arrays.equals(serviceqname, other.serviceqname)) {
|
||||
return false;
|
||||
}
|
||||
if (smallIcon == null) {
|
||||
if (other.smallIcon != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!smallIcon.equals(other.smallIcon)) {
|
||||
return false;
|
||||
}
|
||||
if (wsdlfile == null) {
|
||||
if (other.wsdlfile != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!wsdlfile.equals(other.wsdlfile)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
/*
|
||||
* 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.tomcat.util.descriptor.web;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
|
||||
|
||||
/**
|
||||
* Representation of an application resource reference, as represented in
|
||||
* an <code><res-env-refy></code> element in the deployment descriptor.
|
||||
*
|
||||
* @author Craig R. McClanahan
|
||||
*/
|
||||
public class ContextTransaction implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
// ------------------------------------------------------------- Properties
|
||||
|
||||
|
||||
/**
|
||||
* Holder for our configured properties.
|
||||
*/
|
||||
private final HashMap<String, Object> properties = new HashMap<>();
|
||||
|
||||
/**
|
||||
* @param name The property name
|
||||
* @return a configured property.
|
||||
*/
|
||||
public Object getProperty(String name) {
|
||||
return properties.get(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a configured property.
|
||||
* @param name The property name
|
||||
* @param value The property value
|
||||
*/
|
||||
public void setProperty(String name, Object value) {
|
||||
properties.put(name, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a configured property.
|
||||
* @param name The property name
|
||||
*/
|
||||
public void removeProperty(String name) {
|
||||
properties.remove(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* List properties.
|
||||
* @return the property names iterator
|
||||
*/
|
||||
public Iterator<String> listProperties() {
|
||||
return properties.keySet().iterator();
|
||||
}
|
||||
|
||||
|
||||
// --------------------------------------------------------- Public Methods
|
||||
|
||||
|
||||
/**
|
||||
* Return a String representation of this object.
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder("Transaction[");
|
||||
sb.append("]");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
163
java/org/apache/tomcat/util/descriptor/web/ErrorPage.java
Normal file
163
java/org/apache/tomcat/util/descriptor/web/ErrorPage.java
Normal file
@@ -0,0 +1,163 @@
|
||||
/*
|
||||
* 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.tomcat.util.descriptor.web;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.apache.tomcat.util.buf.UDecoder;
|
||||
|
||||
/**
|
||||
* Representation of an error page element for a web application,
|
||||
* as represented in a <code><error-page></code> element in the
|
||||
* deployment descriptor.
|
||||
*
|
||||
* @author Craig R. McClanahan
|
||||
*/
|
||||
public class ErrorPage implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
// ----------------------------------------------------- Instance Variables
|
||||
|
||||
|
||||
/**
|
||||
* The error (status) code for which this error page is active. Note that
|
||||
* status code 0 is used for the default error page.
|
||||
*/
|
||||
private int errorCode = 0;
|
||||
|
||||
|
||||
/**
|
||||
* The exception type for which this error page is active.
|
||||
*/
|
||||
private String exceptionType = null;
|
||||
|
||||
|
||||
/**
|
||||
* The context-relative location to handle this error or exception.
|
||||
*/
|
||||
private String location = null;
|
||||
|
||||
|
||||
// ------------------------------------------------------------- Properties
|
||||
|
||||
|
||||
/**
|
||||
* @return the error code.
|
||||
*/
|
||||
public int getErrorCode() {
|
||||
return this.errorCode;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the error code.
|
||||
*
|
||||
* @param errorCode The new error code
|
||||
*/
|
||||
public void setErrorCode(int errorCode) {
|
||||
this.errorCode = errorCode;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the error code (hack for default XmlMapper data type).
|
||||
*
|
||||
* @param errorCode The new error code
|
||||
*/
|
||||
public void setErrorCode(String errorCode) {
|
||||
|
||||
try {
|
||||
this.errorCode = Integer.parseInt(errorCode);
|
||||
} catch (NumberFormatException nfe) {
|
||||
throw new IllegalArgumentException(nfe);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the exception type.
|
||||
*/
|
||||
public String getExceptionType() {
|
||||
return this.exceptionType;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the exception type.
|
||||
*
|
||||
* @param exceptionType The new exception type
|
||||
*/
|
||||
public void setExceptionType(String exceptionType) {
|
||||
this.exceptionType = exceptionType;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the location.
|
||||
*/
|
||||
public String getLocation() {
|
||||
return this.location;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the location.
|
||||
*
|
||||
* @param location The new location
|
||||
*/
|
||||
public void setLocation(String location) {
|
||||
|
||||
// if ((location == null) || !location.startsWith("/"))
|
||||
// throw new IllegalArgumentException
|
||||
// ("Error Page Location must start with a '/'");
|
||||
this.location = UDecoder.URLDecode(location);
|
||||
|
||||
}
|
||||
|
||||
|
||||
// --------------------------------------------------------- Public Methods
|
||||
|
||||
|
||||
/**
|
||||
* Render a String representation of this object.
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder("ErrorPage[");
|
||||
if (exceptionType == null) {
|
||||
sb.append("errorCode=");
|
||||
sb.append(errorCode);
|
||||
} else {
|
||||
sb.append("exceptionType=");
|
||||
sb.append(exceptionType);
|
||||
}
|
||||
sb.append(", location=");
|
||||
sb.append(location);
|
||||
sb.append("]");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
if (exceptionType == null) {
|
||||
return Integer.toString(errorCode);
|
||||
} else {
|
||||
return exceptionType;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
205
java/org/apache/tomcat/util/descriptor/web/FilterDef.java
Normal file
205
java/org/apache/tomcat/util/descriptor/web/FilterDef.java
Normal file
@@ -0,0 +1,205 @@
|
||||
/*
|
||||
* 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.tomcat.util.descriptor.web;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.Filter;
|
||||
|
||||
import org.apache.tomcat.util.res.StringManager;
|
||||
|
||||
|
||||
/**
|
||||
* Representation of a filter definition for a web application, as represented
|
||||
* in a <code><filter></code> element in the deployment descriptor.
|
||||
*
|
||||
* @author Craig R. McClanahan
|
||||
*/
|
||||
public class FilterDef implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private static final StringManager sm =
|
||||
StringManager.getManager(Constants.PACKAGE_NAME);
|
||||
|
||||
// ------------------------------------------------------------- Properties
|
||||
|
||||
|
||||
/**
|
||||
* The description of this filter.
|
||||
*/
|
||||
private String description = null;
|
||||
|
||||
public String getDescription() {
|
||||
return this.description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The display name of this filter.
|
||||
*/
|
||||
private String displayName = null;
|
||||
|
||||
public String getDisplayName() {
|
||||
return this.displayName;
|
||||
}
|
||||
|
||||
public void setDisplayName(String displayName) {
|
||||
this.displayName = displayName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The filter instance associated with this definition
|
||||
*/
|
||||
private transient Filter filter = null;
|
||||
|
||||
public Filter getFilter() {
|
||||
return filter;
|
||||
}
|
||||
|
||||
public void setFilter(Filter filter) {
|
||||
this.filter = filter;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The fully qualified name of the Java class that implements this filter.
|
||||
*/
|
||||
private String filterClass = null;
|
||||
|
||||
public String getFilterClass() {
|
||||
return this.filterClass;
|
||||
}
|
||||
|
||||
public void setFilterClass(String filterClass) {
|
||||
this.filterClass = filterClass;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The name of this filter, which must be unique among the filters
|
||||
* defined for a particular web application.
|
||||
*/
|
||||
private String filterName = null;
|
||||
|
||||
public String getFilterName() {
|
||||
return this.filterName;
|
||||
}
|
||||
|
||||
public void setFilterName(String filterName) {
|
||||
if (filterName == null || filterName.equals("")) {
|
||||
throw new IllegalArgumentException(
|
||||
sm.getString("filterDef.invalidFilterName", filterName));
|
||||
}
|
||||
this.filterName = filterName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The large icon associated with this filter.
|
||||
*/
|
||||
private String largeIcon = null;
|
||||
|
||||
public String getLargeIcon() {
|
||||
return this.largeIcon;
|
||||
}
|
||||
|
||||
public void setLargeIcon(String largeIcon) {
|
||||
this.largeIcon = largeIcon;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The set of initialization parameters for this filter, keyed by
|
||||
* parameter name.
|
||||
*/
|
||||
private final Map<String, String> parameters = new HashMap<>();
|
||||
|
||||
public Map<String, String> getParameterMap() {
|
||||
return this.parameters;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The small icon associated with this filter.
|
||||
*/
|
||||
private String smallIcon = null;
|
||||
|
||||
public String getSmallIcon() {
|
||||
return this.smallIcon;
|
||||
}
|
||||
|
||||
public void setSmallIcon(String smallIcon) {
|
||||
this.smallIcon = smallIcon;
|
||||
}
|
||||
|
||||
private String asyncSupported = null;
|
||||
|
||||
public String getAsyncSupported() {
|
||||
return asyncSupported;
|
||||
}
|
||||
|
||||
public void setAsyncSupported(String asyncSupported) {
|
||||
this.asyncSupported = asyncSupported;
|
||||
}
|
||||
|
||||
|
||||
// --------------------------------------------------------- Public Methods
|
||||
|
||||
|
||||
/**
|
||||
* Add an initialization parameter to the set of parameters associated
|
||||
* with this filter.
|
||||
*
|
||||
* @param name The initialization parameter name
|
||||
* @param value The initialization parameter value
|
||||
*/
|
||||
public void addInitParameter(String name, String value) {
|
||||
|
||||
if (parameters.containsKey(name)) {
|
||||
// The spec does not define this but the TCK expects the first
|
||||
// definition to take precedence
|
||||
return;
|
||||
}
|
||||
parameters.put(name, value);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Render a String representation of this object.
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder("FilterDef[");
|
||||
sb.append("filterName=");
|
||||
sb.append(this.filterName);
|
||||
sb.append(", filterClass=");
|
||||
sb.append(this.filterClass);
|
||||
sb.append("]");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
222
java/org/apache/tomcat/util/descriptor/web/FilterMap.java
Normal file
222
java/org/apache/tomcat/util/descriptor/web/FilterMap.java
Normal file
@@ -0,0 +1,222 @@
|
||||
/*
|
||||
* 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.tomcat.util.descriptor.web;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Locale;
|
||||
|
||||
import javax.servlet.DispatcherType;
|
||||
|
||||
import org.apache.tomcat.util.buf.UDecoder;
|
||||
|
||||
/**
|
||||
* Representation of a filter mapping for a web application, as represented
|
||||
* in a <code><filter-mapping></code> element in the deployment
|
||||
* descriptor. Each filter mapping must contain a filter name plus either
|
||||
* a URL pattern or a servlet name.
|
||||
*
|
||||
* @author Craig R. McClanahan
|
||||
*/
|
||||
public class FilterMap extends XmlEncodingBase implements Serializable {
|
||||
|
||||
|
||||
// ------------------------------------------------------------- Properties
|
||||
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* The name of this filter to be executed when this mapping matches
|
||||
* a particular request.
|
||||
*/
|
||||
|
||||
public static final int ERROR = 1;
|
||||
public static final int FORWARD = 2;
|
||||
public static final int INCLUDE = 4;
|
||||
public static final int REQUEST = 8;
|
||||
public static final int ASYNC = 16;
|
||||
|
||||
// represents nothing having been set. This will be seen
|
||||
// as equal to a REQUEST
|
||||
private static final int NOT_SET = 0;
|
||||
|
||||
private int dispatcherMapping = NOT_SET;
|
||||
|
||||
private String filterName = null;
|
||||
|
||||
public String getFilterName() {
|
||||
return this.filterName;
|
||||
}
|
||||
|
||||
public void setFilterName(String filterName) {
|
||||
this.filterName = filterName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The servlet name this mapping matches.
|
||||
*/
|
||||
private String[] servletNames = new String[0];
|
||||
|
||||
public String[] getServletNames() {
|
||||
if (matchAllServletNames) {
|
||||
return new String[] {};
|
||||
} else {
|
||||
return this.servletNames;
|
||||
}
|
||||
}
|
||||
|
||||
public void addServletName(String servletName) {
|
||||
if ("*".equals(servletName)) {
|
||||
this.matchAllServletNames = true;
|
||||
} else {
|
||||
String[] results = new String[servletNames.length + 1];
|
||||
System.arraycopy(servletNames, 0, results, 0, servletNames.length);
|
||||
results[servletNames.length] = servletName;
|
||||
servletNames = results;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The flag that indicates this mapping will match all url-patterns
|
||||
*/
|
||||
private boolean matchAllUrlPatterns = false;
|
||||
|
||||
public boolean getMatchAllUrlPatterns() {
|
||||
return matchAllUrlPatterns;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The flag that indicates this mapping will match all servlet-names
|
||||
*/
|
||||
private boolean matchAllServletNames = false;
|
||||
|
||||
public boolean getMatchAllServletNames() {
|
||||
return matchAllServletNames;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The URL pattern this mapping matches.
|
||||
*/
|
||||
private String[] urlPatterns = new String[0];
|
||||
|
||||
public String[] getURLPatterns() {
|
||||
if (matchAllUrlPatterns) {
|
||||
return new String[] {};
|
||||
} else {
|
||||
return this.urlPatterns;
|
||||
}
|
||||
}
|
||||
|
||||
public void addURLPattern(String urlPattern) {
|
||||
addURLPatternDecoded(UDecoder.URLDecode(urlPattern, getCharset()));
|
||||
}
|
||||
public void addURLPatternDecoded(String urlPattern) {
|
||||
if ("*".equals(urlPattern)) {
|
||||
this.matchAllUrlPatterns = true;
|
||||
} else {
|
||||
String[] results = new String[urlPatterns.length + 1];
|
||||
System.arraycopy(urlPatterns, 0, results, 0, urlPatterns.length);
|
||||
results[urlPatterns.length] = UDecoder.URLDecode(urlPattern);
|
||||
urlPatterns = results;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This method will be used to set the current state of the FilterMap
|
||||
* representing the state of when filters should be applied.
|
||||
* @param dispatcherString the dispatcher type which should
|
||||
* match this filter
|
||||
*/
|
||||
public void setDispatcher(String dispatcherString) {
|
||||
String dispatcher = dispatcherString.toUpperCase(Locale.ENGLISH);
|
||||
|
||||
if (dispatcher.equals(DispatcherType.FORWARD.name())) {
|
||||
// apply FORWARD to the global dispatcherMapping.
|
||||
dispatcherMapping |= FORWARD;
|
||||
} else if (dispatcher.equals(DispatcherType.INCLUDE.name())) {
|
||||
// apply INCLUDE to the global dispatcherMapping.
|
||||
dispatcherMapping |= INCLUDE;
|
||||
} else if (dispatcher.equals(DispatcherType.REQUEST.name())) {
|
||||
// apply REQUEST to the global dispatcherMapping.
|
||||
dispatcherMapping |= REQUEST;
|
||||
} else if (dispatcher.equals(DispatcherType.ERROR.name())) {
|
||||
// apply ERROR to the global dispatcherMapping.
|
||||
dispatcherMapping |= ERROR;
|
||||
} else if (dispatcher.equals(DispatcherType.ASYNC.name())) {
|
||||
// apply ERROR to the global dispatcherMapping.
|
||||
dispatcherMapping |= ASYNC;
|
||||
}
|
||||
}
|
||||
|
||||
public int getDispatcherMapping() {
|
||||
// per the SRV.6.2.5 absence of any dispatcher elements is
|
||||
// equivalent to a REQUEST value
|
||||
if (dispatcherMapping == NOT_SET) return REQUEST;
|
||||
|
||||
return dispatcherMapping;
|
||||
}
|
||||
|
||||
public String[] getDispatcherNames() {
|
||||
ArrayList<String> result = new ArrayList<>();
|
||||
if ((dispatcherMapping & FORWARD) != 0) {
|
||||
result.add(DispatcherType.FORWARD.name());
|
||||
}
|
||||
if ((dispatcherMapping & INCLUDE) != 0) {
|
||||
result.add(DispatcherType.INCLUDE.name());
|
||||
}
|
||||
if ((dispatcherMapping & REQUEST) != 0) {
|
||||
result.add(DispatcherType.REQUEST.name());
|
||||
}
|
||||
if ((dispatcherMapping & ERROR) != 0) {
|
||||
result.add(DispatcherType.ERROR.name());
|
||||
}
|
||||
if ((dispatcherMapping & ASYNC) != 0) {
|
||||
result.add(DispatcherType.ASYNC.name());
|
||||
}
|
||||
return result.toArray(new String[result.size()]);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------- Public Methods
|
||||
|
||||
|
||||
/**
|
||||
* Render a String representation of this object.
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder("FilterMap[");
|
||||
sb.append("filterName=");
|
||||
sb.append(this.filterName);
|
||||
for (int i = 0; i < servletNames.length; i++) {
|
||||
sb.append(", servletName=");
|
||||
sb.append(servletNames[i]);
|
||||
}
|
||||
for (int i = 0; i < urlPatterns.length; i++) {
|
||||
sb.append(", urlPattern=");
|
||||
sb.append(urlPatterns[i]);
|
||||
}
|
||||
sb.append("]");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,161 @@
|
||||
/*
|
||||
* 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.tomcat.util.descriptor.web;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.tomcat.Jar;
|
||||
import org.apache.tomcat.JarScannerCallback;
|
||||
import org.xml.sax.InputSource;
|
||||
|
||||
/**
|
||||
* Callback handling a web-fragment.xml descriptor.
|
||||
*/
|
||||
public class FragmentJarScannerCallback implements JarScannerCallback {
|
||||
|
||||
private static final String FRAGMENT_LOCATION =
|
||||
"META-INF/web-fragment.xml";
|
||||
private final WebXmlParser webXmlParser;
|
||||
private final boolean delegate;
|
||||
private final boolean parseRequired;
|
||||
private final Map<String,WebXml> fragments = new HashMap<>();
|
||||
private boolean ok = true;
|
||||
|
||||
public FragmentJarScannerCallback(WebXmlParser webXmlParser, boolean delegate,
|
||||
boolean parseRequired) {
|
||||
this.webXmlParser = webXmlParser;
|
||||
this.delegate = delegate;
|
||||
this.parseRequired = parseRequired;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void scan(Jar jar, String webappPath, boolean isWebapp) throws IOException {
|
||||
|
||||
InputStream is = null;
|
||||
WebXml fragment = new WebXml();
|
||||
fragment.setWebappJar(isWebapp);
|
||||
fragment.setDelegate(delegate);
|
||||
|
||||
try {
|
||||
// Only web application JARs are checked for web-fragment.xml
|
||||
// files.
|
||||
// web-fragment.xml files don't need to be parsed if they are never
|
||||
// going to be used.
|
||||
if (isWebapp && parseRequired) {
|
||||
is = jar.getInputStream(FRAGMENT_LOCATION);
|
||||
}
|
||||
|
||||
if (is == null) {
|
||||
// If there is no web.xml, normal JAR no impact on
|
||||
// distributable
|
||||
fragment.setDistributable(true);
|
||||
} else {
|
||||
String fragmentUrl = jar.getURL(FRAGMENT_LOCATION);
|
||||
InputSource source = new InputSource(fragmentUrl);
|
||||
source.setByteStream(is);
|
||||
if (!webXmlParser.parseWebXml(source, fragment, true)) {
|
||||
ok = false;
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
addFragment(fragment, jar.getJarFileURL());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private String extractJarFileName(URL input) {
|
||||
String url = input.toString();
|
||||
if (url.endsWith("!/")) {
|
||||
// Remove it
|
||||
url = url.substring(0, url.length() - 2);
|
||||
}
|
||||
|
||||
// File name will now be whatever is after the final /
|
||||
return url.substring(url.lastIndexOf('/') + 1);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void scan(File file, String webappPath, boolean isWebapp) throws IOException {
|
||||
|
||||
WebXml fragment = new WebXml();
|
||||
fragment.setWebappJar(isWebapp);
|
||||
fragment.setDelegate(delegate);
|
||||
|
||||
File fragmentFile = new File(file, FRAGMENT_LOCATION);
|
||||
try {
|
||||
if (fragmentFile.isFile()) {
|
||||
try (InputStream stream = new FileInputStream(fragmentFile)) {
|
||||
InputSource source =
|
||||
new InputSource(fragmentFile.toURI().toURL().toString());
|
||||
source.setByteStream(stream);
|
||||
if (!webXmlParser.parseWebXml(source, fragment, true)) {
|
||||
ok = false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// If there is no web.xml, normal folder no impact on
|
||||
// distributable
|
||||
fragment.setDistributable(true);
|
||||
}
|
||||
} finally {
|
||||
addFragment(fragment, file.toURI().toURL());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void addFragment(WebXml fragment, URL url) {
|
||||
fragment.setURL(url);
|
||||
if (fragment.getName() == null) {
|
||||
fragment.setName(url.toString());
|
||||
}
|
||||
fragment.setJarName(extractJarFileName(url));
|
||||
if (fragments.containsKey(fragment.getName())) {
|
||||
// Duplicate. Mark the fragment that has already been found with
|
||||
// this name as having a duplicate so Tomcat can handle it
|
||||
// correctly when the fragments are being ordered.
|
||||
String duplicateName = fragment.getName();
|
||||
fragments.get(duplicateName).setDuplicated(true);
|
||||
// Rename the current fragment so it doesn't clash
|
||||
fragment.setName(url.toString());
|
||||
}
|
||||
fragments.put(fragment.getName(), fragment);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void scanWebInfClasses() {
|
||||
// NO-OP. Fragments unpacked in WEB-INF classes are not handled,
|
||||
// mainly because if there are multiple fragments there is no way to
|
||||
// handle multiple web-fragment.xml files.
|
||||
}
|
||||
|
||||
public boolean isOk() {
|
||||
return ok;
|
||||
}
|
||||
|
||||
public Map<String,WebXml> getFragments() {
|
||||
return fragments;
|
||||
}
|
||||
}
|
||||
25
java/org/apache/tomcat/util/descriptor/web/Injectable.java
Normal file
25
java/org/apache/tomcat/util/descriptor/web/Injectable.java
Normal file
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* 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.tomcat.util.descriptor.web;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface Injectable {
|
||||
public String getName();
|
||||
public void addInjectionTarget(String injectionTargetName, String jndiName);
|
||||
public List<InjectionTarget> getInjectionTargets();
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* 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.tomcat.util.descriptor.web;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class InjectionTarget implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String targetClass;
|
||||
private String targetName;
|
||||
|
||||
|
||||
public InjectionTarget() {
|
||||
// NOOP
|
||||
}
|
||||
|
||||
public InjectionTarget(String targetClass, String targetName) {
|
||||
this.targetClass = targetClass;
|
||||
this.targetName = targetName;
|
||||
}
|
||||
|
||||
public String getTargetClass() {
|
||||
return targetClass;
|
||||
}
|
||||
|
||||
public void setTargetClass(String targetClass) {
|
||||
this.targetClass = targetClass;
|
||||
}
|
||||
|
||||
public String getTargetName() {
|
||||
return targetName;
|
||||
}
|
||||
|
||||
public void setTargetName(String targetName) {
|
||||
this.targetName = targetName;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* 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.tomcat.util.descriptor.web;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
import javax.servlet.descriptor.JspConfigDescriptor;
|
||||
import javax.servlet.descriptor.JspPropertyGroupDescriptor;
|
||||
import javax.servlet.descriptor.TaglibDescriptor;
|
||||
|
||||
public class JspConfigDescriptorImpl implements JspConfigDescriptor {
|
||||
|
||||
private final Collection<JspPropertyGroupDescriptor> jspPropertyGroups;
|
||||
private final Collection<TaglibDescriptor> taglibs;
|
||||
|
||||
public JspConfigDescriptorImpl(Collection<JspPropertyGroupDescriptor> jspPropertyGroups,
|
||||
Collection<TaglibDescriptor> taglibs) {
|
||||
this.jspPropertyGroups = jspPropertyGroups;
|
||||
this.taglibs = taglibs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<JspPropertyGroupDescriptor> getJspPropertyGroups() {
|
||||
return new ArrayList<>(jspPropertyGroups);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<TaglibDescriptor> getTaglibs() {
|
||||
return new ArrayList<>(taglibs);
|
||||
}
|
||||
}
|
||||
109
java/org/apache/tomcat/util/descriptor/web/JspPropertyGroup.java
Normal file
109
java/org/apache/tomcat/util/descriptor/web/JspPropertyGroup.java
Normal file
@@ -0,0 +1,109 @@
|
||||
/*
|
||||
* 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.tomcat.util.descriptor.web;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.tomcat.util.buf.UDecoder;
|
||||
|
||||
/**
|
||||
* Representation of a jsp-property-group element in web.xml.
|
||||
*/
|
||||
public class JspPropertyGroup extends XmlEncodingBase {
|
||||
|
||||
private Boolean deferredSyntax = null;
|
||||
public void setDeferredSyntax(String deferredSyntax) {
|
||||
this.deferredSyntax = Boolean.valueOf(deferredSyntax);
|
||||
}
|
||||
public Boolean getDeferredSyntax() { return deferredSyntax; }
|
||||
|
||||
private Boolean elIgnored = null;
|
||||
public void setElIgnored(String elIgnored) {
|
||||
this.elIgnored = Boolean.valueOf(elIgnored);
|
||||
}
|
||||
public Boolean getElIgnored() { return elIgnored; }
|
||||
|
||||
private final Collection<String> includeCodas = new ArrayList<>();
|
||||
public void addIncludeCoda(String includeCoda) {
|
||||
includeCodas.add(includeCoda);
|
||||
}
|
||||
public Collection<String> getIncludeCodas() { return includeCodas; }
|
||||
|
||||
private final Collection<String> includePreludes = new ArrayList<>();
|
||||
public void addIncludePrelude(String includePrelude) {
|
||||
includePreludes.add(includePrelude);
|
||||
}
|
||||
public Collection<String> getIncludePreludes() { return includePreludes; }
|
||||
|
||||
private Boolean isXml = null;
|
||||
public void setIsXml(String isXml) {
|
||||
this.isXml = Boolean.valueOf(isXml);
|
||||
}
|
||||
public Boolean getIsXml() { return isXml; }
|
||||
|
||||
private String pageEncoding = null;
|
||||
public void setPageEncoding(String pageEncoding) {
|
||||
this.pageEncoding = pageEncoding;
|
||||
}
|
||||
public String getPageEncoding() { return this.pageEncoding; }
|
||||
|
||||
private Boolean scriptingInvalid = null;
|
||||
public void setScriptingInvalid(String scriptingInvalid) {
|
||||
this.scriptingInvalid = Boolean.valueOf(scriptingInvalid);
|
||||
}
|
||||
public Boolean getScriptingInvalid() { return scriptingInvalid; }
|
||||
|
||||
private Boolean trimWhitespace = null;
|
||||
public void setTrimWhitespace(String trimWhitespace) {
|
||||
this.trimWhitespace = Boolean.valueOf(trimWhitespace);
|
||||
}
|
||||
public Boolean getTrimWhitespace() { return trimWhitespace; }
|
||||
|
||||
private LinkedHashSet<String> urlPattern = new LinkedHashSet<>();
|
||||
public void addUrlPattern(String urlPattern) {
|
||||
addUrlPatternDecoded(UDecoder.URLDecode(urlPattern, getCharset()));
|
||||
}
|
||||
public void addUrlPatternDecoded(String urlPattern) {
|
||||
this.urlPattern.add(urlPattern);
|
||||
}
|
||||
public Set<String> getUrlPatterns() { return this.urlPattern; }
|
||||
|
||||
private String defaultContentType = null;
|
||||
public void setDefaultContentType(String defaultContentType) {
|
||||
this.defaultContentType = defaultContentType;
|
||||
}
|
||||
public String getDefaultContentType() { return this.defaultContentType; }
|
||||
|
||||
private String buffer = null;
|
||||
public void setBuffer(String buffer) {
|
||||
this.buffer = buffer;
|
||||
}
|
||||
public String getBuffer() { return this.buffer; }
|
||||
|
||||
private Boolean errorOnUndeclaredNamespace = null;
|
||||
public void setErrorOnUndeclaredNamespace(
|
||||
String errorOnUndeclaredNamespace) {
|
||||
this.errorOnUndeclaredNamespace =
|
||||
Boolean.valueOf(errorOnUndeclaredNamespace);
|
||||
}
|
||||
public Boolean getErrorOnUndeclaredNamespace() {
|
||||
return this.errorOnUndeclaredNamespace;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,145 @@
|
||||
/*
|
||||
* 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.tomcat.util.descriptor.web;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
import javax.servlet.descriptor.JspPropertyGroupDescriptor;
|
||||
|
||||
|
||||
|
||||
public class JspPropertyGroupDescriptorImpl
|
||||
implements JspPropertyGroupDescriptor{
|
||||
|
||||
private final JspPropertyGroup jspPropertyGroup;
|
||||
|
||||
|
||||
public JspPropertyGroupDescriptorImpl(
|
||||
JspPropertyGroup jspPropertyGroup) {
|
||||
this.jspPropertyGroup = jspPropertyGroup;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getBuffer() {
|
||||
return jspPropertyGroup.getBuffer();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getDefaultContentType() {
|
||||
return jspPropertyGroup.getDefaultContentType();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getDeferredSyntaxAllowedAsLiteral() {
|
||||
String result = null;
|
||||
|
||||
if (jspPropertyGroup.getDeferredSyntax() != null) {
|
||||
result = jspPropertyGroup.getDeferredSyntax().toString();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getElIgnored() {
|
||||
String result = null;
|
||||
|
||||
if (jspPropertyGroup.getElIgnored() != null) {
|
||||
result = jspPropertyGroup.getElIgnored().toString();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getErrorOnUndeclaredNamespace() {
|
||||
String result = null;
|
||||
|
||||
if (jspPropertyGroup.getErrorOnUndeclaredNamespace() != null) {
|
||||
result =
|
||||
jspPropertyGroup.getErrorOnUndeclaredNamespace().toString();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Collection<String> getIncludeCodas() {
|
||||
return new ArrayList<>(jspPropertyGroup.getIncludeCodas());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Collection<String> getIncludePreludes() {
|
||||
return new ArrayList<>(jspPropertyGroup.getIncludePreludes());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getIsXml() {
|
||||
String result = null;
|
||||
|
||||
if (jspPropertyGroup.getIsXml() != null) {
|
||||
result = jspPropertyGroup.getIsXml().toString();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getPageEncoding() {
|
||||
return jspPropertyGroup.getPageEncoding();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getScriptingInvalid() {
|
||||
String result = null;
|
||||
|
||||
if (jspPropertyGroup.getScriptingInvalid() != null) {
|
||||
result = jspPropertyGroup.getScriptingInvalid().toString();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getTrimDirectiveWhitespaces() {
|
||||
String result = null;
|
||||
|
||||
if (jspPropertyGroup.getTrimWhitespace() != null) {
|
||||
result = jspPropertyGroup.getTrimWhitespace().toString();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Collection<String> getUrlPatterns() {
|
||||
return new ArrayList<>(jspPropertyGroup.getUrlPatterns());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
# 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.
|
||||
|
||||
filterDef.invalidFilterName=Invalid <filter-name> [{0}] in filter definition.
|
||||
|
||||
securityConstraint.uncoveredHttpMethod=For security constraints with URL pattern [{0}] only the HTTP methods [{1}] are covered. All other methods are uncovered.
|
||||
securityConstraint.uncoveredHttpMethodFix=Adding security constraints with URL pattern [{0}] to deny access with the uncovered HTTP methods that are not one of the following [{1}]
|
||||
securityConstraint.uncoveredHttpOmittedMethod=For security constraints with URL pattern [{0}] the HTTP methods [{1}] are uncovered.
|
||||
securityConstraint.uncoveredHttpOmittedMethodFix=Adding security constraints with URL pattern [{0}] to deny access with the uncovered HTTP methods [{1}]
|
||||
|
||||
servletDef.invalidServletName=Invalid <servlet-name> [{0}] in servlet definition.
|
||||
|
||||
webRuleSet.absoluteOrdering=<absolute-ordering> element not valid in web-fragment.xml and will be ignored
|
||||
webRuleSet.absoluteOrderingCount=<absolute-ordering> element is limited to 1 occurrence
|
||||
webRuleSet.nameCount=<name> element is limited to 1 occurrence
|
||||
webRuleSet.postconstruct.duplicate=Duplicate post construct method definition for class [{0}]
|
||||
webRuleSet.predestroy.duplicate=Duplicate @PreDestroy method definition for class [{0}]
|
||||
webRuleSet.relativeOrdering=<ordering> element not valid in web.xml and will be ignored
|
||||
webRuleSet.relativeOrderingCount=<ordering> element is limited to 1 occurrence
|
||||
|
||||
webXml.duplicateEnvEntry=Duplicate env-entry name [{0}]
|
||||
webXml.duplicateFilter=Duplicate filter name [{0}]
|
||||
webXml.duplicateFragment=More than one fragment with the name [{0}] was found. This is not legal with relative ordering. See section 8.2.2 2c of the Servlet specification for details. Consider using absolute ordering.
|
||||
webXml.duplicateMessageDestination=Duplicate message-destination name [{0}]
|
||||
webXml.duplicateMessageDestinationRef=Duplicate message-destination-ref name [{0}]
|
||||
webXml.duplicateResourceEnvRef=Duplicate resource-env-ref name [{0}]
|
||||
webXml.duplicateResourceRef=Duplicate resource-ref name [{0}]
|
||||
webXml.duplicateServletMapping=The servlets named [{0}] and [{1}] are both mapped to the url-pattern [{2}] which is not permitted
|
||||
webXml.duplicateTaglibUri=Duplicate tag library URI [{0}]
|
||||
webXml.mergeConflictDisplayName=The display name was defined in multiple fragments with different values including fragment with name [{0}] located at [{1}]
|
||||
webXml.mergeConflictFilter=The Filter [{0}] was defined inconsistently in multiple fragments including fragment with name [{1}] located at [{2}]
|
||||
webXml.mergeConflictLoginConfig=A LoginConfig was defined inconsistently in multiple fragments including fragment with name [{0}] located at [{1}]
|
||||
webXml.mergeConflictOrder=Fragment relative ordering contains circular references. This can be resolved by using absolute ordering in web.xml.
|
||||
webXml.mergeConflictResource=The Resource [{0}] was defined inconsistently in multiple fragments including fragment with name [{1}] located at [{2}]
|
||||
webXml.mergeConflictServlet=The Servlet [{0}] was defined inconsistently in multiple fragments including fragment with name [{1}] located at [{2}]
|
||||
webXml.mergeConflictSessionCookieComment=The session cookie comment was defined inconsistently in multiple fragments with different values including fragment with name [{0}] located at [{1}]
|
||||
webXml.mergeConflictSessionCookieDomain=The session cookie domain was defined inconsistently in multiple fragments with different values including fragment with name [{0}] located at [{1}]
|
||||
webXml.mergeConflictSessionCookieHttpOnly=The session cookie http-only flag was defined inconsistently in multiple fragments with different values including fragment with name [{0}] located at [{1}]
|
||||
webXml.mergeConflictSessionCookieMaxAge=The session cookie max-age was defined inconsistently in multiple fragments with different values including fragment with name [{0}] located at [{1}]
|
||||
webXml.mergeConflictSessionCookieName=The session cookie name was defined inconsistently in multiple fragments with different values including fragment with name [{0}] located at [{1}]
|
||||
webXml.mergeConflictSessionCookiePath=The session cookie path was defined inconsistently in multiple fragments with different values including fragment with name [{0}] located at [{1}]
|
||||
webXml.mergeConflictSessionCookieSecure=The session cookie secure flag was defined inconsistently in multiple fragments with different values including fragment with name [{0}] located at [{1}]
|
||||
webXml.mergeConflictSessionTimeout=The session timeout was defined inconsistently in multiple fragments with different values including fragment with name [{0}] located at [{1}]
|
||||
webXml.mergeConflictSessionTrackingMode=The session tracking modes were defined inconsistently in multiple fragments including fragment with name [{0}] located at [{1}]
|
||||
webXml.mergeConflictString=The [{0}] with name [{1}] was defined inconsistently in multiple fragments including fragment with name [{2}] located at [{3}]
|
||||
webXml.multipleOther=Multiple <others> entries nested in <ordering> element
|
||||
webXml.reservedName=A web.xml file was detected using a reserved name [{0}]. The name element will be ignored for this fragment.
|
||||
webXml.unrecognisedPublicId=The public ID [{0}] did not match any of the known public ID''s for web.xml files so the version could not be identified
|
||||
webXml.version.unknown=Unknown version string [{0}]. Default version will be used.
|
||||
webXml.wrongFragmentName=Used a wrong fragment name [{0}] at web.xml absolute-ordering tag!
|
||||
|
||||
webXmlParser.applicationParse=Parse error in application web.xml file at [{0}]
|
||||
webXmlParser.applicationPosition=Occurred at line [{0}] column [{1}]
|
||||
webXmlParser.applicationStart=Parsing application web.xml file at [{0}]
|
||||
|
||||
xmlEncodingBase.encodingInvalid=The encoding [{0}] is not recognised by this JRE. The existing value of [{1}] will be used
|
||||
@@ -0,0 +1,20 @@
|
||||
# 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.
|
||||
|
||||
filterDef.invalidFilterName=Ungültiger <filter-name> [{0}] in der Filter Definition.
|
||||
|
||||
webRuleSet.postconstruct.duplicate=Doppelte Post-Konstruktor-Methoden-Definition für Klasse [{0}]
|
||||
|
||||
webXml.duplicateFilter=Doppelter Filter-Name [{0}]
|
||||
@@ -0,0 +1,31 @@
|
||||
# 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.
|
||||
|
||||
filterDef.invalidFilterName=<filter-name> [{0}] inválido en la definición de filtros.\n
|
||||
|
||||
securityConstraint.uncoveredHttpOmittedMethod=Debido a restricciones de seguridad con el patrón de URL [{0}] los métodos HTTP [{1}] no estan cubiertos.
|
||||
|
||||
webRuleSet.absoluteOrdering=Elemento <absolute-ordering> no válido en web-fragment.xml y será ignorado
|
||||
webRuleSet.postconstruct.duplicate=La definición del metodo the post construcción para la clase [{0}] esta duplicada\n
|
||||
webRuleSet.relativeOrdering=elemento <ordering> no válido en web.xml y será ignorado
|
||||
|
||||
webXml.duplicateFilter=Filtro de nombre duplicado [{0}]\n
|
||||
webXml.duplicateServletMapping=Los servlets llamados [{0}] y [{1}] estan ambos mapeados al patrón de URL [{2}] el cual no esta permitido
|
||||
webXml.mergeConflictSessionTrackingMode=Los modos de seguimiento fueron definidos inconsistentemente en multiples fragmentos, incluyendo fragmentos con el nombre [{0}] localizado en [{1}]\n
|
||||
webXml.reservedName=Un archivo web.xml fue detectado usando un nombre reservado [{0}]. El nombre será ignorado para este fragmento.
|
||||
|
||||
webXmlParser.applicationParse=Error de evaluación (parse) en el archivo web.xml de la aplicación a [{0}]
|
||||
webXmlParser.applicationPosition=Se ha producido en la línea [{0}] columna [{1}]
|
||||
webXmlParser.applicationStart=Analizando fichero de aplicación web.xml en [{0}]
|
||||
@@ -0,0 +1,66 @@
|
||||
# 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.
|
||||
|
||||
filterDef.invalidFilterName=Valeur Invalide de <filter-name> [{0}] dans la définition du filtre.
|
||||
|
||||
securityConstraint.uncoveredHttpMethod=Les méthodes HTTP [{1}] des contraintes de sécurité du modèle d''URL [{0}] sont protégées, toutes les autres ne le sont pas
|
||||
securityConstraint.uncoveredHttpMethodFix=Ajout de contraintes de sécurité avec le masque d''URL [{0}] pour empêcher l''accès aux méthodes HTTP non couvertes qui ne sont pas une de celles ci [{1}]
|
||||
securityConstraint.uncoveredHttpOmittedMethod=Les méthodes HTTP [{1}] des contraintes de sécurité du modèle d''URL [{0}] ne sont pas protégées
|
||||
securityConstraint.uncoveredHttpOmittedMethodFix=Ajout de contraintes de sécurité avec le masque d''URL [{0}] pour empêcher l''accès aux méthodes HTTP [{1}] non couvertes
|
||||
|
||||
servletDef.invalidServletName=<servlet-name> [{0}] invalide dans la définition du Servlet
|
||||
|
||||
webRuleSet.absoluteOrdering=L’élément <absolute-ordering> est invalide dans web-fragment.xml et sera ignoré
|
||||
webRuleSet.absoluteOrderingCount=L'élément <absolute-ordering> est limité à 1 ocurrence
|
||||
webRuleSet.nameCount=L'élément <name> est limité à 1 ocurrence
|
||||
webRuleSet.postconstruct.duplicate=La méthode post construct est dupliquée dans la classe [{0}]
|
||||
webRuleSet.predestroy.duplicate=Double définition de l''annotation de méthode @PreDestroy pour la classe [{0}]
|
||||
webRuleSet.relativeOrdering=L’élément <ordering> est invalide dans web.xml et sera ignoré
|
||||
webRuleSet.relativeOrderingCount=L'élément <ordering> est limité à 1 ocurrence
|
||||
|
||||
webXml.duplicateEnvEntry=Le nom de l''env-entry [{0}] a été déclaré en double
|
||||
webXml.duplicateFilter=Nom du filtre dupliqué [{0}]
|
||||
webXml.duplicateFragment=Il y a plus d''un fragment nommé [{0}], ce qui n''est pas légal avec l''ordre relatif; voir la section 8.2.2 2c de la spécification Servlet, l''ordre absolu peut éventuellement être utilisé
|
||||
webXml.duplicateMessageDestination=Le nom de la message-destination [{0}] a été déclaré en double
|
||||
webXml.duplicateMessageDestinationRef=Le nom de la message-destination-ref [{0}] a été déclaré en double
|
||||
webXml.duplicateResourceEnvRef=Le nom de la resource-env-ref [{0}] a été déclaré en double
|
||||
webXml.duplicateResourceRef=Le nom de la resource-ref [{0}] a été déclaré en double
|
||||
webXml.duplicateServletMapping=Les servlets nommés [{0}] et [{1}] sont tous deux associés au même modèle d''URL [{2}], ce qui n''est pas permis
|
||||
webXml.duplicateTaglibUri=Librairies de tags déclarée en double avec l''URI [{0}]
|
||||
webXml.mergeConflictDisplayName=Le nom d''affichage a été défini de manière inconsistante entre différents fragments dont le fragment [{0}] situé à [{1}]
|
||||
webXml.mergeConflictFilter=Le Filter [{0}] a été défini de manière inconsistante entre différents fragments dont le fragment [{1}] situé à [{2}]
|
||||
webXml.mergeConflictLoginConfig=Le LoginConfig a été défini de manière inconsistante entre différents fragments dont le fragment [{0}] situé à [{1}]
|
||||
webXml.mergeConflictOrder=L'ordre relatif des fragments contient des références circulaires, cela peut être résolu en utilisant un ordre absolu dans web.xml
|
||||
webXml.mergeConflictResource=La Resource [{0}] a été définie de manière inconsistante entre différents fragments dont le fragment [{1}] situé à [{2}]
|
||||
webXml.mergeConflictServlet=Le Servlet [{0}] a été défini de manière inconsistante entre différents fragments dont le fragment [{1}] situé à [{2}]
|
||||
webXml.mergeConflictSessionCookieComment=Le commentaire de cookie de session a été défini de manière inconsistante avec des valeurs différentes entre différents fragments dont le fragment [{0}] situé à [{1}]
|
||||
webXml.mergeConflictSessionCookieDomain=Le domaine de cookie de session a été défini de manière inconsistante avec des valeurs différentes entre différents fragments dont le fragment [{0}] situé à [{1}]
|
||||
webXml.mergeConflictSessionCookieHttpOnly=L''indicateur http-only du cookie de session a été défini de manière inconsistante avec des valeurs différentes entre différents fragments dont le fragment [{0}] situé à [{1}]
|
||||
webXml.mergeConflictSessionCookieMaxAge=Le max-age du cookie de session a été défini de manière inconsistante avec des valeurs différentes entre différents fragments dont le fragment [{0}] situé à [{1}]
|
||||
webXml.mergeConflictSessionCookieName=Le nom de cookie de session a été défini de manière inconsistante avec des valeurs différentes entre différents fragments dont le fragment [{0}] situé à [{1}]
|
||||
webXml.mergeConflictSessionCookiePath=Le chemin du cookie de session a été défini de manière inconsistante avec des valeurs différentes entre différents fragments dont le fragment [{0}] situé à [{1}]
|
||||
webXml.mergeConflictSessionCookieSecure=L''indicateur secure du cookie de session a été défini de manière inconsistante avec des valeurs différentes entre différents fragments dont le fragment [{0}] situé à [{1}]
|
||||
webXml.mergeConflictSessionTimeout=Le timeout de la session a été défini de manière inconsistante avec des valeurs différentes entre différents fragments dont le fragment [{0}] situé à [{1}]
|
||||
webXml.mergeConflictSessionTrackingMode=Les modes de gestion de la session ont été déclarés de manière inconsistante entre plusieurs fragments nommés [{0}] et localisés à [{1}]
|
||||
webXml.mergeConflictString=Le [{0}] avec comme nom [{1}] a été défini de manière inconsistante entre différents fragments dont le fragment [{2}] situé à [{3}]
|
||||
webXml.multipleOther=Plusieurs entrées <others> sont incluses dans l'élément <ordering>
|
||||
webXml.reservedName=Un fichier web.xml a été détecté avec un nom réservé [{0}], l''élément name sera ignoré pour ce fragment
|
||||
webXml.unrecognisedPublicId=L''identifiant public [{0}] ne correspond à aucun des identifiants connus pour les fichiers web.xml, donc la version n''a pu être indentifiée
|
||||
webXml.version.unknown=Version [{0}] inconnue, utilisation de la version par défaut
|
||||
webXml.wrongFragmentName=Utilisation d''un mauvais nom de fragment [{0}] dans le tag absolute-ordering de web.xml
|
||||
|
||||
webXmlParser.applicationParse=Erreur de traitement du web.xml de l''application à [{0}]
|
||||
webXmlParser.applicationPosition=S''est produit à la ligne [{0}] colonne [{1}]
|
||||
webXmlParser.applicationStart=Traitement du web.xml de l''application à [{0}]
|
||||
@@ -0,0 +1,66 @@
|
||||
# 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.
|
||||
|
||||
filterDef.invalidFilterName=フィルター定義に無効な <フィルター名> [{0}] があります。
|
||||
|
||||
securityConstraint.uncoveredHttpMethod=URLパターン[{0}]のセキュリティ制約の場合、HTTPメソッド[{1}]のみが対象となります。 その他の方法はすべて対象外です。
|
||||
securityConstraint.uncoveredHttpMethodFix=次の[{1}]ではない特定のHTTPメソッドのアクセスを拒否するURLパターン[{0}]を持つセキュリティ制約を追加します。
|
||||
securityConstraint.uncoveredHttpOmittedMethod=URLパターン[{0}]を持つセキュリティ制約の場合、HTTPメソッド[{1}]は検出されません。
|
||||
securityConstraint.uncoveredHttpOmittedMethodFix=保護されていないHTTPメソッド[{1}]でのアクセスを拒否するURLパターン[{0}]のセキュリティ制約を追加
|
||||
|
||||
servletDef.invalidServletName=サーブレット定義の<servlet-name> [{0}]が無効です。
|
||||
|
||||
webRuleSet.absoluteOrdering=<absolute-ordering>要素はweb-fragment.xmlで無効であり無視されます。
|
||||
webRuleSet.absoluteOrderingCount=<absolute-ordering>要素は1回の発生に制限されます。
|
||||
webRuleSet.nameCount=<name>要素は1回に制限されます。
|
||||
webRuleSet.postconstruct.duplicate=クラス [{0}]にPostConstructメソッド定義が重複しています
|
||||
webRuleSet.predestroy.duplicate=クラス[{0}]の重複する@PreDestroyメソッド定義
|
||||
webRuleSet.relativeOrdering=<ordering>要素はweb.xmlで無効であり無視されます。
|
||||
webRuleSet.relativeOrderingCount=<ordering>要素は1回の出現に制限されます。
|
||||
|
||||
webXml.duplicateEnvEntry=重複したenvエントリ名[{0}]
|
||||
webXml.duplicateFilter=同じ名前のファイル [{0}] が存在します。
|
||||
webXml.duplicateFragment=同名のフラグメント [{0}] が複数見つかりました。相対的な順序付けは正式な機能ではありません。詳細は Servlet Speification の 8.2.2 節 2c 項を参照してください。絶対的な順序付けの利用を検討してください。
|
||||
webXml.duplicateMessageDestination=重複するmessage-destination-name[{0}]
|
||||
webXml.duplicateMessageDestinationRef=重複したmessage-destination-ref 名 [{0}]
|
||||
webXml.duplicateResourceEnvRef=重複した resource-env-ref [{0}]
|
||||
webXml.duplicateResourceRef=重複したresource-ref [{0}]
|
||||
webXml.duplicateServletMapping=サーブレット [{0}] と [{1}] を同じ url-pattern [{2}] にマッピングすることはできません。
|
||||
webXml.duplicateTaglibUri=URI [{0}] のタグライブラリは重複しています。
|
||||
webXml.mergeConflictDisplayName=[{1}] に配置されたフラグメント [{0}] の表示名は、他のフラグメントと異なります。
|
||||
webXml.mergeConflictFilter=[{2}]に配置された名前[{1}]を持つフラグメントを含む複数のフラグメントでフィルタ[{0}]が一貫して定義されていません
|
||||
webXml.mergeConflictLoginConfig=[{1}] に配置されたフラグメント [{0}] の LoginConfig は、他のフラグメントと異なります。
|
||||
webXml.mergeConflictOrder=フラグメントの相対順序には循環参照が含まれます。 これは、web.xmlで絶対順序を使用することで解決できます。
|
||||
webXml.mergeConflictResource=[{2}]にある名前[{1}]のフラグメントを含む、複数のフラグメントでリソース[{0}]が一貫して定義されていません。
|
||||
webXml.mergeConflictServlet=Servlet [{0}]は、[{2}]にある名前[{1}]のフラグメントを含む複数のフラグメントで一貫して定義されていません
|
||||
webXml.mergeConflictSessionCookieComment=セッションCookieのコメントは、[{1}]にある名前[{0}]のフラグメントを含む異なる値を持つ複数のフラグメントで一貫して定義されていません。
|
||||
webXml.mergeConflictSessionCookieDomain=セッションCookieドメインは、[{1}]にある名前[{0}]のフラグメントを含む、異なる値を持つ複数のフラグメントで一貫して定義されていません。
|
||||
webXml.mergeConflictSessionCookieHttpOnly=[{1}] に配置されたフラグメント [{0}] のセッションクッキー http-only フラグの値は、他のフラグメントと異なります。
|
||||
webXml.mergeConflictSessionCookieMaxAge=[{1}] に配置されたフラグメント [{0}] のセッションクッキー max-age の値は、他のフラグメントと異なります。
|
||||
webXml.mergeConflictSessionCookieName=セッションCookie名は、[{1}]にある名前[{0}]のフラグメントを含む異なる値を持つ複数のフラグメントで矛盾して定義されました。
|
||||
webXml.mergeConflictSessionCookiePath=[{1}] に配置されたフラグメント [{0}] のセッションクッキー path は、他のフラグメントと異なります。
|
||||
webXml.mergeConflictSessionCookieSecure=[{1}] に配置されたフラグメント [{0}] のセッションクッキー secure フラグの値は、他のフラグメントと異なります。
|
||||
webXml.mergeConflictSessionTimeout=[{1}] に配置されたフラグメント [{0}] のセッションタイムアウト時間は、他のフラグメントと異なります。
|
||||
webXml.mergeConflictSessionTrackingMode=[{1}] に配置されたフラグメント名 [{0}] を含む複数のフラグメントについて、セッション追跡モードの設定が一貫しません。
|
||||
webXml.mergeConflictString=[{0}] の [{1}] は [{3}] に配置された複数フラグメント [{2}] で別の値が定義されています。
|
||||
webXml.multipleOther=<ordering> 要素に複数の <others> 要素が指定されました。
|
||||
webXml.reservedName=予約名[{0}]を使用してweb.xmlファイルが検出されました。 name要素はこのフラグメントでは無視されます。
|
||||
webXml.unrecognisedPublicId=public ID [{0}]は、既知のweb.xmlファイルのpublic IDと一致しないため、バージョンを特定できませんでした。
|
||||
webXml.version.unknown=[{0}] は未知のバージョン文字列です。初期値を使用します。
|
||||
webXml.wrongFragmentName=web.xmlのabsolute-orderingタグで間違ったフラグメント名[{0}]を使用しました!
|
||||
|
||||
webXmlParser.applicationParse=[{0}]のアプリケーションweb.xmlファイルの解析エラー
|
||||
webXmlParser.applicationPosition=行[{0}]列[{1}]で発生しました。
|
||||
webXmlParser.applicationStart=[{0}]のアプリケーションweb.xmlファイルの解析
|
||||
@@ -0,0 +1,66 @@
|
||||
# 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.
|
||||
|
||||
filterDef.invalidFilterName=유효하지 않은 <filter-name>. [{0}]이(가) 필터 정의에 포함되어 있습니다.
|
||||
|
||||
securityConstraint.uncoveredHttpMethod=URL 패턴 [{0}]와(과) 함께 설정되는 security constraint들에 대해, HTTP 메소드들 [{1}]만이 커버됩니다. 다른 모든 메소드들은 커버되지 않습니다.
|
||||
securityConstraint.uncoveredHttpMethodFix=[{1}] 중의 하나가 아닌, 커버될 수 없는 HTTP 메소드들을 사용한 접근을 거부하기 위하여, URL 패턴이 [{0}]인 security constraint들을 추가합니다.
|
||||
securityConstraint.uncoveredHttpOmittedMethod=URL 패턴 [{0}]와(과) 함께 설정된 security constraint들에 대하여, HTTP 메소드들 [{1}]은(는) 커버되지 않습니다.
|
||||
securityConstraint.uncoveredHttpOmittedMethodFix=커버될 수 없는 HTTP 메소드들 [{1}]에 대한 접근을 거부하기 위하여, URL 패턴 [{0}]와(과) 함께 security constraint를 추가합니다.
|
||||
|
||||
servletDef.invalidServletName=서블릿 정의에서 유효하지 않은 <servlet-name> [{0}]
|
||||
|
||||
webRuleSet.absoluteOrdering=<absolute-ordering> 엘리먼트는 web-fragment.xml 내에서 유효하지 않으므로, 무시될 것입니다.
|
||||
webRuleSet.absoluteOrderingCount=<absolute-ordering> 엘리먼트는 1회만 나타나도록 제한됩니다.
|
||||
webRuleSet.nameCount=<name> 엘리먼트는 단 한번만 나타나도록 제한됩니다.
|
||||
webRuleSet.postconstruct.duplicate=클래스 [{0}]에 PostConstruct 메소드가 중복 정의되어 있습니다.
|
||||
webRuleSet.predestroy.duplicate=클래스 [{0}]에 중복된 @PreDestroy 메소드 정의
|
||||
webRuleSet.relativeOrdering=web.xml 내에서 유효하지 않아서, 해당 <ordering> 엘리먼트는 무시될 것입니다.
|
||||
webRuleSet.relativeOrderingCount=<ordering> 엘리먼트는 오직 한번만 나타나도록 제한됩니다.
|
||||
|
||||
webXml.duplicateEnvEntry=중복된 env-entry 이름 [{0}]
|
||||
webXml.duplicateFilter=중복된 필터 이름: [{0}]
|
||||
webXml.duplicateFragment=이름이 [{0}]인, 둘 이상의 fragment들이 발견되었습니다. 이는 상대적 순서배열에서 불허됩니다. 상세 정보는 서블릿 스펙 8.2.2 2c 장을 참조하십시오. 절대적 순서배열을 사용하는 것을 고려해 보십시오.
|
||||
webXml.duplicateMessageDestination=중복된 message-destination 이름 [{0}]
|
||||
webXml.duplicateMessageDestinationRef=중복된 message-destination-ref 이름 [{0}]
|
||||
webXml.duplicateResourceEnvRef=중복된 resource-env-ref 이름 [{0}]입니다.
|
||||
webXml.duplicateResourceRef=중복된 resource-ref 이름: [{0}]
|
||||
webXml.duplicateServletMapping=이름이 [{0}]과 [{1}]인 두 서블릿들 모두 url-pattern [{2}]에 매핑되어 있는데, 이는 허용되지 않습니다.
|
||||
webXml.duplicateTaglibUri=중복된 태그 라이브러리 URI [{0}]
|
||||
webXml.mergeConflictDisplayName=표시 이름이, 위치가 [{1}]이고 이름이 [{0}]인 fragment를 포함하여, 여러 개의 fragment들에 다른 값들로 정의되었습니다.
|
||||
webXml.mergeConflictFilter=필터 [{0}]이(가), [{2}]에 위치한 [{1}](이)라는 이름을 가진 fragment를 포함하여, 여러 개의 fragment들에서 일관되지 않게 정의되었습니다.
|
||||
webXml.mergeConflictLoginConfig=LoginConfig가, [{1}]에 위치하고 이름이 [{0}]인 fragment를 포함하여, 여러 개의 fragment들에 일관되지 않게 정의되었습니다.
|
||||
webXml.mergeConflictOrder=Fragment의 상대적 순서들이 순환 참조를 포함하고 있습니다. 이 문제는 web.xml에서 절대 순서를 사용함으로써 해결될 수 있습니다.
|
||||
webXml.mergeConflictResource=리소스 [{0}]은(는), 이름이 [{1}](이)고 [{2}]에 위치한 fragment를 포함하여, 여러 개의 fragment들에서 일관되지 않게 정의되었습니다.
|
||||
webXml.mergeConflictServlet=서블릿 [{0}]이(가), [{2}]에 위치하고 [{1}](이)라는 이름을 가진 fragment를 포함하여, 여러 개의 fragment들에서 일관되지 않게 정의되었습니다.
|
||||
webXml.mergeConflictSessionCookieComment=세션 쿠키 주석이, [{1}]에 위치하고 [{0}](이)라는 이름의 fragment를 포함하여, 여러 개의 fragment들에서 다른 값들로 비일관되게 정의되었습니다.
|
||||
webXml.mergeConflictSessionCookieDomain=세션 쿠키 도메인이, [{1}]에 위치하고 이름이 [{0}]인 fragment를 포함하여, 여러 개의 fragment들에서 다른 값들로 일관되지 않게 정의되었습니다.
|
||||
webXml.mergeConflictSessionCookieHttpOnly=세션 쿠키의 http-only 플래그가, [{1}]에 위치하고 이름이 [{0}]인 fragment를 포함하여, 여러 개의 fragment들에 다른 값들로 일관되지 않게 정의되었습니다.
|
||||
webXml.mergeConflictSessionCookieMaxAge=세션 쿠키의 max-age가, [{1}]에 위치하고 이름이 [{0}]인 fragment를 포함하여, 여러 개의 fragment들에서 다른 값들로 일관되지 않게 정의되었습니다.
|
||||
webXml.mergeConflictSessionCookieName=세션 쿠키 이름이, [{1}]에 위치하고 [{0}](이)라는 이름을 가진 fragment를 포함하여, 여러 개의 fragment들에서 다른 값들로 일관되지 않게 정의되었습니다.
|
||||
webXml.mergeConflictSessionCookiePath=세션 쿠기 경로가, [{1}]에 위치하고 이름이 [{0}]인 fragment를 포함하여, 여러 개의 fragment들에서 다른 값들로 일관되지 않게 정의되었습니다.
|
||||
webXml.mergeConflictSessionCookieSecure=세션 쿠키의 secure 플래그가, [{1}]에 위치하고 이름이 [{0}]인 fragment를 포함하여, 여러 개의 fragment들에서 다른 값들로 일관되지 않게 정의되었습니다.
|
||||
webXml.mergeConflictSessionTimeout=세션 제한 시간 초과 값이, [{1}]에 위치하고 이름이 [{0}]인 fragment를 포함하여, 여러 개의 fragment들에 다른 값들로 일관되지 않게 정의되었습니다.
|
||||
webXml.mergeConflictSessionTrackingMode=세션 트랙킹 모드 설정들이, [{1}]에 위치하고 [{0}](이)라는 이름의 fragment를 포함하여, 여러 fragment들에 일관되지 않게 정의되었습니다.
|
||||
webXml.mergeConflictString=이름이 [{1}]인 [{0}]이(가), [{3}]에 위치하고 이름이 [{2}]인 fragment를 포함하여, 여러 개의 fragment들에서 일관되지 않게 정의되었습니다.
|
||||
webXml.multipleOther=<ordering> 엘리먼트 안에 내재된, 여러 개의 <others> 엔트리들
|
||||
webXml.reservedName=예약된 이름 [{0}]을(를) 사용한 web.xml이 탐지되었습니다. name 엘리먼트는 이 fragment를 위해 무시될 것입니다.
|
||||
webXml.unrecognisedPublicId=public ID [{0}]이(가), web.xml 파일들을 위해 알려진 public ID들 중 어떤 것과도 부합되지 않아, 해당 버전을 알아낼 수 없습니다.
|
||||
webXml.version.unknown=알 수 없는 버전 문자열 [{0}]. 기본 버전이 사용될 것입니다.
|
||||
webXml.wrongFragmentName=web.xml의 absolute-ordering 태그에서 잘못된 fragment 이름, [{0}]이(가) 사용되었습니다!
|
||||
|
||||
webXmlParser.applicationParse=[{0}]에 위치한 애플리케이션 web.xml 내에서 파싱 오류 발생
|
||||
webXmlParser.applicationPosition=행 [{0}], 열 [{1}]에서 발생했음
|
||||
webXmlParser.applicationStart=[{0}]에 위치한 애플리케이션 web.xml을 파싱합니다.
|
||||
@@ -0,0 +1,40 @@
|
||||
# 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.
|
||||
|
||||
filterDef.invalidFilterName=过滤器定义中的<filter-name> [{0}] 无效。
|
||||
|
||||
securityConstraint.uncoveredHttpOmittedMethod=对于URL模式[{0}]的安全性约束,将发现HTTP方法[{1}]。
|
||||
securityConstraint.uncoveredHttpOmittedMethodFix=添加url模式为[{0}]的安全约束以拒绝使用未覆盖的http方法[{1}]的访问
|
||||
|
||||
webRuleSet.absoluteOrdering=<绝对值排序>元素在web片段xml中无效,将被忽略。
|
||||
webRuleSet.nameCount=<name>元素只能出现1次
|
||||
webRuleSet.postconstruct.duplicate=class [{0}] 有重复的 post 构造方法声明
|
||||
|
||||
webXml.duplicateEnvEntry=重复的env-entry 名 [{0}]
|
||||
webXml.duplicateFilter=重复的过滤器名称 [{0}]
|
||||
webXml.duplicateServletMapping=名为 [{0}]和 [{1}] 的servlet不能映射为一个url模式(url-pattern) [{2}]
|
||||
webXml.mergeConflictDisplayName=显示名称在多个片段中被定义,这些片段包含不同的值,包括位于[{1}]的[{0}]的片段。
|
||||
webXml.mergeConflictFilter=筛选器[{0}]在多个片段中定义不一致,包括位于[{2}]的名为[{1}]的片段
|
||||
webXml.mergeConflictOrder=片段相对顺序包含循环引用。这可以通过在web.xml中使用绝对排序来解决。
|
||||
webXml.mergeConflictServlet=Servlet[{0}]在多个片段中的定义不一致,包括位于[{2}]的名为[{1}]的片段
|
||||
webXml.mergeConflictSessionCookieName=会话cookie名称在多个具有不同值的片段中定义不一致,包括位于 [{1}] 的片段 [{0}]
|
||||
webXml.mergeConflictSessionTimeout=会话超时以不同值的多个片段不一致地定义,这些片段包括位于[{1}]的具有名称[{0}]的片段。
|
||||
webXml.mergeConflictSessionTrackingMode=会话跟踪模式在多个片段中定义不一致,包括位于[{1}]的名称为[{0}]的片段
|
||||
webXml.reservedName=使用保留名称[{0}]检测到web.xml文件。 此片段将忽略name元素。
|
||||
webXml.unrecognisedPublicId=对于web.xml文件,公共ID[{0}]不匹配任何已知的公共ID‘,因此无法识别版本。
|
||||
webXml.version.unknown=未知版本字符串 [{0}]。将使用默认版本。
|
||||
webXml.wrongFragmentName=在web.xml绝对排序标签上使用了错误的片段名[{0}]!
|
||||
|
||||
webXmlParser.applicationPosition=出现在第 [{0}] 行 第 [{1}] 列
|
||||
217
java/org/apache/tomcat/util/descriptor/web/LoginConfig.java
Normal file
217
java/org/apache/tomcat/util/descriptor/web/LoginConfig.java
Normal file
@@ -0,0 +1,217 @@
|
||||
/*
|
||||
* 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.tomcat.util.descriptor.web;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.apache.tomcat.util.buf.UDecoder;
|
||||
|
||||
/**
|
||||
* Representation of a login configuration element for a web application,
|
||||
* as represented in a <code><login-config></code> element in the
|
||||
* deployment descriptor.
|
||||
*
|
||||
* @author Craig R. McClanahan
|
||||
*/
|
||||
public class LoginConfig implements Serializable {
|
||||
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
// ----------------------------------------------------------- Constructors
|
||||
|
||||
|
||||
/**
|
||||
* Construct a new LoginConfig with default properties.
|
||||
*/
|
||||
public LoginConfig() {
|
||||
|
||||
super();
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Construct a new LoginConfig with the specified properties.
|
||||
*
|
||||
* @param authMethod The authentication method
|
||||
* @param realmName The realm name
|
||||
* @param loginPage The login page URI
|
||||
* @param errorPage The error page URI
|
||||
*/
|
||||
public LoginConfig(String authMethod, String realmName,
|
||||
String loginPage, String errorPage) {
|
||||
|
||||
super();
|
||||
setAuthMethod(authMethod);
|
||||
setRealmName(realmName);
|
||||
setLoginPage(loginPage);
|
||||
setErrorPage(errorPage);
|
||||
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------------------- Properties
|
||||
|
||||
|
||||
/**
|
||||
* The authentication method to use for application login. Must be
|
||||
* BASIC, DIGEST, FORM, or CLIENT-CERT.
|
||||
*/
|
||||
private String authMethod = null;
|
||||
|
||||
public String getAuthMethod() {
|
||||
return this.authMethod;
|
||||
}
|
||||
|
||||
public void setAuthMethod(String authMethod) {
|
||||
this.authMethod = authMethod;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The context-relative URI of the error page for form login.
|
||||
*/
|
||||
private String errorPage = null;
|
||||
|
||||
public String getErrorPage() {
|
||||
return this.errorPage;
|
||||
}
|
||||
|
||||
public void setErrorPage(String errorPage) {
|
||||
// if ((errorPage == null) || !errorPage.startsWith("/"))
|
||||
// throw new IllegalArgumentException
|
||||
// ("Error Page resource path must start with a '/'");
|
||||
this.errorPage = UDecoder.URLDecode(errorPage);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The context-relative URI of the login page for form login.
|
||||
*/
|
||||
private String loginPage = null;
|
||||
|
||||
public String getLoginPage() {
|
||||
return this.loginPage;
|
||||
}
|
||||
|
||||
public void setLoginPage(String loginPage) {
|
||||
// if ((loginPage == null) || !loginPage.startsWith("/"))
|
||||
// throw new IllegalArgumentException
|
||||
// ("Login Page resource path must start with a '/'");
|
||||
this.loginPage = UDecoder.URLDecode(loginPage);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The realm name used when challenging the user for authentication
|
||||
* credentials.
|
||||
*/
|
||||
private String realmName = null;
|
||||
|
||||
public String getRealmName() {
|
||||
return this.realmName;
|
||||
}
|
||||
|
||||
public void setRealmName(String realmName) {
|
||||
this.realmName = realmName;
|
||||
}
|
||||
|
||||
|
||||
// --------------------------------------------------------- Public Methods
|
||||
|
||||
|
||||
/**
|
||||
* Return a String representation of this object.
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder("LoginConfig[");
|
||||
sb.append("authMethod=");
|
||||
sb.append(authMethod);
|
||||
if (realmName != null) {
|
||||
sb.append(", realmName=");
|
||||
sb.append(realmName);
|
||||
}
|
||||
if (loginPage != null) {
|
||||
sb.append(", loginPage=");
|
||||
sb.append(loginPage);
|
||||
}
|
||||
if (errorPage != null) {
|
||||
sb.append(", errorPage=");
|
||||
sb.append(errorPage);
|
||||
}
|
||||
sb.append("]");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see java.lang.Object#hashCode()
|
||||
*/
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result
|
||||
+ ((authMethod == null) ? 0 : authMethod.hashCode());
|
||||
result = prime * result
|
||||
+ ((errorPage == null) ? 0 : errorPage.hashCode());
|
||||
result = prime * result
|
||||
+ ((loginPage == null) ? 0 : loginPage.hashCode());
|
||||
result = prime * result
|
||||
+ ((realmName == null) ? 0 : realmName.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see java.lang.Object#equals(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (!(obj instanceof LoginConfig))
|
||||
return false;
|
||||
LoginConfig other = (LoginConfig) obj;
|
||||
if (authMethod == null) {
|
||||
if (other.authMethod != null)
|
||||
return false;
|
||||
} else if (!authMethod.equals(other.authMethod))
|
||||
return false;
|
||||
if (errorPage == null) {
|
||||
if (other.errorPage != null)
|
||||
return false;
|
||||
} else if (!errorPage.equals(other.errorPage))
|
||||
return false;
|
||||
if (loginPage == null) {
|
||||
if (other.loginPage != null)
|
||||
return false;
|
||||
} else if (!loginPage.equals(other.loginPage))
|
||||
return false;
|
||||
if (realmName == null) {
|
||||
if (other.realmName != null)
|
||||
return false;
|
||||
} else if (!realmName.equals(other.realmName))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,158 @@
|
||||
/*
|
||||
* 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.tomcat.util.descriptor.web;
|
||||
|
||||
|
||||
/**
|
||||
* <p>Representation of a message destination for a web application, as
|
||||
* represented in a <code><message-destination></code> element
|
||||
* in the deployment descriptor.</p>
|
||||
*
|
||||
* @author Craig R. McClanahan
|
||||
* @since Tomcat 5.0
|
||||
*/
|
||||
public class MessageDestination extends ResourceBase {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
// ------------------------------------------------------------- Properties
|
||||
|
||||
|
||||
/**
|
||||
* The display name of this destination.
|
||||
*/
|
||||
private String displayName = null;
|
||||
|
||||
public String getDisplayName() {
|
||||
return this.displayName;
|
||||
}
|
||||
|
||||
public void setDisplayName(String displayName) {
|
||||
this.displayName = displayName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The large icon of this destination.
|
||||
*/
|
||||
private String largeIcon = null;
|
||||
|
||||
public String getLargeIcon() {
|
||||
return this.largeIcon;
|
||||
}
|
||||
|
||||
public void setLargeIcon(String largeIcon) {
|
||||
this.largeIcon = largeIcon;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The small icon of this destination.
|
||||
*/
|
||||
private String smallIcon = null;
|
||||
|
||||
public String getSmallIcon() {
|
||||
return this.smallIcon;
|
||||
}
|
||||
|
||||
public void setSmallIcon(String smallIcon) {
|
||||
this.smallIcon = smallIcon;
|
||||
}
|
||||
|
||||
|
||||
// --------------------------------------------------------- Public Methods
|
||||
|
||||
|
||||
/**
|
||||
* Return a String representation of this object.
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder("MessageDestination[");
|
||||
sb.append("name=");
|
||||
sb.append(getName());
|
||||
if (displayName != null) {
|
||||
sb.append(", displayName=");
|
||||
sb.append(displayName);
|
||||
}
|
||||
if (largeIcon != null) {
|
||||
sb.append(", largeIcon=");
|
||||
sb.append(largeIcon);
|
||||
}
|
||||
if (smallIcon != null) {
|
||||
sb.append(", smallIcon=");
|
||||
sb.append(smallIcon);
|
||||
}
|
||||
if (getDescription() != null) {
|
||||
sb.append(", description=");
|
||||
sb.append(getDescription());
|
||||
}
|
||||
sb.append("]");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = super.hashCode();
|
||||
result = prime * result +
|
||||
((displayName == null) ? 0 : displayName.hashCode());
|
||||
result = prime * result +
|
||||
((largeIcon == null) ? 0 : largeIcon.hashCode());
|
||||
result = prime * result +
|
||||
((smallIcon == null) ? 0 : smallIcon.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (!super.equals(obj)) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
MessageDestination other = (MessageDestination) obj;
|
||||
if (displayName == null) {
|
||||
if (other.displayName != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!displayName.equals(other.displayName)) {
|
||||
return false;
|
||||
}
|
||||
if (largeIcon == null) {
|
||||
if (other.largeIcon != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!largeIcon.equals(other.largeIcon)) {
|
||||
return false;
|
||||
}
|
||||
if (smallIcon == null) {
|
||||
if (other.smallIcon != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!smallIcon.equals(other.smallIcon)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,132 @@
|
||||
/*
|
||||
* 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.tomcat.util.descriptor.web;
|
||||
|
||||
|
||||
/**
|
||||
* <p>Representation of a message destination reference for a web application,
|
||||
* as represented in a <code><message-destination-ref></code> element
|
||||
* in the deployment descriptor.</p>
|
||||
*
|
||||
* @author Craig R. McClanahan
|
||||
* @since Tomcat 5.0
|
||||
*/
|
||||
public class MessageDestinationRef extends ResourceBase {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
// ------------------------------------------------------------- Properties
|
||||
|
||||
|
||||
/**
|
||||
* The link of this destination ref.
|
||||
*/
|
||||
private String link = null;
|
||||
|
||||
public String getLink() {
|
||||
return this.link;
|
||||
}
|
||||
|
||||
public void setLink(String link) {
|
||||
this.link = link;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The usage of this destination ref.
|
||||
*/
|
||||
private String usage = null;
|
||||
|
||||
public String getUsage() {
|
||||
return this.usage;
|
||||
}
|
||||
|
||||
public void setUsage(String usage) {
|
||||
this.usage = usage;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------- Public Methods
|
||||
|
||||
|
||||
/**
|
||||
* Return a String representation of this object.
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder("MessageDestination[");
|
||||
sb.append("name=");
|
||||
sb.append(getName());
|
||||
if (link != null) {
|
||||
sb.append(", link=");
|
||||
sb.append(link);
|
||||
}
|
||||
if (getType() != null) {
|
||||
sb.append(", type=");
|
||||
sb.append(getType());
|
||||
}
|
||||
if (usage != null) {
|
||||
sb.append(", usage=");
|
||||
sb.append(usage);
|
||||
}
|
||||
if (getDescription() != null) {
|
||||
sb.append(", description=");
|
||||
sb.append(getDescription());
|
||||
}
|
||||
sb.append("]");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = super.hashCode();
|
||||
result = prime * result + ((link == null) ? 0 : link.hashCode());
|
||||
result = prime * result + ((usage == null) ? 0 : usage.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (!super.equals(obj)) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
MessageDestinationRef other = (MessageDestinationRef) obj;
|
||||
if (link == null) {
|
||||
if (other.link != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!link.equals(other.link)) {
|
||||
return false;
|
||||
}
|
||||
if (usage == null) {
|
||||
if (other.usage != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!usage.equals(other.usage)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
138
java/org/apache/tomcat/util/descriptor/web/MultipartDef.java
Normal file
138
java/org/apache/tomcat/util/descriptor/web/MultipartDef.java
Normal file
@@ -0,0 +1,138 @@
|
||||
/*
|
||||
* 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.tomcat.util.descriptor.web;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
/**
|
||||
* Representation of a the multipart configuration for a servlet.
|
||||
*/
|
||||
public class MultipartDef implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
// ------------------------------------------------------------- Properties
|
||||
private String location;
|
||||
|
||||
public String getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
public void setLocation(String location) {
|
||||
this.location = location;
|
||||
}
|
||||
|
||||
|
||||
private String maxFileSize;
|
||||
|
||||
public String getMaxFileSize() {
|
||||
return maxFileSize;
|
||||
}
|
||||
|
||||
public void setMaxFileSize(String maxFileSize) {
|
||||
this.maxFileSize = maxFileSize;
|
||||
}
|
||||
|
||||
|
||||
private String maxRequestSize;
|
||||
|
||||
public String getMaxRequestSize() {
|
||||
return maxRequestSize;
|
||||
}
|
||||
|
||||
public void setMaxRequestSize(String maxRequestSize) {
|
||||
this.maxRequestSize = maxRequestSize;
|
||||
}
|
||||
|
||||
|
||||
private String fileSizeThreshold;
|
||||
|
||||
public String getFileSizeThreshold() {
|
||||
return fileSizeThreshold;
|
||||
}
|
||||
|
||||
public void setFileSizeThreshold(String fileSizeThreshold) {
|
||||
this.fileSizeThreshold = fileSizeThreshold;
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------- Object methods
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime
|
||||
* result
|
||||
+ ((fileSizeThreshold == null) ? 0 : fileSizeThreshold
|
||||
.hashCode());
|
||||
result = prime * result
|
||||
+ ((location == null) ? 0 : location.hashCode());
|
||||
result = prime * result
|
||||
+ ((maxFileSize == null) ? 0 : maxFileSize.hashCode());
|
||||
result = prime * result
|
||||
+ ((maxRequestSize == null) ? 0 : maxRequestSize.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (!(obj instanceof MultipartDef)) {
|
||||
return false;
|
||||
}
|
||||
MultipartDef other = (MultipartDef) obj;
|
||||
if (fileSizeThreshold == null) {
|
||||
if (other.fileSizeThreshold != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!fileSizeThreshold.equals(other.fileSizeThreshold)) {
|
||||
return false;
|
||||
}
|
||||
if (location == null) {
|
||||
if (other.location != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!location.equals(other.location)) {
|
||||
return false;
|
||||
}
|
||||
if (maxFileSize == null) {
|
||||
if (other.maxFileSize != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!maxFileSize.equals(other.maxFileSize)) {
|
||||
return false;
|
||||
}
|
||||
if (maxRequestSize == null) {
|
||||
if (other.maxRequestSize != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!maxRequestSize.equals(other.maxRequestSize)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* 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.tomcat.util.descriptor.web;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Defines an interface for the object that is added to the representation of a
|
||||
* JNDI resource in web.xml to enable it to also be the implementation of that
|
||||
* JNDI resource. Only Catalina implements this interface but because the
|
||||
* web.xml representation is shared this interface has to be visible to Catalina
|
||||
* and Jasper.
|
||||
*/
|
||||
public interface NamingResources {
|
||||
|
||||
void addEnvironment(ContextEnvironment ce);
|
||||
void removeEnvironment(String name);
|
||||
|
||||
void addResource(ContextResource cr);
|
||||
void removeResource(String name);
|
||||
|
||||
void addResourceLink(ContextResourceLink crl);
|
||||
void removeResourceLink(String name);
|
||||
|
||||
Object getContainer();
|
||||
}
|
||||
233
java/org/apache/tomcat/util/descriptor/web/ResourceBase.java
Normal file
233
java/org/apache/tomcat/util/descriptor/web/ResourceBase.java
Normal file
@@ -0,0 +1,233 @@
|
||||
/*
|
||||
* 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.tomcat.util.descriptor.web;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* Representation of an Context element
|
||||
*
|
||||
* @author Peter Rossbach (pero@apache.org)
|
||||
*/
|
||||
public class ResourceBase implements Serializable, Injectable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
// ------------------------------------------------------------- Properties
|
||||
|
||||
/**
|
||||
* The description of this resource.
|
||||
*/
|
||||
private String description = null;
|
||||
|
||||
public String getDescription() {
|
||||
return this.description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* The name of this resource.
|
||||
*/
|
||||
private String name = null;
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The name of the resource implementation class.
|
||||
*/
|
||||
private String type = null;
|
||||
|
||||
public String getType() {
|
||||
return this.type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
|
||||
private String lookupName = null;
|
||||
|
||||
public String getLookupName() {
|
||||
return lookupName;
|
||||
}
|
||||
|
||||
public void setLookupName(String lookupName) {
|
||||
if (lookupName == null || lookupName.length() == 0) {
|
||||
this.lookupName = null;
|
||||
return;
|
||||
}
|
||||
this.lookupName = lookupName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Holder for our configured properties.
|
||||
*/
|
||||
private final HashMap<String, Object> properties = new HashMap<>();
|
||||
|
||||
/**
|
||||
* @param name The property name
|
||||
* @return a configured property.
|
||||
*/
|
||||
public Object getProperty(String name) {
|
||||
return properties.get(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a configured property.
|
||||
* @param name The property name
|
||||
* @param value The property value
|
||||
*/
|
||||
public void setProperty(String name, Object value) {
|
||||
properties.put(name, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a configured property.
|
||||
* @param name The property name
|
||||
*/
|
||||
public void removeProperty(String name) {
|
||||
properties.remove(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* List properties.
|
||||
* @return the property names iterator
|
||||
*/
|
||||
public Iterator<String> listProperties() {
|
||||
return properties.keySet().iterator();
|
||||
}
|
||||
|
||||
private final List<InjectionTarget> injectionTargets = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
public void addInjectionTarget(String injectionTargetName, String jndiName) {
|
||||
InjectionTarget target = new InjectionTarget(injectionTargetName, jndiName);
|
||||
injectionTargets.add(target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<InjectionTarget> getInjectionTargets() {
|
||||
return injectionTargets;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((description == null) ? 0 : description.hashCode());
|
||||
result = prime * result + ((injectionTargets == null) ? 0 : injectionTargets.hashCode());
|
||||
result = prime * result + ((name == null) ? 0 : name.hashCode());
|
||||
result = prime * result + ((properties == null) ? 0 : properties.hashCode());
|
||||
result = prime * result + ((type == null) ? 0 : type.hashCode());
|
||||
result = prime * result + ((lookupName == null) ? 0 : lookupName.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
ResourceBase other = (ResourceBase) obj;
|
||||
if (description == null) {
|
||||
if (other.description != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!description.equals(other.description)) {
|
||||
return false;
|
||||
}
|
||||
if (injectionTargets == null) {
|
||||
if (other.injectionTargets != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!injectionTargets.equals(other.injectionTargets)) {
|
||||
return false;
|
||||
}
|
||||
if (name == null) {
|
||||
if (other.name != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!name.equals(other.name)) {
|
||||
return false;
|
||||
}
|
||||
if (properties == null) {
|
||||
if (other.properties != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!properties.equals(other.properties)) {
|
||||
return false;
|
||||
}
|
||||
if (type == null) {
|
||||
if (other.type != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!type.equals(other.type)) {
|
||||
return false;
|
||||
}
|
||||
if (lookupName == null) {
|
||||
if (other.lookupName != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!lookupName.equals(other.lookupName)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The NamingResources with which we are associated (if any).
|
||||
*/
|
||||
private NamingResources resources = null;
|
||||
|
||||
public NamingResources getNamingResources() {
|
||||
return this.resources;
|
||||
}
|
||||
|
||||
public void setNamingResources(NamingResources resources) {
|
||||
this.resources = resources;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,400 @@
|
||||
/*
|
||||
* 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.tomcat.util.descriptor.web;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import org.apache.tomcat.util.buf.UDecoder;
|
||||
|
||||
|
||||
/**
|
||||
* Representation of a web resource collection for a web application's security
|
||||
* constraint, as represented in a <code><web-resource-collection></code>
|
||||
* element in the deployment descriptor.
|
||||
* <p>
|
||||
* <b>WARNING</b>: It is assumed that instances of this class will be created
|
||||
* and modified only within the context of a single thread, before the instance
|
||||
* is made visible to the remainder of the application. After that, only read
|
||||
* access is expected. Therefore, none of the read and write access within
|
||||
* this class is synchronized.
|
||||
*
|
||||
* @author Craig R. McClanahan
|
||||
*/
|
||||
public class SecurityCollection extends XmlEncodingBase implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
// ----------------------------------------------------------- Constructors
|
||||
|
||||
|
||||
/**
|
||||
* Construct a new security collection instance with default values.
|
||||
*/
|
||||
public SecurityCollection() {
|
||||
|
||||
this(null, null);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Construct a new security collection instance with specified values.
|
||||
*
|
||||
* @param name Name of this security collection
|
||||
* @param description Description of this security collection
|
||||
*/
|
||||
public SecurityCollection(String name, String description) {
|
||||
|
||||
super();
|
||||
setName(name);
|
||||
setDescription(description);
|
||||
|
||||
}
|
||||
|
||||
|
||||
// ----------------------------------------------------- Instance Variables
|
||||
|
||||
|
||||
/**
|
||||
* Description of this web resource collection.
|
||||
*/
|
||||
private String description = null;
|
||||
|
||||
|
||||
/**
|
||||
* The HTTP methods explicitly covered by this web resource collection.
|
||||
*/
|
||||
private String methods[] = new String[0];
|
||||
|
||||
|
||||
/**
|
||||
* The HTTP methods explicitly excluded from this web resource collection.
|
||||
*/
|
||||
private String omittedMethods[] = new String[0];
|
||||
|
||||
/**
|
||||
* The name of this web resource collection.
|
||||
*/
|
||||
private String name = null;
|
||||
|
||||
|
||||
/**
|
||||
* The URL patterns protected by this security collection.
|
||||
*/
|
||||
private String patterns[] = new String[0];
|
||||
|
||||
|
||||
/**
|
||||
* This security collection was established by a deployment descriptor.
|
||||
* Defaults to <code>true</code>.
|
||||
*/
|
||||
private boolean isFromDescriptor = true;
|
||||
|
||||
// ------------------------------------------------------------- Properties
|
||||
|
||||
|
||||
/**
|
||||
* @return the description of this web resource collection.
|
||||
*/
|
||||
public String getDescription() {
|
||||
return this.description;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the description of this web resource collection.
|
||||
*
|
||||
* @param description The new description
|
||||
*/
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the name of this web resource collection.
|
||||
*/
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the name of this web resource collection
|
||||
*
|
||||
* @param name The new name
|
||||
*/
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return if this constraint was defined in a deployment descriptor.
|
||||
*/
|
||||
public boolean isFromDescriptor() {
|
||||
return isFromDescriptor;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set if this constraint was defined in a deployment descriptor.
|
||||
* @param isFromDescriptor <code>true</code> was declared in a descriptor
|
||||
*/
|
||||
public void setFromDescriptor(boolean isFromDescriptor) {
|
||||
this.isFromDescriptor = isFromDescriptor;
|
||||
}
|
||||
|
||||
|
||||
// --------------------------------------------------------- Public Methods
|
||||
|
||||
|
||||
/**
|
||||
* Add an HTTP request method to be explicitly part of this web resource
|
||||
* collection.
|
||||
* @param method The method
|
||||
*/
|
||||
public void addMethod(String method) {
|
||||
|
||||
if (method == null)
|
||||
return;
|
||||
String results[] = new String[methods.length + 1];
|
||||
for (int i = 0; i < methods.length; i++)
|
||||
results[i] = methods[i];
|
||||
results[methods.length] = method;
|
||||
methods = results;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add an HTTP request method to the methods explicitly excluded from this
|
||||
* web resource collection.
|
||||
* @param method The method
|
||||
*/
|
||||
public void addOmittedMethod(String method) {
|
||||
if (method == null)
|
||||
return;
|
||||
String results[] = new String[omittedMethods.length + 1];
|
||||
for (int i = 0; i < omittedMethods.length; i++)
|
||||
results[i] = omittedMethods[i];
|
||||
results[omittedMethods.length] = method;
|
||||
omittedMethods = results;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a URL pattern to be part of this web resource collection.
|
||||
* @param pattern The pattern
|
||||
*/
|
||||
public void addPattern(String pattern) {
|
||||
addPatternDecoded(UDecoder.URLDecode(pattern, StandardCharsets.UTF_8));
|
||||
}
|
||||
public void addPatternDecoded(String pattern) {
|
||||
|
||||
if (pattern == null)
|
||||
return;
|
||||
|
||||
String decodedPattern = UDecoder.URLDecode(pattern);
|
||||
String results[] = new String[patterns.length + 1];
|
||||
for (int i = 0; i < patterns.length; i++) {
|
||||
results[i] = patterns[i];
|
||||
}
|
||||
results[patterns.length] = decodedPattern;
|
||||
patterns = results;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check if the collection applies to the specified method.
|
||||
* @param method Request method to check
|
||||
* @return <code>true</code> if the specified HTTP request method is
|
||||
* part of this web resource collection.
|
||||
*/
|
||||
public boolean findMethod(String method) {
|
||||
|
||||
if (methods.length == 0 && omittedMethods.length == 0)
|
||||
return true;
|
||||
if (methods.length > 0) {
|
||||
for (int i = 0; i < methods.length; i++) {
|
||||
if (methods[i].equals(method))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (omittedMethods.length > 0) {
|
||||
for (int i = 0; i < omittedMethods.length; i++) {
|
||||
if (omittedMethods[i].equals(method))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the set of HTTP request methods that are part of this web
|
||||
* resource collection, or a zero-length array if no methods have been
|
||||
* explicitly included.
|
||||
*/
|
||||
public String[] findMethods() {
|
||||
return methods;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the set of HTTP request methods that are explicitly excluded from
|
||||
* this web resource collection, or a zero-length array if no request
|
||||
* methods are excluded.
|
||||
*/
|
||||
public String[] findOmittedMethods() {
|
||||
return omittedMethods;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Is the specified pattern part of this web resource collection?
|
||||
*
|
||||
* @param pattern Pattern to be compared
|
||||
* @return <code>true</code> if the pattern is part of the collection
|
||||
*/
|
||||
public boolean findPattern(String pattern) {
|
||||
for (int i = 0; i < patterns.length; i++) {
|
||||
if (patterns[i].equals(pattern))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the set of URL patterns that are part of this web resource
|
||||
* collection. If none have been specified, a zero-length array is
|
||||
* returned.
|
||||
*/
|
||||
public String[] findPatterns() {
|
||||
return patterns;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Remove the specified HTTP request method from those that are part
|
||||
* of this web resource collection.
|
||||
*
|
||||
* @param method Request method to be removed
|
||||
*/
|
||||
public void removeMethod(String method) {
|
||||
|
||||
if (method == null)
|
||||
return;
|
||||
int n = -1;
|
||||
for (int i = 0; i < methods.length; i++) {
|
||||
if (methods[i].equals(method)) {
|
||||
n = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (n >= 0) {
|
||||
int j = 0;
|
||||
String results[] = new String[methods.length - 1];
|
||||
for (int i = 0; i < methods.length; i++) {
|
||||
if (i != n)
|
||||
results[j++] = methods[i];
|
||||
}
|
||||
methods = results;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Remove the specified HTTP request method from those that are explicitly
|
||||
* excluded from this web resource collection.
|
||||
*
|
||||
* @param method Request method to be removed
|
||||
*/
|
||||
public void removeOmittedMethod(String method) {
|
||||
|
||||
if (method == null)
|
||||
return;
|
||||
int n = -1;
|
||||
for (int i = 0; i < omittedMethods.length; i++) {
|
||||
if (omittedMethods[i].equals(method)) {
|
||||
n = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (n >= 0) {
|
||||
int j = 0;
|
||||
String results[] = new String[omittedMethods.length - 1];
|
||||
for (int i = 0; i < omittedMethods.length; i++) {
|
||||
if (i != n)
|
||||
results[j++] = omittedMethods[i];
|
||||
}
|
||||
omittedMethods = results;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Remove the specified URL pattern from those that are part of this
|
||||
* web resource collection.
|
||||
*
|
||||
* @param pattern Pattern to be removed
|
||||
*/
|
||||
public void removePattern(String pattern) {
|
||||
|
||||
if (pattern == null)
|
||||
return;
|
||||
int n = -1;
|
||||
for (int i = 0; i < patterns.length; i++) {
|
||||
if (patterns[i].equals(pattern)) {
|
||||
n = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (n >= 0) {
|
||||
int j = 0;
|
||||
String results[] = new String[patterns.length - 1];
|
||||
for (int i = 0; i < patterns.length; i++) {
|
||||
if (i != n)
|
||||
results[j++] = patterns[i];
|
||||
}
|
||||
patterns = results;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return a String representation of this security collection.
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder("SecurityCollection[");
|
||||
sb.append(name);
|
||||
if (description != null) {
|
||||
sb.append(", ");
|
||||
sb.append(description);
|
||||
}
|
||||
sb.append("]");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,766 @@
|
||||
/*
|
||||
* 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.tomcat.util.descriptor.web;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.servlet.HttpConstraintElement;
|
||||
import javax.servlet.HttpMethodConstraintElement;
|
||||
import javax.servlet.ServletSecurityElement;
|
||||
import javax.servlet.annotation.ServletSecurity;
|
||||
import javax.servlet.annotation.ServletSecurity.EmptyRoleSemantic;
|
||||
|
||||
import org.apache.juli.logging.Log;
|
||||
import org.apache.tomcat.util.res.StringManager;
|
||||
|
||||
|
||||
/**
|
||||
* Representation of a security constraint element for a web application,
|
||||
* as represented in a <code><security-constraint></code> element in the
|
||||
* deployment descriptor.
|
||||
* <p>
|
||||
* <b>WARNING</b>: It is assumed that instances of this class will be created
|
||||
* and modified only within the context of a single thread, before the instance
|
||||
* is made visible to the remainder of the application. After that, only read
|
||||
* access is expected. Therefore, none of the read and write access within
|
||||
* this class is synchronized.
|
||||
*
|
||||
* @author Craig R. McClanahan
|
||||
*/
|
||||
public class SecurityConstraint extends XmlEncodingBase implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public static final String ROLE_ALL_ROLES = "*";
|
||||
public static final String ROLE_ALL_AUTHENTICATED_USERS = "**";
|
||||
|
||||
private static final StringManager sm =
|
||||
StringManager.getManager(Constants.PACKAGE_NAME);
|
||||
|
||||
|
||||
// ----------------------------------------------------------- Constructors
|
||||
|
||||
/**
|
||||
* Construct a new security constraint instance with default values.
|
||||
*/
|
||||
public SecurityConstraint() {
|
||||
super();
|
||||
}
|
||||
|
||||
|
||||
// ----------------------------------------------------- Instance Variables
|
||||
|
||||
|
||||
/**
|
||||
* Was the "all roles" wildcard - {@link #ROLE_ALL_ROLES} - included in the
|
||||
* authorization constraints for this security constraint?
|
||||
*/
|
||||
private boolean allRoles = false;
|
||||
|
||||
|
||||
/**
|
||||
* Was the "all authenticated users" wildcard -
|
||||
* {@link #ROLE_ALL_AUTHENTICATED_USERS} - included in the authorization
|
||||
* constraints for this security constraint?
|
||||
*/
|
||||
private boolean authenticatedUsers = false;
|
||||
|
||||
|
||||
/**
|
||||
* Was an authorization constraint included in this security constraint?
|
||||
* This is necessary to distinguish the case where an auth-constraint with
|
||||
* no roles (signifying no direct access at all) was requested, versus
|
||||
* a lack of auth-constraint which implies no access control checking.
|
||||
*/
|
||||
private boolean authConstraint = false;
|
||||
|
||||
|
||||
/**
|
||||
* The set of roles permitted to access resources protected by this
|
||||
* security constraint.
|
||||
*/
|
||||
private String authRoles[] = new String[0];
|
||||
|
||||
|
||||
/**
|
||||
* The set of web resource collections protected by this security
|
||||
* constraint.
|
||||
*/
|
||||
private SecurityCollection collections[] = new SecurityCollection[0];
|
||||
|
||||
|
||||
/**
|
||||
* The display name of this security constraint.
|
||||
*/
|
||||
private String displayName = null;
|
||||
|
||||
|
||||
/**
|
||||
* The user data constraint for this security constraint. Must be NONE,
|
||||
* INTEGRAL, or CONFIDENTIAL.
|
||||
*/
|
||||
private String userConstraint = "NONE";
|
||||
|
||||
|
||||
// ------------------------------------------------------------- Properties
|
||||
|
||||
|
||||
/**
|
||||
* Was the "all roles" wildcard included in this authentication
|
||||
* constraint?
|
||||
* @return <code>true</code> if all roles
|
||||
*/
|
||||
public boolean getAllRoles() {
|
||||
|
||||
return this.allRoles;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Was the "all authenticated users" wildcard included in this
|
||||
* authentication constraint?
|
||||
* @return <code>true</code> if all authenticated users
|
||||
*/
|
||||
public boolean getAuthenticatedUsers() {
|
||||
return this.authenticatedUsers;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the authorization constraint present flag for this security
|
||||
* constraint.
|
||||
* @return <code>true</code> if this needs authorization
|
||||
*/
|
||||
public boolean getAuthConstraint() {
|
||||
|
||||
return this.authConstraint;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the authorization constraint present flag for this security
|
||||
* constraint.
|
||||
* @param authConstraint The new value
|
||||
*/
|
||||
public void setAuthConstraint(boolean authConstraint) {
|
||||
|
||||
this.authConstraint = authConstraint;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the display name of this security constraint.
|
||||
*/
|
||||
public String getDisplayName() {
|
||||
|
||||
return this.displayName;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the display name of this security constraint.
|
||||
* @param displayName The new value
|
||||
*/
|
||||
public void setDisplayName(String displayName) {
|
||||
|
||||
this.displayName = displayName;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the user data constraint for this security constraint.
|
||||
* @return the user constraint
|
||||
*/
|
||||
public String getUserConstraint() {
|
||||
|
||||
return userConstraint;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the user data constraint for this security constraint.
|
||||
*
|
||||
* @param userConstraint The new user data constraint
|
||||
*/
|
||||
public void setUserConstraint(String userConstraint) {
|
||||
|
||||
if (userConstraint != null)
|
||||
this.userConstraint = userConstraint;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Called in the unlikely event that an application defines a role named
|
||||
* "**".
|
||||
*/
|
||||
public void treatAllAuthenticatedUsersAsApplicationRole() {
|
||||
if (authenticatedUsers) {
|
||||
authenticatedUsers = false;
|
||||
|
||||
String results[] = new String[authRoles.length + 1];
|
||||
for (int i = 0; i < authRoles.length; i++)
|
||||
results[i] = authRoles[i];
|
||||
results[authRoles.length] = ROLE_ALL_AUTHENTICATED_USERS;
|
||||
authRoles = results;
|
||||
authConstraint = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// --------------------------------------------------------- Public Methods
|
||||
|
||||
|
||||
/**
|
||||
* Add an authorization role, which is a role name that will be
|
||||
* permitted access to the resources protected by this security constraint.
|
||||
*
|
||||
* @param authRole Role name to be added
|
||||
*/
|
||||
public void addAuthRole(String authRole) {
|
||||
|
||||
if (authRole == null)
|
||||
return;
|
||||
|
||||
if (ROLE_ALL_ROLES.equals(authRole)) {
|
||||
allRoles = true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (ROLE_ALL_AUTHENTICATED_USERS.equals(authRole)) {
|
||||
authenticatedUsers = true;
|
||||
return;
|
||||
}
|
||||
|
||||
String results[] = new String[authRoles.length + 1];
|
||||
for (int i = 0; i < authRoles.length; i++)
|
||||
results[i] = authRoles[i];
|
||||
results[authRoles.length] = authRole;
|
||||
authRoles = results;
|
||||
authConstraint = true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add a new web resource collection to those protected by this
|
||||
* security constraint.
|
||||
*
|
||||
* @param collection The new web resource collection
|
||||
*/
|
||||
public void addCollection(SecurityCollection collection) {
|
||||
|
||||
if (collection == null)
|
||||
return;
|
||||
|
||||
collection.setCharset(getCharset());
|
||||
|
||||
SecurityCollection results[] =
|
||||
new SecurityCollection[collections.length + 1];
|
||||
for (int i = 0; i < collections.length; i++)
|
||||
results[i] = collections[i];
|
||||
results[collections.length] = collection;
|
||||
collections = results;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check a role.
|
||||
*
|
||||
* @param role Role name to be checked
|
||||
* @return <code>true</code> if the specified role is permitted access to
|
||||
* the resources protected by this security constraint.
|
||||
*/
|
||||
public boolean findAuthRole(String role) {
|
||||
|
||||
if (role == null)
|
||||
return false;
|
||||
for (int i = 0; i < authRoles.length; i++) {
|
||||
if (role.equals(authRoles[i]))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the set of roles that are permitted access to the resources
|
||||
* protected by this security constraint. If none have been defined,
|
||||
* a zero-length array is returned (which implies that all authenticated
|
||||
* users are permitted access).
|
||||
* @return the roles array
|
||||
*/
|
||||
public String[] findAuthRoles() {
|
||||
return authRoles;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the web resource collection for the specified name, if any;
|
||||
* otherwise, return <code>null</code>.
|
||||
*
|
||||
* @param name Web resource collection name to return
|
||||
* @return the collection
|
||||
*/
|
||||
public SecurityCollection findCollection(String name) {
|
||||
if (name == null)
|
||||
return null;
|
||||
for (int i = 0; i < collections.length; i++) {
|
||||
if (name.equals(collections[i].getName()))
|
||||
return collections[i];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return all of the web resource collections protected by this
|
||||
* security constraint. If there are none, a zero-length array is
|
||||
* returned.
|
||||
* @return the collections array
|
||||
*/
|
||||
public SecurityCollection[] findCollections() {
|
||||
return collections;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check if the constraint applies to a URI and method.
|
||||
* @param uri Context-relative URI to check
|
||||
* @param method Request method being used
|
||||
* @return <code>true</code> if the specified context-relative URI (and
|
||||
* associated HTTP method) are protected by this security constraint.
|
||||
*/
|
||||
public boolean included(String uri, String method) {
|
||||
|
||||
// We cannot match without a valid request method
|
||||
if (method == null)
|
||||
return false;
|
||||
|
||||
// Check all of the collections included in this constraint
|
||||
for (int i = 0; i < collections.length; i++) {
|
||||
if (!collections[i].findMethod(method))
|
||||
continue;
|
||||
String patterns[] = collections[i].findPatterns();
|
||||
for (int j = 0; j < patterns.length; j++) {
|
||||
if (matchPattern(uri, patterns[j]))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// No collection included in this constraint matches this request
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Remove the specified role from the set of roles permitted to access
|
||||
* the resources protected by this security constraint.
|
||||
*
|
||||
* @param authRole Role name to be removed
|
||||
*/
|
||||
public void removeAuthRole(String authRole) {
|
||||
|
||||
if (authRole == null)
|
||||
return;
|
||||
|
||||
if (ROLE_ALL_ROLES.equals(authRole)) {
|
||||
allRoles = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (ROLE_ALL_AUTHENTICATED_USERS.equals(authRole)) {
|
||||
authenticatedUsers = false;
|
||||
return;
|
||||
}
|
||||
|
||||
int n = -1;
|
||||
for (int i = 0; i < authRoles.length; i++) {
|
||||
if (authRoles[i].equals(authRole)) {
|
||||
n = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (n >= 0) {
|
||||
int j = 0;
|
||||
String results[] = new String[authRoles.length - 1];
|
||||
for (int i = 0; i < authRoles.length; i++) {
|
||||
if (i != n)
|
||||
results[j++] = authRoles[i];
|
||||
}
|
||||
authRoles = results;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Remove the specified web resource collection from those protected by
|
||||
* this security constraint.
|
||||
*
|
||||
* @param collection Web resource collection to be removed
|
||||
*/
|
||||
public void removeCollection(SecurityCollection collection) {
|
||||
|
||||
if (collection == null)
|
||||
return;
|
||||
int n = -1;
|
||||
for (int i = 0; i < collections.length; i++) {
|
||||
if (collections[i].equals(collection)) {
|
||||
n = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (n >= 0) {
|
||||
int j = 0;
|
||||
SecurityCollection results[] =
|
||||
new SecurityCollection[collections.length - 1];
|
||||
for (int i = 0; i < collections.length; i++) {
|
||||
if (i != n)
|
||||
results[j++] = collections[i];
|
||||
}
|
||||
collections = results;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return a String representation of this security constraint.
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder("SecurityConstraint[");
|
||||
for (int i = 0; i < collections.length; i++) {
|
||||
if (i > 0)
|
||||
sb.append(", ");
|
||||
sb.append(collections[i].getName());
|
||||
}
|
||||
sb.append("]");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
||||
// -------------------------------------------------------- Private Methods
|
||||
|
||||
|
||||
/**
|
||||
* Does the specified request path match the specified URL pattern?
|
||||
* This method follows the same rules (in the same order) as those used
|
||||
* for mapping requests to servlets.
|
||||
*
|
||||
* @param path Context-relative request path to be checked
|
||||
* (must start with '/')
|
||||
* @param pattern URL pattern to be compared against
|
||||
*/
|
||||
private boolean matchPattern(String path, String pattern) {
|
||||
|
||||
// Normalize the argument strings
|
||||
if ((path == null) || (path.length() == 0))
|
||||
path = "/";
|
||||
if ((pattern == null) || (pattern.length() == 0))
|
||||
pattern = "/";
|
||||
|
||||
// Check for exact match
|
||||
if (path.equals(pattern))
|
||||
return true;
|
||||
|
||||
// Check for path prefix matching
|
||||
if (pattern.startsWith("/") && pattern.endsWith("/*")) {
|
||||
pattern = pattern.substring(0, pattern.length() - 2);
|
||||
if (pattern.length() == 0)
|
||||
return true; // "/*" is the same as "/"
|
||||
if (path.endsWith("/"))
|
||||
path = path.substring(0, path.length() - 1);
|
||||
while (true) {
|
||||
if (pattern.equals(path))
|
||||
return true;
|
||||
int slash = path.lastIndexOf('/');
|
||||
if (slash <= 0)
|
||||
break;
|
||||
path = path.substring(0, slash);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check for suffix matching
|
||||
if (pattern.startsWith("*.")) {
|
||||
int slash = path.lastIndexOf('/');
|
||||
int period = path.lastIndexOf('.');
|
||||
if ((slash >= 0) && (period > slash) &&
|
||||
path.endsWith(pattern.substring(1))) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check for universal mapping
|
||||
if (pattern.equals("/"))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Convert a {@link ServletSecurityElement} to an array of
|
||||
* {@link SecurityConstraint}(s).
|
||||
*
|
||||
* @param element The element to be converted
|
||||
* @param urlPattern The url pattern that the element should be applied
|
||||
* to
|
||||
* @return The (possibly zero length) array of constraints that
|
||||
* are the equivalent to the input
|
||||
*/
|
||||
public static SecurityConstraint[] createConstraints(
|
||||
ServletSecurityElement element, String urlPattern) {
|
||||
Set<SecurityConstraint> result = new HashSet<>();
|
||||
|
||||
// Add the per method constraints
|
||||
Collection<HttpMethodConstraintElement> methods =
|
||||
element.getHttpMethodConstraints();
|
||||
for (HttpMethodConstraintElement methodElement : methods) {
|
||||
SecurityConstraint constraint =
|
||||
createConstraint(methodElement, urlPattern, true);
|
||||
// There will always be a single collection
|
||||
SecurityCollection collection = constraint.findCollections()[0];
|
||||
collection.addMethod(methodElement.getMethodName());
|
||||
result.add(constraint);
|
||||
}
|
||||
|
||||
// Add the constraint for all the other methods
|
||||
SecurityConstraint constraint = createConstraint(element, urlPattern, false);
|
||||
if (constraint != null) {
|
||||
// There will always be a single collection
|
||||
SecurityCollection collection = constraint.findCollections()[0];
|
||||
for (String name : element.getMethodNames()) {
|
||||
collection.addOmittedMethod(name);
|
||||
}
|
||||
|
||||
result.add(constraint);
|
||||
|
||||
}
|
||||
|
||||
return result.toArray(new SecurityConstraint[result.size()]);
|
||||
}
|
||||
|
||||
private static SecurityConstraint createConstraint(
|
||||
HttpConstraintElement element, String urlPattern, boolean alwaysCreate) {
|
||||
|
||||
SecurityConstraint constraint = new SecurityConstraint();
|
||||
SecurityCollection collection = new SecurityCollection();
|
||||
boolean create = alwaysCreate;
|
||||
|
||||
if (element.getTransportGuarantee() !=
|
||||
ServletSecurity.TransportGuarantee.NONE) {
|
||||
constraint.setUserConstraint(element.getTransportGuarantee().name());
|
||||
create = true;
|
||||
}
|
||||
if (element.getRolesAllowed().length > 0) {
|
||||
String[] roles = element.getRolesAllowed();
|
||||
for (String role : roles) {
|
||||
constraint.addAuthRole(role);
|
||||
}
|
||||
create = true;
|
||||
}
|
||||
if (element.getEmptyRoleSemantic() != EmptyRoleSemantic.PERMIT) {
|
||||
constraint.setAuthConstraint(true);
|
||||
create = true;
|
||||
}
|
||||
|
||||
if (create) {
|
||||
collection.addPattern(urlPattern);
|
||||
constraint.addCollection(collection);
|
||||
return constraint;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public static SecurityConstraint[] findUncoveredHttpMethods(
|
||||
SecurityConstraint[] constraints,
|
||||
boolean denyUncoveredHttpMethods, Log log) {
|
||||
|
||||
Set<String> coveredPatterns = new HashSet<>();
|
||||
Map<String,Set<String>> urlMethodMap = new HashMap<>();
|
||||
Map<String,Set<String>> urlOmittedMethodMap = new HashMap<>();
|
||||
|
||||
List<SecurityConstraint> newConstraints = new ArrayList<>();
|
||||
|
||||
// First build the lists of covered patterns and those patterns that
|
||||
// might be uncovered
|
||||
for (SecurityConstraint constraint : constraints) {
|
||||
SecurityCollection[] collections = constraint.findCollections();
|
||||
for (SecurityCollection collection : collections) {
|
||||
String[] patterns = collection.findPatterns();
|
||||
String[] methods = collection.findMethods();
|
||||
String[] omittedMethods = collection.findOmittedMethods();
|
||||
// Simple case: no methods
|
||||
if (methods.length == 0 && omittedMethods.length == 0) {
|
||||
for (String pattern : patterns) {
|
||||
coveredPatterns.add(pattern);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
// Pre-calculate so we don't do this for every iteration of the
|
||||
// following loop
|
||||
List<String> omNew = null;
|
||||
if (omittedMethods.length != 0) {
|
||||
omNew = Arrays.asList(omittedMethods);
|
||||
}
|
||||
|
||||
// Only need to process uncovered patterns
|
||||
for (String pattern : patterns) {
|
||||
if (!coveredPatterns.contains(pattern)) {
|
||||
if (methods.length == 0) {
|
||||
// Build the interset of omitted methods for this
|
||||
// pattern
|
||||
Set<String> om = urlOmittedMethodMap.get(pattern);
|
||||
if (om == null) {
|
||||
om = new HashSet<>();
|
||||
urlOmittedMethodMap.put(pattern, om);
|
||||
om.addAll(omNew);
|
||||
} else {
|
||||
om.retainAll(omNew);
|
||||
}
|
||||
} else {
|
||||
// Build the union of methods for this pattern
|
||||
Set<String> m = urlMethodMap.get(pattern);
|
||||
if (m == null) {
|
||||
m = new HashSet<>();
|
||||
urlMethodMap.put(pattern, m);
|
||||
}
|
||||
for (String method : methods) {
|
||||
m.add(method);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Now check the potentially uncovered patterns
|
||||
for (Map.Entry<String, Set<String>> entry : urlMethodMap.entrySet()) {
|
||||
String pattern = entry.getKey();
|
||||
if (coveredPatterns.contains(pattern)) {
|
||||
// Fully covered. Ignore any partial coverage
|
||||
urlOmittedMethodMap.remove(pattern);
|
||||
continue;
|
||||
}
|
||||
|
||||
Set<String> omittedMethods = urlOmittedMethodMap.remove(pattern);
|
||||
Set<String> methods = entry.getValue();
|
||||
|
||||
if (omittedMethods == null) {
|
||||
StringBuilder msg = new StringBuilder();
|
||||
for (String method : methods) {
|
||||
msg.append(method);
|
||||
msg.append(' ');
|
||||
}
|
||||
if (denyUncoveredHttpMethods) {
|
||||
log.info(sm.getString(
|
||||
"securityConstraint.uncoveredHttpMethodFix",
|
||||
pattern, msg.toString().trim()));
|
||||
SecurityCollection collection = new SecurityCollection();
|
||||
for (String method : methods) {
|
||||
collection.addOmittedMethod(method);
|
||||
}
|
||||
collection.addPatternDecoded(pattern);
|
||||
collection.setName("deny-uncovered-http-methods");
|
||||
SecurityConstraint constraint = new SecurityConstraint();
|
||||
constraint.setAuthConstraint(true);
|
||||
constraint.addCollection(collection);
|
||||
newConstraints.add(constraint);
|
||||
} else {
|
||||
log.error(sm.getString(
|
||||
"securityConstraint.uncoveredHttpMethod",
|
||||
pattern, msg.toString().trim()));
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
// As long as every omitted method as a corresponding method the
|
||||
// pattern is fully covered.
|
||||
omittedMethods.removeAll(methods);
|
||||
|
||||
handleOmittedMethods(omittedMethods, pattern, denyUncoveredHttpMethods,
|
||||
newConstraints, log);
|
||||
}
|
||||
for (Map.Entry<String, Set<String>> entry :
|
||||
urlOmittedMethodMap.entrySet()) {
|
||||
String pattern = entry.getKey();
|
||||
if (coveredPatterns.contains(pattern)) {
|
||||
// Fully covered. Ignore any partial coverage
|
||||
continue;
|
||||
}
|
||||
|
||||
handleOmittedMethods(entry.getValue(), pattern, denyUncoveredHttpMethods,
|
||||
newConstraints, log);
|
||||
}
|
||||
|
||||
return newConstraints.toArray(new SecurityConstraint[newConstraints.size()]);
|
||||
}
|
||||
|
||||
|
||||
private static void handleOmittedMethods(Set<String> omittedMethods, String pattern,
|
||||
boolean denyUncoveredHttpMethods, List<SecurityConstraint> newConstraints, Log log) {
|
||||
if (omittedMethods.size() > 0) {
|
||||
StringBuilder msg = new StringBuilder();
|
||||
for (String method : omittedMethods) {
|
||||
msg.append(method);
|
||||
msg.append(' ');
|
||||
}
|
||||
if (denyUncoveredHttpMethods) {
|
||||
log.info(sm.getString(
|
||||
"securityConstraint.uncoveredHttpOmittedMethodFix",
|
||||
pattern, msg.toString().trim()));
|
||||
SecurityCollection collection = new SecurityCollection();
|
||||
for (String method : omittedMethods) {
|
||||
collection.addMethod(method);
|
||||
}
|
||||
collection.addPatternDecoded(pattern);
|
||||
collection.setName("deny-uncovered-http-methods");
|
||||
SecurityConstraint constraint = new SecurityConstraint();
|
||||
constraint.setAuthConstraint(true);
|
||||
constraint.addCollection(collection);
|
||||
newConstraints.add(constraint);
|
||||
} else {
|
||||
log.error(sm.getString(
|
||||
"securityConstraint.uncoveredHttpOmittedMethod",
|
||||
pattern, msg.toString().trim()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
/*
|
||||
* 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.tomcat.util.descriptor.web;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
/**
|
||||
* <p>Representation of a security role reference for a web application, as
|
||||
* represented in a <code><security-role-ref></code> element
|
||||
* in the deployment descriptor.</p>
|
||||
*
|
||||
* @since Tomcat 5.5
|
||||
*/
|
||||
public class SecurityRoleRef implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
// ------------------------------------------------------------- Properties
|
||||
|
||||
/**
|
||||
* The (required) role name.
|
||||
*/
|
||||
private String name = null;
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The optional role link.
|
||||
*/
|
||||
private String link = null;
|
||||
|
||||
public String getLink() {
|
||||
return this.link;
|
||||
}
|
||||
|
||||
public void setLink(String link) {
|
||||
this.link = link;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// --------------------------------------------------------- Public Methods
|
||||
|
||||
|
||||
/**
|
||||
* Return a String representation of this object.
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder("SecurityRoleRef[");
|
||||
sb.append("name=");
|
||||
sb.append(name);
|
||||
if (link != null) {
|
||||
sb.append(", link=");
|
||||
sb.append(link);
|
||||
}
|
||||
sb.append("]");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
274
java/org/apache/tomcat/util/descriptor/web/ServletDef.java
Normal file
274
java/org/apache/tomcat/util/descriptor/web/ServletDef.java
Normal file
@@ -0,0 +1,274 @@
|
||||
/*
|
||||
* 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.tomcat.util.descriptor.web;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.tomcat.util.res.StringManager;
|
||||
|
||||
|
||||
/**
|
||||
* Representation of a servlet definition for a web application, as represented
|
||||
* in a <code><servlet></code> element in the deployment descriptor.
|
||||
*/
|
||||
|
||||
public class ServletDef implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private static final StringManager sm =
|
||||
StringManager.getManager(Constants.PACKAGE_NAME);
|
||||
|
||||
// ------------------------------------------------------------- Properties
|
||||
|
||||
|
||||
/**
|
||||
* The description of this servlet.
|
||||
*/
|
||||
private String description = null;
|
||||
|
||||
public String getDescription() {
|
||||
return this.description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The display name of this servlet.
|
||||
*/
|
||||
private String displayName = null;
|
||||
|
||||
public String getDisplayName() {
|
||||
return this.displayName;
|
||||
}
|
||||
|
||||
public void setDisplayName(String displayName) {
|
||||
this.displayName = displayName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The small icon associated with this servlet.
|
||||
*/
|
||||
private String smallIcon = null;
|
||||
|
||||
public String getSmallIcon() {
|
||||
return this.smallIcon;
|
||||
}
|
||||
|
||||
public void setSmallIcon(String smallIcon) {
|
||||
this.smallIcon = smallIcon;
|
||||
}
|
||||
|
||||
/**
|
||||
* The large icon associated with this servlet.
|
||||
*/
|
||||
private String largeIcon = null;
|
||||
|
||||
public String getLargeIcon() {
|
||||
return this.largeIcon;
|
||||
}
|
||||
|
||||
public void setLargeIcon(String largeIcon) {
|
||||
this.largeIcon = largeIcon;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The name of this servlet, which must be unique among the servlets
|
||||
* defined for a particular web application.
|
||||
*/
|
||||
private String servletName = null;
|
||||
|
||||
public String getServletName() {
|
||||
return this.servletName;
|
||||
}
|
||||
|
||||
public void setServletName(String servletName) {
|
||||
if (servletName == null || servletName.equals("")) {
|
||||
throw new IllegalArgumentException(
|
||||
sm.getString("servletDef.invalidServletName", servletName));
|
||||
}
|
||||
this.servletName = servletName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The fully qualified name of the Java class that implements this servlet.
|
||||
*/
|
||||
private String servletClass = null;
|
||||
|
||||
public String getServletClass() {
|
||||
return this.servletClass;
|
||||
}
|
||||
|
||||
public void setServletClass(String servletClass) {
|
||||
this.servletClass = servletClass;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The name of the JSP file to which this servlet definition applies
|
||||
*/
|
||||
private String jspFile = null;
|
||||
|
||||
public String getJspFile() {
|
||||
return this.jspFile;
|
||||
}
|
||||
|
||||
public void setJspFile(String jspFile) {
|
||||
this.jspFile = jspFile;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The set of initialization parameters for this servlet, keyed by
|
||||
* parameter name.
|
||||
*/
|
||||
private final Map<String, String> parameters = new HashMap<>();
|
||||
|
||||
public Map<String, String> getParameterMap() {
|
||||
return this.parameters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an initialization parameter to the set of parameters associated
|
||||
* with this servlet.
|
||||
*
|
||||
* @param name The initialisation parameter name
|
||||
* @param value The initialisation parameter value
|
||||
*/
|
||||
public void addInitParameter(String name, String value) {
|
||||
|
||||
if (parameters.containsKey(name)) {
|
||||
// The spec does not define this but the TCK expects the first
|
||||
// definition to take precedence
|
||||
return;
|
||||
}
|
||||
parameters.put(name, value);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* The load-on-startup order for this servlet
|
||||
*/
|
||||
private Integer loadOnStartup = null;
|
||||
|
||||
public Integer getLoadOnStartup() {
|
||||
return this.loadOnStartup;
|
||||
}
|
||||
|
||||
public void setLoadOnStartup(String loadOnStartup) {
|
||||
this.loadOnStartup = Integer.valueOf(loadOnStartup);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The run-as configuration for this servlet
|
||||
*/
|
||||
private String runAs = null;
|
||||
|
||||
public String getRunAs() {
|
||||
return this.runAs;
|
||||
}
|
||||
|
||||
public void setRunAs(String runAs) {
|
||||
this.runAs = runAs;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The set of security role references for this servlet
|
||||
*/
|
||||
private final Set<SecurityRoleRef> securityRoleRefs = new HashSet<>();
|
||||
|
||||
public Set<SecurityRoleRef> getSecurityRoleRefs() {
|
||||
return this.securityRoleRefs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a security-role-ref to the set of security-role-refs associated
|
||||
* with this servlet.
|
||||
* @param securityRoleRef The security role
|
||||
*/
|
||||
public void addSecurityRoleRef(SecurityRoleRef securityRoleRef) {
|
||||
securityRoleRefs.add(securityRoleRef);
|
||||
}
|
||||
|
||||
/**
|
||||
* The multipart configuration, if any, for this servlet
|
||||
*/
|
||||
private MultipartDef multipartDef = null;
|
||||
|
||||
public MultipartDef getMultipartDef() {
|
||||
return this.multipartDef;
|
||||
}
|
||||
|
||||
public void setMultipartDef(MultipartDef multipartDef) {
|
||||
this.multipartDef = multipartDef;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Does this servlet support async.
|
||||
*/
|
||||
private Boolean asyncSupported = null;
|
||||
|
||||
public Boolean getAsyncSupported() {
|
||||
return this.asyncSupported;
|
||||
}
|
||||
|
||||
public void setAsyncSupported(String asyncSupported) {
|
||||
this.asyncSupported = Boolean.valueOf(asyncSupported);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Is this servlet enabled.
|
||||
*/
|
||||
private Boolean enabled = null;
|
||||
|
||||
public Boolean getEnabled() {
|
||||
return this.enabled;
|
||||
}
|
||||
|
||||
public void setEnabled(String enabled) {
|
||||
this.enabled = Boolean.valueOf(enabled);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Can this ServletDef be overridden by an SCI?
|
||||
*/
|
||||
private boolean overridable = false;
|
||||
|
||||
public boolean isOverridable() {
|
||||
return overridable;
|
||||
}
|
||||
|
||||
public void setOverridable(boolean overridable) {
|
||||
this.overridable = overridable;
|
||||
}
|
||||
|
||||
}
|
||||
105
java/org/apache/tomcat/util/descriptor/web/SessionConfig.java
Normal file
105
java/org/apache/tomcat/util/descriptor/web/SessionConfig.java
Normal file
@@ -0,0 +1,105 @@
|
||||
/*
|
||||
* 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.tomcat.util.descriptor.web;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import javax.servlet.SessionTrackingMode;
|
||||
|
||||
/**
|
||||
* Representation of a session configuration element for a web application,
|
||||
* as represented in a <code><session-config></code> element in the
|
||||
* deployment descriptor.
|
||||
*/
|
||||
public class SessionConfig {
|
||||
private Integer sessionTimeout;
|
||||
private String cookieName;
|
||||
private String cookieDomain;
|
||||
private String cookiePath;
|
||||
private String cookieComment;
|
||||
private Boolean cookieHttpOnly;
|
||||
private Boolean cookieSecure;
|
||||
private Integer cookieMaxAge;
|
||||
private final EnumSet<SessionTrackingMode> sessionTrackingModes =
|
||||
EnumSet.noneOf(SessionTrackingMode.class);
|
||||
|
||||
public Integer getSessionTimeout() {
|
||||
return sessionTimeout;
|
||||
}
|
||||
public void setSessionTimeout(String sessionTimeout) {
|
||||
this.sessionTimeout = Integer.valueOf(sessionTimeout);
|
||||
}
|
||||
|
||||
public String getCookieName() {
|
||||
return cookieName;
|
||||
}
|
||||
public void setCookieName(String cookieName) {
|
||||
this.cookieName = cookieName;
|
||||
}
|
||||
|
||||
public String getCookieDomain() {
|
||||
return cookieDomain;
|
||||
}
|
||||
public void setCookieDomain(String cookieDomain) {
|
||||
this.cookieDomain = cookieDomain;
|
||||
}
|
||||
|
||||
public String getCookiePath() {
|
||||
return cookiePath;
|
||||
}
|
||||
public void setCookiePath(String cookiePath) {
|
||||
this.cookiePath = cookiePath;
|
||||
}
|
||||
|
||||
public String getCookieComment() {
|
||||
return cookieComment;
|
||||
}
|
||||
public void setCookieComment(String cookieComment) {
|
||||
this.cookieComment = cookieComment;
|
||||
}
|
||||
|
||||
public Boolean getCookieHttpOnly() {
|
||||
return cookieHttpOnly;
|
||||
}
|
||||
public void setCookieHttpOnly(String cookieHttpOnly) {
|
||||
this.cookieHttpOnly = Boolean.valueOf(cookieHttpOnly);
|
||||
}
|
||||
|
||||
public Boolean getCookieSecure() {
|
||||
return cookieSecure;
|
||||
}
|
||||
public void setCookieSecure(String cookieSecure) {
|
||||
this.cookieSecure = Boolean.valueOf(cookieSecure);
|
||||
}
|
||||
|
||||
public Integer getCookieMaxAge() {
|
||||
return cookieMaxAge;
|
||||
}
|
||||
public void setCookieMaxAge(String cookieMaxAge) {
|
||||
this.cookieMaxAge = Integer.valueOf(cookieMaxAge);
|
||||
}
|
||||
|
||||
public EnumSet<SessionTrackingMode> getSessionTrackingModes() {
|
||||
return sessionTrackingModes;
|
||||
}
|
||||
public void addSessionTrackingMode(String sessionTrackingMode) {
|
||||
sessionTrackingModes.add(
|
||||
SessionTrackingMode.valueOf(sessionTrackingMode));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
/*
|
||||
* 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.tomcat.util.descriptor.web;
|
||||
|
||||
import javax.servlet.descriptor.TaglibDescriptor;
|
||||
|
||||
public class TaglibDescriptorImpl implements TaglibDescriptor {
|
||||
|
||||
private final String location;
|
||||
private final String uri;
|
||||
|
||||
public TaglibDescriptorImpl(String location, String uri) {
|
||||
this.location = location;
|
||||
this.uri = uri;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTaglibLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTaglibURI() {
|
||||
return uri;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result
|
||||
+ ((location == null) ? 0 : location.hashCode());
|
||||
result = prime * result + ((uri == null) ? 0 : uri.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (!(obj instanceof TaglibDescriptorImpl)) {
|
||||
return false;
|
||||
}
|
||||
TaglibDescriptorImpl other = (TaglibDescriptorImpl) obj;
|
||||
if (location == null) {
|
||||
if (other.location != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!location.equals(other.location)) {
|
||||
return false;
|
||||
}
|
||||
if (uri == null) {
|
||||
if (other.uri != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!uri.equals(other.uri)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
1379
java/org/apache/tomcat/util/descriptor/web/WebRuleSet.java
Normal file
1379
java/org/apache/tomcat/util/descriptor/web/WebRuleSet.java
Normal file
File diff suppressed because it is too large
Load Diff
2394
java/org/apache/tomcat/util/descriptor/web/WebXml.java
Normal file
2394
java/org/apache/tomcat/util/descriptor/web/WebXml.java
Normal file
File diff suppressed because it is too large
Load Diff
155
java/org/apache/tomcat/util/descriptor/web/WebXmlParser.java
Normal file
155
java/org/apache/tomcat/util/descriptor/web/WebXmlParser.java
Normal file
@@ -0,0 +1,155 @@
|
||||
/*
|
||||
* 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.tomcat.util.descriptor.web;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
|
||||
import org.apache.juli.logging.Log;
|
||||
import org.apache.juli.logging.LogFactory;
|
||||
import org.apache.tomcat.util.descriptor.DigesterFactory;
|
||||
import org.apache.tomcat.util.descriptor.InputSourceUtil;
|
||||
import org.apache.tomcat.util.descriptor.XmlErrorHandler;
|
||||
import org.apache.tomcat.util.digester.Digester;
|
||||
import org.apache.tomcat.util.res.StringManager;
|
||||
import org.xml.sax.InputSource;
|
||||
import org.xml.sax.SAXParseException;
|
||||
|
||||
public class WebXmlParser {
|
||||
|
||||
private final Log log = LogFactory.getLog(WebXmlParser.class); // must not be static
|
||||
|
||||
/**
|
||||
* The string resources for this package.
|
||||
*/
|
||||
private static final StringManager sm =
|
||||
StringManager.getManager(Constants.PACKAGE_NAME);
|
||||
|
||||
/**
|
||||
* The <code>Digester</code> we will use to process web application
|
||||
* deployment descriptor files.
|
||||
*/
|
||||
private final Digester webDigester;
|
||||
private final WebRuleSet webRuleSet;
|
||||
|
||||
/**
|
||||
* The <code>Digester</code> we will use to process web fragment
|
||||
* deployment descriptor files.
|
||||
*/
|
||||
private final Digester webFragmentDigester;
|
||||
private final WebRuleSet webFragmentRuleSet;
|
||||
|
||||
|
||||
public WebXmlParser(boolean namespaceAware, boolean validation,
|
||||
boolean blockExternal) {
|
||||
webRuleSet = new WebRuleSet(false);
|
||||
webDigester = DigesterFactory.newDigester(validation,
|
||||
namespaceAware, webRuleSet, blockExternal);
|
||||
webDigester.getParser();
|
||||
|
||||
webFragmentRuleSet = new WebRuleSet(true);
|
||||
webFragmentDigester = DigesterFactory.newDigester(validation,
|
||||
namespaceAware, webFragmentRuleSet, blockExternal);
|
||||
webFragmentDigester.getParser();
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse a web descriptor at a location.
|
||||
*
|
||||
* @param url the location; if null no load will be attempted
|
||||
* @param dest the instance to be populated by the parse operation
|
||||
* @param fragment indicate if the descriptor is a web-app or web-fragment
|
||||
* @return true if the descriptor was successfully parsed
|
||||
* @throws IOException if there was a problem reading from the URL
|
||||
*/
|
||||
public boolean parseWebXml(URL url, WebXml dest, boolean fragment) throws IOException {
|
||||
if (url == null) {
|
||||
return true;
|
||||
}
|
||||
InputSource source = new InputSource(url.toExternalForm());
|
||||
source.setByteStream(url.openStream());
|
||||
return parseWebXml(source, dest, fragment);
|
||||
}
|
||||
|
||||
|
||||
public boolean parseWebXml(InputSource source, WebXml dest,
|
||||
boolean fragment) {
|
||||
|
||||
boolean ok = true;
|
||||
|
||||
if (source == null) {
|
||||
return ok;
|
||||
}
|
||||
|
||||
XmlErrorHandler handler = new XmlErrorHandler();
|
||||
|
||||
Digester digester;
|
||||
WebRuleSet ruleSet;
|
||||
if (fragment) {
|
||||
digester = webFragmentDigester;
|
||||
ruleSet = webFragmentRuleSet;
|
||||
} else {
|
||||
digester = webDigester;
|
||||
ruleSet = webRuleSet;
|
||||
}
|
||||
|
||||
digester.push(dest);
|
||||
digester.setErrorHandler(handler);
|
||||
|
||||
if(log.isDebugEnabled()) {
|
||||
log.debug(sm.getString("webXmlParser.applicationStart",
|
||||
source.getSystemId()));
|
||||
}
|
||||
|
||||
try {
|
||||
digester.parse(source);
|
||||
|
||||
if (handler.getWarnings().size() > 0 ||
|
||||
handler.getErrors().size() > 0) {
|
||||
ok = false;
|
||||
handler.logFindings(log, source.getSystemId());
|
||||
}
|
||||
} catch (SAXParseException e) {
|
||||
log.error(sm.getString("webXmlParser.applicationParse",
|
||||
source.getSystemId()), e);
|
||||
log.error(sm.getString("webXmlParser.applicationPosition",
|
||||
"" + e.getLineNumber(),
|
||||
"" + e.getColumnNumber()));
|
||||
ok = false;
|
||||
} catch (Exception e) {
|
||||
log.error(sm.getString("webXmlParser.applicationParse",
|
||||
source.getSystemId()), e);
|
||||
ok = false;
|
||||
} finally {
|
||||
InputSourceUtil.close(source);
|
||||
digester.reset();
|
||||
ruleSet.recycle();
|
||||
}
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the ClassLoader to be used for creating descriptor objects.
|
||||
* @param classLoader the ClassLoader to be used for creating descriptor objects
|
||||
*/
|
||||
public void setClassLoader(ClassLoader classLoader) {
|
||||
webDigester.setClassLoader(classLoader);
|
||||
webFragmentDigester.setClassLoader(classLoader);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
* 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.tomcat.util.descriptor.web;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import org.apache.juli.logging.Log;
|
||||
import org.apache.juli.logging.LogFactory;
|
||||
import org.apache.tomcat.util.buf.B2CConverter;
|
||||
import org.apache.tomcat.util.res.StringManager;
|
||||
|
||||
/**
|
||||
* Base class for those elements that need to track the encoding used in the
|
||||
* source XML.
|
||||
*/
|
||||
public abstract class XmlEncodingBase {
|
||||
|
||||
private static final StringManager sm = StringManager.getManager(XmlEncodingBase.class);
|
||||
private static Log log = LogFactory.getLog(XmlEncodingBase.class);
|
||||
private Charset charset = StandardCharsets.UTF_8;
|
||||
|
||||
|
||||
/**
|
||||
* @param encoding The encoding of the XML source that was used to
|
||||
* populated this object.
|
||||
* @deprecated This method will be removed in Tomcat 9
|
||||
*/
|
||||
@Deprecated
|
||||
public void setEncoding(String encoding) {
|
||||
try {
|
||||
charset = B2CConverter.getCharset(encoding);
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
log.warn(sm.getString("xmlEncodingBase.encodingInvalid", encoding, charset.name()), e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Obtain the encoding of the XML source that was used to populated this
|
||||
* object.
|
||||
*
|
||||
* @return The encoding of the associated XML source or <code>UTF-8</code>
|
||||
* if the encoding could not be determined
|
||||
* @deprecated This method will be removed in Tomcat 9
|
||||
*/
|
||||
@Deprecated
|
||||
public String getEncoding() {
|
||||
return charset.name();
|
||||
}
|
||||
|
||||
|
||||
public void setCharset(Charset charset) {
|
||||
this.charset = charset;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Obtain the character encoding of the XML source that was used to
|
||||
* populated this object.
|
||||
*
|
||||
* @return The character encoding of the associated XML source or
|
||||
* <code>UTF-8</code> if the encoding could not be determined
|
||||
*/
|
||||
public Charset getCharset() {
|
||||
return charset;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
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.
|
||||
-->
|
||||
<mbeans-descriptors>
|
||||
|
||||
<mbean name="ContextEnvironment"
|
||||
className="org.apache.catalina.mbeans.ContextEnvironmentMBean"
|
||||
description="Representation of an application environment entry"
|
||||
domain="Catalina"
|
||||
group="Resources"
|
||||
type="org.apache.tomcat.util.descriptor.web.ContextEnvironment">
|
||||
|
||||
<attribute name="className"
|
||||
description="Fully qualified class name of the managed object"
|
||||
type="java.lang.String"
|
||||
writeable="false"/>
|
||||
|
||||
<attribute name="description"
|
||||
description="The description of this environment entry"
|
||||
type="java.lang.String"/>
|
||||
|
||||
<attribute name="name"
|
||||
description="The name of this environment entry"
|
||||
type="java.lang.String"/>
|
||||
|
||||
<attribute name="override"
|
||||
description="Does this environment entry allow overrides by the
|
||||
application deployment descriptor"
|
||||
type="boolean"/>
|
||||
|
||||
<attribute name="type"
|
||||
description="The type of this environment entry"
|
||||
type="java.lang.String"/>
|
||||
|
||||
<attribute name="value"
|
||||
description="The value of this environment entry"
|
||||
type="java.lang.String"/>
|
||||
</mbean>
|
||||
|
||||
|
||||
<mbean name="ContextResource"
|
||||
className="org.apache.catalina.mbeans.ContextResourceMBean"
|
||||
description="Representation of a resource reference for a web application"
|
||||
domain="Catalina"
|
||||
group="Resources"
|
||||
type="org.apache.tomcat.util.descriptor.web.ContextResource">
|
||||
|
||||
<attribute name="auth"
|
||||
description="The authorization requirement for this resource"
|
||||
type="java.lang.String"/>
|
||||
|
||||
<attribute name="description"
|
||||
description="The description of this resource"
|
||||
type="java.lang.String"/>
|
||||
|
||||
<attribute name="name"
|
||||
description="The name of this resource"
|
||||
type="java.lang.String"/>
|
||||
|
||||
<attribute name="scope"
|
||||
description="The sharing scope of this resource factory"
|
||||
type="java.lang.String"/>
|
||||
|
||||
<attribute name="type"
|
||||
description="The type of this environment entry"
|
||||
type="java.lang.String"/>
|
||||
</mbean>
|
||||
|
||||
|
||||
<mbean name="ContextResourceLink"
|
||||
className="org.apache.catalina.mbeans.ContextResourceLinkMBean"
|
||||
description="Representation of a resource link for a web application"
|
||||
domain="Catalina"
|
||||
group="Resources"
|
||||
type="org.apache.tomcat.util.descriptor.web.ContextResourceLink">
|
||||
|
||||
<attribute name="global"
|
||||
description="The global name of this resource"
|
||||
type="java.lang.String"/>
|
||||
|
||||
<attribute name="name"
|
||||
description="The name of this resource"
|
||||
type="java.lang.String"/>
|
||||
|
||||
<attribute name="description"
|
||||
description="The description of this resource"
|
||||
type="java.lang.String"/>
|
||||
|
||||
<attribute name="type"
|
||||
description="The type of this resource"
|
||||
type="java.lang.String"/>
|
||||
|
||||
</mbean>
|
||||
|
||||
|
||||
</mbeans-descriptors>
|
||||
26
java/org/apache/tomcat/util/descriptor/web/package.html
Normal file
26
java/org/apache/tomcat/util/descriptor/web/package.html
Normal file
@@ -0,0 +1,26 @@
|
||||
<!--
|
||||
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.
|
||||
-->
|
||||
<body>
|
||||
|
||||
<p>This package contains Java objects that represent complex data structures
|
||||
from the web application deployment descriptor file (<code>web.xml</code>).
|
||||
It is assumed that these objects will be initialized within the context of
|
||||
a single thread, and then referenced in a read-only manner subsequent to that
|
||||
time. Therefore, no multi-thread synchronization is utilized within the
|
||||
implementation classes.</p>
|
||||
|
||||
</body>
|
||||
Reference in New Issue
Block a user