Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRĂ¼diger Herrmann2011-06-28 17:14:19 -0400
committerRĂ¼diger Herrmann2011-06-28 17:14:19 -0400
commit44b3fabd12dbc5875a86bcdd96c62bcd78aea60c (patch)
treea231d36b2bc0dff74f4e166be71c86cb1203ee8a
parent19e34879509ffaf8c601d4f90cf4bbdbea1f8465 (diff)
downloadorg.apache.tomcat-44b3fabd12dbc5875a86bcdd96c62bcd78aea60c.tar.gz
org.apache.tomcat-44b3fabd12dbc5875a86bcdd96c62bcd78aea60c.tar.xz
org.apache.tomcat-44b3fabd12dbc5875a86bcdd96c62bcd78aea60c.zip
Initial commit of [CQ 5286] Tomcat 7.0.12 Version: Subset (PB CQ5094)
-rw-r--r--bundles/org.apache.tomcat/.classpath7
-rw-r--r--bundles/org.apache.tomcat/.project28
-rw-r--r--bundles/org.apache.tomcat/.settings/org.eclipse.jdt.core.prefs8
-rw-r--r--bundles/org.apache.tomcat/.settings/org.eclipse.pde.core.prefs4
-rw-r--r--bundles/org.apache.tomcat/META-INF/MANIFEST.MF27
-rw-r--r--bundles/org.apache.tomcat/build.properties18
-rw-r--r--bundles/org.apache.tomcat/src/javax/annotation/Generated.java35
-rw-r--r--bundles/org.apache.tomcat/src/javax/annotation/PostConstruct.java31
-rw-r--r--bundles/org.apache.tomcat/src/javax/annotation/PreDestroy.java31
-rw-r--r--bundles/org.apache.tomcat/src/javax/annotation/Resource.java41
-rw-r--r--bundles/org.apache.tomcat/src/javax/annotation/Resources.java31
-rw-r--r--bundles/org.apache.tomcat/src/javax/annotation/security/DeclareRoles.java31
-rw-r--r--bundles/org.apache.tomcat/src/javax/annotation/security/DenyAll.java31
-rw-r--r--bundles/org.apache.tomcat/src/javax/annotation/security/PermitAll.java31
-rw-r--r--bundles/org.apache.tomcat/src/javax/annotation/security/RolesAllowed.java31
-rw-r--r--bundles/org.apache.tomcat/src/javax/annotation/security/RunAs.java31
-rw-r--r--bundles/org.apache.tomcat/src/javax/ejb/EJB.java36
-rw-r--r--bundles/org.apache.tomcat/src/javax/ejb/EJBs.java31
-rw-r--r--bundles/org.apache.tomcat/src/javax/mail/Authenticator.java23
-rw-r--r--bundles/org.apache.tomcat/src/javax/mail/PasswordAuthentication.java24
-rw-r--r--bundles/org.apache.tomcat/src/javax/mail/Session.java29
-rw-r--r--bundles/org.apache.tomcat/src/javax/servlet/annotation/HandlesTypes.java40
-rw-r--r--bundles/org.apache.tomcat/src/javax/servlet/annotation/HttpConstraint.java69
-rw-r--r--bundles/org.apache.tomcat/src/javax/servlet/annotation/HttpMethodConstraint.java74
-rw-r--r--bundles/org.apache.tomcat/src/javax/servlet/annotation/MultipartConfig.java68
-rw-r--r--bundles/org.apache.tomcat/src/javax/servlet/annotation/ServletSecurity.java90
-rw-r--r--bundles/org.apache.tomcat/src/javax/servlet/annotation/WebFilter.java122
-rw-r--r--bundles/org.apache.tomcat/src/javax/servlet/annotation/WebInitParam.java57
-rw-r--r--bundles/org.apache.tomcat/src/javax/servlet/annotation/WebListener.java53
-rw-r--r--bundles/org.apache.tomcat/src/javax/servlet/annotation/WebServlet.java113
-rw-r--r--bundles/org.apache.tomcat/src/javax/servlet/descriptor/JspConfigDescriptor.java28
-rw-r--r--bundles/org.apache.tomcat/src/javax/servlet/descriptor/JspPropertyGroupDescriptor.java38
-rw-r--r--bundles/org.apache.tomcat/src/javax/servlet/descriptor/TaglibDescriptor.java26
-rw-r--r--bundles/org.apache.tomcat/src/javax/servlet/http/Cookie.java468
-rw-r--r--bundles/org.apache.tomcat/src/javax/servlet/http/HttpServlet.java822
-rw-r--r--bundles/org.apache.tomcat/src/javax/servlet/http/HttpServletRequest.java486
-rw-r--r--bundles/org.apache.tomcat/src/javax/servlet/http/HttpServletRequestWrapper.java326
-rw-r--r--bundles/org.apache.tomcat/src/javax/servlet/http/HttpServletResponse.java592
-rw-r--r--bundles/org.apache.tomcat/src/javax/servlet/http/HttpServletResponseWrapper.java248
-rw-r--r--bundles/org.apache.tomcat/src/javax/servlet/http/HttpSession.java287
-rw-r--r--bundles/org.apache.tomcat/src/javax/servlet/http/HttpSessionActivationListener.java37
-rw-r--r--bundles/org.apache.tomcat/src/javax/servlet/http/HttpSessionAttributeListener.java46
-rw-r--r--bundles/org.apache.tomcat/src/javax/servlet/http/HttpSessionBindingEvent.java113
-rw-r--r--bundles/org.apache.tomcat/src/javax/servlet/http/HttpSessionBindingListener.java55
-rw-r--r--bundles/org.apache.tomcat/src/javax/servlet/http/HttpSessionContext.java53
-rw-r--r--bundles/org.apache.tomcat/src/javax/servlet/http/HttpSessionEvent.java37
-rw-r--r--bundles/org.apache.tomcat/src/javax/servlet/http/HttpSessionListener.java48
-rw-r--r--bundles/org.apache.tomcat/src/javax/servlet/http/HttpUtils.java282
-rw-r--r--bundles/org.apache.tomcat/src/javax/servlet/http/LocalStrings.properties29
-rw-r--r--bundles/org.apache.tomcat/src/javax/servlet/http/LocalStrings_es.properties30
-rw-r--r--bundles/org.apache.tomcat/src/javax/servlet/http/LocalStrings_fr.properties28
-rw-r--r--bundles/org.apache.tomcat/src/javax/servlet/http/LocalStrings_ja.properties28
-rw-r--r--bundles/org.apache.tomcat/src/javax/servlet/http/Part.java44
-rw-r--r--bundles/org.apache.tomcat/src/javax/servlet/http/package.html30
-rw-r--r--bundles/org.apache.tomcat/src/javax/servlet/jsp/ErrorData.java90
-rw-r--r--bundles/org.apache.tomcat/src/javax/servlet/jsp/HttpJspPage.java60
-rw-r--r--bundles/org.apache.tomcat/src/javax/servlet/jsp/JspApplicationContext.java83
-rw-r--r--bundles/org.apache.tomcat/src/javax/servlet/jsp/JspContext.java282
-rw-r--r--bundles/org.apache.tomcat/src/javax/servlet/jsp/JspEngineInfo.java49
-rw-r--r--bundles/org.apache.tomcat/src/javax/servlet/jsp/JspException.java101
-rw-r--r--bundles/org.apache.tomcat/src/javax/servlet/jsp/JspFactory.java157
-rw-r--r--bundles/org.apache.tomcat/src/javax/servlet/jsp/JspPage.java90
-rw-r--r--bundles/org.apache.tomcat/src/javax/servlet/jsp/JspTagException.java85
-rw-r--r--bundles/org.apache.tomcat/src/javax/servlet/jsp/JspWriter.java458
-rw-r--r--bundles/org.apache.tomcat/src/javax/servlet/jsp/PageContext.java535
-rw-r--r--bundles/org.apache.tomcat/src/javax/servlet/jsp/SkipPageException.java77
-rw-r--r--bundles/org.apache.tomcat/src/javax/servlet/jsp/el/ELException.java81
-rw-r--r--bundles/org.apache.tomcat/src/javax/servlet/jsp/el/ELParseException.java53
-rw-r--r--bundles/org.apache.tomcat/src/javax/servlet/jsp/el/Expression.java54
-rw-r--r--bundles/org.apache.tomcat/src/javax/servlet/jsp/el/ExpressionEvaluator.java115
-rw-r--r--bundles/org.apache.tomcat/src/javax/servlet/jsp/el/FunctionMapper.java41
-rw-r--r--bundles/org.apache.tomcat/src/javax/servlet/jsp/el/ImplicitObjectELResolver.java630
-rw-r--r--bundles/org.apache.tomcat/src/javax/servlet/jsp/el/ScopedAttributeELResolver.java198
-rw-r--r--bundles/org.apache.tomcat/src/javax/servlet/jsp/el/VariableResolver.java51
-rw-r--r--bundles/org.apache.tomcat/src/javax/servlet/jsp/el/package.html37
-rw-r--r--bundles/org.apache.tomcat/src/javax/servlet/jsp/package.html29
-rw-r--r--bundles/org.apache.tomcat/src/javax/servlet/jsp/tagext/doc-files/BodyTagProtocol.gifbin0 -> 4647 bytes
-rw-r--r--bundles/org.apache.tomcat/src/javax/servlet/jsp/tagext/doc-files/IterationTagProtocol.gifbin0 -> 3762 bytes
-rw-r--r--bundles/org.apache.tomcat/src/javax/servlet/jsp/tagext/doc-files/TagProtocol.gifbin0 -> 4152 bytes
-rw-r--r--bundles/org.apache.tomcat/src/javax/servlet/jsp/tagext/doc-files/VariableInfo-1.gifbin0 -> 2306 bytes
-rw-r--r--bundles/org.apache.tomcat/src/javax/xml/ws/WebServiceRef.java37
-rw-r--r--bundles/org.apache.tomcat/src/javax/xml/ws/WebServiceRefs.java31
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/ha/CatalinaCluster.java123
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/ha/ClusterDeployer.java111
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/ha/ClusterListener.java116
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/ha/ClusterManager.java90
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/ha/ClusterMessage.java35
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/ha/ClusterMessageBase.java85
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/ha/ClusterRuleSet.java195
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/ha/ClusterSession.java40
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/ha/ClusterValve.java40
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/ha/authenticator/ClusterSingleSignOn.java434
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/ha/authenticator/ClusterSingleSignOnListener.java184
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/ha/authenticator/SingleSignOnMessage.java195
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/ha/authenticator/mbeans-descriptors.xml39
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/ha/backend/CollectedInfo.java106
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/ha/backend/HeartbeatListener.java132
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/ha/backend/MultiCastSender.java88
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/ha/backend/Proxy.java34
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/ha/backend/Sender.java36
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/ha/backend/TcpSender.java207
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/ha/context/ReplicatedContext.java210
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/ha/deploy/Constants.java27
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/ha/deploy/FarmWarDeployer.java741
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/ha/deploy/FileChangeListener.java24
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/ha/deploy/FileMessage.java113
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/ha/deploy/FileMessageFactory.java384
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/ha/deploy/LocalStrings.properties47
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/ha/deploy/UndeployMessage.java122
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/ha/deploy/WarWatcher.java246
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/ha/deploy/mbeans-descriptors.xml42
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/ha/jmx/ClusterJmxHelper.java134
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/ha/package.html23
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/ha/util/IDynamicProperty.java58
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/loader/Constants.java26
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/loader/JdbcLeakPrevention.java76
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/loader/LocalStrings.properties78
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/loader/LocalStrings_es.properties46
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/loader/LocalStrings_fr.properties45
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/loader/LocalStrings_ja.properties46
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/loader/ResourceEntry.java78
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/loader/StandardClassLoader.java46
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/loader/StandardClassLoaderMBean.java30
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/loader/VirtualWebappLoader.java190
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/loader/WebappClassLoader.java3380
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/loader/WebappLoader.java1210
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/loader/mbeans-descriptors.xml174
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/manager/Constants.java216
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/manager/DummyProxySession.java200
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/manager/HTMLManagerServlet.java1369
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/manager/JMXProxyServlet.java281
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/manager/JspHelper.java245
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/manager/LocalStrings.properties118
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/manager/LocalStrings_de.properties95
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/manager/LocalStrings_es.properties101
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/manager/LocalStrings_fr.properties106
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/manager/LocalStrings_ja.properties94
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/manager/ManagerServlet.java1673
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/manager/StatusManagerServlet.java347
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/manager/StatusTransformer.java938
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/manager/util/BaseSessionComparator.java49
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/manager/util/ReverseComparator.java47
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/manager/util/SessionUtils.java264
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/mbeans/ClassNameMBean.java78
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/mbeans/ConnectorMBean.java142
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/mbeans/Constants.java27
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/mbeans/ContainerMBean.java325
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/mbeans/ContextEnvironmentMBean.java107
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/mbeans/ContextMBean.java241
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/mbeans/ContextResourceLinkMBean.java182
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/mbeans/ContextResourceMBean.java187
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/mbeans/GlobalResourcesLifecycleListener.java239
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/mbeans/GroupMBean.java185
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/mbeans/JmxRemoteLifecycleListener.java309
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/mbeans/LocalStrings.properties20
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/mbeans/LocalStrings_fr.properties20
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/mbeans/MBeanFactory.java993
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/mbeans/MBeanUtils.java1698
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/mbeans/MemoryUserDatabaseMBean.java389
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/mbeans/NamingResourcesMBean.java324
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/mbeans/RoleMBean.java81
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/mbeans/ServiceMBean.java188
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/mbeans/UserMBean.java227
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/mbeans/mbeans-descriptors.xml347
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/ssi/ByteArrayServletOutputStream.java65
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/ssi/ExpressionParseTree.java410
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/ssi/ExpressionTokenizer.java173
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/ssi/ResponseIncludeWrapper.java264
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/ssi/SSICommand.java51
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/ssi/SSIConditional.java139
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/ssi/SSIConditionalState.java44
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/ssi/SSIConfig.java59
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/ssi/SSIEcho.java75
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/ssi/SSIExec.java83
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/ssi/SSIExternalResolver.java77
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/ssi/SSIFilter.java186
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/ssi/SSIFlastmod.java77
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/ssi/SSIFsize.java122
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/ssi/SSIInclude.java66
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/ssi/SSIMediator.java354
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/ssi/SSIPrintenv.java62
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/ssi/SSIProcessor.java332
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/ssi/SSIServlet.java228
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/ssi/SSIServletExternalResolver.java584
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/ssi/SSIServletRequestUtil.java56
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/ssi/SSISet.java64
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/ssi/SSIStopProcessingException.java33
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/ssi/package.html32
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/tribes/ByteMessage.java103
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/tribes/Channel.java362
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/tribes/ChannelException.java183
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/tribes/ChannelInterceptor.java180
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/tribes/ChannelListener.java68
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/tribes/ChannelMessage.java108
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/tribes/ChannelReceiver.java83
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/tribes/ChannelSender.java73
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/tribes/Constants.java32
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/tribes/ErrorHandler.java46
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/tribes/Heartbeat.java34
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/tribes/ManagedChannel.java78
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/tribes/Member.java125
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/tribes/MembershipListener.java45
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/tribes/MembershipService.java142
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/tribes/MessageListener.java43
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/tribes/RemoteProcessException.java49
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/tribes/UniqueId.java78
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/tribes/group/AbsoluteOrder.java122
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/tribes/group/ChannelCoordinator.java332
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/tribes/group/ChannelInterceptorBase.java173
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/tribes/group/ExtendedRpcCallback.java46
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/tribes/group/GroupChannel.java684
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/tribes/group/InterceptorPayload.java35
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/tribes/group/Response.java54
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/tribes/group/RpcCallback.java46
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/tribes/group/RpcChannel.java312
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/tribes/group/RpcMessage.java119
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/tribes/membership/Constants.java40
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/tribes/membership/LocalStrings.properties16
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/tribes/membership/LocalStrings_es.properties16
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/tribes/membership/McastService.java683
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/tribes/membership/McastServiceImpl.java667
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/tribes/membership/MemberImpl.java636
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/tribes/membership/Membership.java328
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/tribes/membership/StaticMember.java78
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/tribes/membership/mbeans-descriptors.xml100
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/tribes/package.html86
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/tribes/tipis/AbstractReplicatedMap.java1519
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/tribes/tipis/LazyReplicatedMap.java183
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/tribes/tipis/ReplicatedMap.java121
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/tribes/tipis/ReplicatedMapEntry.java122
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/tribes/tipis/Streamable.java61
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/tribes/transport/bio/util/FastQueue.java367
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/tribes/transport/bio/util/LinkObject.java109
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/tribes/transport/bio/util/SingleRemoveSynchronizedAddLock.java255
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/tribes/transport/nio/NioReceiver.java440
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/tribes/transport/nio/NioReplicationTask.java335
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/tribes/transport/nio/NioSender.java382
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/tribes/transport/nio/ParallelNioSender.java329
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/tribes/transport/nio/PooledParallelSender.java88
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/tribes/util/Arrays.java230
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/tribes/util/ExecutorFactory.java86
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/tribes/util/LocalStrings.properties16
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/tribes/util/Logs.java29
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/tribes/util/StringManager.java171
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/tribes/util/TcclThreadFactory.java66
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/catalina/tribes/util/UUIDGenerator.java92
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/coyote/ajp/AbstractAjpProcessor.java873
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/coyote/ajp/AbstractAjpProtocol.java66
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/coyote/ajp/AjpAprProcessor.java732
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/coyote/ajp/AjpAprProtocol.java320
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/coyote/ajp/AjpMessage.java424
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/coyote/ajp/AjpProcessor.java646
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/coyote/ajp/AjpProtocol.java273
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/coyote/ajp/Constants.java422
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/coyote/ajp/LocalStrings.properties46
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/coyote/ajp/LocalStrings_es.properties30
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/coyote/http11/AbstractHttp11JsseProtocol.java121
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/coyote/http11/AbstractHttp11Processor.java1020
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/coyote/http11/AbstractHttp11Protocol.java179
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/coyote/http11/AbstractInputBuffer.java313
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/coyote/http11/AbstractOutputBuffer.java542
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/coyote/http11/Constants.java209
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/coyote/http11/Http11AprProcessor.java942
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/coyote/http11/Http11AprProtocol.java486
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/coyote/http11/Http11NioProcessor.java1025
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/coyote/http11/Http11NioProtocol.java494
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/coyote/http11/Http11Processor.java827
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/coyote/http11/Http11Protocol.java305
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/coyote/http11/InputFilter.java88
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/coyote/http11/InternalAprInputBuffer.java639
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/coyote/http11/InternalAprOutputBuffer.java258
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/coyote/http11/InternalInputBuffer.java508
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/coyote/http11/InternalNioInputBuffer.java776
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/coyote/http11/InternalNioOutputBuffer.java299
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/coyote/http11/InternalOutputBuffer.java260
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/coyote/http11/LocalStrings.properties40
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/coyote/http11/LocalStrings_es.properties37
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/coyote/http11/LocalStrings_fr.properties25
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/coyote/http11/LocalStrings_ja.properties25
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/coyote/http11/OutputFilter.java77
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/el/ExpressionFactoryImpl.java79
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/el/Messages.properties67
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/el/Messages_es.properties42
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/el/MethodExpressionImpl.java331
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/el/MethodExpressionLiteral.java105
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/el/ValueExpressionImpl.java284
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/el/ValueExpressionLiteral.java123
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/el/lang/ELArithmetic.java418
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/el/lang/ELSupport.java482
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/el/lang/EvaluationContext.java93
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/el/lang/ExpressionBuilder.java240
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/el/lang/FunctionMapperFactory.java60
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/el/lang/FunctionMapperImpl.java192
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/el/lang/VariableMapperFactory.java55
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/el/lang/VariableMapperImpl.java61
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/el/parser/ArithmeticNode.java43
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/el/parser/AstAnd.java47
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/el/parser/AstBracketSuffix.java40
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/el/parser/AstChoice.java49
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/el/parser/AstCompositeExpression.java58
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/el/parser/AstDeferredExpression.java58
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/el/parser/AstDiv.java43
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/el/parser/AstDotSuffix.java51
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/el/parser/AstDynamicExpression.java58
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/el/parser/AstEmpty.java61
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/el/parser/AstEqual.java42
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/el/parser/AstFalse.java40
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/el/parser/AstFloatingPoint.java61
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/el/parser/AstFunction.java137
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/el/parser/AstGreaterThan.java48
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/el/parser/AstGreaterThanEqual.java48
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/el/parser/AstIdentifier.java174
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/el/parser/AstInteger.java61
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/el/parser/AstLessThan.java48
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/el/parser/AstLessThanEqual.java48
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/el/parser/AstLiteralExpression.java67
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/el/parser/AstMethodParameters.java48
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/el/parser/AstMinus.java43
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/el/parser/AstMod.java43
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/el/parser/AstMult.java43
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/el/parser/AstNegative.java85
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/el/parser/AstNot.java48
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/el/parser/AstNotEqual.java42
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/el/parser/AstNull.java46
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/el/parser/AstOr.java47
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/el/parser/AstPlus.java43
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/el/parser/AstString.java77
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/el/parser/AstTrue.java40
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/el/parser/AstValue.java331
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/el/parser/BooleanNode.java40
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/el/parser/ELParser.html223
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/el/parser/ELParser.java2263
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/el/parser/ELParser.jjt477
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/el/parser/ELParserConstants.java184
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/el/parser/ELParserTokenManager.java1292
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/el/parser/ELParserTreeConstants.java79
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/el/parser/JJTELParserState.java123
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/el/parser/Node.java84
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/el/parser/NodeVisitor.java25
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/el/parser/ParseException.java187
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/el/parser/SimpleCharStream.java471
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/el/parser/SimpleNode.java218
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/el/parser/Token.java131
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/el/parser/TokenMgrError.java147
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/jasper/Constants.java222
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/jasper/EmbeddedServletOptions.java761
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/jasper/JasperException.java48
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/jasper/JspCompilationContext.java753
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/jasper/Options.java236
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/jasper/compiler/tagplugin/TagPlugin.java37
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/jasper/compiler/tagplugin/TagPluginContext.java124
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/jasper/el/ELContextImpl.java105
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/jasper/el/ELContextWrapper.java89
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/jasper/el/ELResolverImpl.java173
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/jasper/el/ExpressionEvaluatorImpl.java64
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/jasper/el/ExpressionImpl.java40
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/jasper/el/FunctionMapperImpl.java37
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/jasper/el/JspELException.java28
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/jasper/el/JspMethodExpression.java116
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/jasper/el/JspMethodNotFoundException.java28
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/jasper/el/JspPropertyNotFoundException.java30
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/jasper/el/JspPropertyNotWritableException.java29
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/jasper/el/JspValueExpression.java148
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/jasper/el/VariableResolverImpl.java37
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/jasper/resources/LocalStrings.properties487
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/jasper/resources/LocalStrings_es.properties454
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/jasper/resources/LocalStrings_fr.properties316
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/jasper/resources/LocalStrings_ja.properties417
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/jasper/runtime/BodyContentImpl.java657
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/jasper/runtime/HttpJspBase.java91
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/jasper/runtime/InstanceManagerFactory.java40
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/jasper/runtime/JspApplicationContextImpl.java156
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/jasper/runtime/JspContextWrapper.java497
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/jasper/runtime/JspFactoryImpl.java223
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/jasper/runtime/JspFragmentHelper.java66
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/jasper/runtime/JspRuntimeLibrary.java1006
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/jasper/runtime/JspSourceDependent.java39
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/jasper/runtime/JspWriterImpl.java621
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/jasper/runtime/PageContextImpl.java1002
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/jasper/runtime/PerThreadTagHandlerPool.java139
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/jasper/runtime/ProtectedFunctionMapper.java201
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/jasper/runtime/ServletResponseWrapperInclude.java79
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/jasper/runtime/TagHandlerPool.java179
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/jasper/security/SecurityClassLoad.java114
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/jasper/security/SecurityUtil.java81
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/jasper/servlet/JasperLoader.java172
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/jasper/servlet/JspCServletContext.java648
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/jasper/servlet/JspServlet.java427
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/jasper/servlet/JspServletWrapper.java574
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/jasper/servlet/mbeans-descriptors.xml45
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/jasper/tagplugins/jstl/Util.java336
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/jasper/tagplugins/jstl/core/Catch.java73
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/jasper/tagplugins/jstl/core/Choose.java36
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/jasper/tagplugins/jstl/core/ForEach.java346
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/jasper/tagplugins/jstl/core/ForTokens.java120
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/jasper/tagplugins/jstl/core/If.java52
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/jasper/tagplugins/jstl/core/Import.java382
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/jasper/tagplugins/jstl/core/Otherwise.java34
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/jasper/tagplugins/jstl/core/Out.java91
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/jasper/tagplugins/jstl/core/Param.java78
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/jasper/tagplugins/jstl/core/Redirect.java84
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/jasper/tagplugins/jstl/core/Remove.java46
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/jasper/tagplugins/jstl/core/Set.java168
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/jasper/tagplugins/jstl/core/Url.java102
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/jasper/tagplugins/jstl/core/When.java52
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/jasper/tagplugins/jstl/tagPlugins.xml63
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/jasper/util/Enumerator.java126
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/jasper/util/ExceptionUtils.java38
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/jasper/util/FastRemovalDequeue.java309
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/jasper/util/UniqueAttributesImpl.java120
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/juli/AsyncFileHandler.java176
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/juli/ClassLoaderLogManager.java689
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/juli/FileHandler.java388
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/juli/JdkLoggerFormatter.java110
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/juli/OneLineFormatter.java127
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/juli/VerbatimFormatter.java45
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/naming/factory/BeanFactory.java249
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/naming/factory/Constants.java59
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/naming/factory/DataSourceLinkFactory.java140
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/naming/factory/EjbFactory.java179
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/naming/factory/MailSessionFactory.java157
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/naming/factory/OpenEjbFactory.java92
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/naming/factory/ResourceEnvFactory.java128
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/naming/factory/ResourceFactory.java157
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/naming/factory/ResourceLinkFactory.java105
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/naming/factory/SendMailFactory.java133
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/naming/factory/TransactionFactory.java128
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/naming/factory/package.html23
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/naming/resources/BaseDirContext.java1628
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/naming/resources/CacheEntry.java69
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/naming/resources/Constants.java32
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/naming/resources/DirContextURLConnection.java462
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/naming/resources/DirContextURLStreamHandler.java268
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/naming/resources/DirContextURLStreamHandlerFactory.java81
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/naming/resources/FileDirContext.java1109
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/naming/resources/ImmutableNameNotFoundException.java52
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/naming/resources/LocalStrings.properties45
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/naming/resources/LocalStrings_es.properties35
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/naming/resources/LocalStrings_fr.properties35
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/naming/resources/LocalStrings_ja.properties36
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/naming/resources/ProxyDirContext.java1711
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/naming/resources/RecyclableNamingEnumeration.java118
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/naming/resources/Resource.java113
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/naming/resources/ResourceAttributes.java979
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/naming/resources/ResourceCache.java424
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/naming/resources/VirtualDirContext.java225
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/naming/resources/WARDirContext.java1003
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/naming/resources/jndi/Handler.java32
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/naming/resources/package.html31
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/tomcat/jni/File.java722
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/tomcat/jni/Global.java96
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/tomcat/util/DomUtil.java270
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/tomcat/util/ExceptionUtils.java38
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/tomcat/util/IntrospectionUtils.java909
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/tomcat/util/MutableInteger.java29
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/tomcat/util/bcel/util/BCELComparator.java46
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/tomcat/util/bcel/util/ByteSequence.java58
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/tomcat/util/bcel/util/package.html41
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/tomcat/util/buf/Ascii.java247
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/tomcat/util/buf/B2CConverter.java195
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/tomcat/util/buf/ByteChunk.java872
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/tomcat/util/buf/C2BConverter.java275
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/tomcat/util/buf/CharChunk.java720
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/tomcat/util/buf/HexUtils.java102
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/tomcat/util/buf/MessageBytes.java646
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/tomcat/util/buf/StringCache.java692
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/tomcat/util/buf/UDecoder.java276
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/tomcat/util/buf/UEncoder.java174
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/tomcat/util/buf/package.html38
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/tomcat/util/file/Constants.java27
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/tomcat/util/file/LocalStrings.properties16
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/tomcat/util/file/Matcher.java566
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/tomcat/util/file/package.html29
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/tomcat/util/http/fileupload/disk/DiskFileItem.java743
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/tomcat/util/http/fileupload/disk/DiskFileItemFactory.java230
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/tomcat/util/http/fileupload/servlet/ServletFileUpload.java153
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/tomcat/util/http/fileupload/servlet/ServletRequestContext.java111
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/tomcat/util/http/fileupload/util/Closeable.java38
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/tomcat/util/http/fileupload/util/FileItemHeadersImpl.java92
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/tomcat/util/http/fileupload/util/LimitedInputStream.java158
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/tomcat/util/http/fileupload/util/Streams.java198
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/tomcat/util/http/mapper/LocalStrings.properties16
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/tomcat/util/http/mapper/Mapper.java1505
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/tomcat/util/http/mapper/MappingData.java55
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/tomcat/util/http/res/LocalStrings.properties62
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/tomcat/util/http/res/LocalStrings_es.properties63
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/tomcat/util/http/res/LocalStrings_fr.properties61
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/tomcat/util/http/res/LocalStrings_ja.properties63
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/tomcat/util/log/CaptureLog.java50
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/tomcat/util/log/SystemLogHandler.java272
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/tomcat/util/modeler/modules/MbeansDescriptorsDOMSource.java304
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/tomcat/util/modeler/modules/MbeansDescriptorsDigesterSource.java250
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/tomcat/util/modeler/modules/MbeansDescriptorsIntrospectionSource.java421
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/tomcat/util/modeler/modules/MbeansDescriptorsSerSource.java105
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/tomcat/util/modeler/modules/MbeansSource.java368
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/tomcat/util/modeler/modules/MbeansSourceMBean.java60
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/tomcat/util/modeler/modules/ModelerSource.java84
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/tomcat/util/modeler/modules/package.html59
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/tomcat/util/net/AbstractEndpoint.java773
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/tomcat/util/net/AprEndpoint.java1785
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/tomcat/util/net/Constants.java33
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/tomcat/util/net/DefaultServerSocketFactory.java66
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/tomcat/util/net/JIoEndpoint.java589
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/tomcat/util/net/NioBlockingSelector.java399
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/tomcat/util/net/NioChannel.java219
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/tomcat/util/net/NioEndpoint.java1620
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/tomcat/util/net/NioSelectorPool.java302
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/tomcat/util/net/SSLImplementation.java91
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/tomcat/util/net/SSLSessionManager.java31
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/tomcat/util/net/SSLSupport.java137
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/tomcat/util/net/SSLUtil.java33
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/tomcat/util/net/SecureNioChannel.java562
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/tomcat/util/net/ServerSocketFactory.java97
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/tomcat/util/net/SocketProperties.java424
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/tomcat/util/net/SocketStatus.java27
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/tomcat/util/net/SocketWrapper.java53
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/tomcat/util/net/URL.java745
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/tomcat/util/net/jsse/res/LocalStrings.properties20
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/tomcat/util/net/jsse/res/LocalStrings_es.properties16
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/tomcat/util/net/jsse/res/LocalStrings_fr.properties16
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/tomcat/util/net/jsse/res/LocalStrings_ja.properties17
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/tomcat/util/net/res/LocalStrings.properties48
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/tomcat/util/net/res/LocalStrings_es.properties39
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/tomcat/util/net/res/LocalStrings_fr.properties21
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/tomcat/util/net/res/LocalStrings_ja.properties21
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/tomcat/util/res/StringManager.java206
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/tomcat/util/threads/Constants.java27
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/tomcat/util/threads/CounterLatch.java179
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/tomcat/util/threads/DedicatedThreadExecutor.java137
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/tomcat/util/threads/ResizableExecutor.java44
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/tomcat/util/threads/TaskQueue.java123
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/tomcat/util/threads/TaskThread.java45
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/tomcat/util/threads/TaskThreadFactory.java48
-rw-r--r--bundles/org.apache.tomcat/src/org/apache/tomcat/util/threads/ThreadPoolExecutor.java246
534 files changed, 118260 insertions, 0 deletions
diff --git a/bundles/org.apache.tomcat/.classpath b/bundles/org.apache.tomcat/.classpath
new file mode 100644
index 0000000..ad32c83
--- /dev/null
+++ b/bundles/org.apache.tomcat/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/bundles/org.apache.tomcat/.project b/bundles/org.apache.tomcat/.project
new file mode 100644
index 0000000..99ace6a
--- /dev/null
+++ b/bundles/org.apache.tomcat/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.apache.tomcat</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/bundles/org.apache.tomcat/.settings/org.eclipse.jdt.core.prefs b/bundles/org.apache.tomcat/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..b7cbedf
--- /dev/null
+++ b/bundles/org.apache.tomcat/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,8 @@
+#Thu Jun 09 11:01:57 CEST 2011
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
diff --git a/bundles/org.apache.tomcat/.settings/org.eclipse.pde.core.prefs b/bundles/org.apache.tomcat/.settings/org.eclipse.pde.core.prefs
new file mode 100644
index 0000000..90841bf
--- /dev/null
+++ b/bundles/org.apache.tomcat/.settings/org.eclipse.pde.core.prefs
@@ -0,0 +1,4 @@
+#Thu Jun 09 11:01:57 CEST 2011
+eclipse.preferences.version=1
+pluginProject.extensions=false
+resolve.requirebundle=false
diff --git a/bundles/org.apache.tomcat/META-INF/MANIFEST.MF b/bundles/org.apache.tomcat/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..885f7c9
--- /dev/null
+++ b/bundles/org.apache.tomcat/META-INF/MANIFEST.MF
@@ -0,0 +1,27 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Apache Tomcat
+Bundle-SymbolicName: org.apache.tomcat
+Bundle-Version: 7.0.12.qualifier
+Bundle-Vendor: Apache Software Foundation
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Import-Package: javax.servlet;version="3.0.0",
+ javax.servlet.annotation;version="3.0.0",
+ javax.servlet.descriptor;version="3.0.0",
+ javax.servlet.http;version="3.0.0",
+ javax.servlet.resources;version="3.0.0"
+Bundle-ActivationPolicy: lazy
+Export-Package: org.apache.catalina;version="7.0.12.qualifier",
+ org.apache.catalina.connector;version="7.0.12.qualifier",
+ org.apache.catalina.deploy;version="7.0.12.qualifier",
+ org.apache.catalina.ha.session;version="7.0.12.qualifier",
+ org.apache.catalina.ha.tcp;version="7.0.12.qualifier",
+ org.apache.catalina.servlets;version="7.0.12.qualifier",
+ org.apache.catalina.session;version="7.0.12.qualifier",
+ org.apache.catalina.startup;version="7.0.12.qualifier",
+ org.apache.catalina.tribes;version="7.0.12.qualifier",
+ org.apache.catalina.tribes.group;version="7.0.12.qualifier",
+ org.apache.catalina.tribes.group.interceptors;version="7.0.12.qualifier",
+ org.apache.catalina.tribes.membership;version="7.0.12.qualifier",
+ org.apache.catalina.tribes.transport;version="7.0.12.qualifier",
+ org.apache.catalina.tribes.transport.nio;version="7.0.12.qualifier"
diff --git a/bundles/org.apache.tomcat/build.properties b/bundles/org.apache.tomcat/build.properties
new file mode 100644
index 0000000..2d06797
--- /dev/null
+++ b/bundles/org.apache.tomcat/build.properties
@@ -0,0 +1,18 @@
+################################################################################
+# Copyright (c) 2011 EclipseSource and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# EclipseSource - initial API and implementation
+################################################################################
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
+javacDefaultEncoding.. = UTF-8
+jre.compilation.profile = JavaSE-1.6
+javacSource = 1.6
+javacTarget = 1.6
diff --git a/bundles/org.apache.tomcat/src/javax/annotation/Generated.java b/bundles/org.apache.tomcat/src/javax/annotation/Generated.java
new file mode 100644
index 0000000..d4721db
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/javax/annotation/Generated.java
@@ -0,0 +1,35 @@
+/*
+ * 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 javax.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Target({ElementType.ANNOTATION_TYPE, ElementType.CONSTRUCTOR,
+ ElementType.FIELD, ElementType.LOCAL_VARIABLE, ElementType.METHOD,
+ ElementType.PACKAGE, ElementType.PARAMETER, ElementType.TYPE})
+@Retention(RetentionPolicy.SOURCE)
+
+public @interface Generated {
+ public String[] value();
+ public String date() default "";
+ public String comment() default "";
+}
diff --git a/bundles/org.apache.tomcat/src/javax/annotation/PostConstruct.java b/bundles/org.apache.tomcat/src/javax/annotation/PostConstruct.java
new file mode 100644
index 0000000..8ad363a
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/javax/annotation/PostConstruct.java
@@ -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.
+ */
+
+
+package javax.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Target({ElementType.METHOD})
+@Retention(RetentionPolicy.RUNTIME)
+
+public @interface PostConstruct {
+ // No attributes
+}
diff --git a/bundles/org.apache.tomcat/src/javax/annotation/PreDestroy.java b/bundles/org.apache.tomcat/src/javax/annotation/PreDestroy.java
new file mode 100644
index 0000000..d5be75a
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/javax/annotation/PreDestroy.java
@@ -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.
+ */
+
+
+package javax.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Target({ElementType.METHOD})
+@Retention(RetentionPolicy.RUNTIME)
+
+public @interface PreDestroy {
+ // No attributes
+}
diff --git a/bundles/org.apache.tomcat/src/javax/annotation/Resource.java b/bundles/org.apache.tomcat/src/javax/annotation/Resource.java
new file mode 100644
index 0000000..21a5d8b
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/javax/annotation/Resource.java
@@ -0,0 +1,41 @@
+/*
+ * 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 javax.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Target({ElementType.TYPE, ElementType.METHOD, ElementType.FIELD})
+@Retention(RetentionPolicy.RUNTIME)
+
+public @interface Resource {
+ public enum AuthenticationType {
+ CONTAINER,
+ APPLICATION
+ }
+ public String name() default "";
+ @SuppressWarnings("rawtypes") // Can't use Class<?> because API needs to match specification
+ public Class type() default Object.class;
+ public AuthenticationType authenticationType() default AuthenticationType.CONTAINER;
+ public boolean shareable() default true;
+ public String description() default "";
+ public String mappedName() default "";
+}
diff --git a/bundles/org.apache.tomcat/src/javax/annotation/Resources.java b/bundles/org.apache.tomcat/src/javax/annotation/Resources.java
new file mode 100644
index 0000000..4b398f2
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/javax/annotation/Resources.java
@@ -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.
+ */
+
+
+package javax.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+
+public @interface Resources {
+ public Resource[] value();
+}
diff --git a/bundles/org.apache.tomcat/src/javax/annotation/security/DeclareRoles.java b/bundles/org.apache.tomcat/src/javax/annotation/security/DeclareRoles.java
new file mode 100644
index 0000000..d5d214a
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/javax/annotation/security/DeclareRoles.java
@@ -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.
+ */
+
+
+package javax.annotation.security;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+
+public @interface DeclareRoles {
+ public String[] value();
+}
diff --git a/bundles/org.apache.tomcat/src/javax/annotation/security/DenyAll.java b/bundles/org.apache.tomcat/src/javax/annotation/security/DenyAll.java
new file mode 100644
index 0000000..6fdf829
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/javax/annotation/security/DenyAll.java
@@ -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.
+ */
+
+
+package javax.annotation.security;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Target({ElementType.METHOD})
+@Retention(RetentionPolicy.RUNTIME)
+
+public @interface DenyAll {
+ // No attributes
+}
diff --git a/bundles/org.apache.tomcat/src/javax/annotation/security/PermitAll.java b/bundles/org.apache.tomcat/src/javax/annotation/security/PermitAll.java
new file mode 100644
index 0000000..dfe3aa5
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/javax/annotation/security/PermitAll.java
@@ -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.
+ */
+
+
+package javax.annotation.security;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Target({ElementType.TYPE, ElementType.METHOD})
+@Retention(RetentionPolicy.RUNTIME)
+
+public @interface PermitAll {
+ // No attributes
+}
diff --git a/bundles/org.apache.tomcat/src/javax/annotation/security/RolesAllowed.java b/bundles/org.apache.tomcat/src/javax/annotation/security/RolesAllowed.java
new file mode 100644
index 0000000..fced761
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/javax/annotation/security/RolesAllowed.java
@@ -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.
+ */
+
+
+package javax.annotation.security;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Target({ElementType.TYPE, ElementType.METHOD})
+@Retention(RetentionPolicy.RUNTIME)
+
+public @interface RolesAllowed {
+ public String[] value();
+}
diff --git a/bundles/org.apache.tomcat/src/javax/annotation/security/RunAs.java b/bundles/org.apache.tomcat/src/javax/annotation/security/RunAs.java
new file mode 100644
index 0000000..3920d7c
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/javax/annotation/security/RunAs.java
@@ -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.
+ */
+
+
+package javax.annotation.security;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+
+public @interface RunAs {
+ public String value();
+}
diff --git a/bundles/org.apache.tomcat/src/javax/ejb/EJB.java b/bundles/org.apache.tomcat/src/javax/ejb/EJB.java
new file mode 100644
index 0000000..85233ed
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/javax/ejb/EJB.java
@@ -0,0 +1,36 @@
+/*
+ * 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 javax.ejb;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Target({ElementType.METHOD, ElementType.TYPE, ElementType.FIELD})
+@Retention(RetentionPolicy.RUNTIME)
+
+public @interface EJB {
+ String name() default "";
+ String description() default "";
+ @SuppressWarnings("rawtypes") // Can't use Class<?> because API needs to match specification
+ Class beanInterface() default java.lang.Object.class;
+ String beanName() default "";
+ String mappedName() default "";
+}
diff --git a/bundles/org.apache.tomcat/src/javax/ejb/EJBs.java b/bundles/org.apache.tomcat/src/javax/ejb/EJBs.java
new file mode 100644
index 0000000..3f752f9
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/javax/ejb/EJBs.java
@@ -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.
+ */
+
+
+package javax.ejb;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+
+public @interface EJBs {
+ EJB[] value();
+}
diff --git a/bundles/org.apache.tomcat/src/javax/mail/Authenticator.java b/bundles/org.apache.tomcat/src/javax/mail/Authenticator.java
new file mode 100644
index 0000000..78df841
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/javax/mail/Authenticator.java
@@ -0,0 +1,23 @@
+/*
+ * 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 javax.mail;
+
+public class Authenticator {
+ protected PasswordAuthentication getPasswordAuthentication() {
+ return null;
+ }
+}
diff --git a/bundles/org.apache.tomcat/src/javax/mail/PasswordAuthentication.java b/bundles/org.apache.tomcat/src/javax/mail/PasswordAuthentication.java
new file mode 100644
index 0000000..d5d9411
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/javax/mail/PasswordAuthentication.java
@@ -0,0 +1,24 @@
+/*
+ * 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 javax.mail;
+
+@SuppressWarnings("unused") // Dummy implementation
+public class PasswordAuthentication {
+ public PasswordAuthentication(String user, String password) {
+ // Dummy implementation
+ }
+}
diff --git a/bundles/org.apache.tomcat/src/javax/mail/Session.java b/bundles/org.apache.tomcat/src/javax/mail/Session.java
new file mode 100644
index 0000000..a95a11b
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/javax/mail/Session.java
@@ -0,0 +1,29 @@
+/*
+ * 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 javax.mail;
+
+import java.util.Properties;
+
+@SuppressWarnings("unused") // Dummy implementation
+public class Session {
+ public static Session getInstance(Properties props, Authenticator auth) {
+ return null;
+ }
+ public static Session getInstance(Properties props) {
+ return null;
+ }
+}
diff --git a/bundles/org.apache.tomcat/src/javax/servlet/annotation/HandlesTypes.java b/bundles/org.apache.tomcat/src/javax/servlet/annotation/HandlesTypes.java
new file mode 100644
index 0000000..f1ff122
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/javax/servlet/annotation/HandlesTypes.java
@@ -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 javax.servlet.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * This annotation is used to declare an array of application classes which are
+ * passed to a {@link javax.servlet.ServletContainerInitializer}.
+ *
+ * @since Servlet 3.0
+ */
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@SuppressWarnings("rawtypes") // Spec API does not use generics
+public @interface HandlesTypes {
+
+ /**
+ * @return array of classes
+ */
+ Class[] value();
+
+}
diff --git a/bundles/org.apache.tomcat/src/javax/servlet/annotation/HttpConstraint.java b/bundles/org.apache.tomcat/src/javax/servlet/annotation/HttpConstraint.java
new file mode 100644
index 0000000..2223e92
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/javax/servlet/annotation/HttpConstraint.java
@@ -0,0 +1,69 @@
+/*
+ * 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 javax.servlet.annotation;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+import javax.servlet.annotation.ServletSecurity.EmptyRoleSemantic;
+import javax.servlet.annotation.ServletSecurity.TransportGuarantee;
+
+/**
+ * This annotation represents the security constraints that are applied to all
+ * requests with HTTP protocol method types that are not otherwise represented
+ * by a corresponding {@link javax.servlet.annotation.HttpMethodConstraint} in a
+ * {@link javax.servlet.annotation.ServletSecurity} annotation.
+ *
+ * @since Servlet 3.0
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+public @interface HttpConstraint {
+
+ /**
+ * The EmptyRoleSemantic determines the behaviour when the rolesAllowed list
+ * is empty.
+ *
+ * @return empty role semantic
+ */
+ EmptyRoleSemantic value() default EmptyRoleSemantic.PERMIT;
+
+ /**
+ * Determines whether SSL/TLS is required to process the current request.
+ *
+ * @return transport guarantee
+ */
+ TransportGuarantee transportGuarantee() default TransportGuarantee.NONE;
+
+ /**
+ * The authorized roles' names. The container may discard duplicate role
+ * names during processing of the annotation. N.B. The String "*" does not
+ * have a special meaning if it occurs as a role name.
+ *
+ * @return array of names. The array may be of zero length, in which case
+ * the EmptyRoleSemantic applies; the returned value determines
+ * whether access is to be permitted or denied regardless of the
+ * identity and authentication state in either case, PERMIT or DENY.<br />
+ * Otherwise, when the array contains one or more role names access
+ * is permitted if the user a member of at least one of the named
+ * roles. The EmptyRoleSemantic is not applied in this case.
+ *
+ */
+ String[] rolesAllowed() default {};
+
+}
diff --git a/bundles/org.apache.tomcat/src/javax/servlet/annotation/HttpMethodConstraint.java b/bundles/org.apache.tomcat/src/javax/servlet/annotation/HttpMethodConstraint.java
new file mode 100644
index 0000000..4175a7c
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/javax/servlet/annotation/HttpMethodConstraint.java
@@ -0,0 +1,74 @@
+/*
+ * 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 javax.servlet.annotation;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+import javax.servlet.annotation.ServletSecurity.EmptyRoleSemantic;
+import javax.servlet.annotation.ServletSecurity.TransportGuarantee;
+
+/**
+ * Specific security constraints can be applied to different types of request,
+ * differentiated by the HTTP protocol method type by using this annotation
+ * inside the {@link javax.servlet.annotation.ServletSecurity} annotation.
+ *
+ * @since Servlet 3.0
+ *
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+public @interface HttpMethodConstraint {
+
+ /**
+ * HTTP Protocol method name (e.g. POST, PUT)
+ *
+ * @return method name
+ */
+ String value();
+
+ /**
+ * The EmptyRoleSemantic determines the behaviour when the rolesAllowed list
+ * is empty.
+ *
+ * @return empty role semantic
+ */
+ EmptyRoleSemantic emptyRoleSemantic() default EmptyRoleSemantic.PERMIT;
+
+ /**
+ * Determines whether SSL/TLS is required to process the current request.
+ *
+ * @return transport guarantee
+ */
+ TransportGuarantee transportGuarantee() default TransportGuarantee.NONE;
+
+ /**
+ * The authorized roles' names. The container may discard duplicate role
+ * names during processing of the annotation. N.B. The String "*" does not
+ * have a special meaning if it occurs as a role name.
+ *
+ * @return array of names. The array may be of zero length, in which case
+ * the EmptyRoleSemantic applies; the returned value determines
+ * whether access is to be permitted or denied regardless of the
+ * identity and authentication state in either case, PERMIT or DENY.<br />
+ * Otherwise, when the array contains one or more role names access
+ * is permitted if the user a member of at least one of the named
+ * roles. The EmptyRoleSemantic is not applied in this case.
+ */
+ String[] rolesAllowed() default {};
+}
diff --git a/bundles/org.apache.tomcat/src/javax/servlet/annotation/MultipartConfig.java b/bundles/org.apache.tomcat/src/javax/servlet/annotation/MultipartConfig.java
new file mode 100644
index 0000000..4b8bb2f
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/javax/servlet/annotation/MultipartConfig.java
@@ -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.
+ */
+package javax.servlet.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * This annotation is used to indicate that the {@link javax.servlet.Servlet} on
+ * which it is declared expects requests to made using the {@code
+ * multipart/form-data} MIME type. <br />
+ * <br />
+ *
+ * {@link javax.servlet.http.Part} components of a given {@code
+ * multipart/form-data} request are retrieved by a Servlet annotated with
+ * {@code MultipartConfig} by calling
+ * {@link javax.servlet.http.HttpServletRequest#getPart} or
+ * {@link javax.servlet.http.HttpServletRequest#getParts}.<br />
+ * <br />
+ *
+ * E.g. <code>@WebServlet("/upload")}</code><br />
+ *
+ * <code>@MultipartConfig()</code> <code>public class UploadServlet extends
+ * HttpServlet ... } </code><br />
+ *
+ * @since Servlet 3.0
+ */
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+public @interface MultipartConfig {
+
+ /**
+ * @return location in which the Container stores temporary files
+ */
+ String location() default "";
+
+ /**
+ * @return the maximum size allowed for uploaded files (in bytes)
+ */
+ long maxFileSize() default -1L;
+
+ /**
+ * @return the maximum size of the request allowed for {@code
+ * multipart/form-data}
+ */
+ long maxRequestSize() default -1L;
+
+ /**
+ * @return the size threshold at which the file will be written to the disk
+ */
+ int fileSizeThreshold() default 0;
+}
diff --git a/bundles/org.apache.tomcat/src/javax/servlet/annotation/ServletSecurity.java b/bundles/org.apache.tomcat/src/javax/servlet/annotation/ServletSecurity.java
new file mode 100644
index 0000000..cebb072
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/javax/servlet/annotation/ServletSecurity.java
@@ -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 javax.servlet.annotation;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Declare this annotation on a {@link javax.servlet.Servlet} implementation
+ * class to enforce security constraints on HTTP protocol requests.<br />
+ * The container applies constraints to the URL patterns mapped to each Servlet
+ * which declares this annotation.<br />
+ * <br />
+ *
+ * @since Servlet 3.0
+ */
+@Inherited
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+public @interface ServletSecurity {
+
+ /**
+ * Represents the two possible values of the empty role semantic, active
+ * when a list of role names is empty.
+ */
+ enum EmptyRoleSemantic {
+
+ /**
+ * Access MUST be permitted, regardless of authentication state or
+ * identity
+ */
+ PERMIT,
+
+ /**
+ * Access MUST be denied, regardless of authentication state or identity
+ */
+ DENY
+ }
+
+ /**
+ * Represents the two possible values of data transport, encrypted or not.
+ */
+ enum TransportGuarantee {
+
+ /**
+ * User data must not be encrypted by the container during transport
+ */
+ NONE,
+
+ /**
+ * The container MUST encrypt user data during transport
+ */
+ CONFIDENTIAL
+ }
+
+ /**
+ * The default constraint to apply to requests not handled by specific
+ * method constraints
+ *
+ * @return http constraint
+ */
+ HttpConstraint value() default @HttpConstraint;
+
+ /**
+ * An array of HttpMethodContraint objects to which the security constraint
+ * will be applied
+ *
+ * @return array of http method constraint
+ */
+ HttpMethodConstraint[] httpMethodConstraints() default {};
+}
diff --git a/bundles/org.apache.tomcat/src/javax/servlet/annotation/WebFilter.java b/bundles/org.apache.tomcat/src/javax/servlet/annotation/WebFilter.java
new file mode 100644
index 0000000..aaac994
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/javax/servlet/annotation/WebFilter.java
@@ -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 javax.servlet.annotation;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.servlet.DispatcherType;
+
+/**
+ * The annotation used to declare a Servlet {@link javax.servlet.Filter}. <br />
+ * <br />
+ *
+ * This annotation will be processed by the container during deployment, the
+ * Filter class in which it is found will be created as per the configuration
+ * and applied to the URL patterns, {@link javax.servlet.Servlet}s and
+ * {@link javax.servlet.DispatcherType}s.<br />
+ * <br/>
+ *
+ * If the name attribute is not defined, the fully qualified name of the class
+ * is used.<br/>
+ * <br/>
+ *
+ * At least one URL pattern MUST be declared in either the {@code value} or
+ * {@code urlPattern} attribute of the annotation, but not both.<br/>
+ * <br/>
+ *
+ * The {@code value} attribute is recommended for use when the URL pattern is
+ * the only attribute being set, otherwise the {@code urlPattern} attribute
+ * should be used.<br />
+ * <br />
+ *
+ * The annotated class MUST implement {@link javax.servlet.Filter}.
+ *
+ * E.g.
+ *
+ * <code>@WebFilter("/path/*")</code><br />
+ * <code>public class AnExampleFilter implements Filter { ... </code><br />
+ *
+ * @since Servlet 3.0 (Section 8.1.2)
+ *
+ */
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+public @interface WebFilter {
+
+ /**
+ * @return description of the Filter, if present
+ */
+ String description() default "";
+
+ /**
+ * @return display name of the Filter, if present
+ */
+ String displayName() default "";
+
+ /**
+ * @return array of initialization params for this Filter
+ */
+ WebInitParam[] initParams() default {};
+
+ /**
+ * @return name of the Filter, if present
+ */
+ String filterName() default "";
+
+ /**
+ * @return small icon for this Filter, if present
+ */
+ String smallIcon() default "";
+
+ /**
+ * @return the large icon for this Filter, if present
+ */
+ String largeIcon() default "";
+
+ /**
+ * @return array of Servlet names to which this Filter applies
+ */
+ String[] servletNames() default {};
+
+ /**
+ * A convenience method, to allow extremely simple annotation of a class.
+ *
+ * @return array of URL patterns
+ * @see #urlPatterns()
+ */
+ String[] value() default {};
+
+ /**
+ * @return array of URL patterns to which this Filter applies
+ */
+ String[] urlPatterns() default {};
+
+ /**
+ * @return array of DispatcherTypes to which this filter applies
+ */
+ DispatcherType[] dispatcherTypes() default {DispatcherType.REQUEST};
+
+ /**
+ * @return asynchronous operation supported by this Filter
+ */
+ boolean asyncSupported() default false;
+}
diff --git a/bundles/org.apache.tomcat/src/javax/servlet/annotation/WebInitParam.java b/bundles/org.apache.tomcat/src/javax/servlet/annotation/WebInitParam.java
new file mode 100644
index 0000000..d4b7573
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/javax/servlet/annotation/WebInitParam.java
@@ -0,0 +1,57 @@
+/*
+ * 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 javax.servlet.annotation;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * The annotation used to declare an initialization parameter on a
+ * {@link javax.servlet.Servlet} or {@link javax.servlet.Filter}, within a
+ * {@link javax.servlet.annotation.WebFilter} or
+ * {@link javax.servlet.annotation.WebServlet} annotation.<br />
+ * <br />
+ *
+ * E.g.
+ * <code>&amp;#064;WebServlet(name="TestServlet", urlPatterns={"/test"},initParams={&amp;#064;WebInitParam(name="test", value="true")})
+ * public class TestServlet extends HttpServlet { ... </code><br />
+ *
+ * @since Servlet 3.0
+ */
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+public @interface WebInitParam {
+
+ /**
+ * @return name of the initialization parameter
+ */
+ String name();
+
+ /**
+ * @return value of the initialization parameter
+ */
+ String value();
+
+ /**
+ * @return description of the initialization parameter
+ */
+ String description() default "";
+}
diff --git a/bundles/org.apache.tomcat/src/javax/servlet/annotation/WebListener.java b/bundles/org.apache.tomcat/src/javax/servlet/annotation/WebListener.java
new file mode 100644
index 0000000..eeed16d
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/javax/servlet/annotation/WebListener.java
@@ -0,0 +1,53 @@
+/*
+ * 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 javax.servlet.annotation;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * The annotation used to declare a listener for various types of event, in a
+ * given web application context.<br />
+ * <br />
+ *
+ * The class annotated MUST implement one, (or more), of the following
+ * interfaces: {@link javax.servlet.http.HttpSessionAttributeListener},
+ * {@link javax.servlet.http.HttpSessionListener},
+ * {@link javax.servlet.ServletContextAttributeListener},
+ * {@link javax.servlet.ServletContextListener},
+ * {@link javax.servlet.ServletRequestAttributeListener},
+ * {@link javax.servlet.ServletRequestListener} <br />
+ * <br />
+ *
+ * E.g. <code>@WebListener</code><br />
+ * <code>public TestListener implements ServletContextListener {</code><br />
+ *
+ * @since Servlet 3.0
+ */
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+public @interface WebListener {
+
+ /**
+ * @return description of the listener, if present
+ */
+ String value() default "";
+}
diff --git a/bundles/org.apache.tomcat/src/javax/servlet/annotation/WebServlet.java b/bundles/org.apache.tomcat/src/javax/servlet/annotation/WebServlet.java
new file mode 100644
index 0000000..53f9b4c
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/javax/servlet/annotation/WebServlet.java
@@ -0,0 +1,113 @@
+/*
+ * 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 javax.servlet.annotation;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * This annotation is used to declare the configuration of an
+ * {@link javax.servlet.Servlet}. <br/>
+ *
+ * If the name attribute is not defined, the fully qualified name of the class
+ * is used.<br/>
+ * <br/>
+ *
+ * At least one URL pattern MUST be declared in either the {@code value} or
+ * {@code urlPattern} attribute of the annotation, but not both.<br/>
+ * <br/>
+ *
+ * The {@code value} attribute is recommended for use when the URL pattern is
+ * the only attribute being set, otherwise the {@code urlPattern} attribute
+ * should be used.<br />
+ * <br />
+ *
+ * The class on which this annotation is declared MUST extend
+ * {@link javax.servlet.http.HttpServlet}. <br />
+ * <br />
+ *
+ * E.g. <code>@WebServlet("/path")}<br />
+ * public class TestServlet extends HttpServlet ... {</code><br />
+ *
+ * E.g.
+ * <code>@WebServlet(name="TestServlet", urlPatterns={"/path", "/alt"}) <br />
+ * public class TestServlet extends HttpServlet ... {</code><br />
+ *
+ * @since Servlet 3.0 (Section 8.1.1)
+ *
+ */
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+public @interface WebServlet {
+
+ /**
+ * @return name of the Servlet
+ */
+ String name() default "";
+
+ /**
+ * A convenience method, to allow extremely simple annotation of a class.
+ *
+ * @return array of URL patterns
+ * @see #urlPatterns()
+ */
+ String[] value() default {};
+
+ /**
+ * @return array of URL patterns to which this Filter applies
+ */
+ String[] urlPatterns() default {};
+
+ /**
+ * @return load on startup ordering hint
+ */
+ int loadOnStartup() default -1;
+
+ /**
+ * @return array of initialization params for this Servlet
+ */
+ WebInitParam[] initParams() default {};
+
+ /**
+ * @return asynchronous operation supported by this Servlet
+ */
+ boolean asyncSupported() default false;
+
+ /**
+ * @return small icon for this Servlet, if present
+ */
+ String smallIcon() default "";
+
+ /**
+ * @return large icon for this Servlet, if present
+ */
+ String largeIcon() default "";
+
+ /**
+ * @return description of this Servlet, if present
+ */
+ String description() default "";
+
+ /**
+ * @return display name of this Servlet, if present
+ */
+ String displayName() default "";
+}
diff --git a/bundles/org.apache.tomcat/src/javax/servlet/descriptor/JspConfigDescriptor.java b/bundles/org.apache.tomcat/src/javax/servlet/descriptor/JspConfigDescriptor.java
new file mode 100644
index 0000000..8296d44
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/javax/servlet/descriptor/JspConfigDescriptor.java
@@ -0,0 +1,28 @@
+/*
+ * 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 javax.servlet.descriptor;
+
+import java.util.Collection;
+
+/**
+ * @since Servlet 3.0
+ * TODO SERVLET3 - Add comments
+ */
+public interface JspConfigDescriptor {
+ public Collection<TaglibDescriptor> getTaglibs();
+ public Collection<JspPropertyGroupDescriptor> getJspPropertyGroups();
+}
diff --git a/bundles/org.apache.tomcat/src/javax/servlet/descriptor/JspPropertyGroupDescriptor.java b/bundles/org.apache.tomcat/src/javax/servlet/descriptor/JspPropertyGroupDescriptor.java
new file mode 100644
index 0000000..25c71a9
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/javax/servlet/descriptor/JspPropertyGroupDescriptor.java
@@ -0,0 +1,38 @@
+/*
+ * 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 javax.servlet.descriptor;
+
+import java.util.Collection;
+
+/**
+ * @since Servlet 3.0
+ * TODO SERVLET3 - Add comments
+ */
+public interface JspPropertyGroupDescriptor {
+ public Collection<String> getUrlPatterns();
+ public String getElIgnored();
+ public String getPageEncoding();
+ public String getScriptingInvalid();
+ public String getIsXml();
+ public Collection<String> getIncludePreludes();
+ public Collection<String> getIncludeCodas();
+ public String getDeferredSyntaxAllowedAsLiteral();
+ public String getTrimDirectiveWhitespaces();
+ public String getDefaultContentType();
+ public String getBuffer();
+ public String getErrorOnUndeclaredNamespace();
+}
diff --git a/bundles/org.apache.tomcat/src/javax/servlet/descriptor/TaglibDescriptor.java b/bundles/org.apache.tomcat/src/javax/servlet/descriptor/TaglibDescriptor.java
new file mode 100644
index 0000000..f930c5d
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/javax/servlet/descriptor/TaglibDescriptor.java
@@ -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 javax.servlet.descriptor;
+
+/**
+ * @since Servlet 3.0
+ * TODO SERVLET3 - Add comments
+ */
+public interface TaglibDescriptor {
+ public String getTaglibURI();
+ public String getTaglibLocation();
+}
diff --git a/bundles/org.apache.tomcat/src/javax/servlet/http/Cookie.java b/bundles/org.apache.tomcat/src/javax/servlet/http/Cookie.java
new file mode 100644
index 0000000..829b242
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/javax/servlet/http/Cookie.java
@@ -0,0 +1,468 @@
+/*
+ * 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 javax.servlet.http;
+
+import java.io.Serializable;
+import java.text.MessageFormat;
+import java.util.Locale;
+import java.util.ResourceBundle;
+
+/**
+ * Creates a cookie, a small amount of information sent by a servlet to a Web
+ * browser, saved by the browser, and later sent back to the server. A cookie's
+ * value can uniquely identify a client, so cookies are commonly used for
+ * session management.
+ * <p>
+ * A cookie has a name, a single value, and optional attributes such as a
+ * comment, path and domain qualifiers, a maximum age, and a version number.
+ * Some Web browsers have bugs in how they handle the optional attributes, so
+ * use them sparingly to improve the interoperability of your servlets.
+ * <p>
+ * The servlet sends cookies to the browser by using the
+ * {@link HttpServletResponse#addCookie} method, which adds fields to HTTP
+ * response headers to send cookies to the browser, one at a time. The browser
+ * is expected to support 20 cookies for each Web server, 300 cookies total, and
+ * may limit cookie size to 4 KB each.
+ * <p>
+ * The browser returns cookies to the servlet by adding fields to HTTP request
+ * headers. Cookies can be retrieved from a request by using the
+ * {@link HttpServletRequest#getCookies} method. Several cookies might have the
+ * same name but different path attributes.
+ * <p>
+ * Cookies affect the caching of the Web pages that use them. HTTP 1.0 does not
+ * cache pages that use cookies created with this class. This class does not
+ * support the cache control defined with HTTP 1.1.
+ * <p>
+ * This class supports both the Version 0 (by Netscape) and Version 1 (by RFC
+ * 2109) cookie specifications. By default, cookies are created using Version 0
+ * to ensure the best interoperability.
+ *
+ * @author Various
+ * @version $Version$
+ */
+public class Cookie implements Cloneable, Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ private static final String LSTRING_FILE = "javax.servlet.http.LocalStrings";
+ private static ResourceBundle lStrings = ResourceBundle.getBundle(LSTRING_FILE);
+
+ //
+ // The value of the cookie itself.
+ //
+
+ private String name; // NAME= ... "$Name" style is reserved
+ private String value; // value of NAME
+
+ //
+ // Attributes encoded in the header's cookie fields.
+ //
+
+ private String comment; // ;Comment=VALUE ... describes cookie's use
+ // ;Discard ... implied by maxAge < 0
+ private String domain; // ;Domain=VALUE ... domain that sees cookie
+ private int maxAge = -1; // ;Max-Age=VALUE ... cookies auto-expire
+ private String path; // ;Path=VALUE ... URLs that see the cookie
+ private boolean secure; // ;Secure ... e.g. use SSL
+ private int version = 0; // ;Version=1 ... means RFC 2109++ style
+ private boolean httpOnly; // Not in cookie specs, but supported by browsers
+
+ /**
+ * Constructs a cookie with a specified name and value.
+ * <p>
+ * The name must conform to RFC 2109. That means it can contain only ASCII
+ * alphanumeric characters and cannot contain commas, semicolons, or white
+ * space or begin with a $ character. The cookie's name cannot be changed
+ * after creation.
+ * <p>
+ * The value can be anything the server chooses to send. Its value is
+ * probably of interest only to the server. The cookie's value can be
+ * changed after creation with the <code>setValue</code> method.
+ * <p>
+ * By default, cookies are created according to the Netscape cookie
+ * specification. The version can be changed with the
+ * <code>setVersion</code> method.
+ *
+ * @param name
+ * a <code>String</code> specifying the name of the cookie
+ * @param value
+ * a <code>String</code> specifying the value of the cookie
+ * @throws IllegalArgumentException
+ * if the cookie name contains illegal characters (for example,
+ * a comma, space, or semicolon) or it is one of the tokens
+ * reserved for use by the cookie protocol
+ * @see #setValue
+ * @see #setVersion
+ */
+ public Cookie(String name, String value) {
+ if (name == null || name.length() == 0) {
+ throw new IllegalArgumentException(
+ lStrings.getString("err.cookie_name_blank"));
+ }
+ if (!isToken(name) ||
+ name.equalsIgnoreCase("Comment") // rfc2019
+ ||
+ name.equalsIgnoreCase("Discard") // 2019++
+ ||
+ name.equalsIgnoreCase("Domain") ||
+ name.equalsIgnoreCase("Expires") // (old cookies)
+ ||
+ name.equalsIgnoreCase("Max-Age") // rfc2019
+ || name.equalsIgnoreCase("Path") ||
+ name.equalsIgnoreCase("Secure") ||
+ name.equalsIgnoreCase("Version") || name.startsWith("$")) {
+ String errMsg = lStrings.getString("err.cookie_name_is_token");
+ Object[] errArgs = new Object[1];
+ errArgs[0] = name;
+ errMsg = MessageFormat.format(errMsg, errArgs);
+ throw new IllegalArgumentException(errMsg);
+ }
+
+ this.name = name;
+ this.value = value;
+ }
+
+ /**
+ * Specifies a comment that describes a cookie's purpose. The comment is
+ * useful if the browser presents the cookie to the user. Comments are not
+ * supported by Netscape Version 0 cookies.
+ *
+ * @param purpose
+ * a <code>String</code> specifying the comment to display to the
+ * user
+ * @see #getComment
+ */
+ public void setComment(String purpose) {
+ comment = purpose;
+ }
+
+ /**
+ * Returns the comment describing the purpose of this cookie, or
+ * <code>null</code> if the cookie has no comment.
+ *
+ * @return a <code>String</code> containing the comment, or
+ * <code>null</code> if none
+ * @see #setComment
+ */
+ public String getComment() {
+ return comment;
+ }
+
+ /**
+ * Specifies the domain within which this cookie should be presented.
+ * <p>
+ * The form of the domain name is specified by RFC 2109. A domain name
+ * begins with a dot (<code>.foo.com</code>) and means that the cookie is
+ * visible to servers in a specified Domain Name System (DNS) zone (for
+ * example, <code>www.foo.com</code>, but not <code>a.b.foo.com</code>). By
+ * default, cookies are only returned to the server that sent them.
+ *
+ * @param pattern
+ * a <code>String</code> containing the domain name within which
+ * this cookie is visible; form is according to RFC 2109
+ * @see #getDomain
+ */
+ public void setDomain(String pattern) {
+ domain = pattern.toLowerCase(Locale.ENGLISH); // IE allegedly needs this
+ }
+
+ /**
+ * Returns the domain name set for this cookie. The form of the domain name
+ * is set by RFC 2109.
+ *
+ * @return a <code>String</code> containing the domain name
+ * @see #setDomain
+ */
+ public String getDomain() {
+ return domain;
+ }
+
+ /**
+ * Sets the maximum age of the cookie in seconds.
+ * <p>
+ * A positive value indicates that the cookie will expire after that many
+ * seconds have passed. Note that the value is the <i>maximum</i> age when
+ * the cookie will expire, not the cookie's current age.
+ * <p>
+ * A negative value means that the cookie is not stored persistently and
+ * will be deleted when the Web browser exits. A zero value causes the
+ * cookie to be deleted.
+ *
+ * @param expiry
+ * an integer specifying the maximum age of the cookie in
+ * seconds; if negative, means the cookie is not stored; if zero,
+ * deletes the cookie
+ * @see #getMaxAge
+ */
+ public void setMaxAge(int expiry) {
+ maxAge = expiry;
+ }
+
+ /**
+ * Returns the maximum age of the cookie, specified in seconds, By default,
+ * <code>-1</code> indicating the cookie will persist until browser
+ * shutdown.
+ *
+ * @return an integer specifying the maximum age of the cookie in seconds; if
+ * negative, means the cookie persists until browser shutdown
+ * @see #setMaxAge
+ */
+ public int getMaxAge() {
+ return maxAge;
+ }
+
+ /**
+ * Specifies a path for the cookie to which the client should return the
+ * cookie.
+ * <p>
+ * The cookie is visible to all the pages in the directory you specify, and
+ * all the pages in that directory's subdirectories. A cookie's path must
+ * include the servlet that set the cookie, for example, <i>/catalog</i>,
+ * which makes the cookie visible to all directories on the server under
+ * <i>/catalog</i>.
+ * <p>
+ * Consult RFC 2109 (available on the Internet) for more information on
+ * setting path names for cookies.
+ *
+ * @param uri
+ * a <code>String</code> specifying a path
+ * @see #getPath
+ */
+ public void setPath(String uri) {
+ path = uri;
+ }
+
+ /**
+ * Returns the path on the server to which the browser returns this cookie.
+ * The cookie is visible to all subpaths on the server.
+ *
+ * @return a <code>String</code> specifying a path that contains a servlet
+ * name, for example, <i>/catalog</i>
+ * @see #setPath
+ */
+ public String getPath() {
+ return path;
+ }
+
+ /**
+ * Indicates to the browser whether the cookie should only be sent using a
+ * secure protocol, such as HTTPS or SSL.
+ * <p>
+ * The default value is <code>false</code>.
+ *
+ * @param flag
+ * if <code>true</code>, sends the cookie from the browser to the
+ * server only when using a secure protocol; if
+ * <code>false</code>, sent on any protocol
+ * @see #getSecure
+ */
+ public void setSecure(boolean flag) {
+ secure = flag;
+ }
+
+ /**
+ * Returns <code>true</code> if the browser is sending cookies only over a
+ * secure protocol, or <code>false</code> if the browser can send cookies
+ * using any protocol.
+ *
+ * @return <code>true</code> if the browser uses a secure protocol;
+ * otherwise, <code>true</code>
+ * @see #setSecure
+ */
+ public boolean getSecure() {
+ return secure;
+ }
+
+ /**
+ * Returns the name of the cookie. The name cannot be changed after
+ * creation.
+ *
+ * @return a <code>String</code> specifying the cookie's name
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Assigns a new value to a cookie after the cookie is created. If you use a
+ * binary value, you may want to use BASE64 encoding.
+ * <p>
+ * With Version 0 cookies, values should not contain white space, brackets,
+ * parentheses, equals signs, commas, double quotes, slashes, question
+ * marks, at signs, colons, and semicolons. Empty values may not behave the
+ * same way on all browsers.
+ *
+ * @param newValue
+ * a <code>String</code> specifying the new value
+ * @see #getValue
+ * @see Cookie
+ */
+ public void setValue(String newValue) {
+ value = newValue;
+ }
+
+ /**
+ * Returns the value of the cookie.
+ *
+ * @return a <code>String</code> containing the cookie's present value
+ * @see #setValue
+ * @see Cookie
+ */
+ public String getValue() {
+ return value;
+ }
+
+ /**
+ * Returns the version of the protocol this cookie complies with. Version 1
+ * complies with RFC 2109, and version 0 complies with the original cookie
+ * specification drafted by Netscape. Cookies provided by a browser use and
+ * identify the browser's cookie version.
+ *
+ * @return 0 if the cookie complies with the original Netscape specification;
+ * 1 if the cookie complies with RFC 2109
+ * @see #setVersion
+ */
+ public int getVersion() {
+ return version;
+ }
+
+ /**
+ * Sets the version of the cookie protocol this cookie complies with.
+ * Version 0 complies with the original Netscape cookie specification.
+ * Version 1 complies with RFC 2109.
+ * <p>
+ * Since RFC 2109 is still somewhat new, consider version 1 as experimental;
+ * do not use it yet on production sites.
+ *
+ * @param v
+ * 0 if the cookie should comply with the original Netscape
+ * specification; 1 if the cookie should comply with RFC 2109
+ * @see #getVersion
+ */
+ public void setVersion(int v) {
+ version = v;
+ }
+
+ // Note -- disabled for now to allow full Netscape compatibility
+ // from RFC 2068, token special case characters
+ //
+ // private static final String tspecials = "()<>@,;:\\\"/[]?={} \t";
+
+ private static final String tspecials = ",; ";
+ private static final String tspecials2NoSlash = "()<>@,;:\\\"[]?={} \t";
+ private static final String tspecials2WithSlash = tspecials2NoSlash + "/";
+ private static final String tspecials2;
+
+ /**
+ * If set to true, we parse cookies strictly according to the servlet,
+ * cookie and HTTP specs by default.
+ */
+ private static final boolean STRICT_SERVLET_COMPLIANCE;
+
+ /**
+ * If set to true, the <code>/</code> character will be treated as a
+ * separator. Default is usually false. If STRICT_SERVLET_COMPLIANCE==true
+ * then default is true. Explicitly setting always takes priority.
+ */
+ private static final boolean FWD_SLASH_IS_SEPARATOR;
+
+ /**
+ * If set to true, enforce the cookie naming rules in the spec that require
+ * no separators in the cookie name. Default is usually false. If
+ * STRICT_SERVLET_COMPLIANCE==true then default is true. Explicitly setting
+ * always takes priority.
+ */
+ private static final boolean STRICT_NAMING;
+
+ static {
+ STRICT_SERVLET_COMPLIANCE = Boolean.valueOf(
+ System.getProperty(
+ "org.apache.catalina.STRICT_SERVLET_COMPLIANCE",
+ "false")).booleanValue();
+
+ String fwdSlashIsSeparator = System.getProperty("org.apache.tomcat.util.http.ServerCookie.FWD_SLASH_IS_SEPARATOR");
+ if (fwdSlashIsSeparator == null) {
+ FWD_SLASH_IS_SEPARATOR = STRICT_SERVLET_COMPLIANCE;
+ } else {
+ FWD_SLASH_IS_SEPARATOR = Boolean.valueOf(fwdSlashIsSeparator).booleanValue();
+ }
+
+ if (FWD_SLASH_IS_SEPARATOR) {
+ tspecials2 = tspecials2WithSlash;
+ } else {
+ tspecials2 = tspecials2NoSlash;
+ }
+
+ String strictNaming = System.getProperty("org.apache.tomcat.util.http.ServerCookie.STRICT_NAMING");
+ if (strictNaming == null) {
+ STRICT_NAMING = STRICT_SERVLET_COMPLIANCE;
+ } else {
+ STRICT_NAMING = Boolean.valueOf(strictNaming).booleanValue();
+ }
+
+ }
+
+ /*
+ * Tests a string and returns true if the string counts as a reserved token
+ * in the Java language.
+ * @param value the <code>String</code> to be tested
+ * @return <code>true</code> if the <code>String</code> is a reserved token;
+ * <code>false</code> if it is not
+ */
+ private boolean isToken(String possibleToken) {
+ int len = possibleToken.length();
+
+ for (int i = 0; i < len; i++) {
+ char c = possibleToken.charAt(i);
+
+ if (c < 0x20 || c >= 0x7f || tspecials.indexOf(c) != -1 ||
+ (STRICT_NAMING && tspecials2.indexOf(c) != -1)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * Overrides the standard <code>java.lang.Object.clone</code> method to
+ * return a copy of this cookie.
+ */
+ @Override
+ public Object clone() {
+ try {
+ return super.clone();
+ } catch (CloneNotSupportedException e) {
+ throw new RuntimeException(e.getMessage());
+ }
+ }
+
+ /**
+ * @return TODO
+ * @since Servlet 3.0 TODO SERVLET3 - Add comments
+ */
+ public boolean isHttpOnly() {
+ return httpOnly;
+ }
+
+ /**
+ * @param httpOnly
+ * @since Servlet 3.0 TODO SERVLET3 - Add comments
+ */
+ public void setHttpOnly(boolean httpOnly) {
+ this.httpOnly = httpOnly;
+ }
+}
diff --git a/bundles/org.apache.tomcat/src/javax/servlet/http/HttpServlet.java b/bundles/org.apache.tomcat/src/javax/servlet/http/HttpServlet.java
new file mode 100644
index 0000000..92ea07d
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/javax/servlet/http/HttpServlet.java
@@ -0,0 +1,822 @@
+/*
+ * 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 javax.servlet.http;
+
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+import java.io.UnsupportedEncodingException;
+import java.lang.reflect.Method;
+import java.text.MessageFormat;
+import java.util.Enumeration;
+import java.util.ResourceBundle;
+
+import javax.servlet.GenericServlet;
+import javax.servlet.ServletException;
+import javax.servlet.ServletOutputStream;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+
+
+/**
+ * Provides an abstract class to be subclassed to create
+ * an HTTP servlet suitable for a Web site. A subclass of
+ * <code>HttpServlet</code> must override at least
+ * one method, usually one of these:
+ *
+ * <ul>
+ * <li> <code>doGet</code>, if the servlet supports HTTP GET requests
+ * <li> <code>doPost</code>, for HTTP POST requests
+ * <li> <code>doPut</code>, for HTTP PUT requests
+ * <li> <code>doDelete</code>, for HTTP DELETE requests
+ * <li> <code>init</code> and <code>destroy</code>,
+ * to manage resources that are held for the life of the servlet
+ * <li> <code>getServletInfo</code>, which the servlet uses to
+ * provide information about itself
+ * </ul>
+ *
+ * <p>There's almost no reason to override the <code>service</code>
+ * method. <code>service</code> handles standard HTTP
+ * requests by dispatching them to the handler methods
+ * for each HTTP request type (the <code>do</code><i>XXX</i>
+ * methods listed above).
+ *
+ * <p>Likewise, there's almost no reason to override the
+ * <code>doOptions</code> and <code>doTrace</code> methods.
+ *
+ * <p>Servlets typically run on multithreaded servers,
+ * so be aware that a servlet must handle concurrent
+ * requests and be careful to synchronize access to shared resources.
+ * Shared resources include in-memory data such as
+ * instance or class variables and external objects
+ * such as files, database connections, and network
+ * connections.
+ * See the
+ * <a href="http://java.sun.com/Series/Tutorial/java/threads/multithreaded.html">
+ * Java Tutorial on Multithreaded Programming</a> for more
+ * information on handling multiple threads in a Java program.
+ *
+ * @author Various
+ * @version $Version$
+ */
+public abstract class HttpServlet extends GenericServlet {
+
+ private static final long serialVersionUID = 1L;
+
+ private static final String METHOD_DELETE = "DELETE";
+ private static final String METHOD_HEAD = "HEAD";
+ private static final String METHOD_GET = "GET";
+ private static final String METHOD_OPTIONS = "OPTIONS";
+ private static final String METHOD_POST = "POST";
+ private static final String METHOD_PUT = "PUT";
+ private static final String METHOD_TRACE = "TRACE";
+
+ private static final String HEADER_IFMODSINCE = "If-Modified-Since";
+ private static final String HEADER_LASTMOD = "Last-Modified";
+
+ private static final String LSTRING_FILE =
+ "javax.servlet.http.LocalStrings";
+ private static ResourceBundle lStrings =
+ ResourceBundle.getBundle(LSTRING_FILE);
+
+
+ /**
+ * Does nothing, because this is an abstract class.
+ */
+ public HttpServlet() {
+ // NOOP
+ }
+
+
+ /**
+ * Called by the server (via the <code>service</code> method) to
+ * allow a servlet to handle a GET request.
+ *
+ * <p>Overriding this method to support a GET request also
+ * automatically supports an HTTP HEAD request. A HEAD
+ * request is a GET request that returns no body in the
+ * response, only the request header fields.
+ *
+ * <p>When overriding this method, read the request data,
+ * write the response headers, get the response's writer or
+ * output stream object, and finally, write the response data.
+ * It's best to include content type and encoding. When using
+ * a <code>PrintWriter</code> object to return the response,
+ * set the content type before accessing the
+ * <code>PrintWriter</code> object.
+ *
+ * <p>The servlet container must write the headers before
+ * committing the response, because in HTTP the headers must be sent
+ * before the response body.
+ *
+ * <p>Where possible, set the Content-Length header (with the
+ * {@link javax.servlet.ServletResponse#setContentLength} method),
+ * to allow the servlet container to use a persistent connection
+ * to return its response to the client, improving performance.
+ * The content length is automatically set if the entire response fits
+ * inside the response buffer.
+ *
+ * <p>When using HTTP 1.1 chunked encoding (which means that the response
+ * has a Transfer-Encoding header), do not set the Content-Length header.
+ *
+ * <p>The GET method should be safe, that is, without
+ * any side effects for which users are held responsible.
+ * For example, most form queries have no side effects.
+ * If a client request is intended to change stored data,
+ * the request should use some other HTTP method.
+ *
+ * <p>The GET method should also be idempotent, meaning
+ * that it can be safely repeated. Sometimes making a
+ * method safe also makes it idempotent. For example,
+ * repeating queries is both safe and idempotent, but
+ * buying a product online or modifying data is neither
+ * safe nor idempotent.
+ *
+ * <p>If the request is incorrectly formatted, <code>doGet</code>
+ * returns an HTTP "Bad Request" message.
+ *
+ * @param req an {@link HttpServletRequest} object that
+ * contains the request the client has made
+ * of the servlet
+ *
+ * @param resp an {@link HttpServletResponse} object that
+ * contains the response the servlet sends
+ * to the client
+ *
+ * @exception IOException if an input or output error is
+ * detected when the servlet handles
+ * the GET request
+ *
+ * @exception ServletException if the request for the GET
+ * could not be handled
+ *
+ * @see javax.servlet.ServletResponse#setContentType
+ */
+ protected void doGet(HttpServletRequest req, HttpServletResponse resp)
+ throws ServletException, IOException
+ {
+ String protocol = req.getProtocol();
+ String msg = lStrings.getString("http.method_get_not_supported");
+ if (protocol.endsWith("1.1")) {
+ resp.sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED, msg);
+ } else {
+ resp.sendError(HttpServletResponse.SC_BAD_REQUEST, msg);
+ }
+ }
+
+
+ /**
+ * Returns the time the <code>HttpServletRequest</code>
+ * object was last modified,
+ * in milliseconds since midnight January 1, 1970 GMT.
+ * If the time is unknown, this method returns a negative
+ * number (the default).
+ *
+ * <p>Servlets that support HTTP GET requests and can quickly determine
+ * their last modification time should override this method.
+ * This makes browser and proxy caches work more effectively,
+ * reducing the load on server and network resources.
+ *
+ * @param req the <code>HttpServletRequest</code>
+ * object that is sent to the servlet
+ *
+ * @return a <code>long</code> integer specifying
+ * the time the <code>HttpServletRequest</code>
+ * object was last modified, in milliseconds
+ * since midnight, January 1, 1970 GMT, or
+ * -1 if the time is not known
+ */
+ protected long getLastModified(HttpServletRequest req) {
+ return -1;
+ }
+
+
+ /**
+ * <p>Receives an HTTP HEAD request from the protected
+ * <code>service</code> method and handles the
+ * request.
+ * The client sends a HEAD request when it wants
+ * to see only the headers of a response, such as
+ * Content-Type or Content-Length. The HTTP HEAD
+ * method counts the output bytes in the response
+ * to set the Content-Length header accurately.
+ *
+ * <p>If you override this method, you can avoid computing
+ * the response body and just set the response headers
+ * directly to improve performance. Make sure that the
+ * <code>doHead</code> method you write is both safe
+ * and idempotent (that is, protects itself from being
+ * called multiple times for one HTTP HEAD request).
+ *
+ * <p>If the HTTP HEAD request is incorrectly formatted,
+ * <code>doHead</code> returns an HTTP "Bad Request"
+ * message.
+ *
+ * @param req the request object that is passed to the servlet
+ *
+ * @param resp the response object that the servlet
+ * uses to return the headers to the client
+ *
+ * @exception IOException if an input or output error occurs
+ *
+ * @exception ServletException if the request for the HEAD
+ * could not be handled
+ */
+ protected void doHead(HttpServletRequest req, HttpServletResponse resp)
+ throws ServletException, IOException {
+
+ NoBodyResponse response = new NoBodyResponse(resp);
+
+ doGet(req, response);
+ response.setContentLength();
+ }
+
+
+ /**
+ * Called by the server (via the <code>service</code> method)
+ * to allow a servlet to handle a POST request.
+ *
+ * The HTTP POST method allows the client to send
+ * data of unlimited length to the Web server a single time
+ * and is useful when posting information such as
+ * credit card numbers.
+ *
+ * <p>When overriding this method, read the request data,
+ * write the response headers, get the response's writer or output
+ * stream object, and finally, write the response data. It's best
+ * to include content type and encoding. When using a
+ * <code>PrintWriter</code> object to return the response, set the
+ * content type before accessing the <code>PrintWriter</code> object.
+ *
+ * <p>The servlet container must write the headers before committing the
+ * response, because in HTTP the headers must be sent before the
+ * response body.
+ *
+ * <p>Where possible, set the Content-Length header (with the
+ * {@link javax.servlet.ServletResponse#setContentLength} method),
+ * to allow the servlet container to use a persistent connection
+ * to return its response to the client, improving performance.
+ * The content length is automatically set if the entire response fits
+ * inside the response buffer.
+ *
+ * <p>When using HTTP 1.1 chunked encoding (which means that the response
+ * has a Transfer-Encoding header), do not set the Content-Length header.
+ *
+ * <p>This method does not need to be either safe or idempotent.
+ * Operations requested through POST can have side effects for
+ * which the user can be held accountable, for example,
+ * updating stored data or buying items online.
+ *
+ * <p>If the HTTP POST request is incorrectly formatted,
+ * <code>doPost</code> returns an HTTP "Bad Request" message.
+ *
+ *
+ * @param req an {@link HttpServletRequest} object that
+ * contains the request the client has made
+ * of the servlet
+ *
+ * @param resp an {@link HttpServletResponse} object that
+ * contains the response the servlet sends
+ * to the client
+ *
+ * @exception IOException if an input or output error is
+ * detected when the servlet handles
+ * the request
+ *
+ * @exception ServletException if the request for the POST
+ * could not be handled
+ *
+ * @see javax.servlet.ServletOutputStream
+ * @see javax.servlet.ServletResponse#setContentType
+ */
+ protected void doPost(HttpServletRequest req, HttpServletResponse resp)
+ throws ServletException, IOException {
+
+ String protocol = req.getProtocol();
+ String msg = lStrings.getString("http.method_post_not_supported");
+ if (protocol.endsWith("1.1")) {
+ resp.sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED, msg);
+ } else {
+ resp.sendError(HttpServletResponse.SC_BAD_REQUEST, msg);
+ }
+ }
+
+
+ /**
+ * Called by the server (via the <code>service</code> method)
+ * to allow a servlet to handle a PUT request.
+ *
+ * The PUT operation allows a client to
+ * place a file on the server and is similar to
+ * sending a file by FTP.
+ *
+ * <p>When overriding this method, leave intact
+ * any content headers sent with the request (including
+ * Content-Length, Content-Type, Content-Transfer-Encoding,
+ * Content-Encoding, Content-Base, Content-Language, Content-Location,
+ * Content-MD5, and Content-Range). If your method cannot
+ * handle a content header, it must issue an error message
+ * (HTTP 501 - Not Implemented) and discard the request.
+ * For more information on HTTP 1.1, see RFC 2616
+ * <a href="http://www.ietf.org/rfc/rfc2616.txt"></a>.
+ *
+ * <p>This method does not need to be either safe or idempotent.
+ * Operations that <code>doPut</code> performs can have side
+ * effects for which the user can be held accountable. When using
+ * this method, it may be useful to save a copy of the
+ * affected URL in temporary storage.
+ *
+ * <p>If the HTTP PUT request is incorrectly formatted,
+ * <code>doPut</code> returns an HTTP "Bad Request" message.
+ *
+ * @param req the {@link HttpServletRequest} object that
+ * contains the request the client made of
+ * the servlet
+ *
+ * @param resp the {@link HttpServletResponse} object that
+ * contains the response the servlet returns
+ * to the client
+ *
+ * @exception IOException if an input or output error occurs
+ * while the servlet is handling the
+ * PUT request
+ *
+ * @exception ServletException if the request for the PUT
+ * cannot be handled
+ */
+ protected void doPut(HttpServletRequest req, HttpServletResponse resp)
+ throws ServletException, IOException {
+
+ String protocol = req.getProtocol();
+ String msg = lStrings.getString("http.method_put_not_supported");
+ if (protocol.endsWith("1.1")) {
+ resp.sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED, msg);
+ } else {
+ resp.sendError(HttpServletResponse.SC_BAD_REQUEST, msg);
+ }
+ }
+
+
+ /**
+ * Called by the server (via the <code>service</code> method)
+ * to allow a servlet to handle a DELETE request.
+ *
+ * The DELETE operation allows a client to remove a document
+ * or Web page from the server.
+ *
+ * <p>This method does not need to be either safe
+ * or idempotent. Operations requested through
+ * DELETE can have side effects for which users
+ * can be held accountable. When using
+ * this method, it may be useful to save a copy of the
+ * affected URL in temporary storage.
+ *
+ * <p>If the HTTP DELETE request is incorrectly formatted,
+ * <code>doDelete</code> returns an HTTP "Bad Request"
+ * message.
+ *
+ * @param req the {@link HttpServletRequest} object that
+ * contains the request the client made of
+ * the servlet
+ *
+ *
+ * @param resp the {@link HttpServletResponse} object that
+ * contains the response the servlet returns
+ * to the client
+ *
+ * @exception IOException if an input or output error occurs
+ * while the servlet is handling the
+ * DELETE request
+ *
+ * @exception ServletException if the request for the
+ * DELETE cannot be handled
+ */
+ protected void doDelete(HttpServletRequest req,
+ HttpServletResponse resp)
+ throws ServletException, IOException {
+
+ String protocol = req.getProtocol();
+ String msg = lStrings.getString("http.method_delete_not_supported");
+ if (protocol.endsWith("1.1")) {
+ resp.sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED, msg);
+ } else {
+ resp.sendError(HttpServletResponse.SC_BAD_REQUEST, msg);
+ }
+ }
+
+
+ private static Method[] getAllDeclaredMethods(Class<?> c) {
+
+ if (c.equals(javax.servlet.http.HttpServlet.class)) {
+ return null;
+ }
+
+ Method[] parentMethods = getAllDeclaredMethods(c.getSuperclass());
+ Method[] thisMethods = c.getDeclaredMethods();
+
+ if ((parentMethods != null) && (parentMethods.length > 0)) {
+ Method[] allMethods =
+ new Method[parentMethods.length + thisMethods.length];
+ System.arraycopy(parentMethods, 0, allMethods, 0,
+ parentMethods.length);
+ System.arraycopy(thisMethods, 0, allMethods, parentMethods.length,
+ thisMethods.length);
+
+ thisMethods = allMethods;
+ }
+
+ return thisMethods;
+ }
+
+
+ /**
+ * Called by the server (via the <code>service</code> method)
+ * to allow a servlet to handle a OPTIONS request.
+ *
+ * The OPTIONS request determines which HTTP methods
+ * the server supports and
+ * returns an appropriate header. For example, if a servlet
+ * overrides <code>doGet</code>, this method returns the
+ * following header:
+ *
+ * <p><code>Allow: GET, HEAD, TRACE, OPTIONS</code>
+ *
+ * <p>There's no need to override this method unless the
+ * servlet implements new HTTP methods, beyond those
+ * implemented by HTTP 1.1.
+ *
+ * @param req the {@link HttpServletRequest} object that
+ * contains the request the client made of
+ * the servlet
+ *
+ * @param resp the {@link HttpServletResponse} object that
+ * contains the response the servlet returns
+ * to the client
+ *
+ * @exception IOException if an input or output error occurs
+ * while the servlet is handling the
+ * OPTIONS request
+ *
+ * @exception ServletException if the request for the
+ * OPTIONS cannot be handled
+ */
+ protected void doOptions(HttpServletRequest req,
+ HttpServletResponse resp)
+ throws ServletException, IOException {
+
+ Method[] methods = getAllDeclaredMethods(this.getClass());
+
+ boolean ALLOW_GET = false;
+ boolean ALLOW_HEAD = false;
+ boolean ALLOW_POST = false;
+ boolean ALLOW_PUT = false;
+ boolean ALLOW_DELETE = false;
+ boolean ALLOW_TRACE = true;
+ boolean ALLOW_OPTIONS = true;
+
+ for (int i=0; i<methods.length; i++) {
+ Method m = methods[i];
+
+ if (m.getName().equals("doGet")) {
+ ALLOW_GET = true;
+ ALLOW_HEAD = true;
+ }
+ if (m.getName().equals("doPost"))
+ ALLOW_POST = true;
+ if (m.getName().equals("doPut"))
+ ALLOW_PUT = true;
+ if (m.getName().equals("doDelete"))
+ ALLOW_DELETE = true;
+ }
+
+ String allow = null;
+ if (ALLOW_GET)
+ allow=METHOD_GET;
+ if (ALLOW_HEAD)
+ if (allow==null) allow=METHOD_HEAD;
+ else allow += ", " + METHOD_HEAD;
+ if (ALLOW_POST)
+ if (allow==null) allow=METHOD_POST;
+ else allow += ", " + METHOD_POST;
+ if (ALLOW_PUT)
+ if (allow==null) allow=METHOD_PUT;
+ else allow += ", " + METHOD_PUT;
+ if (ALLOW_DELETE)
+ if (allow==null) allow=METHOD_DELETE;
+ else allow += ", " + METHOD_DELETE;
+ if (ALLOW_TRACE)
+ if (allow==null) allow=METHOD_TRACE;
+ else allow += ", " + METHOD_TRACE;
+ if (ALLOW_OPTIONS)
+ if (allow==null) allow=METHOD_OPTIONS;
+ else allow += ", " + METHOD_OPTIONS;
+
+ resp.setHeader("Allow", allow);
+ }
+
+
+ /**
+ * Called by the server (via the <code>service</code> method)
+ * to allow a servlet to handle a TRACE request.
+ *
+ * A TRACE returns the headers sent with the TRACE
+ * request to the client, so that they can be used in
+ * debugging. There's no need to override this method.
+ *
+ * @param req the {@link HttpServletRequest} object that
+ * contains the request the client made of
+ * the servlet
+ *
+ * @param resp the {@link HttpServletResponse} object that
+ * contains the response the servlet returns
+ * to the client
+ *
+ * @exception IOException if an input or output error occurs
+ * while the servlet is handling the
+ * TRACE request
+ *
+ * @exception ServletException if the request for the
+ * TRACE cannot be handled
+ */
+ protected void doTrace(HttpServletRequest req, HttpServletResponse resp)
+ throws ServletException, IOException
+ {
+
+ int responseLength;
+
+ String CRLF = "\r\n";
+ StringBuilder buffer = new StringBuilder("TRACE ").append(req.getRequestURI())
+ .append(" ").append(req.getProtocol());
+
+ Enumeration<String> reqHeaderEnum = req.getHeaderNames();
+
+ while( reqHeaderEnum.hasMoreElements() ) {
+ String headerName = reqHeaderEnum.nextElement();
+ buffer.append(CRLF).append(headerName).append(": ")
+ .append(req.getHeader(headerName));
+ }
+
+ buffer.append(CRLF);
+
+ responseLength = buffer.length();
+
+ resp.setContentType("message/http");
+ resp.setContentLength(responseLength);
+ ServletOutputStream out = resp.getOutputStream();
+ out.print(buffer.toString());
+ out.close();
+ return;
+ }
+
+
+ /**
+ * Receives standard HTTP requests from the public
+ * <code>service</code> method and dispatches
+ * them to the <code>do</code><i>XXX</i> methods defined in
+ * this class. This method is an HTTP-specific version of the
+ * {@link javax.servlet.Servlet#service} method. There's no
+ * need to override this method.
+ *
+ * @param req the {@link HttpServletRequest} object that
+ * contains the request the client made of
+ * the servlet
+ *
+ * @param resp the {@link HttpServletResponse} object that
+ * contains the response the servlet returns
+ * to the client
+ *
+ * @exception IOException if an input or output error occurs
+ * while the servlet is handling the
+ * HTTP request
+ *
+ * @exception ServletException if the HTTP request
+ * cannot be handled
+ *
+ * @see javax.servlet.Servlet#service
+ */
+ protected void service(HttpServletRequest req, HttpServletResponse resp)
+ throws ServletException, IOException {
+
+ String method = req.getMethod();
+
+ if (method.equals(METHOD_GET)) {
+ long lastModified = getLastModified(req);
+ if (lastModified == -1) {
+ // servlet doesn't support if-modified-since, no reason
+ // to go through further expensive logic
+ doGet(req, resp);
+ } else {
+ long ifModifiedSince = req.getDateHeader(HEADER_IFMODSINCE);
+ if (ifModifiedSince < (lastModified / 1000 * 1000)) {
+ // If the servlet mod time is later, call doGet()
+ // Round down to the nearest second for a proper compare
+ // A ifModifiedSince of -1 will always be less
+ maybeSetLastModified(resp, lastModified);
+ doGet(req, resp);
+ } else {
+ resp.setStatus(HttpServletResponse.SC_NOT_MODIFIED);
+ }
+ }
+
+ } else if (method.equals(METHOD_HEAD)) {
+ long lastModified = getLastModified(req);
+ maybeSetLastModified(resp, lastModified);
+ doHead(req, resp);
+
+ } else if (method.equals(METHOD_POST)) {
+ doPost(req, resp);
+
+ } else if (method.equals(METHOD_PUT)) {
+ doPut(req, resp);
+
+ } else if (method.equals(METHOD_DELETE)) {
+ doDelete(req, resp);
+
+ } else if (method.equals(METHOD_OPTIONS)) {
+ doOptions(req,resp);
+
+ } else if (method.equals(METHOD_TRACE)) {
+ doTrace(req,resp);
+
+ } else {
+ //
+ // Note that this means NO servlet supports whatever
+ // method was requested, anywhere on this server.
+ //
+
+ String errMsg = lStrings.getString("http.method_not_implemented");
+ Object[] errArgs = new Object[1];
+ errArgs[0] = method;
+ errMsg = MessageFormat.format(errMsg, errArgs);
+
+ resp.sendError(HttpServletResponse.SC_NOT_IMPLEMENTED, errMsg);
+ }
+ }
+
+
+ /*
+ * Sets the Last-Modified entity header field, if it has not
+ * already been set and if the value is meaningful. Called before
+ * doGet, to ensure that headers are set before response data is
+ * written. A subclass might have set this header already, so we
+ * check.
+ */
+ private void maybeSetLastModified(HttpServletResponse resp,
+ long lastModified) {
+ if (resp.containsHeader(HEADER_LASTMOD))
+ return;
+ if (lastModified >= 0)
+ resp.setDateHeader(HEADER_LASTMOD, lastModified);
+ }
+
+
+ /**
+ * Dispatches client requests to the protected
+ * <code>service</code> method. There's no need to
+ * override this method.
+ *
+ * @param req the {@link HttpServletRequest} object that
+ * contains the request the client made of
+ * the servlet
+ *
+ * @param res the {@link HttpServletResponse} object that
+ * contains the response the servlet returns
+ * to the client
+ *
+ * @exception IOException if an input or output error occurs
+ * while the servlet is handling the
+ * HTTP request
+ *
+ * @exception ServletException if the HTTP request cannot
+ * be handled
+ *
+ * @see javax.servlet.Servlet#service
+ */
+ @Override
+ public void service(ServletRequest req, ServletResponse res)
+ throws ServletException, IOException {
+
+ HttpServletRequest request;
+ HttpServletResponse response;
+
+ try {
+ request = (HttpServletRequest) req;
+ response = (HttpServletResponse) res;
+ } catch (ClassCastException e) {
+ throw new ServletException("non-HTTP request or response");
+ }
+ service(request, response);
+ }
+}
+
+
+/*
+ * A response wrapper for use in (dumb) "HEAD" support.
+ * This just swallows that body, counting the bytes in order to set
+ * the content length appropriately. All other methods delegate to the
+ * wrapped HTTP Servlet Response object.
+ */
+// file private
+class NoBodyResponse extends HttpServletResponseWrapper {
+ private NoBodyOutputStream noBody;
+ private PrintWriter writer;
+ private boolean didSetContentLength;
+
+ // file private
+ NoBodyResponse(HttpServletResponse r) {
+ super(r);
+ noBody = new NoBodyOutputStream();
+ }
+
+ // file private
+ void setContentLength() {
+ if (!didSetContentLength)
+ super.setContentLength(noBody.getContentLength());
+ }
+
+
+ // SERVLET RESPONSE interface methods
+
+ @Override
+ public void setContentLength(int len) {
+ super.setContentLength(len);
+ didSetContentLength = true;
+ }
+
+ @Override
+ public ServletOutputStream getOutputStream() throws IOException {
+ return noBody;
+ }
+
+ @Override
+ public PrintWriter getWriter() throws UnsupportedEncodingException {
+
+ if (writer == null) {
+ OutputStreamWriter w;
+
+ w = new OutputStreamWriter(noBody, getCharacterEncoding());
+ writer = new PrintWriter(w);
+ }
+ return writer;
+ }
+}
+
+
+/*
+ * Servlet output stream that gobbles up all its data.
+ */
+
+// file private
+class NoBodyOutputStream extends ServletOutputStream {
+
+ private static final String LSTRING_FILE =
+ "javax.servlet.http.LocalStrings";
+ private static ResourceBundle lStrings =
+ ResourceBundle.getBundle(LSTRING_FILE);
+
+ private int contentLength = 0;
+
+ // file private
+ NoBodyOutputStream() {
+ // NOOP
+ }
+
+ // file private
+ int getContentLength() {
+ return contentLength;
+ }
+
+ @Override
+ public void write(int b) {
+ contentLength++;
+ }
+
+ @Override
+ public void write(byte buf[], int offset, int len)
+ throws IOException
+ {
+ if (len >= 0) {
+ contentLength += len;
+ } else {
+ // XXX
+ // isn't this really an IllegalArgumentException?
+
+ String msg = lStrings.getString("err.io.negativelength");
+ throw new IOException(msg);
+ }
+ }
+}
diff --git a/bundles/org.apache.tomcat/src/javax/servlet/http/HttpServletRequest.java b/bundles/org.apache.tomcat/src/javax/servlet/http/HttpServletRequest.java
new file mode 100644
index 0000000..b1b0a72
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/javax/servlet/http/HttpServletRequest.java
@@ -0,0 +1,486 @@
+/*
+ * 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 javax.servlet.http;
+
+import java.io.IOException;
+import java.util.Collection;
+import java.util.Enumeration;
+
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+
+/**
+ * Extends the {@link javax.servlet.ServletRequest} interface to provide request
+ * information for HTTP servlets.
+ * <p>
+ * The servlet container creates an <code>HttpServletRequest</code> object and
+ * passes it as an argument to the servlet's service methods (<code>doGet</code>, <code>doPost</code>, etc).
+ *
+ * @author Various
+ * @version $Version$
+ */
+public interface HttpServletRequest extends ServletRequest {
+
+ /**
+ * String identifier for Basic authentication. Value "BASIC"
+ */
+ public static final String BASIC_AUTH = "BASIC";
+ /**
+ * String identifier for Form authentication. Value "FORM"
+ */
+ public static final String FORM_AUTH = "FORM";
+ /**
+ * String identifier for Client Certificate authentication. Value
+ * "CLIENT_CERT"
+ */
+ public static final String CLIENT_CERT_AUTH = "CLIENT_CERT";
+ /**
+ * String identifier for Digest authentication. Value "DIGEST"
+ */
+ public static final String DIGEST_AUTH = "DIGEST";
+
+ /**
+ * Returns the name of the authentication scheme used to protect the
+ * servlet. All servlet containers support basic, form and client
+ * certificate authentication, and may additionally support digest
+ * authentication. If the servlet is not authenticated <code>null</code> is
+ * returned.
+ * <p>
+ * Same as the value of the CGI variable AUTH_TYPE.
+ *
+ * @return one of the static members BASIC_AUTH, FORM_AUTH, CLIENT_CERT_AUTH,
+ * DIGEST_AUTH (suitable for == comparison) or the
+ * container-specific string indicating the authentication scheme,
+ * or <code>null</code> if the request was not authenticated.
+ */
+ public String getAuthType();
+
+ /**
+ * Returns an array containing all of the <code>Cookie</code> objects the
+ * client sent with this request. This method returns <code>null</code> if
+ * no cookies were sent.
+ *
+ * @return an array of all the <code>Cookies</code> included with this
+ * request, or <code>null</code> if the request has no cookies
+ */
+ public Cookie[] getCookies();
+
+ /**
+ * Returns the value of the specified request header as a <code>long</code>
+ * value that represents a <code>Date</code> object. Use this method with
+ * headers that contain dates, such as <code>If-Modified-Since</code>.
+ * <p>
+ * The date is returned as the number of milliseconds since January 1, 1970
+ * GMT. The header name is case insensitive.
+ * <p>
+ * If the request did not have a header of the specified name, this method
+ * returns -1. If the header can't be converted to a date, the method throws
+ * an <code>IllegalArgumentException</code>.
+ *
+ * @param name
+ * a <code>String</code> specifying the name of the header
+ * @return a <code>long</code> value representing the date specified in the
+ * header expressed as the number of milliseconds since January 1,
+ * 1970 GMT, or -1 if the named header was not included with the
+ * request
+ * @exception IllegalArgumentException
+ * If the header value can't be converted to a date
+ */
+ public long getDateHeader(String name);
+
+ /**
+ * Returns the value of the specified request header as a
+ * <code>String</code>. If the request did not include a header of the
+ * specified name, this method returns <code>null</code>. If there are
+ * multiple headers with the same name, this method returns the first head
+ * in the request. The header name is case insensitive. You can use this
+ * method with any request header.
+ *
+ * @param name
+ * a <code>String</code> specifying the header name
+ * @return a <code>String</code> containing the value of the requested
+ * header, or <code>null</code> if the request does not have a
+ * header of that name
+ */
+ public String getHeader(String name);
+
+ /**
+ * Returns all the values of the specified request header as an
+ * <code>Enumeration</code> of <code>String</code> objects.
+ * <p>
+ * Some headers, such as <code>Accept-Language</code> can be sent by clients
+ * as several headers each with a different value rather than sending the
+ * header as a comma separated list.
+ * <p>
+ * If the request did not include any headers of the specified name, this
+ * method returns an empty <code>Enumeration</code>. The header name is case
+ * insensitive. You can use this method with any request header.
+ *
+ * @param name
+ * a <code>String</code> specifying the header name
+ * @return an <code>Enumeration</code> containing the values of the requested
+ * header. If the request does not have any headers of that name
+ * return an empty enumeration. If the container does not allow
+ * access to header information, return null
+ */
+ public Enumeration<String> getHeaders(String name);
+
+ /**
+ * Returns an enumeration of all the header names this request contains. If
+ * the request has no headers, this method returns an empty enumeration.
+ * <p>
+ * Some servlet containers do not allow servlets to access headers using
+ * this method, in which case this method returns <code>null</code>
+ *
+ * @return an enumeration of all the header names sent with this request; if
+ * the request has no headers, an empty enumeration; if the servlet
+ * container does not allow servlets to use this method,
+ * <code>null</code>
+ */
+ public Enumeration<String> getHeaderNames();
+
+ /**
+ * Returns the value of the specified request header as an <code>int</code>.
+ * If the request does not have a header of the specified name, this method
+ * returns -1. If the header cannot be converted to an integer, this method
+ * throws a <code>NumberFormatException</code>.
+ * <p>
+ * The header name is case insensitive.
+ *
+ * @param name
+ * a <code>String</code> specifying the name of a request header
+ * @return an integer expressing the value of the request header or -1 if the
+ * request doesn't have a header of this name
+ * @exception NumberFormatException
+ * If the header value can't be converted to an
+ * <code>int</code>
+ */
+ public int getIntHeader(String name);
+
+ /**
+ * Returns the name of the HTTP method with which this request was made, for
+ * example, GET, POST, or PUT. Same as the value of the CGI variable
+ * REQUEST_METHOD.
+ *
+ * @return a <code>String</code> specifying the name of the method with
+ * which this request was made
+ */
+ public String getMethod();
+
+ /**
+ * Returns any extra path information associated with the URL the client
+ * sent when it made this request. The extra path information follows the
+ * servlet path but precedes the query string and will start with a "/"
+ * character.
+ * <p>
+ * This method returns <code>null</code> if there was no extra path
+ * information.
+ * <p>
+ * Same as the value of the CGI variable PATH_INFO.
+ *
+ * @return a <code>String</code>, decoded by the web container, specifying
+ * extra path information that comes after the servlet path but
+ * before the query string in the request URL; or <code>null</code>
+ * if the URL does not have any extra path information
+ */
+ public String getPathInfo();
+
+ /**
+ * Returns any extra path information after the servlet name but before the
+ * query string, and translates it to a real path. Same as the value of the
+ * CGI variable PATH_TRANSLATED.
+ * <p>
+ * If the URL does not have any extra path information, this method returns
+ * <code>null</code> or the servlet container cannot translate the virtual
+ * path to a real path for any reason (such as when the web application is
+ * executed from an archive). The web container does not decode this string.
+ *
+ * @return a <code>String</code> specifying the real path, or
+ * <code>null</code> if the URL does not have any extra path
+ * information
+ */
+ public String getPathTranslated();
+
+ /**
+ * Returns the portion of the request URI that indicates the context of the
+ * request. The context path always comes first in a request URI. The path
+ * starts with a "/" character but does not end with a "/" character. For
+ * servlets in the default (root) context, this method returns "". The
+ * container does not decode this string.
+ *
+ * @return a <code>String</code> specifying the portion of the request URI
+ * that indicates the context of the request
+ */
+ public String getContextPath();
+
+ /**
+ * Returns the query string that is contained in the request URL after the
+ * path. This method returns <code>null</code> if the URL does not have a
+ * query string. Same as the value of the CGI variable QUERY_STRING.
+ *
+ * @return a <code>String</code> containing the query string or
+ * <code>null</code> if the URL contains no query string. The value
+ * is not decoded by the container.
+ */
+ public String getQueryString();
+
+ /**
+ * Returns the login of the user making this request, if the user has been
+ * authenticated, or <code>null</code> if the user has not been
+ * authenticated. Whether the user name is sent with each subsequent request
+ * depends on the browser and type of authentication. Same as the value of
+ * the CGI variable REMOTE_USER.
+ *
+ * @return a <code>String</code> specifying the login of the user making
+ * this request, or <code>null</code> if the user login is not known
+ */
+ public String getRemoteUser();
+
+ /**
+ * Returns a boolean indicating whether the authenticated user is included
+ * in the specified logical "role". Roles and role membership can be defined
+ * using deployment descriptors. If the user has not been authenticated, the
+ * method returns <code>false</code>.
+ *
+ * @param role
+ * a <code>String</code> specifying the name of the role
+ * @return a <code>boolean</code> indicating whether the user making this
+ * request belongs to a given role; <code>false</code> if the user
+ * has not been authenticated
+ */
+ public boolean isUserInRole(String role);
+
+ /**
+ * Returns a <code>java.security.Principal</code> object containing the name
+ * of the current authenticated user. If the user has not been
+ * authenticated, the method returns <code>null</code>.
+ *
+ * @return a <code>java.security.Principal</code> containing the name of the
+ * user making this request; <code>null</code> if the user has not
+ * been authenticated
+ */
+ public java.security.Principal getUserPrincipal();
+
+ /**
+ * Returns the session ID specified by the client. This may not be the same
+ * as the ID of the current valid session for this request. If the client
+ * did not specify a session ID, this method returns <code>null</code>.
+ *
+ * @return a <code>String</code> specifying the session ID, or
+ * <code>null</code> if the request did not specify a session ID
+ * @see #isRequestedSessionIdValid
+ */
+ public String getRequestedSessionId();
+
+ /**
+ * Returns the part of this request's URL from the protocol name up to the
+ * query string in the first line of the HTTP request. The web container
+ * does not decode this String. For example:
+ * <table summary="Examples of Returned Values">
+ * <tr align=left>
+ * <th>First line of HTTP request</th>
+ * <th>Returned Value</th>
+ * <tr>
+ * <td>POST /some/path.html HTTP/1.1
+ * <td>
+ * <td>/some/path.html
+ * <tr>
+ * <td>GET http://foo.bar/a.html HTTP/1.0
+ * <td>
+ * <td>/a.html
+ * <tr>
+ * <td>HEAD /xyz?a=b HTTP/1.1
+ * <td>
+ * <td>/xyz
+ * </table>
+ * <p>
+ * To reconstruct an URL with a scheme and host, use
+ * {@link HttpUtils#getRequestURL}.
+ *
+ * @return a <code>String</code> containing the part of the URL from the
+ * protocol name up to the query string
+ * @see HttpUtils#getRequestURL
+ */
+ public String getRequestURI();
+
+ /**
+ * Reconstructs the URL the client used to make the request. The returned
+ * URL contains a protocol, server name, port number, and server path, but
+ * it does not include query string parameters.
+ * <p>
+ * Because this method returns a <code>StringBuffer</code>, not a string,
+ * you can modify the URL easily, for example, to append query parameters.
+ * <p>
+ * This method is useful for creating redirect messages and for reporting
+ * errors.
+ *
+ * @return a <code>StringBuffer</code> object containing the reconstructed
+ * URL
+ */
+ public StringBuffer getRequestURL();
+
+ /**
+ * Returns the part of this request's URL that calls the servlet. This path
+ * starts with a "/" character and includes either the servlet name or a
+ * path to the servlet, but does not include any extra path information or a
+ * query string. Same as the value of the CGI variable SCRIPT_NAME.
+ * <p>
+ * This method will return an empty string ("") if the servlet used to
+ * process this request was matched using the "/*" pattern.
+ *
+ * @return a <code>String</code> containing the name or path of the servlet
+ * being called, as specified in the request URL, decoded, or an
+ * empty string if the servlet used to process the request is
+ * matched using the "/*" pattern.
+ */
+ public String getServletPath();
+
+ /**
+ * Returns the current <code>HttpSession</code> associated with this request
+ * or, if there is no current session and <code>create</code> is true,
+ * returns a new session.
+ * <p>
+ * If <code>create</code> is <code>false</code> and the request has no valid
+ * <code>HttpSession</code>, this method returns <code>null</code>.
+ * <p>
+ * To make sure the session is properly maintained, you must call this
+ * method before the response is committed. If the container is using
+ * cookies to maintain session integrity and is asked to create a new
+ * session when the response is committed, an IllegalStateException is
+ * thrown.
+ *
+ * @param create
+ * <code>true</code> to create a new session for this request if
+ * necessary; <code>false</code> to return <code>null</code> if
+ * there's no current session
+ * @return the <code>HttpSession</code> associated with this request or
+ * <code>null</code> if <code>create</code> is <code>false</code>
+ * and the request has no valid session
+ * @see #getSession()
+ */
+ public HttpSession getSession(boolean create);
+
+ /**
+ * Returns the current session associated with this request, or if the
+ * request does not have a session, creates one.
+ *
+ * @return the <code>HttpSession</code> associated with this request
+ * @see #getSession(boolean)
+ */
+ public HttpSession getSession();
+
+ /**
+ * Checks whether the requested session ID is still valid.
+ *
+ * @return <code>true</code> if this request has an id for a valid session
+ * in the current session context; <code>false</code> otherwise
+ * @see #getRequestedSessionId
+ * @see #getSession
+ * @see HttpSessionContext
+ */
+ public boolean isRequestedSessionIdValid();
+
+ /**
+ * Checks whether the requested session ID came in as a cookie.
+ *
+ * @return <code>true</code> if the session ID came in as a cookie;
+ * otherwise, <code>false</code>
+ * @see #getSession
+ */
+ public boolean isRequestedSessionIdFromCookie();
+
+ /**
+ * Checks whether the requested session ID came in as part of the request
+ * URL.
+ *
+ * @return <code>true</code> if the session ID came in as part of a URL;
+ * otherwise, <code>false</code>
+ * @see #getSession
+ */
+ public boolean isRequestedSessionIdFromURL();
+
+ /**
+ * @deprecated As of Version 2.1 of the Java Servlet API, use
+ * {@link #isRequestedSessionIdFromURL} instead.
+ */
+ @SuppressWarnings("dep-ann")
+ // Spec API does not use @Deprecated
+ public boolean isRequestedSessionIdFromUrl();
+
+ /**
+ * @param response
+ * @return TODO
+ * @throws IOException
+ * @throws ServletException
+ * @since Servlet 3.0 TODO SERVLET3 - Add comments
+ */
+ public boolean authenticate(HttpServletResponse response)
+ throws IOException, ServletException;
+
+ /**
+ * @param username
+ * @param password
+ * @throws ServletException
+ * If any of {@link #getRemoteUser()},
+ * {@link #getUserPrincipal()} or {@link #getAuthType()} are
+ * non-null, if the configured authenticator does not support
+ * user name and password authentication or if the
+ * authentication fails
+ * @since Servlet 3.0 TODO SERVLET3 - Add comments
+ */
+ public void login(String username, String password) throws ServletException;
+
+ /**
+ * @throws ServletException
+ * If the logout fails
+ * @since Servlet 3.0 TODO SERVLET3 - Add comments
+ */
+ public void logout() throws ServletException;
+
+ /**
+ * Return a collection of all uploaded Parts.
+ *
+ * @return A collection of all uploaded Parts.
+ * @throws IOException
+ * if an I/O error occurs
+ * @throws IllegalStateException
+ * if size limits are exceeded
+ * @throws ServletException
+ * if the request is not multipart/form-data
+ * @since Servlet 3.0
+ */
+ public Collection<Part> getParts() throws IOException,
+ IllegalStateException, ServletException;
+
+ /**
+ * Gets the named Part or null if the Part does not exist. Triggers upload
+ * of all Parts.
+ *
+ * @param name
+ * @return The named Part or null if the Part does not exist
+ * @throws IOException
+ * if an I/O error occurs
+ * @throws IllegalStateException
+ * if size limits are exceeded
+ * @throws ServletException
+ * if the request is not multipart/form-data
+ * @since Servlet 3.0
+ */
+ public Part getPart(String name) throws IOException, IllegalStateException,
+ ServletException;
+}
diff --git a/bundles/org.apache.tomcat/src/javax/servlet/http/HttpServletRequestWrapper.java b/bundles/org.apache.tomcat/src/javax/servlet/http/HttpServletRequestWrapper.java
new file mode 100644
index 0000000..1d3b329
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/javax/servlet/http/HttpServletRequestWrapper.java
@@ -0,0 +1,326 @@
+/*
+ * 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 javax.servlet.http;
+
+import java.io.IOException;
+import java.util.Collection;
+import java.util.Enumeration;
+
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequestWrapper;
+
+/**
+ * Provides a convenient implementation of the HttpServletRequest interface that
+ * can be subclassed by developers wishing to adapt the request to a Servlet.
+ * This class implements the Wrapper or Decorator pattern. Methods default to
+ * calling through to the wrapped request object.
+ *
+ * @see javax.servlet.http.HttpServletRequest
+ * @since v 2.3
+ */
+public class HttpServletRequestWrapper extends ServletRequestWrapper implements
+ HttpServletRequest {
+
+ /**
+ * Constructs a request object wrapping the given request.
+ *
+ * @throws java.lang.IllegalArgumentException
+ * if the request is null
+ */
+ public HttpServletRequestWrapper(HttpServletRequest request) {
+ super(request);
+ }
+
+ private HttpServletRequest _getHttpServletRequest() {
+ return (HttpServletRequest) super.getRequest();
+ }
+
+ /**
+ * The default behavior of this method is to return getAuthType() on the
+ * wrapped request object.
+ */
+ @Override
+ public String getAuthType() {
+ return this._getHttpServletRequest().getAuthType();
+ }
+
+ /**
+ * The default behavior of this method is to return getCookies() on the
+ * wrapped request object.
+ */
+ @Override
+ public Cookie[] getCookies() {
+ return this._getHttpServletRequest().getCookies();
+ }
+
+ /**
+ * The default behavior of this method is to return getDateHeader(String
+ * name) on the wrapped request object.
+ */
+ @Override
+ public long getDateHeader(String name) {
+ return this._getHttpServletRequest().getDateHeader(name);
+ }
+
+ /**
+ * The default behavior of this method is to return getHeader(String name)
+ * on the wrapped request object.
+ */
+ @Override
+ public String getHeader(String name) {
+ return this._getHttpServletRequest().getHeader(name);
+ }
+
+ /**
+ * The default behavior of this method is to return getHeaders(String name)
+ * on the wrapped request object.
+ */
+ @Override
+ public Enumeration<String> getHeaders(String name) {
+ return this._getHttpServletRequest().getHeaders(name);
+ }
+
+ /**
+ * The default behavior of this method is to return getHeaderNames() on the
+ * wrapped request object.
+ */
+ @Override
+ public Enumeration<String> getHeaderNames() {
+ return this._getHttpServletRequest().getHeaderNames();
+ }
+
+ /**
+ * The default behavior of this method is to return getIntHeader(String
+ * name) on the wrapped request object.
+ */
+ @Override
+ public int getIntHeader(String name) {
+ return this._getHttpServletRequest().getIntHeader(name);
+ }
+
+ /**
+ * The default behavior of this method is to return getMethod() on the
+ * wrapped request object.
+ */
+ @Override
+ public String getMethod() {
+ return this._getHttpServletRequest().getMethod();
+ }
+
+ /**
+ * The default behavior of this method is to return getPathInfo() on the
+ * wrapped request object.
+ */
+ @Override
+ public String getPathInfo() {
+ return this._getHttpServletRequest().getPathInfo();
+ }
+
+ /**
+ * The default behavior of this method is to return getPathTranslated() on
+ * the wrapped request object.
+ */
+ @Override
+ public String getPathTranslated() {
+ return this._getHttpServletRequest().getPathTranslated();
+ }
+
+ /**
+ * The default behavior of this method is to return getContextPath() on the
+ * wrapped request object.
+ */
+ @Override
+ public String getContextPath() {
+ return this._getHttpServletRequest().getContextPath();
+ }
+
+ /**
+ * The default behavior of this method is to return getQueryString() on the
+ * wrapped request object.
+ */
+ @Override
+ public String getQueryString() {
+ return this._getHttpServletRequest().getQueryString();
+ }
+
+ /**
+ * The default behavior of this method is to return getRemoteUser() on the
+ * wrapped request object.
+ */
+ @Override
+ public String getRemoteUser() {
+ return this._getHttpServletRequest().getRemoteUser();
+ }
+
+ /**
+ * The default behavior of this method is to return isUserInRole(String
+ * role) on the wrapped request object.
+ */
+ @Override
+ public boolean isUserInRole(String role) {
+ return this._getHttpServletRequest().isUserInRole(role);
+ }
+
+ /**
+ * The default behavior of this method is to return getUserPrincipal() on
+ * the wrapped request object.
+ */
+ @Override
+ public java.security.Principal getUserPrincipal() {
+ return this._getHttpServletRequest().getUserPrincipal();
+ }
+
+ /**
+ * The default behavior of this method is to return getRequestedSessionId()
+ * on the wrapped request object.
+ */
+ @Override
+ public String getRequestedSessionId() {
+ return this._getHttpServletRequest().getRequestedSessionId();
+ }
+
+ /**
+ * The default behavior of this method is to return getRequestURI() on the
+ * wrapped request object.
+ */
+ @Override
+ public String getRequestURI() {
+ return this._getHttpServletRequest().getRequestURI();
+ }
+
+ /**
+ * The default behavior of this method is to return getRequestURL() on the
+ * wrapped request object.
+ */
+ @Override
+ public StringBuffer getRequestURL() {
+ return this._getHttpServletRequest().getRequestURL();
+ }
+
+ /**
+ * The default behavior of this method is to return getServletPath() on the
+ * wrapped request object.
+ */
+ @Override
+ public String getServletPath() {
+ return this._getHttpServletRequest().getServletPath();
+ }
+
+ /**
+ * The default behavior of this method is to return getSession(boolean
+ * create) on the wrapped request object.
+ */
+ @Override
+ public HttpSession getSession(boolean create) {
+ return this._getHttpServletRequest().getSession(create);
+ }
+
+ /**
+ * The default behavior of this method is to return getSession() on the
+ * wrapped request object.
+ */
+ @Override
+ public HttpSession getSession() {
+ return this._getHttpServletRequest().getSession();
+ }
+
+ /**
+ * The default behavior of this method is to return
+ * isRequestedSessionIdValid() on the wrapped request object.
+ */
+ @Override
+ public boolean isRequestedSessionIdValid() {
+ return this._getHttpServletRequest().isRequestedSessionIdValid();
+ }
+
+ /**
+ * The default behavior of this method is to return
+ * isRequestedSessionIdFromCookie() on the wrapped request object.
+ */
+ @Override
+ public boolean isRequestedSessionIdFromCookie() {
+ return this._getHttpServletRequest().isRequestedSessionIdFromCookie();
+ }
+
+ /**
+ * The default behavior of this method is to return
+ * isRequestedSessionIdFromURL() on the wrapped request object.
+ */
+ @Override
+ public boolean isRequestedSessionIdFromURL() {
+ return this._getHttpServletRequest().isRequestedSessionIdFromURL();
+ }
+
+ /**
+ * The default behavior of this method is to return
+ * isRequestedSessionIdFromUrl() on the wrapped request object.
+ *
+ * @deprecated As of Version 3.0 of the Java Servlet API
+ */
+ @Override
+ @SuppressWarnings("dep-ann")
+ // Spec API does not use @Deprecated
+ public boolean isRequestedSessionIdFromUrl() {
+ return this._getHttpServletRequest().isRequestedSessionIdFromUrl();
+ }
+
+ /**
+ * @since Servlet 3.0 TODO SERVLET3 - Add comments
+ */
+ @Override
+ public boolean authenticate(HttpServletResponse response)
+ throws IOException, ServletException {
+ return this._getHttpServletRequest().authenticate(response);
+ }
+
+ /**
+ * @since Servlet 3.0 TODO SERVLET3 - Add comments
+ */
+ @Override
+ public void login(String username, String password) throws ServletException {
+ this._getHttpServletRequest().login(username, password);
+ }
+
+ /**
+ * @since Servlet 3.0 TODO SERVLET3 - Add comments
+ */
+ @Override
+ public void logout() throws ServletException {
+ this._getHttpServletRequest().logout();
+ }
+
+ /**
+ * @since Servlet 3.0 TODO SERVLET3 - Add comments
+ */
+ @Override
+ public Collection<Part> getParts() throws IllegalStateException,
+ IOException, ServletException {
+ return this._getHttpServletRequest().getParts();
+ }
+
+ /**
+ * @throws ServletException
+ * @throws IOException
+ * @throws IllegalStateException
+ * @since Servlet 3.0 TODO SERVLET3 - Add comments
+ */
+ @Override
+ public Part getPart(String name) throws IllegalStateException, IOException,
+ ServletException {
+ return this._getHttpServletRequest().getPart(name);
+ }
+}
diff --git a/bundles/org.apache.tomcat/src/javax/servlet/http/HttpServletResponse.java b/bundles/org.apache.tomcat/src/javax/servlet/http/HttpServletResponse.java
new file mode 100644
index 0000000..c111a4d
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/javax/servlet/http/HttpServletResponse.java
@@ -0,0 +1,592 @@
+/*
+ * 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 javax.servlet.http;
+
+import java.io.IOException;
+import java.util.Collection;
+
+import javax.servlet.ServletResponse;
+
+/**
+ * Extends the {@link ServletResponse} interface to provide HTTP-specific
+ * functionality in sending a response. For example, it has methods to access
+ * HTTP headers and cookies.
+ * <p>
+ * The servlet container creates an <code>HttpServletResponse</code> object and
+ * passes it as an argument to the servlet's service methods (<code>doGet</code>, <code>doPost</code>, etc).
+ *
+ * @author Various
+ * @version $Version$
+ * @see javax.servlet.ServletResponse
+ */
+public interface HttpServletResponse extends ServletResponse {
+
+ /**
+ * Adds the specified cookie to the response. This method can be called
+ * multiple times to set more than one cookie.
+ *
+ * @param cookie
+ * the Cookie to return to the client
+ */
+ public void addCookie(Cookie cookie);
+
+ /**
+ * Returns a boolean indicating whether the named response header has
+ * already been set.
+ *
+ * @param name
+ * the header name
+ * @return <code>true</code> if the named response header has already been
+ * set; <code>false</code> otherwise
+ */
+ public boolean containsHeader(String name);
+
+ /**
+ * Encodes the specified URL by including the session ID in it, or, if
+ * encoding is not needed, returns the URL unchanged. The implementation of
+ * this method includes the logic to determine whether the session ID needs
+ * to be encoded in the URL. For example, if the browser supports cookies,
+ * or session tracking is turned off, URL encoding is unnecessary.
+ * <p>
+ * For robust session tracking, all URLs emitted by a servlet should be run
+ * through this method. Otherwise, URL rewriting cannot be used with
+ * browsers which do not support cookies.
+ *
+ * @param url
+ * the url to be encoded.
+ * @return the encoded URL if encoding is needed; the unchanged URL
+ * otherwise.
+ */
+ public String encodeURL(String url);
+
+ /**
+ * Encodes the specified URL for use in the <code>sendRedirect</code> method
+ * or, if encoding is not needed, returns the URL unchanged. The
+ * implementation of this method includes the logic to determine whether the
+ * session ID needs to be encoded in the URL. Because the rules for making
+ * this determination can differ from those used to decide whether to encode
+ * a normal link, this method is separated from the <code>encodeURL</code>
+ * method.
+ * <p>
+ * All URLs sent to the <code>HttpServletResponse.sendRedirect</code> method
+ * should be run through this method. Otherwise, URL rewriting cannot be
+ * used with browsers which do not support cookies.
+ *
+ * @param url
+ * the url to be encoded.
+ * @return the encoded URL if encoding is needed; the unchanged URL
+ * otherwise.
+ * @see #sendRedirect
+ * @see #encodeUrl
+ */
+ public String encodeRedirectURL(String url);
+
+ /**
+ * @param url
+ * the url to be encoded.
+ * @return the encoded URL if encoding is needed; the unchanged URL
+ * otherwise.
+ * @deprecated As of version 2.1, use encodeURL(String url) instead
+ */
+ @SuppressWarnings("dep-ann")
+ // Spec API does not use @Deprecated
+ public String encodeUrl(String url);
+
+ /**
+ * @param url
+ * the url to be encoded.
+ * @return the encoded URL if encoding is needed; the unchanged URL
+ * otherwise.
+ * @deprecated As of version 2.1, use encodeRedirectURL(String url) instead
+ */
+ @SuppressWarnings("dep-ann")
+ // Spec API does not use @Deprecated
+ public String encodeRedirectUrl(String url);
+
+ /**
+ * Sends an error response to the client using the specified status. The
+ * server defaults to creating the response to look like an HTML-formatted
+ * server error page containing the specified message, setting the content
+ * type to "text/html", leaving cookies and other headers unmodified. If an
+ * error-page declaration has been made for the web application
+ * corresponding to the status code passed in, it will be served back in
+ * preference to the suggested msg parameter.
+ * <p>
+ * If the response has already been committed, this method throws an
+ * IllegalStateException. After using this method, the response should be
+ * considered to be committed and should not be written to.
+ *
+ * @param sc
+ * the error status code
+ * @param msg
+ * the descriptive message
+ * @exception IOException
+ * If an input or output exception occurs
+ * @exception IllegalStateException
+ * If the response was committed
+ */
+ public void sendError(int sc, String msg) throws IOException;
+
+ /**
+ * Sends an error response to the client using the specified status code and
+ * clearing the buffer.
+ * <p>
+ * If the response has already been committed, this method throws an
+ * IllegalStateException. After using this method, the response should be
+ * considered to be committed and should not be written to.
+ *
+ * @param sc
+ * the error status code
+ * @exception IOException
+ * If an input or output exception occurs
+ * @exception IllegalStateException
+ * If the response was committed before this method call
+ */
+ public void sendError(int sc) throws IOException;
+
+ /**
+ * Sends a temporary redirect response to the client using the specified
+ * redirect location URL. This method can accept relative URLs; the servlet
+ * container must convert the relative URL to an absolute URL before sending
+ * the response to the client. If the location is relative without a leading
+ * '/' the container interprets it as relative to the current request URI.
+ * If the location is relative with a leading '/' the container interprets
+ * it as relative to the servlet container root.
+ * <p>
+ * If the response has already been committed, this method throws an
+ * IllegalStateException. After using this method, the response should be
+ * considered to be committed and should not be written to.
+ *
+ * @param location
+ * the redirect location URL
+ * @exception IOException
+ * If an input or output exception occurs
+ * @exception IllegalStateException
+ * If the response was committed or if a partial URL is given
+ * and cannot be converted into a valid URL
+ */
+ public void sendRedirect(String location) throws IOException;
+
+ /**
+ * Sets a response header with the given name and date-value. The date is
+ * specified in terms of milliseconds since the epoch. If the header had
+ * already been set, the new value overwrites the previous one. The
+ * <code>containsHeader</code> method can be used to test for the presence
+ * of a header before setting its value.
+ *
+ * @param name
+ * the name of the header to set
+ * @param date
+ * the assigned date value
+ * @see #containsHeader
+ * @see #addDateHeader
+ */
+ public void setDateHeader(String name, long date);
+
+ /**
+ * Adds a response header with the given name and date-value. The date is
+ * specified in terms of milliseconds since the epoch. This method allows
+ * response headers to have multiple values.
+ *
+ * @param name
+ * the name of the header to set
+ * @param date
+ * the additional date value
+ * @see #setDateHeader
+ */
+ public void addDateHeader(String name, long date);
+
+ /**
+ * Sets a response header with the given name and value. If the header had
+ * already been set, the new value overwrites the previous one. The
+ * <code>containsHeader</code> method can be used to test for the presence
+ * of a header before setting its value.
+ *
+ * @param name
+ * the name of the header
+ * @param value
+ * the header value If it contains octet string, it should be
+ * encoded according to RFC 2047
+ * (http://www.ietf.org/rfc/rfc2047.txt)
+ * @see #containsHeader
+ * @see #addHeader
+ */
+ public void setHeader(String name, String value);
+
+ /**
+ * Adds a response header with the given name and value. This method allows
+ * response headers to have multiple values.
+ *
+ * @param name
+ * the name of the header
+ * @param value
+ * the additional header value If it contains octet string, it
+ * should be encoded according to RFC 2047
+ * (http://www.ietf.org/rfc/rfc2047.txt)
+ * @see #setHeader
+ */
+ public void addHeader(String name, String value);
+
+ /**
+ * Sets a response header with the given name and integer value. If the
+ * header had already been set, the new value overwrites the previous one.
+ * The <code>containsHeader</code> method can be used to test for the
+ * presence of a header before setting its value.
+ *
+ * @param name
+ * the name of the header
+ * @param value
+ * the assigned integer value
+ * @see #containsHeader
+ * @see #addIntHeader
+ */
+ public void setIntHeader(String name, int value);
+
+ /**
+ * Adds a response header with the given name and integer value. This method
+ * allows response headers to have multiple values.
+ *
+ * @param name
+ * the name of the header
+ * @param value
+ * the assigned integer value
+ * @see #setIntHeader
+ */
+ public void addIntHeader(String name, int value);
+
+ /**
+ * Sets the status code for this response. This method is used to set the
+ * return status code when there is no error (for example, for the status
+ * codes SC_OK or SC_MOVED_TEMPORARILY). If there is an error, and the
+ * caller wishes to invoke an error-page defined in the web application, the
+ * <code>sendError</code> method should be used instead.
+ * <p>
+ * The container clears the buffer and sets the Location header, preserving
+ * cookies and other headers.
+ *
+ * @param sc
+ * the status code
+ * @see #sendError
+ */
+ public void setStatus(int sc);
+
+ /**
+ * Sets the status code and message for this response.
+ *
+ * @param sc
+ * the status code
+ * @param sm
+ * the status message
+ * @deprecated As of version 2.1, due to ambiguous meaning of the message
+ * parameter. To set a status code use
+ * <code>setStatus(int)</code>, to send an error with a
+ * description use <code>sendError(int, String)</code>.
+ */
+ @SuppressWarnings("dep-ann")
+ // Spec API does not use @Deprecated
+ public void setStatus(int sc, String sm);
+
+ /**
+ * @return TODO
+ * @since Servlet 3.0 TODO SERVLET3 - Add comments
+ */
+ public int getStatus();
+
+ /**
+ * @param name
+ * @return TODO
+ * @since Servlet 3.0 TODO SERVLET3 - Add comments
+ */
+ public String getHeader(String name);
+
+ /**
+ * @param name
+ * @return TODO
+ * @since Servlet 3.0 TODO SERVLET3 - Add comments
+ */
+ public Collection<String> getHeaders(String name);
+
+ /**
+ * @return TODO
+ * @since Servlet 3.0 TODO SERVLET3 - Add comments
+ */
+ public Collection<String> getHeaderNames();
+
+ /*
+ * Server status codes; see RFC 2068.
+ */
+
+ /**
+ * Status code (100) indicating the client can continue.
+ */
+ public static final int SC_CONTINUE = 100;
+
+ /**
+ * Status code (101) indicating the server is switching protocols according
+ * to Upgrade header.
+ */
+ public static final int SC_SWITCHING_PROTOCOLS = 101;
+
+ /**
+ * Status code (200) indicating the request succeeded normally.
+ */
+ public static final int SC_OK = 200;
+
+ /**
+ * Status code (201) indicating the request succeeded and created a new
+ * resource on the server.
+ */
+ public static final int SC_CREATED = 201;
+
+ /**
+ * Status code (202) indicating that a request was accepted for processing,
+ * but was not completed.
+ */
+ public static final int SC_ACCEPTED = 202;
+
+ /**
+ * Status code (203) indicating that the meta information presented by the
+ * client did not originate from the server.
+ */
+ public static final int SC_NON_AUTHORITATIVE_INFORMATION = 203;
+
+ /**
+ * Status code (204) indicating that the request succeeded but that there
+ * was no new information to return.
+ */
+ public static final int SC_NO_CONTENT = 204;
+
+ /**
+ * Status code (205) indicating that the agent <em>SHOULD</em> reset the
+ * document view which caused the request to be sent.
+ */
+ public static final int SC_RESET_CONTENT = 205;
+
+ /**
+ * Status code (206) indicating that the server has fulfilled the partial
+ * GET request for the resource.
+ */
+ public static final int SC_PARTIAL_CONTENT = 206;
+
+ /**
+ * Status code (300) indicating that the requested resource corresponds to
+ * any one of a set of representations, each with its own specific location.
+ */
+ public static final int SC_MULTIPLE_CHOICES = 300;
+
+ /**
+ * Status code (301) indicating that the resource has permanently moved to a
+ * new location, and that future references should use a new URI with their
+ * requests.
+ */
+ public static final int SC_MOVED_PERMANENTLY = 301;
+
+ /**
+ * Status code (302) indicating that the resource has temporarily moved to
+ * another location, but that future references should still use the
+ * original URI to access the resource. This definition is being retained
+ * for backwards compatibility. SC_FOUND is now the preferred definition.
+ */
+ public static final int SC_MOVED_TEMPORARILY = 302;
+
+ /**
+ * Status code (302) indicating that the resource reside temporarily under a
+ * different URI. Since the redirection might be altered on occasion, the
+ * client should continue to use the Request-URI for future
+ * requests.(HTTP/1.1) To represent the status code (302), it is recommended
+ * to use this variable.
+ */
+ public static final int SC_FOUND = 302;
+
+ /**
+ * Status code (303) indicating that the response to the request can be
+ * found under a different URI.
+ */
+ public static final int SC_SEE_OTHER = 303;
+
+ /**
+ * Status code (304) indicating that a conditional GET operation found that
+ * the resource was available and not modified.
+ */
+ public static final int SC_NOT_MODIFIED = 304;
+
+ /**
+ * Status code (305) indicating that the requested resource <em>MUST</em> be
+ * accessed through the proxy given by the <code><em>Location</em></code>
+ * field.
+ */
+ public static final int SC_USE_PROXY = 305;
+
+ /**
+ * Status code (307) indicating that the requested resource resides
+ * temporarily under a different URI. The temporary URI <em>SHOULD</em> be
+ * given by the <code><em>Location</em></code> field in the response.
+ */
+ public static final int SC_TEMPORARY_REDIRECT = 307;
+
+ /**
+ * Status code (400) indicating the request sent by the client was
+ * syntactically incorrect.
+ */
+ public static final int SC_BAD_REQUEST = 400;
+
+ /**
+ * Status code (401) indicating that the request requires HTTP
+ * authentication.
+ */
+ public static final int SC_UNAUTHORIZED = 401;
+
+ /**
+ * Status code (402) reserved for future use.
+ */
+ public static final int SC_PAYMENT_REQUIRED = 402;
+
+ /**
+ * Status code (403) indicating the server understood the request but
+ * refused to fulfill it.
+ */
+ public static final int SC_FORBIDDEN = 403;
+
+ /**
+ * Status code (404) indicating that the requested resource is not
+ * available.
+ */
+ public static final int SC_NOT_FOUND = 404;
+
+ /**
+ * Status code (405) indicating that the method specified in the
+ * <code><em>Request-Line</em></code> is not allowed for the resource
+ * identified by the <code><em>Request-URI</em></code>.
+ */
+ public static final int SC_METHOD_NOT_ALLOWED = 405;
+
+ /**
+ * Status code (406) indicating that the resource identified by the request
+ * is only capable of generating response entities which have content
+ * characteristics not acceptable according to the accept headers sent in
+ * the request.
+ */
+ public static final int SC_NOT_ACCEPTABLE = 406;
+
+ /**
+ * Status code (407) indicating that the client <em>MUST</em> first
+ * authenticate itself with the proxy.
+ */
+ public static final int SC_PROXY_AUTHENTICATION_REQUIRED = 407;
+
+ /**
+ * Status code (408) indicating that the client did not produce a request
+ * within the time that the server was prepared to wait.
+ */
+ public static final int SC_REQUEST_TIMEOUT = 408;
+
+ /**
+ * Status code (409) indicating that the request could not be completed due
+ * to a conflict with the current state of the resource.
+ */
+ public static final int SC_CONFLICT = 409;
+
+ /**
+ * Status code (410) indicating that the resource is no longer available at
+ * the server and no forwarding address is known. This condition
+ * <em>SHOULD</em> be considered permanent.
+ */
+ public static final int SC_GONE = 410;
+
+ /**
+ * Status code (411) indicating that the request cannot be handled without a
+ * defined <code><em>Content-Length</em></code>.
+ */
+ public static final int SC_LENGTH_REQUIRED = 411;
+
+ /**
+ * Status code (412) indicating that the precondition given in one or more
+ * of the request-header fields evaluated to false when it was tested on the
+ * server.
+ */
+ public static final int SC_PRECONDITION_FAILED = 412;
+
+ /**
+ * Status code (413) indicating that the server is refusing to process the
+ * request because the request entity is larger than the server is willing
+ * or able to process.
+ */
+ public static final int SC_REQUEST_ENTITY_TOO_LARGE = 413;
+
+ /**
+ * Status code (414) indicating that the server is refusing to service the
+ * request because the <code><em>Request-URI</em></code> is longer than the
+ * server is willing to interpret.
+ */
+ public static final int SC_REQUEST_URI_TOO_LONG = 414;
+
+ /**
+ * Status code (415) indicating that the server is refusing to service the
+ * request because the entity of the request is in a format not supported by
+ * the requested resource for the requested method.
+ */
+ public static final int SC_UNSUPPORTED_MEDIA_TYPE = 415;
+
+ /**
+ * Status code (416) indicating that the server cannot serve the requested
+ * byte range.
+ */
+ public static final int SC_REQUESTED_RANGE_NOT_SATISFIABLE = 416;
+
+ /**
+ * Status code (417) indicating that the server could not meet the
+ * expectation given in the Expect request header.
+ */
+ public static final int SC_EXPECTATION_FAILED = 417;
+
+ /**
+ * Status code (500) indicating an error inside the HTTP server which
+ * prevented it from fulfilling the request.
+ */
+ public static final int SC_INTERNAL_SERVER_ERROR = 500;
+
+ /**
+ * Status code (501) indicating the HTTP server does not support the
+ * functionality needed to fulfill the request.
+ */
+ public static final int SC_NOT_IMPLEMENTED = 501;
+
+ /**
+ * Status code (502) indicating that the HTTP server received an invalid
+ * response from a server it consulted when acting as a proxy or gateway.
+ */
+ public static final int SC_BAD_GATEWAY = 502;
+
+ /**
+ * Status code (503) indicating that the HTTP server is temporarily
+ * overloaded, and unable to handle the request.
+ */
+ public static final int SC_SERVICE_UNAVAILABLE = 503;
+
+ /**
+ * Status code (504) indicating that the server did not receive a timely
+ * response from the upstream server while acting as a gateway or proxy.
+ */
+ public static final int SC_GATEWAY_TIMEOUT = 504;
+
+ /**
+ * Status code (505) indicating that the server does not support or refuses
+ * to support the HTTP protocol version that was used in the request
+ * message.
+ */
+ public static final int SC_HTTP_VERSION_NOT_SUPPORTED = 505;
+}
diff --git a/bundles/org.apache.tomcat/src/javax/servlet/http/HttpServletResponseWrapper.java b/bundles/org.apache.tomcat/src/javax/servlet/http/HttpServletResponseWrapper.java
new file mode 100644
index 0000000..5162906
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/javax/servlet/http/HttpServletResponseWrapper.java
@@ -0,0 +1,248 @@
+/*
+ * 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 javax.servlet.http;
+
+import java.io.IOException;
+import java.util.Collection;
+
+import javax.servlet.ServletResponseWrapper;
+
+/**
+ * Provides a convenient implementation of the HttpServletResponse interface
+ * that can be subclassed by developers wishing to adapt the response from a
+ * Servlet. This class implements the Wrapper or Decorator pattern. Methods
+ * default to calling through to the wrapped response object.
+ *
+ * @author Various
+ * @version $Version$
+ * @since v 2.3
+ * @see javax.servlet.http.HttpServletResponse
+ */
+public class HttpServletResponseWrapper extends ServletResponseWrapper
+ implements HttpServletResponse {
+
+ /**
+ * Constructs a response adaptor wrapping the given response.
+ *
+ * @throws java.lang.IllegalArgumentException
+ * if the response is null
+ */
+ public HttpServletResponseWrapper(HttpServletResponse response) {
+ super(response);
+ }
+
+ private HttpServletResponse _getHttpServletResponse() {
+ return (HttpServletResponse) super.getResponse();
+ }
+
+ /**
+ * The default behavior of this method is to call addCookie(Cookie cookie)
+ * on the wrapped response object.
+ */
+ @Override
+ public void addCookie(Cookie cookie) {
+ this._getHttpServletResponse().addCookie(cookie);
+ }
+
+ /**
+ * The default behavior of this method is to call containsHeader(String
+ * name) on the wrapped response object.
+ */
+ @Override
+ public boolean containsHeader(String name) {
+ return this._getHttpServletResponse().containsHeader(name);
+ }
+
+ /**
+ * The default behavior of this method is to call encodeURL(String url) on
+ * the wrapped response object.
+ */
+ @Override
+ public String encodeURL(String url) {
+ return this._getHttpServletResponse().encodeURL(url);
+ }
+
+ /**
+ * The default behavior of this method is to return encodeRedirectURL(String
+ * url) on the wrapped response object.
+ */
+ @Override
+ public String encodeRedirectURL(String url) {
+ return this._getHttpServletResponse().encodeRedirectURL(url);
+ }
+
+ /**
+ * The default behavior of this method is to call encodeUrl(String url) on
+ * the wrapped response object.
+ *
+ * @deprecated As of Version 3.0 of the Java Servlet API
+ */
+ @Override
+ @SuppressWarnings("dep-ann")
+ // Spec API does not use @Deprecated
+ public String encodeUrl(String url) {
+ return this._getHttpServletResponse().encodeUrl(url);
+ }
+
+ /**
+ * The default behavior of this method is to return encodeRedirectUrl(String
+ * url) on the wrapped response object.
+ *
+ * @deprecated As of Version 3.0 of the Java Servlet API
+ */
+ @Override
+ @SuppressWarnings("dep-ann")
+ // Spec API does not use @Deprecated
+ public String encodeRedirectUrl(String url) {
+ return this._getHttpServletResponse().encodeRedirectUrl(url);
+ }
+
+ /**
+ * The default behavior of this method is to call sendError(int sc, String
+ * msg) on the wrapped response object.
+ */
+ @Override
+ public void sendError(int sc, String msg) throws IOException {
+ this._getHttpServletResponse().sendError(sc, msg);
+ }
+
+ /**
+ * The default behavior of this method is to call sendError(int sc) on the
+ * wrapped response object.
+ */
+ @Override
+ public void sendError(int sc) throws IOException {
+ this._getHttpServletResponse().sendError(sc);
+ }
+
+ /**
+ * The default behavior of this method is to return sendRedirect(String
+ * location) on the wrapped response object.
+ */
+ @Override
+ public void sendRedirect(String location) throws IOException {
+ this._getHttpServletResponse().sendRedirect(location);
+ }
+
+ /**
+ * The default behavior of this method is to call setDateHeader(String name,
+ * long date) on the wrapped response object.
+ */
+ @Override
+ public void setDateHeader(String name, long date) {
+ this._getHttpServletResponse().setDateHeader(name, date);
+ }
+
+ /**
+ * The default behavior of this method is to call addDateHeader(String name,
+ * long date) on the wrapped response object.
+ */
+ @Override
+ public void addDateHeader(String name, long date) {
+ this._getHttpServletResponse().addDateHeader(name, date);
+ }
+
+ /**
+ * The default behavior of this method is to return setHeader(String name,
+ * String value) on the wrapped response object.
+ */
+ @Override
+ public void setHeader(String name, String value) {
+ this._getHttpServletResponse().setHeader(name, value);
+ }
+
+ /**
+ * The default behavior of this method is to return addHeader(String name,
+ * String value) on the wrapped response object.
+ */
+ @Override
+ public void addHeader(String name, String value) {
+ this._getHttpServletResponse().addHeader(name, value);
+ }
+
+ /**
+ * The default behavior of this method is to call setIntHeader(String name,
+ * int value) on the wrapped response object.
+ */
+ @Override
+ public void setIntHeader(String name, int value) {
+ this._getHttpServletResponse().setIntHeader(name, value);
+ }
+
+ /**
+ * The default behavior of this method is to call addIntHeader(String name,
+ * int value) on the wrapped response object.
+ */
+ @Override
+ public void addIntHeader(String name, int value) {
+ this._getHttpServletResponse().addIntHeader(name, value);
+ }
+
+ /**
+ * The default behavior of this method is to call setStatus(int sc) on the
+ * wrapped response object.
+ */
+ @Override
+ public void setStatus(int sc) {
+ this._getHttpServletResponse().setStatus(sc);
+ }
+
+ /**
+ * The default behavior of this method is to call setStatus(int sc, String
+ * sm) on the wrapped response object.
+ *
+ * @deprecated As of Version 3.0 of the Java Servlet API
+ */
+ @Override
+ @SuppressWarnings("dep-ann")
+ // Spec API does not use @Deprecated
+ public void setStatus(int sc, String sm) {
+ this._getHttpServletResponse().setStatus(sc, sm);
+ }
+
+ /**
+ * @since Servlet 3.0 TODO SERVLET3 - Add comments
+ */
+ @Override
+ public int getStatus() {
+ return this._getHttpServletResponse().getStatus();
+ }
+
+ /**
+ * @since Servlet 3.0 TODO SERVLET3 - Add comments
+ */
+ @Override
+ public String getHeader(String name) {
+ return this._getHttpServletResponse().getHeader(name);
+ }
+
+ /**
+ * @since Servlet 3.0 TODO SERVLET3 - Add comments
+ */
+ @Override
+ public Collection<String> getHeaders(String name) {
+ return this._getHttpServletResponse().getHeaders(name);
+ }
+
+ /**
+ * @since Servlet 3.0 TODO SERVLET3 - Add comments
+ */
+ @Override
+ public Collection<String> getHeaderNames() {
+ return this._getHttpServletResponse().getHeaderNames();
+ }
+}
diff --git a/bundles/org.apache.tomcat/src/javax/servlet/http/HttpSession.java b/bundles/org.apache.tomcat/src/javax/servlet/http/HttpSession.java
new file mode 100644
index 0000000..60f98b1
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/javax/servlet/http/HttpSession.java
@@ -0,0 +1,287 @@
+/*
+ * 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 javax.servlet.http;
+
+import java.util.Enumeration;
+
+import javax.servlet.ServletContext;
+
+/**
+ * Provides a way to identify a user across more than one page request or visit
+ * to a Web site and to store information about that user.
+ * <p>
+ * The servlet container uses this interface to create a session between an HTTP
+ * client and an HTTP server. The session persists for a specified time period,
+ * across more than one connection or page request from the user. A session
+ * usually corresponds to one user, who may visit a site many times. The server
+ * can maintain a session in many ways such as using cookies or rewriting URLs.
+ * <p>
+ * This interface allows servlets to
+ * <ul>
+ * <li>View and manipulate information about a session, such as the session
+ * identifier, creation time, and last accessed time
+ * <li>Bind objects to sessions, allowing user information to persist across
+ * multiple user connections
+ * </ul>
+ * <p>
+ * When an application stores an object in or removes an object from a session,
+ * the session checks whether the object implements
+ * {@link HttpSessionBindingListener}. If it does, the servlet notifies the
+ * object that it has been bound to or unbound from the session. Notifications
+ * are sent after the binding methods complete. For session that are invalidated
+ * or expire, notifications are sent after the session has been invalidated or
+ * expired.
+ * <p>
+ * When container migrates a session between VMs in a distributed container
+ * setting, all session attributes implementing the
+ * {@link HttpSessionActivationListener} interface are notified.
+ * <p>
+ * A servlet should be able to handle cases in which the client does not choose
+ * to join a session, such as when cookies are intentionally turned off. Until
+ * the client joins the session, <code>isNew</code> returns <code>true</code>.
+ * If the client chooses not to join the session, <code>getSession</code> will
+ * return a different session on each request, and <code>isNew</code> will
+ * always return <code>true</code>.
+ * <p>
+ * Session information is scoped only to the current web application (
+ * <code>ServletContext</code>), so information stored in one context will not
+ * be directly visible in another.
+ *
+ * @author Various
+ * @version $Version$
+ * @see HttpSessionBindingListener
+ * @see HttpSessionContext
+ */
+public interface HttpSession {
+
+ /**
+ * Returns the time when this session was created, measured in milliseconds
+ * since midnight January 1, 1970 GMT.
+ *
+ * @return a <code>long</code> specifying when this session was created,
+ * expressed in milliseconds since 1/1/1970 GMT
+ * @exception IllegalStateException
+ * if this method is called on an invalidated session
+ */
+ public long getCreationTime();
+
+ /**
+ * Returns a string containing the unique identifier assigned to this
+ * session. The identifier is assigned by the servlet container and is
+ * implementation dependent.
+ *
+ * @return a string specifying the identifier assigned to this session
+ * @exception IllegalStateException
+ * if this method is called on an invalidated session
+ */
+ public String getId();
+
+ /**
+ * Returns the last time the client sent a request associated with this
+ * session, as the number of milliseconds since midnight January 1, 1970
+ * GMT, and marked by the time the container received the request.
+ * <p>
+ * Actions that your application takes, such as getting or setting a value
+ * associated with the session, do not affect the access time.
+ *
+ * @return a <code>long</code> representing the last time the client sent a
+ * request associated with this session, expressed in milliseconds
+ * since 1/1/1970 GMT
+ * @exception IllegalStateException
+ * if this method is called on an invalidated session
+ */
+ public long getLastAccessedTime();
+
+ /**
+ * Returns the ServletContext to which this session belongs.
+ *
+ * @return The ServletContext object for the web application
+ * @since 2.3
+ */
+ public ServletContext getServletContext();
+
+ /**
+ * Specifies the time, in seconds, between client requests before the
+ * servlet container will invalidate this session. A negative time indicates
+ * the session should never timeout.
+ *
+ * @param interval
+ * An integer specifying the number of seconds
+ */
+ public void setMaxInactiveInterval(int interval);
+
+ /**
+ * Returns the maximum time interval, in seconds, that the servlet container
+ * will keep this session open between client accesses. After this interval,
+ * the servlet container will invalidate the session. The maximum time
+ * interval can be set with the <code>setMaxInactiveInterval</code> method.
+ * A negative time indicates the session should never timeout.
+ *
+ * @return an integer specifying the number of seconds this session remains
+ * open between client requests
+ * @see #setMaxInactiveInterval
+ */
+ public int getMaxInactiveInterval();
+
+ /**
+ * @deprecated As of Version 2.1, this method is deprecated and has no
+ * replacement. It will be removed in a future version of the
+ * Java Servlet API.
+ */
+ @SuppressWarnings("dep-ann")
+ // Spec API does not use @Deprecated
+ public HttpSessionContext getSessionContext();
+
+ /**
+ * Returns the object bound with the specified name in this session, or
+ * <code>null</code> if no object is bound under the name.
+ *
+ * @param name
+ * a string specifying the name of the object
+ * @return the object with the specified name
+ * @exception IllegalStateException
+ * if this method is called on an invalidated session
+ */
+ public Object getAttribute(String name);
+
+ /**
+ * @param name
+ * a string specifying the name of the object
+ * @return the object with the specified name
+ * @exception IllegalStateException
+ * if this method is called on an invalidated session
+ * @deprecated As of Version 2.2, this method is replaced by
+ * {@link #getAttribute}.
+ */
+ @SuppressWarnings("dep-ann")
+ // Spec API does not use @Deprecated
+ public Object getValue(String name);
+
+ /**
+ * Returns an <code>Enumeration</code> of <code>String</code> objects
+ * containing the names of all the objects bound to this session.
+ *
+ * @return an <code>Enumeration</code> of <code>String</code> objects
+ * specifying the names of all the objects bound to this session
+ * @exception IllegalStateException
+ * if this method is called on an invalidated session
+ */
+ public Enumeration<String> getAttributeNames();
+
+ /**
+ * @return an array of <code>String</code> objects specifying the names of
+ * all the objects bound to this session
+ * @exception IllegalStateException
+ * if this method is called on an invalidated session
+ * @deprecated As of Version 2.2, this method is replaced by
+ * {@link #getAttributeNames}
+ */
+ @SuppressWarnings("dep-ann")
+ // Spec API does not use @Deprecated
+ public String[] getValueNames();
+
+ /**
+ * Binds an object to this session, using the name specified. If an object
+ * of the same name is already bound to the session, the object is replaced.
+ * <p>
+ * After this method executes, and if the new object implements
+ * <code>HttpSessionBindingListener</code>, the container calls
+ * <code>HttpSessionBindingListener.valueBound</code>. The container then
+ * notifies any <code>HttpSessionAttributeListener</code>s in the web
+ * application.
+ * <p>
+ * If an object was already bound to this session of this name that
+ * implements <code>HttpSessionBindingListener</code>, its
+ * <code>HttpSessionBindingListener.valueUnbound</code> method is called.
+ * <p>
+ * If the value passed in is null, this has the same effect as calling
+ * <code>removeAttribute()<code>.
+ *
+ * @param name
+ * the name to which the object is bound; cannot be null
+ * @param value
+ * the object to be bound
+ * @exception IllegalStateException
+ * if this method is called on an invalidated session
+ */
+ public void setAttribute(String name, Object value);
+
+ /**
+ * @param name
+ * the name to which the object is bound; cannot be null
+ * @param value
+ * the object to be bound; cannot be null
+ * @exception IllegalStateException
+ * if this method is called on an invalidated session
+ * @deprecated As of Version 2.2, this method is replaced by
+ * {@link #setAttribute}
+ */
+ @SuppressWarnings("dep-ann")
+ // Spec API does not use @Deprecated
+ public void putValue(String name, Object value);
+
+ /**
+ * Removes the object bound with the specified name from this session. If
+ * the session does not have an object bound with the specified name, this
+ * method does nothing.
+ * <p>
+ * After this method executes, and if the object implements
+ * <code>HttpSessionBindingListener</code>, the container calls
+ * <code>HttpSessionBindingListener.valueUnbound</code>. The container then
+ * notifies any <code>HttpSessionAttributeListener</code>s in the web
+ * application.
+ *
+ * @param name
+ * the name of the object to remove from this session
+ * @exception IllegalStateException
+ * if this method is called on an invalidated session
+ */
+ public void removeAttribute(String name);
+
+ /**
+ * @param name
+ * the name of the object to remove from this session
+ * @exception IllegalStateException
+ * if this method is called on an invalidated session
+ * @deprecated As of Version 2.2, this method is replaced by
+ * {@link #removeAttribute}
+ */
+ @SuppressWarnings("dep-ann")
+ // Spec API does not use @Deprecated
+ public void removeValue(String name);
+
+ /**
+ * Invalidates this session then unbinds any objects bound to it.
+ *
+ * @exception IllegalStateException
+ * if this method is called on an already invalidated session
+ */
+ public void invalidate();
+
+ /**
+ * Returns <code>true</code> if the client does not yet know about the
+ * session or if the client chooses not to join the session. For example, if
+ * the server used only cookie-based sessions, and the client had disabled
+ * the use of cookies, then a session would be new on each request.
+ *
+ * @return <code>true</code> if the server has created a session, but the
+ * client has not yet joined
+ * @exception IllegalStateException
+ * if this method is called on an already invalidated session
+ */
+ public boolean isNew();
+}
diff --git a/bundles/org.apache.tomcat/src/javax/servlet/http/HttpSessionActivationListener.java b/bundles/org.apache.tomcat/src/javax/servlet/http/HttpSessionActivationListener.java
new file mode 100644
index 0000000..99a9f03
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/javax/servlet/http/HttpSessionActivationListener.java
@@ -0,0 +1,37 @@
+/*
+* 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 javax.servlet.http;
+
+import java.util.EventListener;
+
+ /** Objects that are bound to a session may listen to container
+ ** events notifying them that sessions will be passivated and that
+ ** session will be activated. A container that migrates session between VMs
+ ** or persists sessions is required to notify all attributes bound to sessions
+ ** implementing HttpSessionActivationListener.
+ **
+ * @since 2.3
+ */
+
+public interface HttpSessionActivationListener extends EventListener {
+
+ /** Notification that the session is about to be passivated.*/
+ public void sessionWillPassivate(HttpSessionEvent se);
+ /** Notification that the session has just been activated.*/
+ public void sessionDidActivate(HttpSessionEvent se);
+}
+
diff --git a/bundles/org.apache.tomcat/src/javax/servlet/http/HttpSessionAttributeListener.java b/bundles/org.apache.tomcat/src/javax/servlet/http/HttpSessionAttributeListener.java
new file mode 100644
index 0000000..05554a1
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/javax/servlet/http/HttpSessionAttributeListener.java
@@ -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 javax.servlet.http;
+
+import java.util.EventListener;
+
+/**
+ * This listener interface can be implemented in order to get notifications of
+ * changes to the attribute lists of sessions within this web application.
+ *
+ * @since v 2.3
+ */
+public interface HttpSessionAttributeListener extends EventListener {
+
+ /**
+ * Notification that an attribute has been added to a session. Called after
+ * the attribute is added.
+ */
+ public void attributeAdded(HttpSessionBindingEvent se);
+
+ /**
+ * Notification that an attribute has been removed from a session. Called
+ * after the attribute is removed.
+ */
+ public void attributeRemoved(HttpSessionBindingEvent se);
+
+ /**
+ * Notification that an attribute has been replaced in a session. Called
+ * after the attribute is replaced.
+ */
+ public void attributeReplaced(HttpSessionBindingEvent se);
+}
diff --git a/bundles/org.apache.tomcat/src/javax/servlet/http/HttpSessionBindingEvent.java b/bundles/org.apache.tomcat/src/javax/servlet/http/HttpSessionBindingEvent.java
new file mode 100644
index 0000000..3501fca
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/javax/servlet/http/HttpSessionBindingEvent.java
@@ -0,0 +1,113 @@
+/*
+ * 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 javax.servlet.http;
+
+/**
+ * Events of this type are either sent to an object that implements
+ * {@link HttpSessionBindingListener} when it is bound or unbound from a
+ * session, or to a {@link HttpSessionAttributeListener} that has been
+ * configured in the deployment descriptor when any attribute is bound, unbound
+ * or replaced in a session.
+ * <p>
+ * The session binds the object by a call to
+ * <code>HttpSession.setAttribute</code> and unbinds the object by a call to
+ * <code>HttpSession.removeAttribute</code>.
+ *
+ * @author Various
+ * @version $Version$
+ * @see HttpSession
+ * @see HttpSessionBindingListener
+ * @see HttpSessionAttributeListener
+ */
+public class HttpSessionBindingEvent extends HttpSessionEvent {
+
+ private static final long serialVersionUID = 1L;
+
+ /* The name to which the object is being bound or unbound */
+ private final String name;
+
+ /* The object is being bound or unbound */
+ private final Object value;
+
+ /**
+ * Constructs an event that notifies an object that it has been bound to or
+ * unbound from a session. To receive the event, the object must implement
+ * {@link HttpSessionBindingListener}.
+ *
+ * @param session
+ * the session to which the object is bound or unbound
+ * @param name
+ * the name with which the object is bound or unbound
+ * @see #getName
+ * @see #getSession
+ */
+ public HttpSessionBindingEvent(HttpSession session, String name) {
+ super(session);
+ this.name = name;
+ this.value = null;
+ }
+
+ /**
+ * Constructs an event that notifies an object that it has been bound to or
+ * unbound from a session. To receive the event, the object must implement
+ * {@link HttpSessionBindingListener}.
+ *
+ * @param session
+ * the session to which the object is bound or unbound
+ * @param name
+ * the name with which the object is bound or unbound
+ * @see #getName
+ * @see #getSession
+ */
+ public HttpSessionBindingEvent(HttpSession session, String name,
+ Object value) {
+ super(session);
+ this.name = name;
+ this.value = value;
+ }
+
+ /** Return the session that changed. */
+ @Override
+ public HttpSession getSession() {
+ return super.getSession();
+ }
+
+ /**
+ * Returns the name with which the attribute is bound to or unbound from the
+ * session.
+ *
+ * @return a string specifying the name with which the object is bound to or
+ * unbound from the session
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Returns the value of the attribute that has been added, removed or
+ * replaced. If the attribute was added (or bound), this is the value of the
+ * attribute. If the attribute was removed (or unbound), this is the value
+ * of the removed attribute. If the attribute was replaced, this is the old
+ * value of the attribute.
+ *
+ * @since 2.3
+ */
+ public Object getValue() {
+ return this.value;
+ }
+}
diff --git a/bundles/org.apache.tomcat/src/javax/servlet/http/HttpSessionBindingListener.java b/bundles/org.apache.tomcat/src/javax/servlet/http/HttpSessionBindingListener.java
new file mode 100644
index 0000000..121ca1a
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/javax/servlet/http/HttpSessionBindingListener.java
@@ -0,0 +1,55 @@
+/*
+ * 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 javax.servlet.http;
+
+import java.util.EventListener;
+
+/**
+ * Causes an object to be notified when it is bound to or unbound from a
+ * session. The object is notified by an {@link HttpSessionBindingEvent} object.
+ * This may be as a result of a servlet programmer explicitly unbinding an
+ * attribute from a session, due to a session being invalidated, or due to a
+ * session timing out.
+ *
+ * @author Various
+ * @version $Version$
+ * @see HttpSession
+ * @see HttpSessionBindingEvent
+ */
+public interface HttpSessionBindingListener extends EventListener {
+
+ /**
+ * Notifies the object that it is being bound to a session and identifies
+ * the session.
+ *
+ * @param event
+ * the event that identifies the session
+ * @see #valueUnbound
+ */
+ public void valueBound(HttpSessionBindingEvent event);
+
+ /**
+ * Notifies the object that it is being unbound from a session and
+ * identifies the session.
+ *
+ * @param event
+ * the event that identifies the session
+ * @see #valueBound
+ */
+ public void valueUnbound(HttpSessionBindingEvent event);
+}
diff --git a/bundles/org.apache.tomcat/src/javax/servlet/http/HttpSessionContext.java b/bundles/org.apache.tomcat/src/javax/servlet/http/HttpSessionContext.java
new file mode 100644
index 0000000..f6b2bcb
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/javax/servlet/http/HttpSessionContext.java
@@ -0,0 +1,53 @@
+/*
+ * 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 javax.servlet.http;
+
+import java.util.Enumeration;
+
+/**
+ * @author Various
+ * @version $Version$
+ * @deprecated As of Java(tm) Servlet API 2.1 for security reasons, with no
+ * replacement. This interface will be removed in a future version
+ * of this API.
+ * @see HttpSession
+ * @see HttpSessionBindingEvent
+ * @see HttpSessionBindingListener
+ */
+@SuppressWarnings("dep-ann")
+// Spec API does not use @Deprecated
+public interface HttpSessionContext {
+
+ /**
+ * @deprecated As of Java Servlet API 2.1 with no replacement. This method
+ * must return null and will be removed in a future version of
+ * this API.
+ */
+ @SuppressWarnings("dep-ann")
+ // Spec API does not use @Deprecated
+ public HttpSession getSession(String sessionId);
+
+ /**
+ * @deprecated As of Java Servlet API 2.1 with no replacement. This method
+ * must return an empty <code>Enumeration</code> and will be
+ * removed in a future version of this API.
+ */
+ @SuppressWarnings("dep-ann")
+ // Spec API does not use @Deprecated
+ public Enumeration<String> getIds();
+}
diff --git a/bundles/org.apache.tomcat/src/javax/servlet/http/HttpSessionEvent.java b/bundles/org.apache.tomcat/src/javax/servlet/http/HttpSessionEvent.java
new file mode 100644
index 0000000..79a34c5
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/javax/servlet/http/HttpSessionEvent.java
@@ -0,0 +1,37 @@
+/*
+ * 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 javax.servlet.http;
+
+/**
+ * This is the class representing event notifications for changes to sessions
+ * within a web application.
+ *
+ * @since v 2.3
+ */
+public class HttpSessionEvent extends java.util.EventObject {
+ private static final long serialVersionUID = 1L;
+
+ /** Construct a session event from the given source. */
+ public HttpSessionEvent(HttpSession source) {
+ super(source);
+ }
+
+ /** Return the session that changed. */
+ public HttpSession getSession() {
+ return (HttpSession) super.getSource();
+ }
+}
diff --git a/bundles/org.apache.tomcat/src/javax/servlet/http/HttpSessionListener.java b/bundles/org.apache.tomcat/src/javax/servlet/http/HttpSessionListener.java
new file mode 100644
index 0000000..f7f862c
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/javax/servlet/http/HttpSessionListener.java
@@ -0,0 +1,48 @@
+/*
+ * 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 javax.servlet.http;
+
+import java.util.EventListener;
+
+/**
+ * Implementations of this interface are notified of changes to the list of
+ * active sessions in a web application. To receive notification events, the
+ * implementation class must be configured in the deployment descriptor for the
+ * web application.
+ *
+ * @see HttpSessionEvent
+ * @since v 2.3
+ */
+public interface HttpSessionListener extends EventListener {
+
+ /**
+ * Notification that a session was created.
+ *
+ * @param se
+ * the notification event
+ */
+ public void sessionCreated(HttpSessionEvent se);
+
+ /**
+ * Notification that a session is about to be invalidated.
+ *
+ * @param se
+ * the notification event
+ */
+ public void sessionDestroyed(HttpSessionEvent se);
+
+}
diff --git a/bundles/org.apache.tomcat/src/javax/servlet/http/HttpUtils.java b/bundles/org.apache.tomcat/src/javax/servlet/http/HttpUtils.java
new file mode 100644
index 0000000..e7e1b91
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/javax/servlet/http/HttpUtils.java
@@ -0,0 +1,282 @@
+/*
+* 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 javax.servlet.http;
+
+import java.io.IOException;
+import java.util.Hashtable;
+import java.util.ResourceBundle;
+import java.util.StringTokenizer;
+
+import javax.servlet.ServletInputStream;
+
+/**
+ * @deprecated As of Java(tm) Servlet API 2.3.
+ * These methods were only useful
+ * with the default encoding and have been moved
+ * to the request interfaces.
+ */
+@SuppressWarnings("dep-ann") // Spec API does not use @Deprecated
+public class HttpUtils {
+
+ private static final String LSTRING_FILE =
+ "javax.servlet.http.LocalStrings";
+ private static ResourceBundle lStrings =
+ ResourceBundle.getBundle(LSTRING_FILE);
+
+
+ /**
+ * Constructs an empty <code>HttpUtils</code> object.
+ *
+ */
+ public HttpUtils() {
+ // NOOP
+ }
+
+
+ /**
+ *
+ * Parses a query string passed from the client to the
+ * server and builds a <code>HashTable</code> object
+ * with key-value pairs.
+ * The query string should be in the form of a string
+ * packaged by the GET or POST method, that is, it
+ * should have key-value pairs in the form <i>key=value</i>,
+ * with each pair separated from the next by a &amp; character.
+ *
+ * <p>A key can appear more than once in the query string
+ * with different values. However, the key appears only once in
+ * the hashtable, with its value being
+ * an array of strings containing the multiple values sent
+ * by the query string.
+ *
+ * <p>The keys and values in the hashtable are stored in their
+ * decoded form, so
+ * any + characters are converted to spaces, and characters
+ * sent in hexadecimal notation (like <i>%xx</i>) are
+ * converted to ASCII characters.
+ *
+ * @param s a string containing the query to be parsed
+ *
+ * @return a <code>HashTable</code> object built
+ * from the parsed key-value pairs
+ *
+ * @exception IllegalArgumentException if the query string
+ * is invalid
+ *
+ */
+ public static Hashtable<String,String[]> parseQueryString(String s) {
+
+ String valArray[] = null;
+
+ if (s == null) {
+ throw new IllegalArgumentException();
+ }
+ Hashtable<String,String[]> ht = new Hashtable<String,String[]>();
+ StringBuilder sb = new StringBuilder();
+ StringTokenizer st = new StringTokenizer(s, "&");
+ while (st.hasMoreTokens()) {
+ String pair = st.nextToken();
+ int pos = pair.indexOf('=');
+ if (pos == -1) {
+ // XXX
+ // should give more detail about the illegal argument
+ throw new IllegalArgumentException();
+ }
+ String key = parseName(pair.substring(0, pos), sb);
+ String val = parseName(pair.substring(pos+1, pair.length()), sb);
+ if (ht.containsKey(key)) {
+ String oldVals[] = ht.get(key);
+ valArray = new String[oldVals.length + 1];
+ for (int i = 0; i < oldVals.length; i++)
+ valArray[i] = oldVals[i];
+ valArray[oldVals.length] = val;
+ } else {
+ valArray = new String[1];
+ valArray[0] = val;
+ }
+ ht.put(key, valArray);
+ }
+ return ht;
+ }
+
+
+ /**
+ *
+ * Parses data from an HTML form that the client sends to
+ * the server using the HTTP POST method and the
+ * <i>application/x-www-form-urlencoded</i> MIME type.
+ *
+ * <p>The data sent by the POST method contains key-value
+ * pairs. A key can appear more than once in the POST data
+ * with different values. However, the key appears only once in
+ * the hashtable, with its value being
+ * an array of strings containing the multiple values sent
+ * by the POST method.
+ *
+ * <p>The keys and values in the hashtable are stored in their
+ * decoded form, so
+ * any + characters are converted to spaces, and characters
+ * sent in hexadecimal notation (like <i>%xx</i>) are
+ * converted to ASCII characters.
+ *
+ *
+ *
+ * @param len an integer specifying the length,
+ * in characters, of the
+ * <code>ServletInputStream</code>
+ * object that is also passed to this
+ * method
+ *
+ * @param in the <code>ServletInputStream</code>
+ * object that contains the data sent
+ * from the client
+ *
+ * @return a <code>HashTable</code> object built
+ * from the parsed key-value pairs
+ *
+ *
+ * @exception IllegalArgumentException if the data
+ * sent by the POST method is invalid
+ *
+ */
+ public static Hashtable<String,String[]> parsePostData(int len,
+ ServletInputStream in) {
+ // XXX
+ // should a length of 0 be an IllegalArgumentException
+
+ // cheap hack to return an empty hash
+ if (len <=0)
+ return new Hashtable<String,String[]>();
+
+ if (in == null) {
+ throw new IllegalArgumentException();
+ }
+
+ // Make sure we read the entire POSTed body.
+ byte[] postedBytes = new byte [len];
+ try {
+ int offset = 0;
+
+ do {
+ int inputLen = in.read (postedBytes, offset, len - offset);
+ if (inputLen <= 0) {
+ String msg = lStrings.getString("err.io.short_read");
+ throw new IllegalArgumentException (msg);
+ }
+ offset += inputLen;
+ } while ((len - offset) > 0);
+
+ } catch (IOException e) {
+ throw new IllegalArgumentException(e.getMessage(), e);
+ }
+
+ // XXX we shouldn't assume that the only kind of POST body
+ // is FORM data encoded using ASCII or ISO Latin/1 ... or
+ // that the body should always be treated as FORM data.
+ try {
+ String postedBody = new String(postedBytes, 0, len, "8859_1");
+ return parseQueryString(postedBody);
+ } catch (java.io.UnsupportedEncodingException e) {
+ // XXX function should accept an encoding parameter & throw this
+ // exception. Otherwise throw something expected.
+ throw new IllegalArgumentException(e.getMessage(), e);
+ }
+ }
+
+
+ /*
+ * Parse a name in the query string.
+ */
+ private static String parseName(String s, StringBuilder sb) {
+ sb.setLength(0);
+ for (int i = 0; i < s.length(); i++) {
+ char c = s.charAt(i);
+ switch (c) {
+ case '+':
+ sb.append(' ');
+ break;
+ case '%':
+ try {
+ sb.append((char) Integer.parseInt(s.substring(i+1, i+3),
+ 16));
+ i += 2;
+ } catch (NumberFormatException e) {
+ // XXX
+ // need to be more specific about illegal arg
+ throw new IllegalArgumentException();
+ } catch (StringIndexOutOfBoundsException e) {
+ String rest = s.substring(i);
+ sb.append(rest);
+ if (rest.length()==2)
+ i++;
+ }
+
+ break;
+ default:
+ sb.append(c);
+ break;
+ }
+ }
+ return sb.toString();
+ }
+
+
+ /**
+ *
+ * Reconstructs the URL the client used to make the request,
+ * using information in the <code>HttpServletRequest</code> object.
+ * The returned URL contains a protocol, server name, port
+ * number, and server path, but it does not include query
+ * string parameters.
+ *
+ * <p>Because this method returns a <code>StringBuffer</code>,
+ * not a string, you can modify the URL easily, for example,
+ * to append query parameters.
+ *
+ * <p>This method is useful for creating redirect messages
+ * and for reporting errors.
+ *
+ * @param req a <code>HttpServletRequest</code> object
+ * containing the client's request
+ *
+ * @return a <code>StringBuffer</code> object containing
+ * the reconstructed URL
+ *
+ */
+ public static StringBuffer getRequestURL (HttpServletRequest req) {
+ StringBuffer url = new StringBuffer ();
+ String scheme = req.getScheme ();
+ int port = req.getServerPort ();
+ String urlPath = req.getRequestURI();
+
+ url.append (scheme); // http, https
+ url.append ("://");
+ url.append (req.getServerName ());
+ if ((scheme.equals ("http") && port != 80)
+ || (scheme.equals ("https") && port != 443)) {
+ url.append (':');
+ url.append (req.getServerPort ());
+ }
+
+ url.append(urlPath);
+ return url;
+ }
+}
+
+
+
diff --git a/bundles/org.apache.tomcat/src/javax/servlet/http/LocalStrings.properties b/bundles/org.apache.tomcat/src/javax/servlet/http/LocalStrings.properties
new file mode 100644
index 0000000..7621fee
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/javax/servlet/http/LocalStrings.properties
@@ -0,0 +1,29 @@
+# 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.
+
+# Default localized string information
+# Localized for Locale en_US
+
+err.cookie_name_is_token=Cookie name \"{0}\" is a reserved token
+err.cookie_name_blank=Cookie name may not be null or zero length
+err.io.negativelength=Negative Length given in write method
+err.io.short_read=Short Read
+
+http.method_not_implemented=Method {0} is not is not implemented by this servlet for this URI
+
+http.method_get_not_supported=HTTP method GET is not supported by this URL
+http.method_post_not_supported=HTTP method POST is not supported by this URL
+http.method_put_not_supported=HTTP method PUT is not supported by this URL
+http.method_delete_not_supported=Http method DELETE is not supported by this URL
diff --git a/bundles/org.apache.tomcat/src/javax/servlet/http/LocalStrings_es.properties b/bundles/org.apache.tomcat/src/javax/servlet/http/LocalStrings_es.properties
new file mode 100644
index 0000000..793fa6b
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/javax/servlet/http/LocalStrings_es.properties
@@ -0,0 +1,30 @@
+# 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.
+
+# $Id: LocalStrings_es.properties,v 1.1 2011/06/28 21:14:12 rherrmann Exp $
+#
+# Default localized string information
+# Localized para Locale es_ES
+
+err.cookie_name_is_token=El Nombre de Cookie {0} es una palabra reservada
+err.io.negativelength=Longitud Negativa en el metodo write
+err.io.short_read=Lectura Corta
+
+http.method_not_implemented=El Metodo {0} no esta definido en la especificacion RFC 2068 y no es soportado por la API Servlet
+
+http.method_get_not_supported=El Metodo HTTP GET no es soportado por esta URL
+http.method_post_not_supported=El Metodo HTTP POST no es soportado por esta URL
+http.method_put_not_supported=El Metodo HTTP PUT no es soportado por esta URL
+http.method_delete_not_supported=El Metodo HTTP DELETE no es soportado por esta URL
diff --git a/bundles/org.apache.tomcat/src/javax/servlet/http/LocalStrings_fr.properties b/bundles/org.apache.tomcat/src/javax/servlet/http/LocalStrings_fr.properties
new file mode 100644
index 0000000..47b8dd7
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/javax/servlet/http/LocalStrings_fr.properties
@@ -0,0 +1,28 @@
+# 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.
+
+# Default localized string information
+# Localized for Locale fr_FR
+
+err.cookie_name_is_token=Le nom de cookie \"{0}\" est un \"token\" r\u00e9serv\u00e9
+err.io.negativelength=Taille n\u00e9gative donn\u00e9e dans la m\u00e9thode \"write\"
+err.io.short_read=Lecture partielle
+
+http.method_not_implemented=Le m\u00e9thode {0} n''est pas d\u00e9finie dans la RFC 2068 et n''est pas support\u00e9e par l''API Servlet
+
+http.method_get_not_supported=La m\u00e9thode HTTP GET n''est pas support\u00e9e par cette URL
+http.method_post_not_supported=La m\u00e9thode HTTP POST n''est pas support\u00e9e par cette URL
+http.method_put_not_supported=La m\u00e9thode HTTP PUT n''est pas support\u00e9e par cette URL
+http.method_delete_not_supported=La m\u00e9thode HTTP DELETE n''est pas support\u00e9e par cette URL
diff --git a/bundles/org.apache.tomcat/src/javax/servlet/http/LocalStrings_ja.properties b/bundles/org.apache.tomcat/src/javax/servlet/http/LocalStrings_ja.properties
new file mode 100644
index 0000000..70983d7
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/javax/servlet/http/LocalStrings_ja.properties
@@ -0,0 +1,28 @@
+# 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.
+
+# Default localized string information
+# Localized for Locale ja_JP
+
+err.cookie_name_is_token=\u30af\u30c3\u30ad\u30fc\u540d \"{0}\" \u306f\u4e88\u7d04\u6e08\u306e\u30c8\u30fc\u30af\u30f3\u3067\u3059\u3002
+err.io.negativelength=write\u30e1\u30bd\u30c3\u30c9\u306b\u8ca0\u306e\u9577\u3055\u304c\u6307\u5b9a\u3055\u308c\u307e\u3057\u305f\u3002
+err.io.short_read=\u8aad\u307f\u8fbc\u307f\u304c\u3059\u3050\u306b\u7d42\u308f\u308a\u307e\u3057\u305f\u3002
+
+http.method_not_implemented=\u30e1\u30bd\u30c3\u30c9 {0} \u306fRFC 2068\u306b\u306f\u5b9a\u7fa9\u3055\u308c\u3066\u304a\u3089\u305a\u3001\u30b5\u30fc\u30d6\u30ec\u30c3\u30c8API\u3067\u306f\u30b5\u30dd\u30fc\u30c8\u3055\u308c\u307e\u305b\u3093\u3002
+
+http.method_get_not_supported=HTTP\u306eGET\u30e1\u30bd\u30c3\u30c9\u306f\u3001\u3053\u306eURL\u3067\u306f\u30b5\u30dd\u30fc\u30c8\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002
+http.method_post_not_supported=HTTP\u306ePOST\u30e1\u30bd\u30c3\u30c9\u306f\u3001\u3053\u306eURL\u3067\u306f\u30b5\u30dd\u30fc\u30c8\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002
+http.method_put_not_supported=HTTP\u306ePUT\u30e1\u30bd\u30c3\u30c9\u306f\u3001\u3053\u306eURL\u3067\u306f\u30b5\u30dd\u30fc\u30c8\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002
+http.method_delete_not_supported=HTTP\u306eDELETE\u30e1\u30bd\u30c3\u30c9\u306f\u3001\u3053\u306eURL\u3067\u306f\u30b5\u30dd\u30fc\u30c8\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002
diff --git a/bundles/org.apache.tomcat/src/javax/servlet/http/Part.java b/bundles/org.apache.tomcat/src/javax/servlet/http/Part.java
new file mode 100644
index 0000000..3e60e40
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/javax/servlet/http/Part.java
@@ -0,0 +1,44 @@
+/*
+* 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 javax.servlet.http;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Collection;
+
+/**
+ * @since Servlet 3.0
+ * TODO SERVLET3 - Add comments
+ */
+public interface Part {
+ public InputStream getInputStream() throws IOException;
+ public String getContentType();
+ public String getName();
+ public long getSize();
+ public void write(String fileName) throws IOException;
+ public void delete() throws IOException;
+
+ /**
+ * Obtains the value of the specified mime header for the part.
+ * @param name Header name
+ * @return The header value or <code>null</code> if the header is not
+ * present
+ */
+ public String getHeader(String name);
+ public Collection<String> getHeaders(String name);
+ public Collection<String> getHeaderNames();
+}
diff --git a/bundles/org.apache.tomcat/src/javax/servlet/http/package.html b/bundles/org.apache.tomcat/src/javax/servlet/http/package.html
new file mode 100644
index 0000000..08e6692
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/javax/servlet/http/package.html
@@ -0,0 +1,30 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<HTML>
+<HEAD>
+<!--
+ 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.
+-->
+</HEAD>
+<BODY BGCOLOR="white">
+
+The javax.servlet.http package contains a number of classes and interfaces
+that describe and define the contracts between a servlet class
+running under the HTTP protocol and the runtime environment provided
+for an instance of such a class by a conforming servlet container.
+
+
+</BODY>
+</HTML>
diff --git a/bundles/org.apache.tomcat/src/javax/servlet/jsp/ErrorData.java b/bundles/org.apache.tomcat/src/javax/servlet/jsp/ErrorData.java
new file mode 100644
index 0000000..a517ad7
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/javax/servlet/jsp/ErrorData.java
@@ -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 javax.servlet.jsp;
+
+/**
+ * Contains information about an error, for error pages. The information
+ * contained in this instance is meaningless if not used in the context of an
+ * error page. To indicate a JSP is an error page, the page author must set the
+ * isErrorPage attribute of the page directive to "true".
+ *
+ * @see PageContext#getErrorData
+ * @since 2.0
+ */
+public final class ErrorData {
+
+ private final Throwable throwable;
+ private final int statusCode;
+ private final String uri;
+ private final String servletName;
+
+ /**
+ * Creates a new ErrorData object.
+ *
+ * @param throwable
+ * The Throwable that is the cause of the error
+ * @param statusCode
+ * The status code of the error
+ * @param uri
+ * The request URI
+ * @param servletName
+ * The name of the servlet invoked
+ */
+ public ErrorData(Throwable throwable, int statusCode, String uri,
+ String servletName) {
+ this.throwable = throwable;
+ this.statusCode = statusCode;
+ this.uri = uri;
+ this.servletName = servletName;
+ }
+
+ /**
+ * Returns the Throwable that caused the error.
+ *
+ * @return The Throwable that caused the error
+ */
+ public Throwable getThrowable() {
+ return this.throwable;
+ }
+
+ /**
+ * Returns the status code of the error.
+ *
+ * @return The status code of the error
+ */
+ public int getStatusCode() {
+ return this.statusCode;
+ }
+
+ /**
+ * Returns the request URI.
+ *
+ * @return The request URI
+ */
+ public String getRequestURI() {
+ return this.uri;
+ }
+
+ /**
+ * Returns the name of the servlet invoked.
+ *
+ * @return The name of the servlet invoked
+ */
+ public String getServletName() {
+ return this.servletName;
+ }
+}
diff --git a/bundles/org.apache.tomcat/src/javax/servlet/jsp/HttpJspPage.java b/bundles/org.apache.tomcat/src/javax/servlet/jsp/HttpJspPage.java
new file mode 100644
index 0000000..0351a09
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/javax/servlet/jsp/HttpJspPage.java
@@ -0,0 +1,60 @@
+/*
+* 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 javax.servlet.jsp;
+
+import java.io.IOException;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * The HttpJspPage interface describes the interaction that a JSP Page
+ * Implementation Class must satisfy when using the HTTP protocol.
+ *
+ * <p>
+ * The behaviour is identical to that of the JspPage, except for the signature
+ * of the _jspService method, which is now expressible in the Java type
+ * system and included explicitly in the interface.
+ *
+ * @see JspPage
+ */
+
+public interface HttpJspPage extends JspPage {
+
+ /** The _jspService()method corresponds to the body of the JSP page. This
+ * method is defined automatically by the JSP container and should never
+ * be defined by the JSP page author.
+ * <p>
+ * If a superclass is specified using the extends attribute, that
+ * superclass may choose to perform some actions in its service() method
+ * before or after calling the _jspService() method. See using the extends
+ * attribute in the JSP_Engine chapter of the JSP specification.
+ *
+ * @param request Provides client request information to the JSP.
+ * @param response Assists the JSP in sending a response to the client.
+ * @throws ServletException Thrown if an error occurred during the
+ * processing of the JSP and that the container should take
+ * appropriate action to clean up the request.
+ * @throws IOException Thrown if an error occurred while writing the
+ * response for this page.
+ */
+ public void _jspService(HttpServletRequest request,
+ HttpServletResponse response)
+ throws ServletException, IOException;
+}
diff --git a/bundles/org.apache.tomcat/src/javax/servlet/jsp/JspApplicationContext.java b/bundles/org.apache.tomcat/src/javax/servlet/jsp/JspApplicationContext.java
new file mode 100644
index 0000000..10817e0
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/javax/servlet/jsp/JspApplicationContext.java
@@ -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 javax.servlet.jsp;
+
+import javax.el.ELContextListener;
+import javax.el.ELResolver;
+import javax.el.ExpressionFactory;
+
+/**
+ * <p>
+ * Stores <i>application</i>-scoped information for the JSP container.
+ * </p>
+ *
+ * @since 2.1
+ */
+public interface JspApplicationContext {
+
+ /**
+ * <p>
+ * Registers an <code>ELContextListener</code> that will notified whenever a
+ * new <code>ELContext</code> is created.
+ * </p>
+ * <p>
+ * At the very least, any <code>ELContext</code> instantiated will have
+ * reference to the <code>JspContext</code> under
+ * <code>JspContext.class</code>.
+ * </p>
+ *
+ * @param listener
+ */
+ public void addELContextListener(ELContextListener listener);
+
+ /**
+ * <p>
+ * Adds an <code>ELResolver</code> to the chain of EL variable and property
+ * management within JSP pages and Tag files.
+ * </p>
+ * <p>
+ * JSP has a default set of ELResolvers to chain for all EL evaluation:
+ * <ul>
+ * <li><code>ImplicitObjectELResolver</code></li>
+ * <li><code>ELResolver</code> instances registered with this method</li>
+ * <li><code>MapELResolver</code></li>
+ * <li><code>ListELResolver</code></li>
+ * <li><code>ArrayELResolver</code></li>
+ * <li><code>BeanELResolver</code></li>
+ * <li><code>ScopedAttributeELResolver</code></li>
+ * </ul>
+ * </p>
+ *
+ * @param resolver
+ * an additional resolver
+ * @throws IllegalStateException
+ * if called after the application's
+ * <code>ServletContextListeners</code> have been initialized.
+ */
+ public void addELResolver(ELResolver resolver) throws IllegalStateException;
+
+ /**
+ * <p>
+ * Returns the JSP container's <code>ExpressionFactory</code> implementation
+ * for EL use.
+ * </p>
+ *
+ * @return an <code>ExpressionFactory</code> implementation
+ */
+ public ExpressionFactory getExpressionFactory();
+
+}
diff --git a/bundles/org.apache.tomcat/src/javax/servlet/jsp/JspContext.java b/bundles/org.apache.tomcat/src/javax/servlet/jsp/JspContext.java
new file mode 100644
index 0000000..3898319
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/javax/servlet/jsp/JspContext.java
@@ -0,0 +1,282 @@
+/*
+* 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 javax.servlet.jsp;
+
+import java.util.Enumeration;
+
+import javax.el.ELContext;
+
+/**
+ * <p>
+ * <code>JspContext</code> serves as the base class for the
+ * PageContext class and abstracts all information that is not specific
+ * to servlets. This allows for Simple Tag Extensions to be used
+ * outside of the context of a request/response Servlet.
+ * <p>
+ * The JspContext provides a number of facilities to the
+ * page/component author and page implementor, including:
+ * <ul>
+ * <li>a single API to manage the various scoped namespaces
+ * <li>a mechanism to obtain the JspWriter for output
+ * <li>a mechanism to expose page directive attributes to the
+ * scripting environment
+ * </ul>
+ *
+ * <p><B>Methods Intended for Container Generated Code</B>
+ * <p>
+ * The following methods enable the <B>management of nested</B> JspWriter
+ * streams to implement Tag Extensions: <code>pushBody()</code> and
+ * <code>popBody()</code>
+ *
+ * <p><B>Methods Intended for JSP authors</B>
+ * <p>
+ * Some methods provide <B>uniform access</B> to the diverse objects
+ * representing scopes.
+ * The implementation must use the underlying machinery
+ * corresponding to that scope, so information can be passed back and
+ * forth between the underlying environment (e.g. Servlets) and JSP pages.
+ * The methods are:
+ * <code>setAttribute()</code>, <code>getAttribute()</code>,
+ * <code>findAttribute()</code>, <code>removeAttribute()</code>,
+ * <code>getAttributesScope()</code> and
+ * <code>getAttributeNamesInScope()</code>.
+ *
+ * <p>
+ * The following methods provide <B>convenient access</B> to implicit objects:
+ * <code>getOut()</code>
+ *
+ * <p>
+ * The following methods provide <B>programmatic access</b> to the
+ * Expression Language evaluator:
+ * <code>getExpressionEvaluator()</code>, <code>getVariableResolver()</code>
+ *
+ * @since 2.0
+ */
+
+public abstract class JspContext {
+
+ /**
+ * Sole constructor. (For invocation by subclass constructors,
+ * typically implicit.)
+ */
+ public JspContext() {
+ // NOOP by default
+ }
+
+ /**
+ * Register the name and value specified with page scope semantics.
+ * If the value passed in is <code>null</code>, this has the same
+ * effect as calling
+ * <code>removeAttribute( name, PageContext.PAGE_SCOPE )</code>.
+ *
+ * @param name the name of the attribute to set
+ * @param value the value to associate with the name, or null if the
+ * attribute is to be removed from the page scope.
+ * @throws NullPointerException if the name is null
+ */
+
+ public abstract void setAttribute(String name, Object value);
+
+ /**
+ * Register the name and value specified with appropriate
+ * scope semantics. If the value passed in is <code>null</code>,
+ * this has the same effect as calling
+ * <code>removeAttribute( name, scope )</code>.
+ *
+ * @param name the name of the attribute to set
+ * @param value the object to associate with the name, or null if
+ * the attribute is to be removed from the specified scope.
+ * @param scope the scope with which to associate the name/object
+ *
+ * @throws NullPointerException if the name is null
+ * @throws IllegalArgumentException if the scope is invalid
+ * @throws IllegalStateException if the scope is
+ * PageContext.SESSION_SCOPE but the page that was requested
+ * does not participate in a session or the session has been
+ * invalidated.
+ */
+
+ public abstract void setAttribute(String name, Object value, int scope);
+
+ /**
+ * Returns the object associated with the name in the page scope or null
+ * if not found.
+ *
+ * @param name the name of the attribute to get
+ * @return the object associated with the name in the page scope
+ * or null if not found.
+ *
+ * @throws NullPointerException if the name is null
+ */
+
+ public abstract Object getAttribute(String name);
+
+ /**
+ * Return the object associated with the name in the specified
+ * scope or null if not found.
+ *
+ * @param name the name of the attribute to set
+ * @param scope the scope with which to associate the name/object
+ * @return the object associated with the name in the specified
+ * scope or null if not found.
+ *
+ * @throws NullPointerException if the name is null
+ * @throws IllegalArgumentException if the scope is invalid
+ * @throws IllegalStateException if the scope is
+ * PageContext.SESSION_SCOPE but the page that was requested
+ * does not participate in a session or the session has been
+ * invalidated.
+ */
+
+ public abstract Object getAttribute(String name, int scope);
+
+ /**
+ * Searches for the named attribute in page, request, session (if valid),
+ * and application scope(s) in order and returns the value associated or
+ * null.
+ *
+ * @param name the name of the attribute to search for
+ * @return the value associated or null
+ * @throws NullPointerException if the name is null
+ */
+
+ public abstract Object findAttribute(String name);
+
+ /**
+ * Remove the object reference associated with the given name
+ * from all scopes. Does nothing if there is no such object.
+ *
+ * @param name The name of the object to remove.
+ * @throws NullPointerException if the name is null
+ */
+
+ public abstract void removeAttribute(String name);
+
+ /**
+ * Remove the object reference associated with the specified name
+ * in the given scope. Does nothing if there is no such object.
+ *
+ * @param name The name of the object to remove.
+ * @param scope The scope where to look.
+ * @throws IllegalArgumentException if the scope is invalid
+ * @throws IllegalStateException if the scope is
+ * PageContext.SESSION_SCOPE but the page that was requested
+ * does not participate in a session or the session has been
+ * invalidated.
+ * @throws NullPointerException if the name is null
+ */
+
+ public abstract void removeAttribute(String name, int scope);
+
+ /**
+ * Get the scope where a given attribute is defined.
+ *
+ * @param name the name of the attribute to return the scope for
+ * @return the scope of the object associated with the name specified or 0
+ * @throws NullPointerException if the name is null
+ */
+
+ public abstract int getAttributesScope(String name);
+
+ /**
+ * Enumerate all the attributes in a given scope.
+ *
+ * @param scope the scope to enumerate all the attributes for
+ * @return an enumeration of names (java.lang.String) of all the
+ * attributes the specified scope
+ * @throws IllegalArgumentException if the scope is invalid
+ * @throws IllegalStateException if the scope is
+ * PageContext.SESSION_SCOPE but the page that was requested
+ * does not participate in a session or the session has been
+ * invalidated.
+ */
+
+ public abstract Enumeration<String> getAttributeNamesInScope(int scope);
+
+ /**
+ * The current value of the out object (a JspWriter).
+ *
+ * @return the current JspWriter stream being used for client response
+ */
+ public abstract JspWriter getOut();
+
+ /**
+ * Provides programmatic access to the ExpressionEvaluator.
+ * The JSP Container must return a valid instance of an
+ * ExpressionEvaluator that can parse EL expressions.
+ *
+ * @return A valid instance of an ExpressionEvaluator.
+ * @since 2.0
+ * @deprecated As of JSP 2.1, replaced by
+ * JspApplicationContext.getExpressionFactory()
+ */
+ @SuppressWarnings("dep-ann") // TCK signature test fails with annotation
+ public abstract javax.servlet.jsp.el.ExpressionEvaluator getExpressionEvaluator();
+
+
+ public abstract ELContext getELContext();
+
+ /**
+ * Returns an instance of a VariableResolver that provides access to the
+ * implicit objects specified in the JSP specification using this JspContext
+ * as the context object.
+ *
+ * @return A valid instance of a VariableResolver.
+ * @since 2.0
+ * @deprecated As of JSP 2.1,
+ * replaced by javax.el.ELContext.getELResolver()
+ * which can be obtained by
+ * jspContext.getELContext().getELResolver()
+ */
+ @SuppressWarnings("dep-ann") // TCK signature test fails with annotation
+ public abstract javax.servlet.jsp.el.VariableResolver getVariableResolver();
+
+ /**
+ * Return a new JspWriter object that sends output to the
+ * provided Writer. Saves the current "out" JspWriter,
+ * and updates the value of the "out" attribute in the
+ * page scope attribute namespace of the JspContext.
+ * <p>The returned JspWriter must implement all methods and
+ * behave as though it were unbuffered. More specifically:
+ * <ul>
+ * <li>clear() must throw an IOException</li>
+ * <li>clearBuffer() does nothing</li>
+ * <li>getBufferSize() always returns 0</li>
+ * <li>getRemaining() always returns 0</li>
+ * </ul>
+ * </p>
+ *
+ * @param writer The Writer for the returned JspWriter to send
+ * output to.
+ * @return a new JspWriter that writes to the given Writer.
+ * @since 2.0
+ */
+ public JspWriter pushBody( java.io.Writer writer ) {
+ return null; // XXX to implement
+ }
+
+ /**
+ * Return the previous JspWriter "out" saved by the matching
+ * pushBody(), and update the value of the "out" attribute in
+ * the page scope attribute namespace of the JspContext.
+ *
+ * @return the saved JspWriter.
+ */
+ public JspWriter popBody() {
+ return null; // XXX to implement
+ }
+}
diff --git a/bundles/org.apache.tomcat/src/javax/servlet/jsp/JspEngineInfo.java b/bundles/org.apache.tomcat/src/javax/servlet/jsp/JspEngineInfo.java
new file mode 100644
index 0000000..b07a0a3
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/javax/servlet/jsp/JspEngineInfo.java
@@ -0,0 +1,49 @@
+/*
+* 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 javax.servlet.jsp;
+
+/**
+ * The JspEngineInfo is an abstract class that provides information on the
+ * current JSP engine.
+ */
+
+public abstract class JspEngineInfo {
+
+ /**
+ * Sole constructor. (For invocation by subclass constructors,
+ * typically implicit.)
+ */
+ public JspEngineInfo() {
+ // NOOP by default
+ }
+
+ /**
+ * Return the version number of the JSP specification that is supported by
+ * this JSP engine.
+ * <p>
+ * Specification version numbers that consists of positive decimal integers
+ * separated by periods ".", for example, "2.0" or "1.2.3.4.5.6.7".
+ * This allows an extensible number to be used to
+ * represent major, minor, micro, etc versions.
+ * The version number must begin with a number.
+ * </p>
+ *
+ * @return the specification version, null is returned if it is not known
+ */
+
+ public abstract String getSpecificationVersion();
+}
diff --git a/bundles/org.apache.tomcat/src/javax/servlet/jsp/JspException.java b/bundles/org.apache.tomcat/src/javax/servlet/jsp/JspException.java
new file mode 100644
index 0000000..90f311a
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/javax/servlet/jsp/JspException.java
@@ -0,0 +1,101 @@
+/*
+* 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 javax.servlet.jsp;
+
+/**
+ * A generic exception known to the JSP engine; uncaught
+ * JspExceptions will result in an invocation of the errorpage
+ * machinery.
+ */
+public class JspException extends Exception {
+
+ private static final long serialVersionUID = 1L;
+
+
+ /**
+ * Construct a JspException.
+ */
+ public JspException() {
+ // NOOP
+ }
+
+
+ /**
+ * Constructs a new JSP exception with the
+ * specified message. The message can be written
+ * to the server log and/or displayed for the user.
+ *
+ * @param msg a <code>String</code> specifying the text of the exception
+ * message
+ */
+ public JspException(String msg) {
+ super(msg);
+ }
+
+
+ /**
+ * Constructs a new <code>JSPException</code> with the specified detail
+ * message and cause. The cause is saved for later retrieval by the
+ * <code>java.lang.Throwable.getCause()</code> and {@link #getRootCause()}
+ * methods.
+ *
+ * @see <code>java.lang.Exception.Exception(String, Throwable)</code>
+ *
+ * @param message a <code>String</code> containing the text of the
+ * exception message
+ *
+ * @param cause the <code>Throwable</code> exception that
+ * interfered with the JSP's normal operation,
+ * making this JSP exception necessary
+ */
+
+ public JspException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+
+ /**
+ * Constructs a new <code>JSPException</code> with the specified cause.
+ * The cause is saved for later retrieval by the
+ * <code>java.lang.Throwable.getCause()</code> and {@link #getRootCause()}
+ * methods.
+ *
+ * @see <code>java.lang.Exception.Exception(Throwable)</code>
+ *
+ * @param cause the <code>Throwable</code> exception that
+ * interfered with the JSP's normal operation, making
+ * the JSP exception necessary
+ */
+
+ public JspException(Throwable cause) {
+ super(cause);
+ }
+
+
+ /**
+ * Returns the exception that caused this JSP exception.
+ *
+ * @return the <code>Throwable</code> that caused this JSP exception
+ *
+ * @deprecated As of JSP 2.1, replaced by
+ * <code>java.lang.Throwable.getCause()</code>
+ */
+ @SuppressWarnings("dep-ann") // TCK signature test fails with annotation
+ public Throwable getRootCause() {
+ return getCause();
+ }
+}
diff --git a/bundles/org.apache.tomcat/src/javax/servlet/jsp/JspFactory.java b/bundles/org.apache.tomcat/src/javax/servlet/jsp/JspFactory.java
new file mode 100644
index 0000000..278c528
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/javax/servlet/jsp/JspFactory.java
@@ -0,0 +1,157 @@
+/*
+* 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 javax.servlet.jsp;
+
+import javax.servlet.Servlet;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+
+/**
+ * <p>
+ * The JspFactory is an abstract class that defines a number of factory
+ * methods available to a JSP page at runtime for the purposes of creating
+ * instances of various interfaces and classes used to support the JSP
+ * implementation.
+ * <p>
+ * A conformant JSP Engine implementation will, during it's initialization
+ * instantiate an implementation dependent subclass of this class, and make
+ * it globally available for use by JSP implementation classes by registering
+ * the instance created with this class via the
+ * static <code> setDefaultFactory() </code> method.
+ * <p>
+ * The PageContext and the JspEngineInfo classes are the only
+ * implementation-dependent classes that can be created from the factory.
+ * <p>
+ * JspFactory objects should not be used by JSP page authors.
+ */
+
+public abstract class JspFactory {
+
+ private static volatile JspFactory deflt = null;
+
+ /**
+ * Sole constructor. (For invocation by subclass constructors,
+ * typically implicit.)
+ */
+ public JspFactory() {
+ // NOOP by default
+ }
+
+ /**
+ * <p>
+ * set the default factory for this implementation. It is illegal for
+ * any principal other than the JSP Engine runtime to call this method.
+ * </p>
+ *
+ * @param deflt The default factory implementation
+ */
+
+ public static void setDefaultFactory(JspFactory deflt) {
+ JspFactory.deflt = deflt;
+ }
+
+ /**
+ * Returns the default factory for this implementation.
+ *
+ * @return the default factory for this implementation
+ */
+
+ public static JspFactory getDefaultFactory() {
+ return deflt;
+ }
+
+ /**
+ * <p>
+ * obtains an instance of an implementation dependent
+ * javax.servlet.jsp.PageContext abstract class for the calling Servlet
+ * and currently pending request and response.
+ * </p>
+ *
+ * <p>
+ * This method is typically called early in the processing of the
+ * _jspService() method of a JSP implementation class in order to
+ * obtain a PageContext object for the request being processed.
+ * </p>
+ * <p>
+ * Invoking this method shall result in the PageContext.initialize()
+ * method being invoked. The PageContext returned is properly initialized.
+ * </p>
+ * <p>
+ * All PageContext objects obtained via this method shall be released
+ * by invoking releasePageContext().
+ * </p>
+ *
+ * @param servlet the requesting servlet
+ * @param request the current request pending on the servlet
+ * @param response the current response pending on the servlet
+ * @param errorPageURL the URL of the error page for the requesting JSP, or
+ * null
+ * @param needsSession true if the JSP participates in a session
+ * @param buffer size of buffer in bytes, PageContext.NO_BUFFER if no
+ * buffer, PageContext.DEFAULT_BUFFER if
+ * implementation default.
+ * @param autoflush should the buffer autoflush to the output stream on
+ * buffer overflow, or throw an IOException?
+ *
+ * @return the page context
+ *
+ * @see javax.servlet.jsp.PageContext
+ */
+
+ public abstract PageContext getPageContext(Servlet servlet,
+ ServletRequest request, ServletResponse response,
+ String errorPageURL, boolean needsSession, int buffer,
+ boolean autoflush);
+
+ /**
+ * <p>
+ * called to release a previously allocated PageContext object.
+ * Results in PageContext.release() being invoked.
+ * This method should be invoked prior to returning from the _jspService()
+ * method of a JSP implementation class.
+ * </p>
+ *
+ * @param pc A PageContext previously obtained by getPageContext()
+ */
+ public abstract void releasePageContext(PageContext pc);
+
+ /**
+ * <p>
+ * called to get implementation-specific information on the current JSP
+ * engine.
+ * </p>
+ *
+ * @return a JspEngineInfo object describing the current JSP engine
+ */
+
+ public abstract JspEngineInfo getEngineInfo();
+
+ /**
+ * <p>
+ * Obtain the <code>JspApplicationContext</code> instance that was
+ * associated within the passed <code>ServletContext</code> for this web
+ * application.
+ * </p>
+ *
+ * @param context the current web application's <code>ServletContext</code>
+ * @return <code>JspApplicationContext</code> instance
+ * @since 2.1
+ */
+ public abstract JspApplicationContext getJspApplicationContext(
+ ServletContext context);
+}
diff --git a/bundles/org.apache.tomcat/src/javax/servlet/jsp/JspPage.java b/bundles/org.apache.tomcat/src/javax/servlet/jsp/JspPage.java
new file mode 100644
index 0000000..bcc9a92
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/javax/servlet/jsp/JspPage.java
@@ -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 javax.servlet.jsp;
+
+import javax.servlet.Servlet;
+
+/**
+ * The JspPage interface describes the generic interaction that a JSP Page
+ * Implementation class must satisfy; pages that use the HTTP protocol
+ * are described by the HttpJspPage interface.
+ *
+ * <p><B>Two plus One Methods</B>
+ * <p>
+ * The interface defines a protocol with 3 methods; only two of
+ * them: jspInit() and jspDestroy() are part of this interface as
+ * the signature of the third method: _jspService() depends on
+ * the specific protocol used and cannot be expressed in a generic
+ * way in Java.
+ * <p>
+ * A class implementing this interface is responsible for invoking
+ * the above methods at the appropriate time based on the
+ * corresponding Servlet-based method invocations.
+ * <p>
+ * The jspInit() and jspDestroy() methods can be defined by a JSP
+ * author, but the _jspService() method is defined automatically
+ * by the JSP processor based on the contents of the JSP page.
+ *
+ * <p><B>_jspService()</B>
+ * <p>
+ * The _jspService()method corresponds to the body of the JSP page. This
+ * method is defined automatically by the JSP container and should never
+ * be defined by the JSP page author.
+ * <p>
+ * If a superclass is specified using the extends attribute, that
+ * superclass may choose to perform some actions in its service() method
+ * before or after calling the _jspService() method. See using the extends
+ * attribute in the JSP_Engine chapter of the JSP specification.
+ * <p>
+ * The specific signature depends on the protocol supported by the JSP page.
+ *
+ * <pre>
+ * public void _jspService(<em>ServletRequestSubtype</em> request,
+ * <em>ServletResponseSubtype</em> response)
+ * throws ServletException, IOException;
+ * </pre>
+ */
+
+
+public interface JspPage extends Servlet {
+
+ /**
+ * The jspInit() method is invoked when the JSP page is initialized. It
+ * is the responsibility of the JSP implementation (and of the class
+ * mentioned by the extends attribute, if present) that at this point
+ * invocations to the getServletConfig() method will return the desired
+ * value.
+ *
+ * A JSP page can override this method by including a definition for it
+ * in a declaration element.
+ *
+ * A JSP page should redefine the init() method from Servlet.
+ */
+ public void jspInit();
+
+ /**
+ * The jspDestroy() method is invoked when the JSP page is about to be
+ * destroyed.
+ *
+ * A JSP page can override this method by including a definition for it
+ * in a declaration element.
+ *
+ * A JSP page should redefine the destroy() method from Servlet.
+ */
+ public void jspDestroy();
+
+}
diff --git a/bundles/org.apache.tomcat/src/javax/servlet/jsp/JspTagException.java b/bundles/org.apache.tomcat/src/javax/servlet/jsp/JspTagException.java
new file mode 100644
index 0000000..64d8697
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/javax/servlet/jsp/JspTagException.java
@@ -0,0 +1,85 @@
+/*
+ * 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 javax.servlet.jsp;
+
+/**
+ * Exception to be used by a Tag Handler to indicate some unrecoverable error.
+ * This error is to be caught by the top level of the JSP page and will result
+ * in an error page.
+ */
+public class JspTagException extends JspException {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Constructs a new JspTagException with the specified message. The message
+ * can be written to the server log and/or displayed for the user.
+ *
+ * @param msg
+ * a <code>String</code> specifying the text of the exception
+ * message
+ */
+ public JspTagException(String msg) {
+ super(msg);
+ }
+
+ /**
+ * Constructs a new JspTagException with no message.
+ */
+ public JspTagException() {
+ super();
+ }
+
+ /**
+ * Constructs a new JspTagException when the JSP Tag needs to throw an
+ * exception and include a message about the "root cause" exception that
+ * interfered with its normal operation, including a description message.
+ *
+ * @param message
+ * a <code>String</code> containing the text of the exception
+ * message
+ * @param rootCause
+ * the <code>Throwable</code> exception that interfered with the
+ * JSP Tag's normal operation, making this JSP Tag exception
+ * necessary
+ * @since 2.0
+ */
+ public JspTagException(String message, Throwable rootCause) {
+ super(message, rootCause);
+ }
+
+ /**
+ * Constructs a new JSP Tag exception when the JSP Tag needs to throw an
+ * exception and include a message about the "root cause" exception that
+ * interfered with its normal operation. The exception's message is based on
+ * the localized message of the underlying exception.
+ * <p>
+ * This method calls the <code>getLocalizedMessage</code> method on the
+ * <code>Throwable</code> exception to get a localized exception message.
+ * When subclassing <code>JspTagException</code>, this method can be
+ * overridden to create an exception message designed for a specific locale.
+ *
+ * @param rootCause
+ * the <code>Throwable</code> exception that interfered with the
+ * JSP Tag's normal operation, making the JSP Tag exception
+ * necessary
+ * @since 2.0
+ */
+ public JspTagException(Throwable rootCause) {
+ super(rootCause);
+ }
+}
diff --git a/bundles/org.apache.tomcat/src/javax/servlet/jsp/JspWriter.java b/bundles/org.apache.tomcat/src/javax/servlet/jsp/JspWriter.java
new file mode 100644
index 0000000..4348c43
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/javax/servlet/jsp/JspWriter.java
@@ -0,0 +1,458 @@
+/*
+ * 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 javax.servlet.jsp;
+
+import java.io.IOException;
+
+/**
+ * <p>
+ * The actions and template data in a JSP page is written using the JspWriter
+ * object that is referenced by the implicit variable out which is initialized
+ * automatically using methods in the PageContext object.
+ *<p>
+ * This abstract class emulates some of the functionality found in the
+ * java.io.BufferedWriter and java.io.PrintWriter classes, however it differs in
+ * that it throws java.io.IOException from the print methods while PrintWriter
+ * does not.
+ * <p>
+ * <B>Buffering</B>
+ * <p>
+ * The initial JspWriter object is associated with the PrintWriter object of the
+ * ServletResponse in a way that depends on whether the page is or is not
+ * buffered. If the page is not buffered, output written to this JspWriter
+ * object will be written through to the PrintWriter directly, which will be
+ * created if necessary by invoking the getWriter() method on the response
+ * object. But if the page is buffered, the PrintWriter object will not be
+ * created until the buffer is flushed and operations like setContentType() are
+ * legal. Since this flexibility simplifies programming substantially, buffering
+ * is the default for JSP pages.
+ * <p>
+ * Buffering raises the issue of what to do when the buffer is exceeded. Two
+ * approaches can be taken:
+ * <ul>
+ * <li>Exceeding the buffer is not a fatal error; when the buffer is exceeded,
+ * just flush the output.
+ * <li>Exceeding the buffer is a fatal error; when the buffer is exceeded, raise
+ * an exception.
+ * </ul>
+ * <p>
+ * Both approaches are valid, and thus both are supported in the JSP technology.
+ * The behavior of a page is controlled by the autoFlush attribute, which
+ * defaults to true. In general, JSP pages that need to be sure that correct and
+ * complete data has been sent to their client may want to set autoFlush to
+ * false, with a typical case being that where the client is an application
+ * itself. On the other hand, JSP pages that send data that is meaningful even
+ * when partially constructed may want to set autoFlush to true; such as when
+ * the data is sent for immediate display through a browser. Each application
+ * will need to consider their specific needs.
+ * <p>
+ * An alternative considered was to make the buffer size unbounded; but, this
+ * had the disadvantage that runaway computations would consume an unbounded
+ * amount of resources.
+ * <p>
+ * The "out" implicit variable of a JSP implementation class is of this type. If
+ * the page directive selects autoflush="true" then all the I/O operations on
+ * this class shall automatically flush the contents of the buffer if an
+ * overflow condition would result if the current operation were performed
+ * without a flush. If autoflush="false" then all the I/O operations on this
+ * class shall throw an IOException if performing the current operation would
+ * result in a buffer overflow condition.
+ *
+ * @see java.io.Writer
+ * @see java.io.BufferedWriter
+ * @see java.io.PrintWriter
+ */
+public abstract class JspWriter extends java.io.Writer {
+
+ /**
+ * Constant indicating that the Writer is not buffering output.
+ */
+ public static final int NO_BUFFER = 0;
+
+ /**
+ * Constant indicating that the Writer is buffered and is using the
+ * implementation default buffer size.
+ */
+ public static final int DEFAULT_BUFFER = -1;
+
+ /**
+ * Constant indicating that the Writer is buffered and is unbounded; this is
+ * used in BodyContent.
+ */
+ public static final int UNBOUNDED_BUFFER = -2;
+
+ /**
+ * Protected constructor.
+ *
+ * @param bufferSize
+ * the size of the buffer to be used by the JspWriter
+ * @param autoFlush
+ * whether the JspWriter should be autoflushing
+ */
+ protected JspWriter(int bufferSize, boolean autoFlush) {
+ this.bufferSize = bufferSize;
+ this.autoFlush = autoFlush;
+ }
+
+ /**
+ * Write a line separator. The line separator string is defined by the
+ * system property <tt>line.separator</tt>, and is not necessarily a single
+ * newline ('\n') character.
+ *
+ * @exception IOException
+ * If an I/O error occurs
+ */
+ public abstract void newLine() throws IOException;
+
+ /**
+ * Print a boolean value. The string produced by <code>{@link
+ * java.lang.String#valueOf(boolean)}</code>
+ * is written to the JspWriter's buffer or, if no buffer is used, directly
+ * to the underlying writer.
+ *
+ * @param b
+ * The <code>boolean</code> to be printed
+ * @throws java.io.IOException
+ * If an error occurred while writing
+ */
+ public abstract void print(boolean b) throws IOException;
+
+ /**
+ * Print a character. The character is written to the JspWriter's buffer or,
+ * if no buffer is used, directly to the underlying writer.
+ *
+ * @param c
+ * The <code>char</code> to be printed
+ * @throws java.io.IOException
+ * If an error occurred while writing
+ */
+ public abstract void print(char c) throws IOException;
+
+ /**
+ * Print an integer. The string produced by <code>{@link
+ * java.lang.String#valueOf(int)}</code>
+ * is written to the JspWriter's buffer or, if no buffer is used, directly
+ * to the underlying writer.
+ *
+ * @param i
+ * The <code>int</code> to be printed
+ * @see java.lang.Integer#toString(int)
+ * @throws java.io.IOException
+ * If an error occurred while writing
+ */
+ public abstract void print(int i) throws IOException;
+
+ /**
+ * Print a long integer. The string produced by <code>{@link
+ * java.lang.String#valueOf(long)}</code>
+ * is written to the JspWriter's buffer or, if no buffer is used, directly
+ * to the underlying writer.
+ *
+ * @param l
+ * The <code>long</code> to be printed
+ * @see java.lang.Long#toString(long)
+ * @throws java.io.IOException
+ * If an error occurred while writing
+ */
+ public abstract void print(long l) throws IOException;
+
+ /**
+ * Print a floating-point number. The string produced by <code>{@link
+ * java.lang.String#valueOf(float)}</code>
+ * is written to the JspWriter's buffer or, if no buffer is used, directly
+ * to the underlying writer.
+ *
+ * @param f
+ * The <code>float</code> to be printed
+ * @see java.lang.Float#toString(float)
+ * @throws java.io.IOException
+ * If an error occurred while writing
+ */
+ public abstract void print(float f) throws IOException;
+
+ /**
+ * Print a double-precision floating-point number. The string produced by
+ * <code>{@link java.lang.String#valueOf(double)}</code> is written to the
+ * JspWriter's buffer or, if no buffer is used, directly to the underlying
+ * writer.
+ *
+ * @param d
+ * The <code>double</code> to be printed
+ * @see java.lang.Double#toString(double)
+ * @throws java.io.IOException
+ * If an error occurred while writing
+ */
+ public abstract void print(double d) throws IOException;
+
+ /**
+ * Print an array of characters. The characters are written to the
+ * JspWriter's buffer or, if no buffer is used, directly to the underlying
+ * writer.
+ *
+ * @param s
+ * The array of chars to be printed
+ * @throws NullPointerException
+ * If <code>s</code> is <code>null</code>
+ * @throws java.io.IOException
+ * If an error occurred while writing
+ */
+ public abstract void print(char s[]) throws IOException;
+
+ /**
+ * Print a string. If the argument is <code>null</code> then the string
+ * <code>"null"</code> is printed. Otherwise, the string's characters are
+ * written to the JspWriter's buffer or, if no buffer is used, directly to
+ * the underlying writer.
+ *
+ * @param s
+ * The <code>String</code> to be printed
+ * @throws java.io.IOException
+ * If an error occurred while writing
+ */
+ public abstract void print(String s) throws IOException;
+
+ /**
+ * Print an object. The string produced by the <code>{@link
+ * java.lang.String#valueOf(Object)}</code>
+ * method is written to the JspWriter's buffer or, if no buffer is used,
+ * directly to the underlying writer.
+ *
+ * @param obj
+ * The <code>Object</code> to be printed
+ * @see java.lang.Object#toString()
+ * @throws java.io.IOException
+ * If an error occurred while writing
+ */
+ public abstract void print(Object obj) throws IOException;
+
+ /**
+ * Terminate the current line by writing the line separator string. The line
+ * separator string is defined by the system property
+ * <code>line.separator</code>, and is not necessarily a single newline
+ * character (<code>'\n'</code>).
+ *
+ * @throws java.io.IOException
+ * If an error occurred while writing
+ */
+ public abstract void println() throws IOException;
+
+ /**
+ * Print a boolean value and then terminate the line. This method behaves as
+ * though it invokes <code>{@link #print(boolean)}</code> and then
+ * <code>{@link #println()}</code>.
+ *
+ * @param x
+ * the boolean to write
+ * @throws java.io.IOException
+ * If an error occurred while writing
+ */
+ public abstract void println(boolean x) throws IOException;
+
+ /**
+ * Print a character and then terminate the line. This method behaves as
+ * though it invokes <code>{@link #print(char)}</code> and then <code>{@link
+ * #println()}</code>
+ * .
+ *
+ * @param x
+ * the char to write
+ * @throws java.io.IOException
+ * If an error occurred while writing
+ */
+ public abstract void println(char x) throws IOException;
+
+ /**
+ * Print an integer and then terminate the line. This method behaves as
+ * though it invokes <code>{@link #print(int)}</code> and then <code>{@link
+ * #println()}</code>
+ * .
+ *
+ * @param x
+ * the int to write
+ * @throws java.io.IOException
+ * If an error occurred while writing
+ */
+ public abstract void println(int x) throws IOException;
+
+ /**
+ * Print a long integer and then terminate the line. This method behaves as
+ * though it invokes <code>{@link #print(long)}</code> and then
+ * <code>{@link #println()}</code>.
+ *
+ * @param x
+ * the long to write
+ * @throws java.io.IOException
+ * If an error occurred while writing
+ */
+ public abstract void println(long x) throws IOException;
+
+ /**
+ * Print a floating-point number and then terminate the line. This method
+ * behaves as though it invokes <code>{@link #print(float)}</code> and then
+ * <code>{@link #println()}</code>.
+ *
+ * @param x
+ * the float to write
+ * @throws java.io.IOException
+ * If an error occurred while writing
+ */
+ public abstract void println(float x) throws IOException;
+
+ /**
+ * Print a double-precision floating-point number and then terminate the
+ * line. This method behaves as though it invokes <code>{@link
+ * #print(double)}</code> and
+ * then <code>{@link #println()}</code>.
+ *
+ * @param x
+ * the double to write
+ * @throws java.io.IOException
+ * If an error occurred while writing
+ */
+ public abstract void println(double x) throws IOException;
+
+ /**
+ * Print an array of characters and then terminate the line. This method
+ * behaves as though it invokes <code>print(char[])</code> and then
+ * <code>println()</code>.
+ *
+ * @param x
+ * the char[] to write
+ * @throws java.io.IOException
+ * If an error occurred while writing
+ */
+ public abstract void println(char x[]) throws IOException;
+
+ /**
+ * Print a String and then terminate the line. This method behaves as though
+ * it invokes <code>{@link #print(String)}</code> and then
+ * <code>{@link #println()}</code>.
+ *
+ * @param x
+ * the String to write
+ * @throws java.io.IOException
+ * If an error occurred while writing
+ */
+ public abstract void println(String x) throws IOException;
+
+ /**
+ * Print an Object and then terminate the line. This method behaves as
+ * though it invokes <code>{@link #print(Object)}</code> and then
+ * <code>{@link #println()}</code>.
+ *
+ * @param x
+ * the Object to write
+ * @throws java.io.IOException
+ * If an error occurred while writing
+ */
+ public abstract void println(Object x) throws IOException;
+
+ /**
+ * Clear the contents of the buffer. If the buffer has been already been
+ * flushed then the clear operation shall throw an IOException to signal the
+ * fact that some data has already been irrevocably written to the client
+ * response stream.
+ *
+ * @throws IOException
+ * If an I/O error occurs
+ */
+ public abstract void clear() throws IOException;
+
+ /**
+ * Clears the current contents of the buffer. Unlike clear(), this method
+ * will not throw an IOException if the buffer has already been flushed. It
+ * merely clears the current content of the buffer and returns.
+ *
+ * @throws IOException
+ * If an I/O error occurs
+ */
+ public abstract void clearBuffer() throws IOException;
+
+ /**
+ * Flush the stream. If the stream has saved any characters from the various
+ * write() methods in a buffer, write them immediately to their intended
+ * destination. Then, if that destination is another character or byte
+ * stream, flush it. Thus one flush() invocation will flush all the buffers
+ * in a chain of Writers and OutputStreams.
+ * <p>
+ * The method may be invoked indirectly if the buffer size is exceeded.
+ * <p>
+ * Once a stream has been closed, further write() or flush() invocations
+ * will cause an IOException to be thrown.
+ *
+ * @exception IOException
+ * If an I/O error occurs
+ */
+ @Override
+ public abstract void flush() throws IOException;
+
+ /**
+ * Close the stream, flushing it first.
+ * <p>
+ * This method needs not be invoked explicitly for the initial JspWriter as
+ * the code generated by the JSP container will automatically include a call
+ * to close().
+ * <p>
+ * Closing a previously-closed stream, unlike flush(), has no effect.
+ *
+ * @exception IOException
+ * If an I/O error occurs
+ */
+ @Override
+ public abstract void close() throws IOException;
+
+ /**
+ * This method returns the size of the buffer used by the JspWriter.
+ *
+ * @return the size of the buffer in bytes, or 0 is unbuffered.
+ */
+ public int getBufferSize() {
+ return bufferSize;
+ }
+
+ /**
+ * This method returns the number of unused bytes in the buffer.
+ *
+ * @return the number of bytes unused in the buffer
+ */
+ public abstract int getRemaining();
+
+ /**
+ * This method indicates whether the JspWriter is autoFlushing.
+ *
+ * @return if this JspWriter is auto flushing or throwing IOExceptions on
+ * buffer overflow conditions
+ */
+ public boolean isAutoFlush() {
+ return autoFlush;
+ }
+
+ /*
+ * fields
+ */
+
+ /**
+ * The size of the buffer used by the JspWriter.
+ */
+ protected int bufferSize;
+
+ /**
+ * Whether the JspWriter is autoflushing.
+ */
+ protected boolean autoFlush;
+}
diff --git a/bundles/org.apache.tomcat/src/javax/servlet/jsp/PageContext.java b/bundles/org.apache.tomcat/src/javax/servlet/jsp/PageContext.java
new file mode 100644
index 0000000..b320a02
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/javax/servlet/jsp/PageContext.java
@@ -0,0 +1,535 @@
+/*
+* 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 javax.servlet.jsp;
+
+import java.io.IOException;
+
+import javax.servlet.RequestDispatcher;
+import javax.servlet.Servlet;
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpSession;
+import javax.servlet.jsp.tagext.BodyContent;
+
+/**
+ * <p>
+ * PageContext extends JspContext to provide useful context information for
+ * when JSP technology is used in a Servlet environment.
+ * <p>
+ * A PageContext instance provides access to all the namespaces associated
+ * with a JSP page, provides access to several page attributes, as well as
+ * a layer above the implementation details. Implicit objects are added
+ * to the pageContext automatically.
+ *
+ * <p> The <code> PageContext </code> class is an abstract class, designed to be
+ * extended to provide implementation dependent implementations thereof, by
+ * conformant JSP engine runtime environments. A PageContext instance is
+ * obtained by a JSP implementation class by calling the
+ * JspFactory.getPageContext() method, and is released by calling
+ * JspFactory.releasePageContext().
+ *
+ * <p> An example of how PageContext, JspFactory, and other classes can be
+ * used within a JSP Page Implementation object is given elsewhere.
+ *
+ * <p>
+ * The PageContext provides a number of facilities to the page/component
+ * author and page implementor, including:
+ * <ul>
+ * <li>a single API to manage the various scoped namespaces
+ * <li>a number of convenience API's to access various public objects
+ * <li>a mechanism to obtain the JspWriter for output
+ * <li>a mechanism to manage session usage by the page
+ * <li>a mechanism to expose page directive attributes to the scripting
+ * environment
+ * <li>mechanisms to forward or include the current request to other active
+ * components in the application
+ * <li>a mechanism to handle errorpage exception processing
+ * </ul>
+ *
+ * <p><B>Methods Intended for Container Generated Code</B>
+ * <p>Some methods are intended to be used by the code generated by the
+ * container, not by code written by JSP page authors, or JSP tag library
+ * authors.
+ * <p>The methods supporting <B>lifecycle</B> are <code>initialize()</code>
+ * and <code>release()</code>
+ *
+ * <p>
+ * The following methods enable the <B>management of nested</B> JspWriter
+ * streams to implement Tag Extensions: <code>pushBody()</code>
+ *
+ * <p><B>Methods Intended for JSP authors</B>
+ * <p>
+ * The following methods provide <B>convenient access</B> to implicit objects:
+ * <code>getException()</code>, <code>getPage()</code>
+ * <code>getRequest()</code>, <code>getResponse()</code>,
+ * <code>getSession()</code>, <code>getServletConfig()</code>
+ * and <code>getServletContext()</code>.
+ *
+ * <p>
+ * The following methods provide support for <B>forwarding, inclusion
+ * and error handling</B>:
+ * <code>forward()</code>, <code>include()</code>,
+ * and <code>handlePageException()</code>.
+ */
+
+public abstract class PageContext
+ extends JspContext
+{
+
+ /**
+ * Sole constructor. (For invocation by subclass constructors,
+ * typically implicit.)
+ */
+ public PageContext() {
+ // NOOP by default
+ }
+
+ /**
+ * Page scope: (this is the default) the named reference remains available
+ * in this PageContext until the return from the current Servlet.service()
+ * invocation.
+ */
+
+ public static final int PAGE_SCOPE = 1;
+
+ /**
+ * Request scope: the named reference remains available from the
+ * ServletRequest associated with the Servlet until the current request
+ * is completed.
+ */
+
+ public static final int REQUEST_SCOPE = 2;
+
+ /**
+ * Session scope (only valid if this page participates in a session):
+ * the named reference remains available from the HttpSession (if any)
+ * associated with the Servlet until the HttpSession is invalidated.
+ */
+
+ public static final int SESSION_SCOPE = 3;
+
+ /**
+ * Application scope: named reference remains available in the
+ * ServletContext until it is reclaimed.
+ */
+
+ public static final int APPLICATION_SCOPE = 4;
+
+ /**
+ * Name used to store the Servlet in this PageContext's nametables.
+ */
+
+ public static final String PAGE = "javax.servlet.jsp.jspPage";
+
+ /**
+ * Name used to store this PageContext in it's own name table.
+ */
+
+ public static final String PAGECONTEXT = "javax.servlet.jsp.jspPageContext";
+
+ /**
+ * Name used to store ServletRequest in PageContext name table.
+ */
+
+ public static final String REQUEST = "javax.servlet.jsp.jspRequest";
+
+ /**
+ * Name used to store ServletResponse in PageContext name table.
+ */
+
+ public static final String RESPONSE = "javax.servlet.jsp.jspResponse";
+
+ /**
+ * Name used to store ServletConfig in PageContext name table.
+ */
+
+ public static final String CONFIG = "javax.servlet.jsp.jspConfig";
+
+ /**
+ * Name used to store HttpSession in PageContext name table.
+ */
+
+ public static final String SESSION = "javax.servlet.jsp.jspSession";
+ /**
+ * Name used to store current JspWriter in PageContext name table.
+ */
+
+ public static final String OUT = "javax.servlet.jsp.jspOut";
+
+ /**
+ * Name used to store ServletContext in PageContext name table.
+ */
+
+ public static final String APPLICATION = "javax.servlet.jsp.jspApplication";
+
+ /**
+ * Name used to store uncaught exception in ServletRequest attribute
+ * list and PageContext name table.
+ */
+
+ public static final String EXCEPTION = "javax.servlet.jsp.jspException";
+
+ /**
+ * <p>
+ * The initialize method is called to initialize an uninitialized PageContext
+ * so that it may be used by a JSP Implementation class to service an
+ * incoming request and response within it's _jspService() method.
+ *
+ * <p>
+ * This method is typically called from JspFactory.getPageContext() in
+ * order to initialize state.
+ *
+ * <p>
+ * This method is required to create an initial JspWriter, and associate
+ * the "out" name in page scope with this newly created object.
+ *
+ * <p>
+ * This method should not be used by page or tag library authors.
+ *
+ * @param servlet The Servlet that is associated with this PageContext
+ * @param request The currently pending request for this Servlet
+ * @param response The currently pending response for this Servlet
+ * @param errorPageURL The value of the errorpage attribute from the page
+ * directive or null
+ * @param needsSession The value of the session attribute from the
+ * page directive
+ * @param bufferSize The value of the buffer attribute from the page
+ * directive
+ * @param autoFlush The value of the autoflush attribute from the page
+ * directive
+ *
+ * @throws IOException during creation of JspWriter
+ * @throws IllegalStateException if out not correctly initialized
+ * @throws IllegalArgumentException If one of the given parameters
+ * is invalid
+ */
+
+ public abstract void initialize(Servlet servlet, ServletRequest request,
+ ServletResponse response, String errorPageURL, boolean needsSession,
+ int bufferSize, boolean autoFlush)
+ throws IOException, IllegalStateException, IllegalArgumentException;
+
+ /**
+ * <p>
+ * This method shall "reset" the internal state of a PageContext, releasing
+ * all internal references, and preparing the PageContext for potential
+ * reuse by a later invocation of initialize(). This method is typically
+ * called from JspFactory.releasePageContext().
+ *
+ * <p>
+ * Subclasses shall envelope this method.
+ *
+ * <p>
+ * This method should not be used by page or tag library authors.
+ *
+ */
+
+ public abstract void release();
+
+ /**
+ * The current value of the session object (an HttpSession).
+ *
+ * @return the HttpSession for this PageContext or null
+ */
+
+ public abstract HttpSession getSession();
+
+ /**
+ * The current value of the page object (In a Servlet environment,
+ * this is an instance of javax.servlet.Servlet).
+ *
+ * @return the Page implementation class instance associated
+ * with this PageContext
+ */
+
+ public abstract Object getPage();
+
+
+ /**
+ * The current value of the request object (a ServletRequest).
+ *
+ * @return The ServletRequest for this PageContext
+ */
+
+ public abstract ServletRequest getRequest();
+
+ /**
+ * The current value of the response object (a ServletResponse).
+ *
+ * @return the ServletResponse for this PageContext
+ */
+
+ public abstract ServletResponse getResponse();
+
+ /**
+ * The current value of the exception object (an Exception).
+ *
+ * @return any exception passed to this as an errorpage
+ */
+
+ public abstract Exception getException();
+
+ /**
+ * The ServletConfig instance.
+ *
+ * @return the ServletConfig for this PageContext
+ */
+
+ public abstract ServletConfig getServletConfig();
+
+ /**
+ * The ServletContext instance.
+ *
+ * @return the ServletContext for this PageContext
+ */
+
+ public abstract ServletContext getServletContext();
+
+ /**
+ * <p>
+ * This method is used to re-direct, or "forward" the current
+ * ServletRequest and ServletResponse to another active component in
+ * the application.
+ * </p>
+ * <p>
+ * If the <I> relativeUrlPath </I> begins with a "/" then the URL specified
+ * is calculated relative to the DOCROOT of the <code> ServletContext </code>
+ * for this JSP. If the path does not begin with a "/" then the URL
+ * specified is calculated relative to the URL of the request that was
+ * mapped to the calling JSP.
+ * </p>
+ * <p>
+ * It is only valid to call this method from a <code> Thread </code>
+ * executing within a <code> _jspService(...) </code> method of a JSP.
+ * </p>
+ * <p>
+ * Once this method has been called successfully, it is illegal for the
+ * calling <code> Thread </code> to attempt to modify the <code>
+ * ServletResponse </code> object. Any such attempt to do so, shall result
+ * in undefined behavior. Typically, callers immediately return from
+ * <code> _jspService(...) </code> after calling this method.
+ * </p>
+ *
+ * @param relativeUrlPath specifies the relative URL path to the target
+ * resource as described above
+ *
+ * @throws IllegalStateException if <code> ServletResponse </code> is not
+ * in a state where a forward can be performed
+ * @throws ServletException if the page that was forwarded to throws
+ * a ServletException
+ * @throws IOException if an I/O error occurred while forwarding
+ */
+
+ public abstract void forward(String relativeUrlPath)
+ throws ServletException, IOException;
+
+ /**
+ * <p>
+ * Causes the resource specified to be processed as part of the current
+ * ServletRequest and ServletResponse being processed by the calling Thread.
+ * The output of the target resources processing of the request is written
+ * directly to the ServletResponse output stream.
+ * </p>
+ * <p>
+ * The current JspWriter "out" for this JSP is flushed as a side-effect
+ * of this call, prior to processing the include.
+ * </p>
+ * <p>
+ * If the <I> relativeUrlPath </I> begins with a "/" then the URL specified
+ * is calculated relative to the DOCROOT of the <code>ServletContext</code>
+ * for this JSP. If the path does not begin with a "/" then the URL
+ * specified is calculated relative to the URL of the request that was
+ * mapped to the calling JSP.
+ * </p>
+ * <p>
+ * It is only valid to call this method from a <code> Thread </code>
+ * executing within a <code> _jspService(...) </code> method of a JSP.
+ * </p>
+ *
+ * @param relativeUrlPath specifies the relative URL path to the target
+ * resource to be included
+ *
+ * @throws ServletException if the page that was forwarded to throws
+ * a ServletException
+ * @throws IOException if an I/O error occurred while forwarding
+ */
+ public abstract void include(String relativeUrlPath)
+ throws ServletException, IOException;
+
+ /**
+ * <p>
+ * Causes the resource specified to be processed as part of the current
+ * ServletRequest and ServletResponse being processed by the calling Thread.
+ * The output of the target resources processing of the request is written
+ * directly to the current JspWriter returned by a call to getOut().
+ * </p>
+ * <p>
+ * If flush is true, The current JspWriter "out" for this JSP
+ * is flushed as a side-effect of this call, prior to processing
+ * the include. Otherwise, the JspWriter "out" is not flushed.
+ * </p>
+ * <p>
+ * If the <i>relativeUrlPath</i> begins with a "/" then the URL specified
+ * is calculated relative to the DOCROOT of the <code>ServletContext</code>
+ * for this JSP. If the path does not begin with a "/" then the URL
+ * specified is calculated relative to the URL of the request that was
+ * mapped to the calling JSP.
+ * </p>
+ * <p>
+ * It is only valid to call this method from a <code> Thread </code>
+ * executing within a <code> _jspService(...) </code> method of a JSP.
+ * </p>
+ *
+ * @param relativeUrlPath specifies the relative URL path to the
+ * target resource to be included
+ * @param flush True if the JspWriter is to be flushed before the include,
+ * or false if not.
+ *
+ * @throws ServletException if the page that was forwarded to throws
+ * a ServletException
+ * @throws IOException if an I/O error occurred while forwarding
+ * @since 2.0
+ */
+ public abstract void include(String relativeUrlPath, boolean flush)
+ throws ServletException, IOException;
+
+ /**
+ * <p>
+ * This method is intended to process an unhandled 'page' level
+ * exception by forwarding the exception to the specified
+ * error page for this JSP. If forwarding is not possible (for
+ * example because the response has already been committed), an
+ * implementation dependent mechanism should be used to invoke
+ * the error page (e.g. "including" the error page instead).
+ *
+ * <p>
+ * If no error page is defined in the page, the exception should
+ * be rethrown so that the standard servlet error handling
+ * takes over.
+ *
+ * <p>
+ * A JSP implementation class shall typically clean up any local state
+ * prior to invoking this and will return immediately thereafter. It is
+ * illegal to generate any output to the client, or to modify any
+ * ServletResponse state after invoking this call.
+ *
+ * <p>
+ * This method is kept for backwards compatibility reasons. Newly
+ * generated code should use PageContext.handlePageException(Throwable).
+ *
+ * @param e the exception to be handled
+ *
+ * @throws ServletException if an error occurs while invoking the error page
+ * @throws IOException if an I/O error occurred while invoking the error
+ * page
+ * @throws NullPointerException if the exception is null
+ *
+ * @see #handlePageException(Throwable)
+ */
+
+ public abstract void handlePageException(Exception e)
+ throws ServletException, IOException;
+
+ /**
+ * <p>
+ * This method is intended to process an unhandled 'page' level
+ * exception by forwarding the exception to the specified
+ * error page for this JSP. If forwarding is not possible (for
+ * example because the response has already been committed), an
+ * implementation dependent mechanism should be used to invoke
+ * the error page (e.g. "including" the error page instead).
+ *
+ * <p>
+ * If no error page is defined in the page, the exception should
+ * be rethrown so that the standard servlet error handling
+ * takes over.
+ *
+ * <p>
+ * This method is intended to process an unhandled "page" level exception
+ * by redirecting the exception to either the specified error page for this
+ * JSP, or if none was specified, to perform some implementation dependent
+ * action.
+ *
+ * <p>
+ * A JSP implementation class shall typically clean up any local state
+ * prior to invoking this and will return immediately thereafter. It is
+ * illegal to generate any output to the client, or to modify any
+ * ServletResponse state after invoking this call.
+ *
+ * @param t the throwable to be handled
+ *
+ * @throws ServletException if an error occurs while invoking the error page
+ * @throws IOException if an I/O error occurred while invoking the error
+ * page
+ * @throws NullPointerException if the exception is null
+ *
+ * @see #handlePageException(Exception)
+ */
+
+ public abstract void handlePageException(Throwable t)
+ throws ServletException, IOException;
+
+ /**
+ * Return a new BodyContent object, save the current "out" JspWriter,
+ * and update the value of the "out" attribute in the page scope
+ * attribute namespace of the PageContext.
+ *
+ * @return the new BodyContent
+ */
+
+ public BodyContent pushBody() {
+ return null; // XXX to implement
+ }
+
+
+ /**
+ * Provides convenient access to error information.
+ *
+ * @return an ErrorData instance containing information about the
+ * error, as obtained from the request attributes, as per the
+ * Servlet specification. If this is not an error page (that is,
+ * if the isErrorPage attribute of the page directive is not set
+ * to "true"), the information is meaningless.
+ *
+ * @since 2.0
+ */
+ public ErrorData getErrorData() {
+ int status = 0;
+
+ Integer status_code = (Integer)getRequest().getAttribute(
+ RequestDispatcher.ERROR_STATUS_CODE);
+ // Avoid NPE if attribute is not set
+ if (status_code != null) {
+ status = status_code.intValue();
+ }
+
+ return new ErrorData(
+ (Throwable)getRequest().getAttribute(
+ RequestDispatcher.ERROR_EXCEPTION),
+ status,
+ (String)getRequest().getAttribute(
+ RequestDispatcher.ERROR_REQUEST_URI),
+ (String)getRequest().getAttribute(
+ RequestDispatcher.ERROR_SERVLET_NAME)
+ );
+ }
+
+}
diff --git a/bundles/org.apache.tomcat/src/javax/servlet/jsp/SkipPageException.java b/bundles/org.apache.tomcat/src/javax/servlet/jsp/SkipPageException.java
new file mode 100644
index 0000000..ba0e15a
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/javax/servlet/jsp/SkipPageException.java
@@ -0,0 +1,77 @@
+/*
+ * 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 javax.servlet.jsp;
+
+/**
+ * Exception to indicate the calling page must cease evaluation. Thrown by a
+ * simple tag handler to indicate that the remainder of the page must not be
+ * evaluated. The result is propagated back to the page in the case where one
+ * tag invokes another (as can be the case with tag files). The effect is
+ * similar to that of a Classic Tag Handler returning Tag.SKIP_PAGE from
+ * doEndTag(). Jsp Fragments may also throw this exception. This exception
+ * should not be thrown manually in a JSP page or tag file - the behavior is
+ * undefined. The exception is intended to be thrown inside SimpleTag handlers
+ * and in JSP fragments.
+ *
+ * @see javax.servlet.jsp.tagext.SimpleTag#doTag
+ * @see javax.servlet.jsp.tagext.JspFragment#invoke
+ * @see javax.servlet.jsp.tagext.Tag#doEndTag
+ * @since 2.0
+ */
+public class SkipPageException extends JspException {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Creates a SkipPageException with no message.
+ */
+ public SkipPageException() {
+ super();
+ }
+
+ /**
+ * Creates a SkipPageException with the provided message.
+ *
+ * @param message
+ * the detail message
+ */
+ public SkipPageException(String message) {
+ super(message);
+ }
+
+ /**
+ * Creates a SkipPageException with the provided message and root cause.
+ *
+ * @param message
+ * the detail message
+ * @param rootCause
+ * the originating cause of this exception
+ */
+ public SkipPageException(String message, Throwable rootCause) {
+ super(message, rootCause);
+ }
+
+ /**
+ * Creates a SkipPageException with the provided root cause.
+ *
+ * @param rootCause
+ * the originating cause of this exception
+ */
+ public SkipPageException(Throwable rootCause) {
+ super(rootCause);
+ }
+}
diff --git a/bundles/org.apache.tomcat/src/javax/servlet/jsp/el/ELException.java b/bundles/org.apache.tomcat/src/javax/servlet/jsp/el/ELException.java
new file mode 100644
index 0000000..f6bdd5c
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/javax/servlet/jsp/el/ELException.java
@@ -0,0 +1,81 @@
+/*
+ * 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 javax.servlet.jsp.el;
+
+/**
+ * Represents any of the exception conditions that arise during the operation
+ * evaluation of the evaluator.
+ *
+ * @since 2.0
+ * @deprecated
+ */
+@SuppressWarnings("dep-ann") // TCK signature test fails with annotation
+public class ELException extends Exception {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Creates an ELException with no detail message.
+ **/
+ public ELException() {
+ super();
+ }
+
+ /**
+ * Creates an ELException with the provided detail message.
+ *
+ * @param pMessage
+ * the detail message
+ **/
+ public ELException(String pMessage) {
+ super(pMessage);
+ }
+
+ /**
+ * Creates an ELException with the given root cause.
+ *
+ * @param pRootCause
+ * the originating cause of this exception
+ **/
+ public ELException(Throwable pRootCause) {
+ super(pRootCause);
+ }
+
+ // -------------------------------------
+ /**
+ * Creates an ELException with the given detail message and root cause.
+ *
+ * @param pMessage
+ * the detail message
+ * @param pRootCause
+ * the originating cause of this exception
+ **/
+ public ELException(String pMessage, Throwable pRootCause) {
+ super(pMessage, pRootCause);
+ }
+
+ // -------------------------------------
+ /**
+ * Returns the root cause.
+ *
+ * @return the root cause of this exception
+ */
+ public Throwable getRootCause() {
+ return getCause();
+ }
+}
diff --git a/bundles/org.apache.tomcat/src/javax/servlet/jsp/el/ELParseException.java b/bundles/org.apache.tomcat/src/javax/servlet/jsp/el/ELParseException.java
new file mode 100644
index 0000000..35e4513
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/javax/servlet/jsp/el/ELParseException.java
@@ -0,0 +1,53 @@
+/*
+* 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 javax.servlet.jsp.el;
+
+
+/**
+ * Represents a parsing error encountered while parsing an EL expression.
+ *
+ * @since 2.0
+ * @deprecated
+ */
+@SuppressWarnings("dep-ann") // TCK signature test fails with annotation
+public class ELParseException extends ELException {
+
+ private static final long serialVersionUID = 1L;
+
+//-------------------------------------
+ /**
+ * Creates an ELParseException with no detail message.
+ */
+ public ELParseException ()
+ {
+ super ();
+ }
+
+ //-------------------------------------
+ /**
+ * Creates an ELParseException with the provided detail message.
+ *
+ * @param pMessage the detail message
+ **/
+ public ELParseException (String pMessage)
+ {
+ super (pMessage);
+ }
+
+ //-------------------------------------
+}
diff --git a/bundles/org.apache.tomcat/src/javax/servlet/jsp/el/Expression.java b/bundles/org.apache.tomcat/src/javax/servlet/jsp/el/Expression.java
new file mode 100644
index 0000000..b1ceb35
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/javax/servlet/jsp/el/Expression.java
@@ -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 javax.servlet.jsp.el;
+
+
+/**
+ * <p>The abstract class for a prepared expression.</p>
+ *
+ * <p>An instance of an Expression can be obtained via from an
+ * ExpressionEvaluator instance.</p>
+ *
+ * <p>An Expression may or not have done a syntactic parse of the expression.
+ * A client invoking the evaluate() method should be ready for the case
+ * where ELParseException exceptions are raised. </p>
+ *
+ * @since 2.0
+ * @deprecated
+ */
+@SuppressWarnings("dep-ann") // TCK signature test fails with annotation
+public abstract class Expression {
+
+ /**
+ * Evaluates an expression that was previously prepared. In some
+ * implementations preparing an expression involves full syntactic
+ * validation, but others may not do so. Evaluating the expression may
+ * raise an ELParseException as well as other ELExceptions due to
+ * run-time evaluation.
+ *
+ * @param vResolver A VariableResolver instance that can be used at
+ * runtime to resolve the name of implicit objects into Objects.
+ * @return The result of the expression evaluation.
+ *
+ * @exception ELException Thrown if the expression evaluation failed.
+ */
+ public abstract Object evaluate( VariableResolver vResolver )
+ throws ELException;
+}
+
diff --git a/bundles/org.apache.tomcat/src/javax/servlet/jsp/el/ExpressionEvaluator.java b/bundles/org.apache.tomcat/src/javax/servlet/jsp/el/ExpressionEvaluator.java
new file mode 100644
index 0000000..785c6f8
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/javax/servlet/jsp/el/ExpressionEvaluator.java
@@ -0,0 +1,115 @@
+/*
+ * 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 javax.servlet.jsp.el;
+
+/**
+ * <p>
+ * The abstract base class for an expression-language evaluator. Classes that
+ * implement an expression language expose their functionality via this abstract
+ * class.
+ * </p>
+ * <p>
+ * An instance of the ExpressionEvaluator can be obtained via the JspContext /
+ * PageContext
+ * </p>
+ * <p>
+ * The parseExpression() and evaluate() methods must be thread-safe. That is,
+ * multiple threads may call these methods on the same ExpressionEvaluator
+ * object simultaneously. Implementations should synchronize access if they
+ * depend on transient state. Implementations should not, however, assume that
+ * only one object of each ExpressionEvaluator type will be instantiated; global
+ * caching should therefore be static.
+ * </p>
+ * <p>
+ * Only a single EL expression, starting with '${' and ending with '}', can be
+ * parsed or evaluated at a time. EL expressions cannot be mixed with static
+ * text. For example, attempting to parse or evaluate "
+ * <code>abc${1+1}def${1+1}ghi</code>" or even "<code>${1+1}${1+1}</code>" will
+ * cause an <code>ELException</code> to be thrown.
+ * </p>
+ * <p>
+ * The following are examples of syntactically legal EL expressions:
+ * <ul>
+ * <li><code>${person.lastName}</code></li>
+ * <li><code>${8 * 8}</code></li>
+ * <li><code>${my:reverse('hello')}</code></li>
+ * </ul>
+ * </p>
+ *
+ * @since 2.0
+ * @deprecated
+ */
+@SuppressWarnings("dep-ann")
+// TCK signature test fails with annotation
+public abstract class ExpressionEvaluator {
+
+ /**
+ * Prepare an expression for later evaluation. This method should perform
+ * syntactic validation of the expression; if in doing so it detects errors,
+ * it should raise an ELParseException.
+ *
+ * @param expression
+ * The expression to be evaluated.
+ * @param expectedType
+ * The expected type of the result of the evaluation
+ * @param fMapper
+ * A FunctionMapper to resolve functions found in the expression.
+ * It can be null, in which case no functions are supported for
+ * this invocation. The ExpressionEvaluator must not hold on to
+ * the FunctionMapper reference after returning from
+ * <code>parseExpression()</code>. The <code>Expression</code>
+ * object returned must invoke the same functions regardless of
+ * whether the mappings in the provided
+ * <code>FunctionMapper</code> instance change between calling
+ * <code>ExpressionEvaluator.parseExpression()</code> and
+ * <code>Expression.evaluate()</code>.
+ * @return The Expression object encapsulating the arguments.
+ * @exception ELException
+ * Thrown if parsing errors were found.
+ */
+ public abstract Expression parseExpression(String expression,
+ @SuppressWarnings("rawtypes")// TCK signature fails with generics
+ Class expectedType, FunctionMapper fMapper) throws ELException;
+
+ /**
+ * Evaluates an expression. This method may perform some syntactic
+ * validation and, if so, it should raise an ELParseException error if it
+ * encounters syntactic errors. EL evaluation errors should cause an
+ * ELException to be raised.
+ *
+ * @param expression
+ * The expression to be evaluated.
+ * @param expectedType
+ * The expected type of the result of the evaluation
+ * @param vResolver
+ * A VariableResolver instance that can be used at runtime to
+ * resolve the name of implicit objects into Objects.
+ * @param fMapper
+ * A FunctionMapper to resolve functions found in the expression.
+ * It can be null, in which case no functions are supported for
+ * this invocation.
+ * @return The result of the expression evaluation.
+ * @exception ELException
+ * Thrown if the expression evaluation failed.
+ */
+ public abstract Object evaluate(
+ String expression,
+ @SuppressWarnings("rawtypes")// TCK signature fails with generics
+ Class expectedType, VariableResolver vResolver,
+ FunctionMapper fMapper) throws ELException;
+}
diff --git a/bundles/org.apache.tomcat/src/javax/servlet/jsp/el/FunctionMapper.java b/bundles/org.apache.tomcat/src/javax/servlet/jsp/el/FunctionMapper.java
new file mode 100644
index 0000000..5b8b83d
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/javax/servlet/jsp/el/FunctionMapper.java
@@ -0,0 +1,41 @@
+/*
+* 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 javax.servlet.jsp.el;
+
+/**
+ * <p>The interface to a map between EL function names and methods.</p>
+ *
+ * <p>Classes implementing this interface may, for instance, consult tag library
+ * information to resolve the map. </p>
+ *
+ * @since 2.0
+ * @deprecated
+ */
+@SuppressWarnings("dep-ann") // TCK signature test fails with annotation
+public interface FunctionMapper {
+ /**
+ * Resolves the specified local name and prefix into a Java.lang.Method.
+ * Returns null if the prefix and local name are not found.
+ *
+ * @param prefix the prefix of the function, or "" if no prefix.
+ * @param localName the short name of the function
+ * @return the result of the method mapping. Null means no entry found.
+ **/
+ public java.lang.reflect.Method resolveFunction(String prefix,
+ String localName);
+}
diff --git a/bundles/org.apache.tomcat/src/javax/servlet/jsp/el/ImplicitObjectELResolver.java b/bundles/org.apache.tomcat/src/javax/servlet/jsp/el/ImplicitObjectELResolver.java
new file mode 100644
index 0000000..588039d
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/javax/servlet/jsp/el/ImplicitObjectELResolver.java
@@ -0,0 +1,630 @@
+/*
+* 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 javax.servlet.jsp.el;
+
+import java.beans.FeatureDescriptor;
+import java.util.AbstractMap;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Enumeration;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.Vector;
+
+import javax.el.ELContext;
+import javax.el.ELException;
+import javax.el.ELResolver;
+import javax.el.PropertyNotFoundException;
+import javax.el.PropertyNotWritableException;
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+import javax.servlet.jsp.JspContext;
+import javax.servlet.jsp.PageContext;
+
+/**
+ *
+ * @since 2.1
+ */
+public class ImplicitObjectELResolver extends ELResolver {
+
+ private static final String[] SCOPE_NAMES = new String[] {
+ "applicationScope", "cookie", "header", "headerValues",
+ "initParam", "pageContext", "pageScope", "param", "paramValues",
+ "requestScope", "sessionScope" };
+
+ private static final int APPLICATIONSCOPE = 0;
+
+ private static final int COOKIE = 1;
+
+ private static final int HEADER = 2;
+
+ private static final int HEADERVALUES = 3;
+
+ private static final int INITPARAM = 4;
+
+ private static final int PAGECONTEXT = 5;
+
+ private static final int PAGESCOPE = 6;
+
+ private static final int PARAM = 7;
+
+ private static final int PARAM_VALUES = 8;
+
+ private static final int REQUEST_SCOPE = 9;
+
+ private static final int SESSION_SCOPE = 10;
+
+ public ImplicitObjectELResolver() {
+ super();
+ }
+
+ @Override
+ public Object getValue(ELContext context, Object base, Object property)
+ throws NullPointerException, PropertyNotFoundException, ELException {
+ if (context == null) {
+ throw new NullPointerException();
+ }
+
+ if (base == null && property != null) {
+ int idx = Arrays.binarySearch(SCOPE_NAMES, property.toString());
+
+ if (idx >= 0) {
+ PageContext page = (PageContext) context
+ .getContext(JspContext.class);
+ context.setPropertyResolved(true);
+ switch (idx) {
+ case APPLICATIONSCOPE:
+ return ScopeManager.get(page).getApplicationScope();
+ case COOKIE:
+ return ScopeManager.get(page).getCookie();
+ case HEADER:
+ return ScopeManager.get(page).getHeader();
+ case HEADERVALUES:
+ return ScopeManager.get(page).getHeaderValues();
+ case INITPARAM:
+ return ScopeManager.get(page).getInitParam();
+ case PAGECONTEXT:
+ return ScopeManager.get(page).getPageContext();
+ case PAGESCOPE:
+ return ScopeManager.get(page).getPageScope();
+ case PARAM:
+ return ScopeManager.get(page).getParam();
+ case PARAM_VALUES:
+ return ScopeManager.get(page).getParamValues();
+ case REQUEST_SCOPE:
+ return ScopeManager.get(page).getRequestScope();
+ case SESSION_SCOPE:
+ return ScopeManager.get(page).getSessionScope();
+ }
+ }
+ }
+ return null;
+ }
+
+ @Override
+ @SuppressWarnings({ "unchecked", "rawtypes" }) // TCK signature test fails with generics
+ public Class getType(ELContext context, Object base, Object property)
+ throws NullPointerException, PropertyNotFoundException, ELException {
+ if (context == null) {
+ throw new NullPointerException();
+ }
+
+ if (base == null && property != null) {
+ int idx = Arrays.binarySearch(SCOPE_NAMES, property.toString());
+ if (idx >= 0) {
+ context.setPropertyResolved(true);
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public void setValue(ELContext context, Object base, Object property,
+ Object value) throws NullPointerException,
+ PropertyNotFoundException, PropertyNotWritableException,
+ ELException {
+ if (context == null) {
+ throw new NullPointerException();
+ }
+
+ if (base == null && property != null) {
+ int idx = Arrays.binarySearch(SCOPE_NAMES, property.toString());
+ if (idx >= 0) {
+ context.setPropertyResolved(true);
+ throw new PropertyNotWritableException();
+ }
+ }
+ }
+
+ @Override
+ public boolean isReadOnly(ELContext context, Object base, Object property)
+ throws NullPointerException, PropertyNotFoundException, ELException {
+ if (context == null) {
+ throw new NullPointerException();
+ }
+
+ if (base == null && property != null) {
+ int idx = Arrays.binarySearch(SCOPE_NAMES, property.toString());
+ if (idx >= 0) {
+ context.setPropertyResolved(true);
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public Iterator<FeatureDescriptor> getFeatureDescriptors(ELContext context, Object base) {
+ List<FeatureDescriptor> feats = new ArrayList<FeatureDescriptor>(
+ SCOPE_NAMES.length);
+ FeatureDescriptor feat;
+ for (int i = 0; i < SCOPE_NAMES.length; i++) {
+ feat = new FeatureDescriptor();
+ feat.setDisplayName(SCOPE_NAMES[i]);
+ feat.setExpert(false);
+ feat.setHidden(false);
+ feat.setName(SCOPE_NAMES[i]);
+ feat.setPreferred(true);
+ feat.setValue(RESOLVABLE_AT_DESIGN_TIME, Boolean.TRUE);
+ feat.setValue(TYPE, String.class);
+ feats.add(feat);
+ }
+ return feats.iterator();
+ }
+
+ @Override
+ public Class<String> getCommonPropertyType(ELContext context, Object base) {
+ if (base == null) {
+ return String.class;
+ }
+ return null;
+ }
+
+ private static class ScopeManager {
+ private static final String MNGR_KEY = ScopeManager.class.getName();
+
+ private final PageContext page;
+
+ private Map<String,Object> applicationScope;
+
+ private Map<String,Cookie> cookie;
+
+ private Map<String,String> header;
+
+ private Map<String,String[]> headerValues;
+
+ private Map<String,String> initParam;
+
+ private Map<String,Object> pageScope;
+
+ private Map<String,String> param;
+
+ private Map<String,String[]> paramValues;
+
+ private Map<String,Object> requestScope;
+
+ private Map<String,Object> sessionScope;
+
+ public ScopeManager(PageContext page) {
+ this.page = page;
+ }
+
+ public static ScopeManager get(PageContext page) {
+ ScopeManager mngr = (ScopeManager) page.getAttribute(MNGR_KEY);
+ if (mngr == null) {
+ mngr = new ScopeManager(page);
+ page.setAttribute(MNGR_KEY, mngr);
+ }
+ return mngr;
+ }
+
+ public Map<String,Object> getApplicationScope() {
+ if (this.applicationScope == null) {
+ this.applicationScope = new ScopeMap<Object>() {
+ @Override
+ protected void setAttribute(String name, Object value) {
+ page.getServletContext().setAttribute(name, value);
+ }
+
+ @Override
+ protected void removeAttribute(String name) {
+ page.getServletContext().removeAttribute(name);
+ }
+
+ @Override
+ protected Enumeration<String> getAttributeNames() {
+ return page.getServletContext().getAttributeNames();
+ }
+
+ @Override
+ protected Object getAttribute(String name) {
+ return page.getServletContext().getAttribute(name);
+ }
+ };
+ }
+ return this.applicationScope;
+ }
+
+ public Map<String,Cookie> getCookie() {
+ if (this.cookie == null) {
+ this.cookie = new ScopeMap<Cookie>() {
+ @Override
+ protected Enumeration<String> getAttributeNames() {
+ Cookie[] c = ((HttpServletRequest) page.getRequest())
+ .getCookies();
+ if (c != null) {
+ Vector<String> v = new Vector<String>();
+ for (int i = 0; i < c.length; i++) {
+ v.add(c[i].getName());
+ }
+ return v.elements();
+ }
+ return null;
+ }
+
+ @Override
+ protected Cookie getAttribute(String name) {
+ Cookie[] c = ((HttpServletRequest) page.getRequest())
+ .getCookies();
+ if (c != null) {
+ for (int i = 0; i < c.length; i++) {
+ if (name.equals(c[i].getName())) {
+ return c[i];
+ }
+ }
+ }
+ return null;
+ }
+
+ };
+ }
+ return this.cookie;
+ }
+
+ public Map<String,String> getHeader() {
+ if (this.header == null) {
+ this.header = new ScopeMap<String>() {
+ @Override
+ protected Enumeration<String> getAttributeNames() {
+ return ((HttpServletRequest) page.getRequest())
+ .getHeaderNames();
+ }
+
+ @Override
+ protected String getAttribute(String name) {
+ return ((HttpServletRequest) page.getRequest())
+ .getHeader(name);
+ }
+ };
+ }
+ return this.header;
+ }
+
+ public Map<String,String[]> getHeaderValues() {
+ if (this.headerValues == null) {
+ this.headerValues = new ScopeMap<String[]>() {
+ @Override
+ protected Enumeration<String> getAttributeNames() {
+ return ((HttpServletRequest) page.getRequest())
+ .getHeaderNames();
+ }
+
+ @Override
+ protected String[] getAttribute(String name) {
+ Enumeration<String> e =
+ ((HttpServletRequest) page.getRequest())
+ .getHeaders(name);
+ if (e != null) {
+ List<String> list = new ArrayList<String>();
+ while (e.hasMoreElements()) {
+ list.add(e.nextElement());
+ }
+ return list.toArray(new String[list.size()]);
+ }
+ return null;
+ }
+
+ };
+ }
+ return this.headerValues;
+ }
+
+ public Map<String,String> getInitParam() {
+ if (this.initParam == null) {
+ this.initParam = new ScopeMap<String>() {
+ @Override
+ protected Enumeration<String> getAttributeNames() {
+ return page.getServletContext().getInitParameterNames();
+ }
+
+ @Override
+ protected String getAttribute(String name) {
+ return page.getServletContext().getInitParameter(name);
+ }
+ };
+ }
+ return this.initParam;
+ }
+
+ public PageContext getPageContext() {
+ return this.page;
+ }
+
+ public Map<String,Object> getPageScope() {
+ if (this.pageScope == null) {
+ this.pageScope = new ScopeMap<Object>() {
+ @Override
+ protected void setAttribute(String name, Object value) {
+ page.setAttribute(name, value);
+ }
+
+ @Override
+ protected void removeAttribute(String name) {
+ page.removeAttribute(name);
+ }
+
+ @Override
+ protected Enumeration<String> getAttributeNames() {
+ return page.getAttributeNamesInScope(
+ PageContext.PAGE_SCOPE);
+ }
+
+ @Override
+ protected Object getAttribute(String name) {
+ return page.getAttribute(name);
+ }
+ };
+ }
+ return this.pageScope;
+ }
+
+ public Map<String,String> getParam() {
+ if (this.param == null) {
+ this.param = new ScopeMap<String>() {
+ @Override
+ protected Enumeration<String> getAttributeNames() {
+ return page.getRequest().getParameterNames();
+ }
+
+ @Override
+ protected String getAttribute(String name) {
+ return page.getRequest().getParameter(name);
+ }
+ };
+ }
+ return this.param;
+ }
+
+ public Map<String,String[]> getParamValues() {
+ if (this.paramValues == null) {
+ this.paramValues = new ScopeMap<String[]>() {
+ @Override
+ protected String[] getAttribute(String name) {
+ return page.getRequest().getParameterValues(name);
+ }
+
+ @Override
+ protected Enumeration<String> getAttributeNames() {
+ return page.getRequest().getParameterNames();
+ }
+ };
+ }
+ return this.paramValues;
+ }
+
+ public Map<String,Object> getRequestScope() {
+ if (this.requestScope == null) {
+ this.requestScope = new ScopeMap<Object>() {
+ @Override
+ protected void setAttribute(String name, Object value) {
+ page.getRequest().setAttribute(name, value);
+ }
+
+ @Override
+ protected void removeAttribute(String name) {
+ page.getRequest().removeAttribute(name);
+ }
+
+ @Override
+ protected Enumeration<String> getAttributeNames() {
+ return page.getRequest().getAttributeNames();
+ }
+
+ @Override
+ protected Object getAttribute(String name) {
+ return page.getRequest().getAttribute(name);
+ }
+ };
+ }
+ return this.requestScope;
+ }
+
+ public Map<String,Object> getSessionScope() {
+ if (this.sessionScope == null) {
+ this.sessionScope = new ScopeMap<Object>() {
+ @Override
+ protected void setAttribute(String name, Object value) {
+ ((HttpServletRequest) page.getRequest()).getSession()
+ .setAttribute(name, value);
+ }
+
+ @Override
+ protected void removeAttribute(String name) {
+ HttpSession session = page.getSession();
+ if (session != null) {
+ session.removeAttribute(name);
+ }
+ }
+
+ @Override
+ protected Enumeration<String> getAttributeNames() {
+ HttpSession session = page.getSession();
+ if (session != null) {
+ return session.getAttributeNames();
+ }
+ return null;
+ }
+
+ @Override
+ protected Object getAttribute(String name) {
+ HttpSession session = page.getSession();
+ if (session != null) {
+ return session.getAttribute(name);
+ }
+ return null;
+ }
+ };
+ }
+ return this.sessionScope;
+ }
+ }
+
+ private abstract static class ScopeMap<V> extends AbstractMap<String,V> {
+
+ protected abstract Enumeration<String> getAttributeNames();
+
+ protected abstract V getAttribute(String name);
+
+ @SuppressWarnings("unused")
+ protected void removeAttribute(String name) {
+ throw new UnsupportedOperationException();
+ }
+
+ @SuppressWarnings("unused")
+ protected void setAttribute(String name, Object value) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public final Set<Map.Entry<String,V>> entrySet() {
+ Enumeration<String> e = getAttributeNames();
+ Set<Map.Entry<String, V>> set = new HashSet<Map.Entry<String, V>>();
+ if (e != null) {
+ while (e.hasMoreElements()) {
+ set.add(new ScopeEntry(e.nextElement()));
+ }
+ }
+ return set;
+ }
+
+ @Override
+ public final int size() {
+ int size = 0;
+ Enumeration<String> e = getAttributeNames();
+ if (e != null) {
+ while (e.hasMoreElements()) {
+ e.nextElement();
+ size++;
+ }
+ }
+ return size;
+ }
+
+ @Override
+ public final boolean containsKey(Object key) {
+ if (key == null) {
+ return false;
+ }
+ Enumeration<String> e = getAttributeNames();
+ if (e != null) {
+ while (e.hasMoreElements()) {
+ if (key.equals(e.nextElement())) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ private class ScopeEntry implements Map.Entry<String,V> {
+
+ private final String key;
+
+ public ScopeEntry(String key) {
+ this.key = key;
+ }
+
+ @Override
+ public String getKey() {
+ return this.key;
+ }
+
+ @Override
+ public V getValue() {
+ return getAttribute(this.key);
+ }
+
+ @Override
+ public V setValue(Object value) {
+ if (value == null) {
+ removeAttribute(this.key);
+ } else {
+ setAttribute(this.key, value);
+ }
+ return null;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ return (obj != null && this.hashCode() == obj.hashCode());
+ }
+
+ @Override
+ public int hashCode() {
+ return this.key.hashCode();
+ }
+
+ }
+
+ @Override
+ public final V get(Object key) {
+ if (key != null) {
+ return getAttribute((String) key);
+ }
+ return null;
+ }
+
+ @Override
+ public final V put(String key, V value) {
+ if (key == null) {
+ throw new NullPointerException();
+ }
+ if (value == null) {
+ this.removeAttribute(key);
+ } else {
+ this.setAttribute(key, value);
+ }
+ return null;
+ }
+
+ @Override
+ public final V remove(Object key) {
+ if (key == null) {
+ throw new NullPointerException();
+ }
+ this.removeAttribute((String) key);
+ return null;
+ }
+
+ }
+
+}
diff --git a/bundles/org.apache.tomcat/src/javax/servlet/jsp/el/ScopedAttributeELResolver.java b/bundles/org.apache.tomcat/src/javax/servlet/jsp/el/ScopedAttributeELResolver.java
new file mode 100644
index 0000000..de7fe39
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/javax/servlet/jsp/el/ScopedAttributeELResolver.java
@@ -0,0 +1,198 @@
+/*
+ * 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 javax.servlet.jsp.el;
+
+import java.beans.FeatureDescriptor;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.el.ELContext;
+import javax.el.ELException;
+import javax.el.ELResolver;
+import javax.el.PropertyNotFoundException;
+import javax.el.PropertyNotWritableException;
+import javax.servlet.jsp.JspContext;
+import javax.servlet.jsp.PageContext;
+
+public class ScopedAttributeELResolver extends ELResolver {
+
+ public ScopedAttributeELResolver() {
+ super();
+ }
+
+ @Override
+ public Object getValue(ELContext context, Object base, Object property)
+ throws NullPointerException, PropertyNotFoundException, ELException {
+ if (context == null) {
+ throw new NullPointerException();
+ }
+
+ if (base == null) {
+ context.setPropertyResolved(true);
+ if (property != null) {
+ String key = property.toString();
+ PageContext page = (PageContext) context
+ .getContext(JspContext.class);
+ return page.findAttribute(key);
+ }
+ }
+
+ return null;
+ }
+
+ @Override
+ public Class<Object> getType(ELContext context, Object base, Object property)
+ throws NullPointerException, PropertyNotFoundException, ELException {
+ if (context == null) {
+ throw new NullPointerException();
+ }
+
+ if (base == null) {
+ context.setPropertyResolved(true);
+ return Object.class;
+ }
+
+ return null;
+ }
+
+ @Override
+ public void setValue(ELContext context, Object base, Object property,
+ Object value) throws NullPointerException,
+ PropertyNotFoundException, PropertyNotWritableException,
+ ELException {
+ if (context == null) {
+ throw new NullPointerException();
+ }
+
+ if (base == null) {
+ context.setPropertyResolved(true);
+ if (property != null) {
+ String key = property.toString();
+ PageContext page = (PageContext) context
+ .getContext(JspContext.class);
+ int scope = page.getAttributesScope(key);
+ if (scope != 0) {
+ page.setAttribute(key, value, scope);
+ } else {
+ page.setAttribute(key, value);
+ }
+ }
+ }
+ }
+
+ @Override
+ public boolean isReadOnly(ELContext context, Object base, Object property)
+ throws NullPointerException, PropertyNotFoundException, ELException {
+ if (context == null) {
+ throw new NullPointerException();
+ }
+
+ if (base == null) {
+ context.setPropertyResolved(true);
+ }
+
+ return false;
+ }
+
+ @Override
+ public Iterator<FeatureDescriptor> getFeatureDescriptors(ELContext context,
+ Object base) {
+
+ PageContext ctxt = (PageContext) context.getContext(JspContext.class);
+ List<FeatureDescriptor> list = new ArrayList<FeatureDescriptor>();
+ Enumeration<String> e;
+ Object value;
+ String name;
+
+ e = ctxt.getAttributeNamesInScope(PageContext.PAGE_SCOPE);
+ while (e.hasMoreElements()) {
+ name = e.nextElement();
+ value = ctxt.getAttribute(name, PageContext.PAGE_SCOPE);
+ FeatureDescriptor descriptor = new FeatureDescriptor();
+ descriptor.setName(name);
+ descriptor.setDisplayName(name);
+ descriptor.setExpert(false);
+ descriptor.setHidden(false);
+ descriptor.setPreferred(true);
+ descriptor.setShortDescription("page scoped attribute");
+ descriptor.setValue("type", value.getClass());
+ descriptor.setValue("resolvableAtDesignTime", Boolean.FALSE);
+ list.add(descriptor);
+ }
+
+ e = ctxt.getAttributeNamesInScope(PageContext.REQUEST_SCOPE);
+ while (e.hasMoreElements()) {
+ name = e.nextElement();
+ value = ctxt.getAttribute(name, PageContext.REQUEST_SCOPE);
+ FeatureDescriptor descriptor = new FeatureDescriptor();
+ descriptor.setName(name);
+ descriptor.setDisplayName(name);
+ descriptor.setExpert(false);
+ descriptor.setHidden(false);
+ descriptor.setPreferred(true);
+ descriptor.setShortDescription("request scope attribute");
+ descriptor.setValue("type", value.getClass());
+ descriptor.setValue("resolvableAtDesignTime", Boolean.FALSE);
+ list.add(descriptor);
+ }
+
+ if (ctxt.getSession() != null) {
+ e = ctxt.getAttributeNamesInScope(PageContext.SESSION_SCOPE);
+ while (e.hasMoreElements()) {
+ name = e.nextElement();
+ value = ctxt.getAttribute(name, PageContext.SESSION_SCOPE);
+ FeatureDescriptor descriptor = new FeatureDescriptor();
+ descriptor.setName(name);
+ descriptor.setDisplayName(name);
+ descriptor.setExpert(false);
+ descriptor.setHidden(false);
+ descriptor.setPreferred(true);
+ descriptor.setShortDescription("session scoped attribute");
+ descriptor.setValue("type", value.getClass());
+ descriptor.setValue("resolvableAtDesignTime", Boolean.FALSE);
+ list.add(descriptor);
+ }
+ }
+
+ e = ctxt.getAttributeNamesInScope(PageContext.APPLICATION_SCOPE);
+ while (e.hasMoreElements()) {
+ name = e.nextElement();
+ value = ctxt.getAttribute(name, PageContext.APPLICATION_SCOPE);
+ FeatureDescriptor descriptor = new FeatureDescriptor();
+ descriptor.setName(name);
+ descriptor.setDisplayName(name);
+ descriptor.setExpert(false);
+ descriptor.setHidden(false);
+ descriptor.setPreferred(true);
+ descriptor.setShortDescription("application scoped attribute");
+ descriptor.setValue("type", value.getClass());
+ descriptor.setValue("resolvableAtDesignTime", Boolean.FALSE);
+ list.add(descriptor);
+ }
+ return list.iterator();
+ }
+
+ @Override
+ public Class<String> getCommonPropertyType(ELContext context, Object base) {
+ if (base == null) {
+ return String.class;
+ }
+ return null;
+ }
+}
diff --git a/bundles/org.apache.tomcat/src/javax/servlet/jsp/el/VariableResolver.java b/bundles/org.apache.tomcat/src/javax/servlet/jsp/el/VariableResolver.java
new file mode 100644
index 0000000..14f31d9
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/javax/servlet/jsp/el/VariableResolver.java
@@ -0,0 +1,51 @@
+/*
+ * 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 javax.servlet.jsp.el;
+
+/**
+ * <p>
+ * This class is used to customize the way an ExpressionEvaluator resolves
+ * variable references at evaluation time. For example, instances of this class
+ * can implement their own variable lookup mechanisms, or introduce the notion
+ * of "implicit variables" which override any other variables. An instance of
+ * this class should be passed when evaluating an expression.
+ * </p>
+ * <p>
+ * An instance of this class includes the context against which resolution will
+ * happen
+ * </p>
+ *
+ * @since 2.0
+ * @deprecated
+ */
+@SuppressWarnings("dep-ann")
+// TCK signature test fails with annotation
+public interface VariableResolver {
+
+ /**
+ * Resolves the specified variable. Returns null if the variable is not
+ * found.
+ *
+ * @param pName
+ * the name of the variable to resolve
+ * @return the result of the variable resolution
+ * @throws ELException
+ * if a failure occurred while trying to resolve the given
+ * variable
+ */
+ public Object resolveVariable(String pName) throws ELException;
+}
diff --git a/bundles/org.apache.tomcat/src/javax/servlet/jsp/el/package.html b/bundles/org.apache.tomcat/src/javax/servlet/jsp/el/package.html
new file mode 100644
index 0000000..ba5a629
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/javax/servlet/jsp/el/package.html
@@ -0,0 +1,37 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<!--
+ 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.
+-->
+</head>
+<body bgcolor="white">
+
+Classes and interfaces for the JSP 2.0 Expression Language API.
+
+<p>
+The JavaServer Pages(tm) (JSP) 2.0 specification provides a portable
+API for evaluating "EL Expressions". As of JSP 2.0, EL expressions can
+be placed directly in the template text of JSP pages and tag files.
+<p>
+This package contains a number of classes and interfaces that describe
+and define programmatic access to the Expression Language evaluator.
+This API can also be used by an implementation of JSP to evaluate the
+expressions, but other implementations, like open-coding into Java
+bytecodes, are allowed. This package is intended to have no dependencies
+on other portions of the JSP 2.0 specification.
+</body>
+</html>
diff --git a/bundles/org.apache.tomcat/src/javax/servlet/jsp/package.html b/bundles/org.apache.tomcat/src/javax/servlet/jsp/package.html
new file mode 100644
index 0000000..ea458fc
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/javax/servlet/jsp/package.html
@@ -0,0 +1,29 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<!--
+ 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.
+-->
+</head>
+<body bgcolor="white">
+Classes and interfaces for the Core JSP 2.0 API.
+<p>
+The javax.servlet.jsp package contains a number of classes and
+interfaces that describe and define the contracts between a JSP page
+implementation class and the runtime environment provided for an
+instance of such a class by a conforming JSP container.
+</body>
+</html>
diff --git a/bundles/org.apache.tomcat/src/javax/servlet/jsp/tagext/doc-files/BodyTagProtocol.gif b/bundles/org.apache.tomcat/src/javax/servlet/jsp/tagext/doc-files/BodyTagProtocol.gif
new file mode 100644
index 0000000..a61e82b
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/javax/servlet/jsp/tagext/doc-files/BodyTagProtocol.gif
Binary files differ
diff --git a/bundles/org.apache.tomcat/src/javax/servlet/jsp/tagext/doc-files/IterationTagProtocol.gif b/bundles/org.apache.tomcat/src/javax/servlet/jsp/tagext/doc-files/IterationTagProtocol.gif
new file mode 100644
index 0000000..c262341
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/javax/servlet/jsp/tagext/doc-files/IterationTagProtocol.gif
Binary files differ
diff --git a/bundles/org.apache.tomcat/src/javax/servlet/jsp/tagext/doc-files/TagProtocol.gif b/bundles/org.apache.tomcat/src/javax/servlet/jsp/tagext/doc-files/TagProtocol.gif
new file mode 100644
index 0000000..9a1880e
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/javax/servlet/jsp/tagext/doc-files/TagProtocol.gif
Binary files differ
diff --git a/bundles/org.apache.tomcat/src/javax/servlet/jsp/tagext/doc-files/VariableInfo-1.gif b/bundles/org.apache.tomcat/src/javax/servlet/jsp/tagext/doc-files/VariableInfo-1.gif
new file mode 100644
index 0000000..32eabeb
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/javax/servlet/jsp/tagext/doc-files/VariableInfo-1.gif
Binary files differ
diff --git a/bundles/org.apache.tomcat/src/javax/xml/ws/WebServiceRef.java b/bundles/org.apache.tomcat/src/javax/xml/ws/WebServiceRef.java
new file mode 100644
index 0000000..6d0d389
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/javax/xml/ws/WebServiceRef.java
@@ -0,0 +1,37 @@
+/*
+ * 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 javax.xml.ws;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Target({ElementType.TYPE, ElementType.METHOD, ElementType.FIELD})
+@Retention(RetentionPolicy.RUNTIME)
+
+public @interface WebServiceRef {
+ public String name() default "";
+ @SuppressWarnings("rawtypes") // Can't use Class<?> because API needs to match specification
+ public Class type() default java.lang.Object.class;
+ @SuppressWarnings("rawtypes") // Can't use Class<?> because API needs to match specification
+ public Class value() default java.lang.Object.class;
+ public String wsdlLocation() default "";
+ public String mappedName() default "";
+}
diff --git a/bundles/org.apache.tomcat/src/javax/xml/ws/WebServiceRefs.java b/bundles/org.apache.tomcat/src/javax/xml/ws/WebServiceRefs.java
new file mode 100644
index 0000000..851b488
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/javax/xml/ws/WebServiceRefs.java
@@ -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.
+ */
+
+
+package javax.xml.ws;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+
+public @interface WebServiceRefs {
+ public WebServiceRef[] value();
+}
diff --git a/bundles/org.apache.tomcat/src/org/apache/catalina/ha/CatalinaCluster.java b/bundles/org.apache.tomcat/src/org/apache/catalina/ha/CatalinaCluster.java
new file mode 100644
index 0000000..dfff7e9
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/org/apache/catalina/ha/CatalinaCluster.java
@@ -0,0 +1,123 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.catalina.ha;
+
+import java.util.Map;
+
+import org.apache.catalina.Cluster;
+import org.apache.catalina.LifecycleException;
+import org.apache.catalina.Manager;
+import org.apache.catalina.Valve;
+import org.apache.catalina.tribes.Channel;
+import org.apache.catalina.tribes.Member;
+import org.apache.juli.logging.Log;
+
+
+
+/**
+ * A <b>CatalinaCluster</b> interface allows to plug in and out the
+ * different cluster implementations
+ *
+ * @author Filip Hanik
+ * @version $Id: CatalinaCluster.java,v 1.1 2011/06/28 21:14:16 rherrmann Exp $
+ */
+
+public interface CatalinaCluster extends Cluster {
+ // ----------------------------------------------------- Instance Variables
+
+ /**
+ * Descriptive information about this component implementation.
+ */
+ public String info = "CatalinaCluster/2.0";
+
+ /**
+ * Start the cluster, the owning container will invoke this
+ * @throws Exception - if failure to start cluster
+ */
+ public void start() throws Exception;
+
+ /**
+ * Stops the cluster, the owning container will invoke this
+ * @throws LifecycleException
+ */
+ public void stop() throws LifecycleException;
+
+ /**
+ * Returns the associates logger with this cluster.
+ *
+ * @return Log
+ */
+ public Log getLogger();
+
+ /**
+ * Sends a message to all the members in the cluster
+ * @param msg ClusterMessage
+ */
+ public void send(ClusterMessage msg);
+
+ /**
+ * Sends a message to a specific member in the cluster.
+ *
+ * @param msg ClusterMessage
+ * @param dest Member
+ */
+ public void send(ClusterMessage msg, Member dest);
+
+ /**
+ * Returns that cluster has members.
+ */
+ public boolean hasMembers();
+
+ /**
+ * Returns all the members currently participating in the cluster.
+ *
+ * @return Member[]
+ */
+ public Member[] getMembers();
+
+ /**
+ * Return the member that represents this node.
+ *
+ * @return Member
+ */
+ public Member getLocalMember();
+
+ public void addValve(Valve valve);
+
+ public void addClusterListener(ClusterListener listener);
+
+ public void removeClusterListener(ClusterListener listener);
+
+ public void setClusterDeployer(ClusterDeployer deployer);
+
+ public ClusterDeployer getClusterDeployer();
+
+ /**
+ * @return The map of managers
+ */
+ public Map<String,ClusterManager> getManagers();
+
+ public Manager getManager(String name);
+ public String getManagerName(String name, Manager manager);
+ public Valve[] getValves();
+
+ public void setChannel(Channel channel);
+ public Channel getChannel();
+
+
+}
diff --git a/bundles/org.apache.tomcat/src/org/apache/catalina/ha/ClusterDeployer.java b/bundles/org.apache.tomcat/src/org/apache/catalina/ha/ClusterDeployer.java
new file mode 100644
index 0000000..74fed19
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/org/apache/catalina/ha/ClusterDeployer.java
@@ -0,0 +1,111 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.catalina.ha;
+
+/**
+ * A <b>ClusterDeployer</b> interface allows to plug in and out the
+ * different deployment implementations
+ *
+ * @author Filip Hanik
+ * @version $Id: ClusterDeployer.java,v 1.1 2011/06/28 21:14:16 rherrmann Exp $
+ */
+import java.io.File;
+import java.io.IOException;
+
+import org.apache.catalina.LifecycleException;
+import org.apache.catalina.tribes.ChannelListener;
+
+public interface ClusterDeployer extends ChannelListener {
+ /**
+ * Descriptive information about this component implementation.
+ */
+ public String info = "ClusterDeployer/1.0";
+ /**
+ * Start the cluster deployer, the owning container will invoke this
+ * @throws Exception - if failure to start cluster
+ */
+ public void start() throws Exception;
+
+ /**
+ * Stops the cluster deployer, the owning container will invoke this
+ * @throws LifecycleException
+ */
+ public void stop() throws LifecycleException;
+
+ /**
+ * Install a new web application, whose web application archive is at the
+ * specified URL, into this container and all the other
+ * members of the cluster with the specified context name.
+ * <p>
+ * If this application is successfully installed locally,
+ * a ContainerEvent of type
+ * <code>INSTALL_EVENT</code> will be sent to all registered listeners,
+ * with the newly created <code>Context</code> as an argument.
+ *
+ * @param contextName The context name to which this application should
+ * be installed (must be unique)
+ * @param webapp A WAR file or unpacked directory structure containing
+ * the web application to be installed
+ *
+ * @exception IllegalArgumentException if the specified context name
+ * is malformed
+ * @exception IllegalStateException if the specified context name
+ * is already attached to an existing web application
+ * @exception IOException if an input/output error was encountered
+ * during installation
+ */
+ public void install(String contextName, File webapp) throws IOException;
+
+ /**
+ * Remove an existing web application, attached to the specified context
+ * name. If this application is successfully removed, a
+ * ContainerEvent of type <code>REMOVE_EVENT</code> will be sent to all
+ * registered listeners, with the removed <code>Context</code> as
+ * an argument. Deletes the web application war file and/or directory
+ * if they exist in the Host's appBase.
+ *
+ * @param contextName The context name of the application to be removed
+ * @param undeploy boolean flag to remove web application from server
+ *
+ * @exception IllegalArgumentException if the specified context name
+ * is malformed
+ * @exception IllegalArgumentException if the specified context name does
+ * not identify a currently installed web application
+ * @exception IOException if an input/output error occurs during
+ * removal
+ */
+ public void remove(String contextName, boolean undeploy) throws IOException;
+
+ /**
+ * call from container Background Process
+ */
+ public void backgroundProcess();
+
+ /**
+ * Returns the cluster the cluster deployer is associated with
+ * @return CatalinaCluster
+ */
+ public CatalinaCluster getCluster();
+
+ /**
+ * Associates the cluster deployer with a cluster
+ * @param cluster CatalinaCluster
+ */
+ public void setCluster(CatalinaCluster cluster);
+
+}
diff --git a/bundles/org.apache.tomcat/src/org/apache/catalina/ha/ClusterListener.java b/bundles/org.apache.tomcat/src/org/apache/catalina/ha/ClusterListener.java
new file mode 100644
index 0000000..aa8974a
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/org/apache/catalina/ha/ClusterListener.java
@@ -0,0 +1,116 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.catalina.ha;
+
+import java.io.Serializable;
+
+import org.apache.catalina.tribes.ChannelListener;
+import org.apache.catalina.tribes.Member;
+
+
+/**
+ * Receive SessionID cluster change from other backup node after primary session
+ * node is failed.
+ *
+ * @author Peter Rossbach
+ * @author Filip Hanik
+ * @version $Id: ClusterListener.java,v 1.1 2011/06/28 21:14:16 rherrmann Exp $
+ */
+public abstract class ClusterListener implements ChannelListener {
+
+ private static final org.apache.juli.logging.Log log =
+ org.apache.juli.logging.LogFactory.getLog(ClusterListener.class);
+
+ //--Instance Variables--------------------------------------
+
+ /**
+ * The string manager for this package.
+ */
+
+ protected CatalinaCluster cluster = null;
+
+ //--Constructor---------------------------------------------
+
+ public ClusterListener() {
+ // NO-OP
+ }
+
+ //--Instance Getters/Setters--------------------------------
+
+ public CatalinaCluster getCluster() {
+ return cluster;
+ }
+
+ public void setCluster(CatalinaCluster cluster) {
+ if (log.isDebugEnabled()) {
+ if (cluster != null)
+ log.debug("add ClusterListener " + this.toString() +
+ " to cluster" + cluster);
+ else
+ log.debug("remove ClusterListener " + this.toString() +
+ " from cluster");
+ }
+ this.cluster = cluster;
+ }
+
+ @Override
+ public boolean equals(Object listener) {
+ return super.equals(listener);
+ }
+
+ @Override
+ public int hashCode() {
+ return super.hashCode();
+ }
+
+ //--Logic---------------------------------------------------
+
+ @Override
+ public final void messageReceived(Serializable msg, Member member) {
+ if ( msg instanceof ClusterMessage ) messageReceived((ClusterMessage)msg);
+ }
+ @Override
+ public final boolean accept(Serializable msg, Member member) {
+ if ( msg instanceof ClusterMessage ) return true;
+ return false;
+ }
+
+
+
+ /**
+ * Callback from the cluster, when a message is received, The cluster will
+ * broadcast it invoking the messageReceived on the receiver.
+ *
+ * @param msg
+ * ClusterMessage - the message received from the cluster
+ */
+ public abstract void messageReceived(ClusterMessage msg) ;
+
+
+ /**
+ * Accept only SessionIDMessages
+ *
+ * @param msg
+ * ClusterMessage
+ * @return boolean - returns true to indicate that messageReceived should be
+ * invoked. If false is returned, the messageReceived method will
+ * not be invoked.
+ */
+ public abstract boolean accept(ClusterMessage msg) ;
+
+}
diff --git a/bundles/org.apache.tomcat/src/org/apache/catalina/ha/ClusterManager.java b/bundles/org.apache.tomcat/src/org/apache/catalina/ha/ClusterManager.java
new file mode 100644
index 0000000..1fca879
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/org/apache/catalina/ha/ClusterManager.java
@@ -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.catalina.ha;
+
+
+import java.io.IOException;
+
+import org.apache.catalina.Manager;
+import org.apache.catalina.tribes.io.ReplicationStream;
+
+
+/**
+ * The common interface used by all cluster manager.
+ * This is so that we can have a more pluggable way
+ * of swapping session managers for different algorithms.
+ *
+ * @author Filip Hanik
+ * @author Peter Rossbach
+ */
+public interface ClusterManager extends Manager {
+
+ /**
+ * A message was received from another node, this
+ * is the callback method to implement if you are interested in
+ * receiving replication messages.
+ * @param msg - the message received.
+ */
+ public void messageDataReceived(ClusterMessage msg);
+
+ /**
+ * When the request has been completed, the replication valve
+ * will notify the manager, and the manager will decide whether
+ * any replication is needed or not.
+ * If there is a need for replication, the manager will
+ * create a session message and that will be replicated.
+ * The cluster determines where it gets sent.
+ * @param sessionId - the sessionId that just completed.
+ * @return a SessionMessage to be sent.
+ */
+ public ClusterMessage requestCompleted(String sessionId);
+
+ /**
+ * When the manager expires session not tied to a request.
+ * The cluster will periodically ask for a list of sessions
+ * that should expire and that should be sent across the wire.
+ * @return String[] The invalidated sessions
+ */
+ public String[] getInvalidatedSessions();
+
+ /**
+ * Return the name of the manager, at host /context name and at engine hostname+/context.
+ * @return String
+ * @since 5.5.10
+ */
+ public String getName();
+
+ /**
+ * Set the name of the manager, at host /context name and at engine hostname+/context
+ * @param name
+ * @since 5.5.10
+ */
+ public void setName(String name);
+
+ public CatalinaCluster getCluster();
+
+ public void setCluster(CatalinaCluster cluster);
+
+ public ReplicationStream getReplicationStream(byte[] data) throws IOException;
+
+ public ReplicationStream getReplicationStream(byte[] data, int offset, int length) throws IOException;
+
+ public boolean isNotifyListenersOnReplication();
+
+ public ClusterManager cloneFromTemplate();
+}
diff --git a/bundles/org.apache.tomcat/src/org/apache/catalina/ha/ClusterMessage.java b/bundles/org.apache.tomcat/src/org/apache/catalina/ha/ClusterMessage.java
new file mode 100644
index 0000000..2faf20c
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/org/apache/catalina/ha/ClusterMessage.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.catalina.ha;
+
+import java.io.Serializable;
+
+import org.apache.catalina.tribes.Member;
+
+
+/**
+ * @author Filip Hanik
+ *
+ */
+public interface ClusterMessage extends Serializable {
+ public Member getAddress();
+ public void setAddress(Member member);
+ public String getUniqueId();
+ public void setUniqueId(String id);
+ public long getTimestamp();
+ public void setTimestamp(long timestamp);
+}
diff --git a/bundles/org.apache.tomcat/src/org/apache/catalina/ha/ClusterMessageBase.java b/bundles/org.apache.tomcat/src/org/apache/catalina/ha/ClusterMessageBase.java
new file mode 100644
index 0000000..505087d
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/org/apache/catalina/ha/ClusterMessageBase.java
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.catalina.ha;
+
+import org.apache.catalina.tribes.Member;
+
+
+/**
+ * <p>Title: </p>
+ *
+ * <p>Description: </p>
+ *
+ *
+ * <p>Company: </p>
+ *
+ * @author not attributable
+ * @version 1.0
+ */
+public class ClusterMessageBase implements ClusterMessage {
+
+ private static final long serialVersionUID = 1L;
+
+ protected transient Member address;
+ private String uniqueId;
+ private long timestamp;
+ public ClusterMessageBase() {
+ // NO-OP
+ }
+
+ /**
+ * getAddress
+ *
+ * @return Member
+ * TODO Implement this org.apache.catalina.ha.ClusterMessage method
+ */
+ @Override
+ public Member getAddress() {
+ return address;
+ }
+
+ @Override
+ public String getUniqueId() {
+ return uniqueId;
+ }
+
+ @Override
+ public long getTimestamp() {
+ return timestamp;
+ }
+
+ /**
+ * setAddress
+ *
+ * @param member Member
+ * TODO Implement this org.apache.catalina.ha.ClusterMessage method
+ */
+ @Override
+ public void setAddress(Member member) {
+ this.address = member;
+ }
+
+ @Override
+ public void setUniqueId(String uniqueId) {
+ this.uniqueId = uniqueId;
+ }
+
+ @Override
+ public void setTimestamp(long timestamp) {
+ this.timestamp = timestamp;
+ }
+}
diff --git a/bundles/org.apache.tomcat/src/org/apache/catalina/ha/ClusterRuleSet.java b/bundles/org.apache.tomcat/src/org/apache/catalina/ha/ClusterRuleSet.java
new file mode 100644
index 0000000..c70affd
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/org/apache/catalina/ha/ClusterRuleSet.java
@@ -0,0 +1,195 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.catalina.ha;
+
+
+import org.apache.tomcat.util.digester.Digester;
+import org.apache.tomcat.util.digester.RuleSetBase;
+
+
+/**
+ * <p><strong>RuleSet</strong> for processing the contents of a
+ * Cluster definition element. </p>
+ *
+ * @author Filip Hanik
+ * @author Peter Rossbach
+ * @version $Id: ClusterRuleSet.java,v 1.1 2011/06/28 21:14:16 rherrmann Exp $
+ */
+
+public class ClusterRuleSet extends RuleSetBase {
+
+
+ // ----------------------------------------------------- Instance Variables
+
+
+ /**
+ * The matching pattern prefix to use for recognizing our elements.
+ */
+ protected String prefix = null;
+
+
+ // ------------------------------------------------------------ Constructor
+
+
+ /**
+ * Construct an instance of this <code>RuleSet</code> with the default
+ * matching pattern prefix.
+ */
+ public ClusterRuleSet() {
+
+ this("");
+
+ }
+
+
+ /**
+ * Construct an instance of this <code>RuleSet</code> with the specified
+ * matching pattern prefix.
+ *
+ * @param prefix Prefix for matching pattern rules (including the
+ * trailing slash character)
+ */
+ public ClusterRuleSet(String prefix) {
+ super();
+ this.namespaceURI = null;
+ this.prefix = prefix;
+ }
+
+
+ // --------------------------------------------------------- Public Methods
+
+
+ /**
+ * <p>Add the set of Rule instances defined in this RuleSet to the
+ * specified <code>Digester</code> instance, associating them with
+ * our namespace URI (if any). This method should only be called
+ * by a Digester instance.</p>
+ *
+ * @param digester Digester instance to which the new Rule instances
+ * should be added.
+ */
+ @Override
+ public void addRuleInstances(Digester digester) {
+ //Cluster configuration start
+ digester.addObjectCreate(prefix + "Manager",
+ null, // MUST be specified in the element
+ "className");
+ digester.addSetProperties(prefix + "Manager");
+ digester.addSetNext(prefix + "Manager",
+ "setManagerTemplate",
+ "org.apache.catalina.ha.ClusterManager");
+
+
+ digester.addObjectCreate(prefix + "Channel",
+ null, // MUST be specified in the element
+ "className");
+ digester.addSetProperties(prefix + "Channel");
+ digester.addSetNext(prefix + "Channel",
+ "setChannel",
+ "org.apache.catalina.tribes.Channel");
+
+
+ String channelPrefix = prefix + "Channel/";
+ { //channel properties
+ digester.addObjectCreate(channelPrefix + "Membership",
+ null, // MUST be specified in the element
+ "className");
+ digester.addSetProperties(channelPrefix + "Membership");
+ digester.addSetNext(channelPrefix + "Membership",
+ "setMembershipService",
+ "org.apache.catalina.tribes.MembershipService");
+
+ digester.addObjectCreate(channelPrefix + "Sender",
+ null, // MUST be specified in the element
+ "className");
+ digester.addSetProperties(channelPrefix + "Sender");
+ digester.addSetNext(channelPrefix + "Sender",
+ "setChannelSender",
+ "org.apache.catalina.tribes.ChannelSender");
+
+ digester.addObjectCreate(channelPrefix + "Sender/Transport",
+ null, // MUST be specified in the element
+ "className");
+ digester.addSetProperties(channelPrefix + "Sender/Transport");
+ digester.addSetNext(channelPrefix + "Sender/Transport",
+ "setTransport",
+ "org.apache.catalina.tribes.transport.MultiPointSender");
+
+
+ digester.addObjectCreate(channelPrefix + "Receiver",
+ null, // MUST be specified in the element
+ "className");
+ digester.addSetProperties(channelPrefix + "Receiver");
+ digester.addSetNext(channelPrefix + "Receiver",
+ "setChannelReceiver",
+ "org.apache.catalina.tribes.ChannelReceiver");
+
+ digester.addObjectCreate(channelPrefix + "Interceptor",
+ null, // MUST be specified in the element
+ "className");
+ digester.addSetProperties(channelPrefix + "Interceptor");
+ digester.addSetNext(channelPrefix + "Interceptor",
+ "addInterceptor",
+ "org.apache.catalina.tribes.ChannelInterceptor");
+
+
+ digester.addObjectCreate(channelPrefix + "Interceptor/Member",
+ null, // MUST be specified in the element
+ "className");
+ digester.addSetProperties(channelPrefix + "Interceptor/Member");
+ digester.addSetNext(channelPrefix + "Interceptor/Member",
+ "addStaticMember",
+ "org.apache.catalina.tribes.Member");
+ }
+
+ digester.addObjectCreate(prefix + "Valve",
+ null, // MUST be specified in the element
+ "className");
+ digester.addSetProperties(prefix + "Valve");
+ digester.addSetNext(prefix + "Valve",
+ "addValve",
+ "org.apache.catalina.Valve");
+
+ digester.addObjectCreate(prefix + "Deployer",
+ null, // MUST be specified in the element
+ "className");
+ digester.addSetProperties(prefix + "Deployer");
+ digester.addSetNext(prefix + "Deployer",
+ "setClusterDeployer",
+ "org.apache.catalina.ha.ClusterDeployer");
+
+ digester.addObjectCreate(prefix + "Listener",
+ null, // MUST be specified in the element
+ "className");
+ digester.addSetProperties(prefix + "Listener");
+ digester.addSetNext(prefix + "Listener",
+ "addLifecycleListener",
+ "org.apache.catalina.LifecycleListener");
+
+ digester.addObjectCreate(prefix + "ClusterListener",
+ null, // MUST be specified in the element
+ "className");
+ digester.addSetProperties(prefix + "ClusterListener");
+ digester.addSetNext(prefix + "ClusterListener",
+ "addClusterListener",
+ "org.apache.catalina.ha.ClusterListener");
+ //Cluster configuration end
+ }
+
+}
diff --git a/bundles/org.apache.tomcat/src/org/apache/catalina/ha/ClusterSession.java b/bundles/org.apache.tomcat/src/org/apache/catalina/ha/ClusterSession.java
new file mode 100644
index 0000000..eb124bb
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/org/apache/catalina/ha/ClusterSession.java
@@ -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.catalina.ha;
+
+import javax.servlet.http.HttpSession;
+
+import org.apache.catalina.Session;
+
+public interface ClusterSession extends Session, HttpSession {
+ /**
+ * returns true if this session is the primary session, if that is the
+ * case, the manager can expire it upon timeout.
+ * @return True if this session is primary
+ */
+ public boolean isPrimarySession();
+
+ /**
+ * Sets whether this is the primary session or not.
+ * @param primarySession Flag value
+ */
+ public void setPrimarySession(boolean primarySession);
+
+
+}
diff --git a/bundles/org.apache.tomcat/src/org/apache/catalina/ha/ClusterValve.java b/bundles/org.apache.tomcat/src/org/apache/catalina/ha/ClusterValve.java
new file mode 100644
index 0000000..fde9b88
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/org/apache/catalina/ha/ClusterValve.java
@@ -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.catalina.ha;
+
+import org.apache.catalina.Valve;
+
+/**
+ * Cluster valves are a simple extension to the Tomcat valve architecture
+ * with a small addition of being able to reference the cluster component in the container it sits in.
+ * @author Filip Hanik
+ * @author Peter Rossbach
+ * @version $Id: ClusterValve.java,v 1.1 2011/06/28 21:14:16 rherrmann Exp $
+ */
+public interface ClusterValve extends Valve{
+ /**
+ * Returns the cluster the cluster deployer is associated with
+ * @return CatalinaCluster
+ */
+ public CatalinaCluster getCluster();
+
+ /**
+ * Associates the cluster deployer with a cluster
+ * @param cluster CatalinaCluster
+ */
+ public void setCluster(CatalinaCluster cluster);
+}
diff --git a/bundles/org.apache.tomcat/src/org/apache/catalina/ha/authenticator/ClusterSingleSignOn.java b/bundles/org.apache.tomcat/src/org/apache/catalina/ha/authenticator/ClusterSingleSignOn.java
new file mode 100644
index 0000000..4b51d50
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/org/apache/catalina/ha/authenticator/ClusterSingleSignOn.java
@@ -0,0 +1,434 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.catalina.ha.authenticator;
+
+
+import java.security.Principal;
+
+import org.apache.catalina.Cluster;
+import org.apache.catalina.Container;
+import org.apache.catalina.Engine;
+import org.apache.catalina.Host;
+import org.apache.catalina.LifecycleException;
+import org.apache.catalina.Manager;
+import org.apache.catalina.Session;
+import org.apache.catalina.authenticator.SingleSignOn;
+import org.apache.catalina.ha.CatalinaCluster;
+import org.apache.catalina.ha.ClusterManager;
+import org.apache.tomcat.util.ExceptionUtils;
+
+
+
+/**
+ * A <strong>Valve</strong> that supports a "single sign on" user experience on
+ * each nodes of a cluster, where the security identity of a user who successfully
+ * authenticates to one web application is propagated to other web applications and
+ * to other nodes cluster in the same security domain. For successful use, the following
+ * requirements must be met:
+ * <ul>
+ * <li>This Valve must be configured on the Container that represents a
+ * virtual host (typically an implementation of <code>Host</code>).</li>
+ * <li>The <code>Realm</code> that contains the shared user and role
+ * information must be configured on the same Container (or a higher
+ * one), and not overridden at the web application level.</li>
+ * <li>The web applications themselves must use one of the standard
+ * Authenticators found in the
+ * <code>org.apache.catalina.authenticator</code> package.</li>
+ * </ul>
+ *
+ * @author Fabien Carrion
+ */
+
+public class ClusterSingleSignOn
+ extends SingleSignOn {
+
+
+ // ----------------------------------------------------- Instance Variables
+
+
+ /**
+ * Descriptive information about this Valve implementation.
+ */
+ protected static final String info =
+ "org.apache.catalina.ha.authenticator.ClusterSingleSignOn";
+
+ protected int messageNumber = 0;
+
+ private ClusterSingleSignOnListener clusterSSOListener = null;
+
+
+ // ------------------------------------------------------------- Properties
+
+ private CatalinaCluster cluster = null;
+
+
+
+ /**
+ * Return descriptive information about this Valve implementation.
+ */
+ @Override
+ public String getInfo() {
+
+ return (info);
+
+ }
+
+ public CatalinaCluster getCluster() {
+
+ return cluster;
+
+ }
+
+ public void setCluster(CatalinaCluster cluster) {
+
+ this.cluster = cluster;
+
+ }
+
+
+ // ------------------------------------------------------ Lifecycle Methods
+
+
+ /**
+ * Start this component and implement the requirements
+ * of {@link org.apache.catalina.util.LifecycleBase#startInternal()}.
+ *
+ * @exception LifecycleException if this component detects a fatal error
+ * that prevents this component from being used
+ */
+ @Override
+ protected synchronized void startInternal() throws LifecycleException {
+
+ clusterSSOListener = new ClusterSingleSignOnListener();
+ clusterSSOListener.setClusterSSO(this);
+
+ // Load the cluster component, if any
+ try {
+ //the channel is already running
+ Cluster cluster = getCluster();
+ // stop remove cluster binding
+ if(cluster == null) {
+ Container host = getContainer();
+ if(host != null && host instanceof Host) {
+ cluster = host.getCluster();
+ if(cluster != null && cluster instanceof CatalinaCluster) {
+ setCluster((CatalinaCluster) cluster);
+ getCluster().addClusterListener(clusterSSOListener);
+ } else {
+ Container engine = host.getParent();
+ if(engine != null && engine instanceof Engine) {
+ cluster = engine.getCluster();
+ if(cluster != null && cluster instanceof CatalinaCluster) {
+ setCluster((CatalinaCluster) cluster);
+ getCluster().addClusterListener(clusterSSOListener);
+ }
+ } else {
+ cluster = null;
+ }
+ }
+ }
+ }
+ if (cluster == null) {
+ throw new LifecycleException(
+ "There is no Cluster for ClusterSingleSignOn");
+ }
+ } catch (Throwable t) {
+ ExceptionUtils.handleThrowable(t);
+ throw new LifecycleException(
+ "ClusterSingleSignOn exception during clusterLoad " + t);
+ }
+
+ super.startInternal();
+ }
+
+
+ /**
+ * Stop this component and implement the requirements
+ * of {@link org.apache.catalina.util.LifecycleBase#stopInternal()}.
+ *
+ * @exception LifecycleException if this component detects a fatal error
+ * that prevents this component from being used
+ */
+ @Override
+ protected synchronized void stopInternal() throws LifecycleException {
+
+ super.stopInternal();
+
+ if (getCluster() != null) {
+ getCluster().removeClusterListener(clusterSSOListener);
+ }
+ }
+
+
+ // ------------------------------------------------------ Protected Methods
+
+
+ /**
+ * Notify the cluster of the addition of a Session to
+ * an SSO session and associate the specified single
+ * sign on identifier with the specified Session on the
+ * local node.
+ *
+ * @param ssoId Single sign on identifier
+ * @param session Session to be associated
+ */
+ @Override
+ protected void associate(String ssoId, Session session) {
+
+ if (cluster != null) {
+ messageNumber++;
+ SingleSignOnMessage msg =
+ new SingleSignOnMessage(cluster.getLocalMember(),
+ ssoId, session.getId());
+ Manager mgr = session.getManager();
+ if ((mgr != null) && (mgr instanceof ClusterManager))
+ msg.setContextName(((ClusterManager) mgr).getName());
+
+ msg.setAction(SingleSignOnMessage.ADD_SESSION);
+
+ cluster.send(msg);
+
+ if (containerLog.isDebugEnabled())
+ containerLog.debug("SingleSignOnMessage Send with action "
+ + msg.getAction());
+ }
+
+ associateLocal(ssoId, session);
+
+ }
+
+ protected void associateLocal(String ssoId, Session session) {
+
+ super.associate(ssoId, session);
+
+ }
+
+ /**
+ * Notify the cluster of the removal of a Session from an
+ * SSO session and deregister the specified session. If it is the last
+ * session, then also get rid of the single sign on identifier on the
+ * local node.
+ *
+ * @param ssoId Single sign on identifier
+ * @param session Session to be deregistered
+ */
+ @Override
+ protected void deregister(String ssoId, Session session) {
+
+ if (cluster != null) {
+ messageNumber++;
+ SingleSignOnMessage msg =
+ new SingleSignOnMessage(cluster.getLocalMember(),
+ ssoId, session.getId());
+ Manager mgr = session.getManager();
+ if ((mgr != null) && (mgr instanceof ClusterManager))
+ msg.setContextName(((ClusterManager) mgr).getName());
+
+ msg.setAction(SingleSignOnMessage.DEREGISTER_SESSION);
+
+ cluster.send(msg);
+ if (containerLog.isDebugEnabled())
+ containerLog.debug("SingleSignOnMessage Send with action "
+ + msg.getAction());
+ }
+
+ deregisterLocal(ssoId, session);
+
+ }
+
+ protected void deregisterLocal(String ssoId, Session session) {
+
+ super.deregister(ssoId, session);
+
+ }
+
+ /**
+ * Notifies the cluster that a single sign on session
+ * has been terminated due to a user logout, deregister
+ * the specified single sign on identifier, and invalidate
+ * any associated sessions on the local node.
+ *
+ * @param ssoId Single sign on identifier to deregister
+ */
+ @Override
+ protected void deregister(String ssoId) {
+
+ if (cluster != null) {
+ messageNumber++;
+ SingleSignOnMessage msg =
+ new SingleSignOnMessage(cluster.getLocalMember(),
+ ssoId, null);
+ msg.setAction(SingleSignOnMessage.LOGOUT_SESSION);
+
+ cluster.send(msg);
+ if (containerLog.isDebugEnabled())
+ containerLog.debug("SingleSignOnMessage Send with action "
+ + msg.getAction());
+ }
+
+ deregisterLocal(ssoId);
+
+ }
+
+ protected void deregisterLocal(String ssoId) {
+
+ super.deregister(ssoId);
+
+ }
+
+ /**
+ * Notifies the cluster of the creation of a new SSO entry
+ * and register the specified Principal as being associated
+ * with the specified value for the single sign on identifier.
+ *
+ * @param ssoId Single sign on identifier to register
+ * @param principal Associated user principal that is identified
+ * @param authType Authentication type used to authenticate this
+ * user principal
+ * @param username Username used to authenticate this user
+ * @param password Password used to authenticate this user
+ */
+ @Override
+ protected void register(String ssoId, Principal principal, String authType,
+ String username, String password) {
+
+ if (cluster != null) {
+ messageNumber++;
+ SingleSignOnMessage msg =
+ new SingleSignOnMessage(cluster.getLocalMember(),
+ ssoId, null);
+ msg.setAction(SingleSignOnMessage.REGISTER_SESSION);
+ msg.setAuthType(authType);
+ msg.setUsername(username);
+ msg.setPassword(password);
+
+ cluster.send(msg);
+ if (containerLog.isDebugEnabled())
+ containerLog.debug("SingleSignOnMessage Send with action "
+ + msg.getAction());
+ }
+
+ registerLocal(ssoId, principal, authType, username, password);
+
+ }
+
+ protected void registerLocal(String ssoId, Principal principal, String authType,
+ String username, String password) {
+
+ super.register(ssoId, principal, authType, username, password);
+
+ }
+
+
+ /**
+ * Notifies the cluster of an update of the security credentials
+ * associated with an SSO session. Updates any <code>SingleSignOnEntry</code>
+ * found under key <code>ssoId</code> with the given authentication data.
+ * <p>
+ * The purpose of this method is to allow an SSO entry that was
+ * established without a username/password combination (i.e. established
+ * following DIGEST or CLIENT-CERT authentication) to be updated with
+ * a username and password if one becomes available through a subsequent
+ * BASIC or FORM authentication. The SSO entry will then be usable for
+ * reauthentication.
+ * <p>
+ * <b>NOTE:</b> Only updates the SSO entry if a call to
+ * <code>SingleSignOnEntry.getCanReauthenticate()</code> returns
+ * <code>false</code>; otherwise, it is assumed that the SSO entry already
+ * has sufficient information to allow reauthentication and that no update
+ * is needed.
+ *
+ * @param ssoId identifier of Single sign to be updated
+ * @param principal the <code>Principal</code> returned by the latest
+ * call to <code>Realm.authenticate</code>.
+ * @param authType the type of authenticator used (BASIC, CLIENT-CERT,
+ * DIGEST or FORM)
+ * @param username the username (if any) used for the authentication
+ * @param password the password (if any) used for the authentication
+ */
+ @Override
+ protected void update(String ssoId, Principal principal, String authType,
+ String username, String password) {
+
+ if (cluster != null) {
+ messageNumber++;
+ SingleSignOnMessage msg =
+ new SingleSignOnMessage(cluster.getLocalMember(),
+ ssoId, null);
+ msg.setAction(SingleSignOnMessage.UPDATE_SESSION);
+ msg.setAuthType(authType);
+ msg.setUsername(username);
+ msg.setPassword(password);
+
+ cluster.send(msg);
+ if (containerLog.isDebugEnabled())
+ containerLog.debug("SingleSignOnMessage Send with action "
+ + msg.getAction());
+ }
+
+ updateLocal(ssoId, principal, authType, username, password);
+
+ }
+
+ protected void updateLocal(String ssoId, Principal principal, String authType,
+ String username, String password) {
+
+ super.update(ssoId, principal, authType, username, password);
+
+ }
+
+
+ /**
+ * Remove a single Session from a SingleSignOn and notify the cluster
+ * of the removal. Called when a session is timed out and no longer active.
+ *
+ * @param ssoId Single sign on identifier from which to remove the session.
+ * @param session the session to be removed.
+ */
+ @Override
+ protected void removeSession(String ssoId, Session session) {
+
+ if (cluster != null) {
+ messageNumber++;
+ SingleSignOnMessage msg =
+ new SingleSignOnMessage(cluster.getLocalMember(),
+ ssoId, session.getId());
+
+ Manager mgr = session.getManager();
+ if ((mgr != null) && (mgr instanceof ClusterManager))
+ msg.setContextName(((ClusterManager) mgr).getName());
+
+ msg.setAction(SingleSignOnMessage.REMOVE_SESSION);
+
+ cluster.send(msg);
+ if (containerLog.isDebugEnabled())
+ containerLog.debug("SingleSignOnMessage Send with action "
+ + msg.getAction());
+ }
+
+ removeSessionLocal(ssoId, session);
+ }
+
+ protected void removeSessionLocal(String ssoId, Session session) {
+
+ super.removeSession(ssoId, session);
+
+ }
+
+}
diff --git a/bundles/org.apache.tomcat/src/org/apache/catalina/ha/authenticator/ClusterSingleSignOnListener.java b/bundles/org.apache.tomcat/src/org/apache/catalina/ha/authenticator/ClusterSingleSignOnListener.java
new file mode 100644
index 0000000..e14a38e
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/org/apache/catalina/ha/authenticator/ClusterSingleSignOnListener.java
@@ -0,0 +1,184 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.catalina.ha.authenticator;
+
+import java.io.IOException;
+import java.util.Map;
+
+import org.apache.catalina.Session;
+import org.apache.catalina.ha.ClusterListener;
+import org.apache.catalina.ha.ClusterManager;
+import org.apache.catalina.ha.ClusterMessage;
+import org.apache.juli.logging.Log;
+import org.apache.juli.logging.LogFactory;
+
+/**
+ * Receive replicated SingleSignOnMessage form other cluster node.
+ *
+ * @author Fabien Carrion
+ */
+public class ClusterSingleSignOnListener extends ClusterListener {
+
+ private static final Log log =
+ LogFactory.getLog(ClusterSingleSignOnListener.class);
+
+ /**
+ * The descriptive information about this implementation.
+ */
+ protected static final String info = "org.apache.catalina.ha.authenticator.ClusterSingleSignOnListener/1.0";
+
+ // ------------------------------------------------------------- Properties
+
+ private ClusterSingleSignOn clusterSSO = null;
+
+
+ //--Constructor---------------------------------------------
+
+ public ClusterSingleSignOnListener() {
+ // NO-OP
+ }
+
+ //--Logic---------------------------------------------------
+
+ /**
+ * Return descriptive information about this implementation.
+ */
+ public String getInfo() {
+
+ return (info);
+
+ }
+
+ public ClusterSingleSignOn getClusterSSO() {
+
+ return clusterSSO;
+
+ }
+
+ public void setClusterSSO(ClusterSingleSignOn clusterSSO) {
+
+ this.clusterSSO = clusterSSO;
+
+ }
+
+
+ /**
+ * Callback from the cluster, when a message is received, The cluster will
+ * broadcast it invoking the messageReceived on the receiver.
+ *
+ * @param myobj
+ * ClusterMessage - the message received from the cluster
+ */
+ @Override
+ public void messageReceived(ClusterMessage myobj) {
+ if (myobj != null && myobj instanceof SingleSignOnMessage) {
+ SingleSignOnMessage msg = (SingleSignOnMessage) myobj;
+ int action = msg.getAction();
+ Session session = null;
+
+ if (log.isDebugEnabled())
+ log.debug("SingleSignOnMessage Received with action "
+ + msg.getAction());
+
+ switch(action) {
+ case SingleSignOnMessage.ADD_SESSION:
+ session = getSession(msg.getSessionId(),
+ msg.getContextName());
+ if (session != null)
+ clusterSSO.associateLocal(msg.getSsoId(), session);
+ break;
+ case SingleSignOnMessage.DEREGISTER_SESSION:
+ session = getSession(msg.getSessionId(),
+ msg.getContextName());
+ if (session != null)
+ clusterSSO.deregisterLocal(msg.getSsoId(), session);
+ break;
+ case SingleSignOnMessage.LOGOUT_SESSION:
+ clusterSSO.deregisterLocal(msg.getSsoId());
+ break;
+ case SingleSignOnMessage.REGISTER_SESSION:
+ clusterSSO.registerLocal(msg.getSsoId(), null, msg.getAuthType(),
+ msg.getUsername(), msg.getPassword());
+ break;
+ case SingleSignOnMessage.UPDATE_SESSION:
+ clusterSSO.updateLocal(msg.getSsoId(), null, msg.getAuthType(),
+ msg.getUsername(), msg.getPassword());
+ break;
+ case SingleSignOnMessage.REMOVE_SESSION:
+ session = getSession(msg.getSessionId(),
+ msg.getContextName());
+ if (session != null)
+ clusterSSO.removeSessionLocal(msg.getSsoId(), session);
+ break;
+ }
+ }
+ }
+
+ /**
+ * Accept only SingleSignOnMessage
+ *
+ * @param msg
+ * ClusterMessage
+ * @return boolean - returns true to indicate that messageReceived should be
+ * invoked. If false is returned, the messageReceived method will
+ * not be invoked.
+ */
+ @Override
+ public boolean accept(ClusterMessage msg) {
+ return (msg instanceof SingleSignOnMessage);
+ }
+
+
+ private Session getSession(String sessionId, String ctxname) {
+
+ Map<String,ClusterManager> managers = clusterSSO.getCluster().getManagers();
+ Session session = null;
+
+ if (ctxname == null) {
+ for (Map.Entry<String, ClusterManager> entry : managers.entrySet()) {
+ if (entry.getValue() != null) {
+ try {
+ session = entry.getValue().findSession(sessionId);
+ } catch (IOException io) {
+ log.error("Session doesn't exist:" + io);
+ }
+ return session;
+ }
+ //this happens a lot before the system has started
+ // up
+ if (log.isDebugEnabled())
+ log.debug("Context manager doesn't exist:"
+ + entry.getKey());
+ }
+ } else {
+ ClusterManager mgr = managers.get(ctxname);
+ if (mgr != null) {
+ try {
+ session = mgr.findSession(sessionId);
+ } catch (IOException io) {
+ log.error("Session doesn't exist:" + io);
+ }
+ return session;
+ } else if (log.isErrorEnabled())
+ log.error("Context manager doesn't exist:" + ctxname);
+ }
+
+ return null;
+ }
+}
+
diff --git a/bundles/org.apache.tomcat/src/org/apache/catalina/ha/authenticator/SingleSignOnMessage.java b/bundles/org.apache.tomcat/src/org/apache/catalina/ha/authenticator/SingleSignOnMessage.java
new file mode 100644
index 0000000..2abfeb2
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/org/apache/catalina/ha/authenticator/SingleSignOnMessage.java
@@ -0,0 +1,195 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.catalina.ha.authenticator;
+
+import org.apache.catalina.ha.ClusterMessage;
+import org.apache.catalina.tribes.Member;
+
+/**
+ * Contains the SingleSignOn data, read and written by the ClusterSingleSignOn
+ * @author Fabien Carrion
+ */
+
+public class SingleSignOnMessage implements ClusterMessage {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final int ADD_SESSION = 1;
+ public static final int DEREGISTER_SESSION = 2;
+ public static final int LOGOUT_SESSION = 3;
+ public static final int REGISTER_SESSION = 4;
+ public static final int UPDATE_SESSION = 5;
+ public static final int REMOVE_SESSION = 6;
+
+ private int action = -1;
+ private String ssoId = null;
+ private String ctxname = null;
+ private String sessionId = null;
+ private String authType = null;
+ private String password = null;
+ private String username = null;
+
+ private Member address = null;
+ private long timestamp = 0;
+ private String uniqueId = null;
+
+ public SingleSignOnMessage(Member source,
+ String ssoId,
+ String sessionId) {
+ this.address = source;
+ this.ssoId = ssoId;
+ this.sessionId = sessionId;
+ }
+
+ /**
+ * Get the address that this message originated from. This would be set
+ * if the message was being relayed from a host other than the one
+ * that originally sent it.
+ */
+ @Override
+ public Member getAddress() {
+ return address;
+ }
+
+ /**
+ * Called by the cluster before sending it to the other
+ * nodes.
+ *
+ * @param member Member
+ */
+ @Override
+ public void setAddress(Member member) {
+ this.address = member;
+ }
+
+ /**
+ * Timestamp message.
+ *
+ * @return long
+ */
+ @Override
+ public long getTimestamp() {
+ return timestamp;
+ }
+
+ /**
+ * Called by the cluster before sending out
+ * the message.
+ *
+ * @param timestamp The timestamp
+ */
+ @Override
+ public void setTimestamp(long timestamp) {
+ this.timestamp = timestamp;
+ }
+
+ /**
+ * Each message must have a unique ID, in case of using async replication,
+ * and a smart queue, this id is used to replace messages not yet sent.
+ *
+ * @return String
+ */
+ @Override
+ public String getUniqueId() {
+ if (this.uniqueId != null)
+ return this.uniqueId;
+ StringBuilder result = new StringBuilder(getSsoId());
+ result.append("#-#");
+ result.append(System.currentTimeMillis());
+ return result.toString();
+ }
+
+ @Override
+ public void setUniqueId(String uniqueId) {
+ this.uniqueId = uniqueId;
+ }
+
+ public int getAction() {
+ return action;
+ }
+
+ public void setAction(int action) {
+ this.action = action;
+ }
+
+ public String getSsoId() {
+ return ssoId;
+ }
+
+ public void setSsoId(String ssoId) {
+ this.ssoId = ssoId;
+ }
+
+ public String getContextName() {
+ return ctxname;
+ }
+
+ public void setContextName(String ctxname) {
+ this.ctxname = ctxname;
+ }
+
+ public String getSessionId() {
+ return sessionId;
+ }
+
+ public void setSessionId(String sessionId) {
+ this.sessionId = sessionId;
+ }
+
+ public String getAuthType() {
+ return authType;
+ }
+
+ public void setAuthType(String authType) {
+ this.authType = authType;
+ }
+
+ public String getPassword() {
+ return password;
+ }
+
+ public void setPassword(String password) {
+ this.password = password;
+ }
+
+ public String getUsername() {
+ return username;
+ }
+
+ public void setUsername(String username) {
+ this.username = username;
+ }
+
+
+ // --------------------------------------------------------- Public Methods
+
+ /**
+ * Return a String rendering of this object.
+ */
+ @Override
+ public String toString() {
+
+ StringBuilder sb = new StringBuilder("SingleSignOnMessage[action=");
+ sb.append(getAction()).append(", ssoId=").append(getSsoId());
+ sb.append(", sessionId=").append(getSessionId()).append(", username=");
+ sb.append(getUsername()).append("]");
+ return (sb.toString());
+
+ }
+
+}
diff --git a/bundles/org.apache.tomcat/src/org/apache/catalina/ha/authenticator/mbeans-descriptors.xml b/bundles/org.apache.tomcat/src/org/apache/catalina/ha/authenticator/mbeans-descriptors.xml
new file mode 100644
index 0000000..0636f95
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/org/apache/catalina/ha/authenticator/mbeans-descriptors.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0"?>
+<!--
+ 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="ClusterSingleSignOn"
+ description="A Valve that supports a 'single signon' user experience on a whole cluster"
+ domain="Catalina"
+ group="Valve"
+ type="org.apache.catalina.cluster.authenticator.ClusterSingleSignOn">
+ <attribute
+ name="className"
+ description="Fully qualified class name of the managed object"
+ type="java.lang.String"
+ writeable="false"/>
+ <attribute
+ name="requireReauthentication"
+ description="Should we attempt to reauthenticate each request against the security Realm?"
+ type="boolean"/>
+ <attribute
+ name="cookieDomain"
+ description="(Optiona) Domain to be used by sso cookies"
+ type="java.lang.String"/>
+ </mbean>
+</mbeans-descriptors>
diff --git a/bundles/org.apache.tomcat/src/org/apache/catalina/ha/backend/CollectedInfo.java b/bundles/org.apache.tomcat/src/org/apache/catalina/ha/backend/CollectedInfo.java
new file mode 100644
index 0000000..c4da0f5
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/org/apache/catalina/ha/backend/CollectedInfo.java
@@ -0,0 +1,106 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.catalina.ha.backend;
+
+/* for MBean to read ready and busy */
+
+import java.util.Iterator;
+import java.util.Set;
+
+import javax.management.MBeanServer;
+import javax.management.ObjectInstance;
+import javax.management.ObjectName;
+
+import org.apache.tomcat.util.modeler.Registry;
+
+/*
+ * Listener to provider informations to mod_heartbeat.c
+ * *msg_format = "v=%u&ready=%u&busy=%u"; (message to send).
+ * send the muticast message using the format...
+ * what about the bind(IP. port) only IP makes sense (for the moment).
+ * BTW:v = version :-)
+ */
+public class CollectedInfo {
+
+ /* Collect info via JMX */
+ protected MBeanServer mBeanServer = null;
+ protected ObjectName objName = null;
+
+ int ready;
+ int busy;
+
+ int port = 0;
+ String host = null;
+
+ public CollectedInfo(String host, int port) throws Exception {
+ init(host, port);
+ }
+ public void init(String host, int port) throws Exception {
+ int iport = 0;
+ String shost = null;
+ mBeanServer = Registry.getRegistry(null, null).getMBeanServer();
+ String onStr = "*:type=ThreadPool,*";
+ ObjectName objectName = new ObjectName(onStr);
+ Set<ObjectInstance> set = mBeanServer.queryMBeans(objectName, null);
+ Iterator<ObjectInstance> iterator = set.iterator();
+ while (iterator.hasNext()) {
+ ObjectInstance oi = iterator.next();
+ objName = oi.getObjectName();
+ String name = objName.getKeyProperty("name");
+
+ /* Name are:
+ * http-8080
+ * jk-10.33.144.3-8009
+ * jk-jfcpc%2F10.33.144.3-8009
+ */
+ String [] elenames = name.split("-");
+ String sport = elenames[elenames.length-1];
+ iport = Integer.parseInt(sport);
+ String [] shosts = elenames[1].split("%2F");
+ shost = shosts[0];
+
+ if (port==0 && host==null)
+ break; /* Take the first one */
+ if (host==null && iport==port)
+ break; /* Only port done */
+ if (shost.compareTo(host) == 0)
+ break; /* Done port and host are the expected ones */
+ }
+ if (objName == null)
+ throw(new Exception("Can't find connector for " + host + ":" + port));
+ this.port = iport;
+ this.host = shost;
+
+ }
+
+ public void refresh() throws Exception {
+ if (mBeanServer == null || objName == null) {
+ throw(new Exception("Not initialized!!!"));
+ }
+ Integer imax = (Integer) mBeanServer.getAttribute(objName, "maxThreads");
+
+ // the currentThreadCount could be 0 before the threads are created...
+ // Integer iready = (Integer) mBeanServer.getAttribute(objName, "currentThreadCount");
+
+ Integer ibusy = (Integer) mBeanServer.getAttribute(objName, "currentThreadsBusy");
+
+ busy = ibusy.intValue();
+ ready = imax.intValue() - ibusy.intValue();
+ }
+}
diff --git a/bundles/org.apache.tomcat/src/org/apache/catalina/ha/backend/HeartbeatListener.java b/bundles/org.apache.tomcat/src/org/apache/catalina/ha/backend/HeartbeatListener.java
new file mode 100644
index 0000000..9bfd426
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/org/apache/catalina/ha/backend/HeartbeatListener.java
@@ -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.catalina.ha.backend;
+
+import org.apache.catalina.ContainerEvent;
+import org.apache.catalina.ContainerListener;
+import org.apache.catalina.Lifecycle;
+import org.apache.catalina.LifecycleEvent;
+import org.apache.catalina.LifecycleListener;
+import org.apache.juli.logging.Log;
+import org.apache.juli.logging.LogFactory;
+
+/*
+ * Listener to provider informations to mod_heartbeat.c
+ * *msg_format = "v=%u&ready=%u&busy=%u"; (message to send).
+ * send the muticast message using the format...
+ * what about the bind(IP. port) only IP makes sense (for the moment).
+ * BTW:v = version :-)
+ */
+public class HeartbeatListener
+ implements LifecycleListener, ContainerListener {
+
+ private static final Log log = LogFactory.getLog(HeartbeatListener.class);
+
+ /* To allow to select the connector */
+ int port = 0;
+ String host = null;
+ public void setHost(String host) { this.host = host; }
+ public void setPort(int port) { this.port = port; }
+
+ /* for multicasting stuff */
+ String ip = "224.0.1.105"; /* Multicast IP */
+ int multiport = 23364; /* Multicast Port */
+ int ttl = 16;
+
+ public void setGroup(String ip) { this.ip = ip; }
+ public String getGroup() { return ip; }
+ public void setMultiport(int multiport) { this.multiport = multiport; }
+ public int getMultiport() { return multiport; }
+ public void setTtl(int ttl) { this.ttl = ttl; }
+ public int getTtl() { return ttl; }
+
+ /**
+ * Proxy list, format "address:port,address:port".
+ */
+ protected String proxyList = null;
+ public String getProxyList() { return proxyList; }
+ public void setProxyList(String proxyList) { this.proxyList = proxyList; }
+
+ /**
+ * URL prefix.
+ */
+ protected String proxyURL = "/HeartbeatListener";
+ public String getProxyURL() { return proxyURL; }
+ public void setProxyURL(String proxyURL) { this.proxyURL = proxyURL; }
+
+ private CollectedInfo coll = null;
+
+ private Sender sender = null;
+
+ @Override
+ public void containerEvent(ContainerEvent event) {
+ }
+
+ @Override
+ public void lifecycleEvent(LifecycleEvent event) {
+
+ if (Lifecycle.PERIODIC_EVENT.equals(event.getType())) {
+ if (sender == null) {
+ if (proxyList == null)
+ sender = new MultiCastSender();
+ else
+ sender = new TcpSender();
+ }
+
+ /* Read busy and ready */
+ if (coll == null) {
+ try {
+ coll = new CollectedInfo(host, port);
+ this.port = coll.port;
+ this.host = coll.host;
+ } catch (Exception ex) {
+ log.error("Unable to initialize info collection: " + ex);
+ coll = null;
+ return;
+ }
+ }
+
+ /* Start or restart sender */
+ try {
+ sender.init(this);
+ } catch (Exception ex) {
+ log.error("Unable to initialize Sender: " + ex);
+ sender = null;
+ return;
+ }
+
+ /* refresh the connector information and send it */
+ try {
+ coll.refresh();
+ } catch (Exception ex) {
+ log.error("Unable to collect load information: " + ex);
+ coll = null;
+ return;
+ }
+ String output = "v=1&ready=" + coll.ready + "&busy=" + coll.busy +
+ "&port=" + port;
+ try {
+ sender.send(output);
+ } catch (Exception ex) {
+ log.error("Unable to send colllected load information: " + ex);
+ }
+ }
+ }
+
+}
diff --git a/bundles/org.apache.tomcat/src/org/apache/catalina/ha/backend/MultiCastSender.java b/bundles/org.apache.tomcat/src/org/apache/catalina/ha/backend/MultiCastSender.java
new file mode 100644
index 0000000..bbb5612
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/org/apache/catalina/ha/backend/MultiCastSender.java
@@ -0,0 +1,88 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.catalina.ha.backend;
+
+import java.io.UnsupportedEncodingException;
+import java.net.DatagramPacket;
+import java.net.InetAddress;
+import java.net.InetSocketAddress;
+import java.net.MulticastSocket;
+
+import org.apache.juli.logging.Log;
+import org.apache.juli.logging.LogFactory;
+
+/*
+ * Sender to proxies using multicast socket.
+ */
+public class MultiCastSender
+ implements Sender {
+
+ private static final Log log = LogFactory.getLog(HeartbeatListener.class);
+
+ HeartbeatListener config = null;
+
+ /* for multicasting stuff */
+ MulticastSocket s = null;
+ InetAddress group = null;
+
+ @Override
+ public void init(HeartbeatListener config) throws Exception {
+ this.config = config;
+ }
+
+ @Override
+ public int send(String mess) throws Exception {
+ if (s == null) {
+ try {
+ group = InetAddress.getByName(config.getGroup());
+ if (config.host != null) {
+ InetAddress addr = InetAddress.getByName(config.host);
+ InetSocketAddress addrs = new InetSocketAddress(addr, config.getMultiport());
+ s = new MulticastSocket(addrs);
+ } else
+ s = new MulticastSocket(config.getMultiport());
+
+ s.setTimeToLive(config.getTtl());
+ s.joinGroup(group);
+ } catch (Exception ex) {
+ log.error("Unable to use multicast: " + ex);
+ s = null;
+ return -1;
+ }
+ }
+
+ byte[] buf;
+ try {
+ buf = mess.getBytes("US-ASCII");
+ } catch (UnsupportedEncodingException ex) {
+ buf = mess.getBytes();
+ }
+ DatagramPacket data = new DatagramPacket(buf, buf.length, group, config.getMultiport());
+ try {
+ s.send(data);
+ } catch (Exception ex) {
+ log.error("Unable to send colllected load information: " + ex);
+ s.close();
+ s = null;
+ return -1;
+ }
+ return 0;
+ }
+
+}
diff --git a/bundles/org.apache.tomcat/src/org/apache/catalina/ha/backend/Proxy.java b/bundles/org.apache.tomcat/src/org/apache/catalina/ha/backend/Proxy.java
new file mode 100644
index 0000000..e6dfc4b
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/org/apache/catalina/ha/backend/Proxy.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.catalina.ha.backend;
+
+import java.net.InetAddress;
+
+/*
+ * This class represents a front-end httpd server.
+ *
+ */
+public class Proxy {
+
+ protected enum State { OK, ERROR, DOWN }
+
+ public InetAddress address = null;
+ public int port = 80;
+ public State state = State.OK;
+}
diff --git a/bundles/org.apache.tomcat/src/org/apache/catalina/ha/backend/Sender.java b/bundles/org.apache.tomcat/src/org/apache/catalina/ha/backend/Sender.java
new file mode 100644
index 0000000..02e3462
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/org/apache/catalina/ha/backend/Sender.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.catalina.ha.backend;
+
+/*
+ * Interface to send data to proxies
+ *
+ */
+public interface Sender {
+
+ /**
+ * Set the configuration parameters
+ */
+ public void init(HeartbeatListener config) throws Exception;
+
+ /**
+ * Send the message to the proxies
+ */
+ public int send(String mess) throws Exception;
+}
diff --git a/bundles/org.apache.tomcat/src/org/apache/catalina/ha/backend/TcpSender.java b/bundles/org.apache.tomcat/src/org/apache/catalina/ha/backend/TcpSender.java
new file mode 100644
index 0000000..2ee0a20
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/org/apache/catalina/ha/backend/TcpSender.java
@@ -0,0 +1,207 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.catalina.ha.backend;
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.OutputStreamWriter;
+import java.net.InetAddress;
+import java.net.InetSocketAddress;
+import java.net.Socket;
+import java.util.StringTokenizer;
+
+import org.apache.juli.logging.Log;
+import org.apache.juli.logging.LogFactory;
+
+/*
+ * Sender to proxies using multicast socket.
+ */
+public class TcpSender
+ implements Sender {
+
+ private static final Log log = LogFactory.getLog(HeartbeatListener.class);
+
+ HeartbeatListener config = null;
+
+ /**
+ * Proxies.
+ */
+ protected Proxy[] proxies = null;
+
+
+ /**
+ * Active connections.
+ */
+
+ protected Socket[] connections = null;
+ protected BufferedReader[] connectionReaders = null;
+ protected BufferedWriter[] connectionWriters = null;
+
+
+ @Override
+ public void init(HeartbeatListener config) throws Exception {
+ this.config = config;
+ StringTokenizer tok = new StringTokenizer(config.getProxyList(), ",");
+ proxies = new Proxy[tok.countTokens()];
+ int i = 0;
+ while (tok.hasMoreTokens()) {
+ String token = tok.nextToken().trim();
+ int pos = token.indexOf(':');
+ if (pos <=0)
+ throw new Exception("bad ProxyList");
+ proxies[i] = new Proxy();
+ proxies[i].port = Integer.parseInt(token.substring(pos + 1));
+ try {
+ proxies[i].address = InetAddress.getByName(token.substring(0, pos));
+ } catch (Exception e) {
+ throw new Exception("bad ProxyList");
+ }
+ i++;
+ }
+ connections = new Socket[proxies.length];
+ connectionReaders = new BufferedReader[proxies.length];
+ connectionWriters = new BufferedWriter[proxies.length];
+
+ }
+
+ @Override
+ public int send(String mess) throws Exception {
+ if (connections == null) {
+ log.error("Not initialized");
+ return -1;
+ }
+ String requestLine = "POST " + config.getProxyURL() + " HTTP/1.0";
+
+ for (int i = 0; i < connections.length; i++) {
+ if (connections[i] == null) {
+ try {
+ if (config.host != null) {
+ connections[i] = new Socket();
+ InetAddress addr = InetAddress.getByName(config.host);
+ InetSocketAddress addrs = new InetSocketAddress(addr, 0);
+ connections[i].setReuseAddress(true);
+ connections[i].bind(addrs);
+ addrs = new InetSocketAddress(proxies[i].address, proxies[i].port);
+ connections[i].connect(addrs);
+ } else
+ connections[i] = new Socket(proxies[i].address, proxies[i].port);
+ connectionReaders[i] = new BufferedReader(new InputStreamReader(connections[i].getInputStream()));
+ connectionWriters[i] = new BufferedWriter(new OutputStreamWriter(connections[i].getOutputStream()));
+ } catch (Exception ex) {
+ log.error("Unable to connect to proxy: " + ex);
+ close(i);
+ }
+ }
+ if (connections[i] == null)
+ continue; // try next proxy in the list
+ BufferedWriter writer = connectionWriters[i];
+ try {
+ writer.write(requestLine);
+ writer.write("\r\n");
+ writer.write("Content-Length: " + mess.length() + "\r\n");
+ writer.write("User-Agent: HeartbeatListener/1.0\r\n");
+ writer.write("Connection: Keep-Alive\r\n");
+ writer.write("\r\n");
+ writer.write(mess);
+ writer.write("\r\n");
+ writer.flush();
+ } catch (Exception ex) {
+ log.error("Unable to send collected load information to proxy: " + ex);
+ close(i);
+ }
+ if (connections[i] == null)
+ continue; // try next proxy in the list
+
+ /* Read httpd answer */
+ String responseStatus = connectionReaders[i].readLine();
+ if (responseStatus == null) {
+ log.error("Unable to read response from proxy");
+ close(i);
+ continue;
+ } else {
+ responseStatus = responseStatus.substring(responseStatus.indexOf(' ') + 1, responseStatus.indexOf(' ', responseStatus.indexOf(' ') + 1));
+ int status = Integer.parseInt(responseStatus);
+ if (status != 200) {
+ log.error("Status is " + status);
+ close(i);
+ continue;
+ }
+
+ // read all the headers.
+ String header = connectionReaders[i].readLine();
+ int contentLength = 0;
+ while (!"".equals(header)) {
+ int colon = header.indexOf(':');
+ String headerName = header.substring(0, colon).trim();
+ String headerValue = header.substring(colon + 1).trim();
+ if ("content-length".equalsIgnoreCase(headerName)) {
+ contentLength = Integer.parseInt(headerValue);
+ }
+ header = connectionReaders[i].readLine();
+ }
+ if (contentLength > 0) {
+ char[] buf = new char[512];
+ while (contentLength > 0) {
+ int thisTime = (contentLength > buf.length) ? buf.length : contentLength;
+ int n = connectionReaders[i].read(buf, 0, thisTime);
+ if (n <= 0) {
+ log.error("Read content failed");
+ close(i);
+ break;
+ } else {
+ contentLength -= n;
+ }
+ }
+ }
+ }
+
+ }
+
+ return 0;
+ }
+
+ /**
+ * Close connection.
+ */
+ protected void close(int i) {
+ try {
+ if (connectionReaders[i] != null) {
+ connectionReaders[i].close();
+ }
+ } catch (IOException e) {
+ }
+ connectionReaders[i] = null;
+ try {
+ if (connectionWriters[i] != null) {
+ connectionWriters[i].close();
+ }
+ } catch (IOException e) {
+ }
+ connectionWriters[i] = null;
+ try {
+ if (connections[i] != null) {
+ connections[i].close();
+ }
+ } catch (IOException e) {
+ }
+ connections[i] = null;
+ }
+}
diff --git a/bundles/org.apache.tomcat/src/org/apache/catalina/ha/context/ReplicatedContext.java b/bundles/org.apache.tomcat/src/org/apache/catalina/ha/context/ReplicatedContext.java
new file mode 100644
index 0000000..e0df86b
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/org/apache/catalina/ha/context/ReplicatedContext.java
@@ -0,0 +1,210 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.catalina.ha.context;
+
+import java.util.AbstractMap;
+import java.util.Enumeration;
+import java.util.concurrent.ConcurrentHashMap;
+
+import javax.servlet.ServletContext;
+
+import org.apache.catalina.Globals;
+import org.apache.catalina.LifecycleException;
+import org.apache.catalina.Loader;
+import org.apache.catalina.core.ApplicationContext;
+import org.apache.catalina.core.StandardContext;
+import org.apache.catalina.ha.CatalinaCluster;
+import org.apache.catalina.tribes.Channel;
+import org.apache.catalina.tribes.tipis.AbstractReplicatedMap.MapOwner;
+import org.apache.catalina.tribes.tipis.ReplicatedMap;
+import org.apache.catalina.util.Enumerator;
+import org.apache.juli.logging.Log;
+import org.apache.juli.logging.LogFactory;
+
+/**
+ * @author Filip Hanik
+ * @version 1.0
+ */
+public class ReplicatedContext extends StandardContext implements MapOwner {
+ private int mapSendOptions = Channel.SEND_OPTIONS_DEFAULT;
+ private static final Log log = LogFactory.getLog( ReplicatedContext.class );
+ protected static long DEFAULT_REPL_TIMEOUT = 15000;//15 seconds
+
+ /**
+ * Start this component and implement the requirements
+ * of {@link org.apache.catalina.util.LifecycleBase#startInternal()}.
+ *
+ * @exception LifecycleException if this component detects a fatal error
+ * that prevents this component from being used
+ */
+ @Override
+ protected synchronized void startInternal() throws LifecycleException {
+
+ try {
+ CatalinaCluster catclust = (CatalinaCluster)this.getCluster();
+ if (this.context == null) this.context = new ReplApplContext(this);
+ if ( catclust != null ) {
+ ReplicatedMap map = new ReplicatedMap(this,catclust.getChannel(),DEFAULT_REPL_TIMEOUT,
+ getName(),getClassLoaders());
+ map.setChannelSendOptions(mapSendOptions);
+ ((ReplApplContext)this.context).setAttributeMap(map);
+ if (getAltDDName() != null) context.setAttribute(Globals.ALT_DD_ATTR, getAltDDName());
+ }
+ super.startInternal();
+ } catch ( Exception x ) {
+ log.error("Unable to start ReplicatedContext",x);
+ throw new LifecycleException("Failed to start ReplicatedContext",x);
+ }
+ }
+
+ /**
+ * Stop this component and implement the requirements
+ * of {@link org.apache.catalina.util.LifecycleBase#stopInternal()}.
+ *
+ * @exception LifecycleException if this component detects a fatal error
+ * that prevents this component from being used
+ */
+ @Override
+ protected synchronized void stopInternal() throws LifecycleException {
+
+ super.stopInternal();
+
+ AbstractMap<String,Object> map =
+ ((ReplApplContext)this.context).getAttributeMap();
+ if ( map!=null && map instanceof ReplicatedMap) {
+ ((ReplicatedMap)map).breakdown();
+ }
+ }
+
+
+ public void setMapSendOptions(int mapSendOptions) {
+ this.mapSendOptions = mapSendOptions;
+ }
+
+ public int getMapSendOptions() {
+ return mapSendOptions;
+ }
+
+ public ClassLoader[] getClassLoaders() {
+ Loader loader = null;
+ ClassLoader classLoader = null;
+ loader = this.getLoader();
+ if (loader != null) classLoader = loader.getClassLoader();
+ if ( classLoader == null ) classLoader = Thread.currentThread().getContextClassLoader();
+ if ( classLoader == Thread.currentThread().getContextClassLoader() ) {
+ return new ClassLoader[] {classLoader};
+ } else {
+ return new ClassLoader[] {classLoader,Thread.currentThread().getContextClassLoader()};
+ }
+ }
+
+ @Override
+ public ServletContext getServletContext() {
+ if (context == null) {
+ context = new ReplApplContext(this);
+ if (getAltDDName() != null)
+ context.setAttribute(Globals.ALT_DD_ATTR,getAltDDName());
+ }
+
+ return ((ReplApplContext)context).getFacade();
+
+ }
+
+
+ protected static class ReplApplContext extends ApplicationContext {
+ protected ConcurrentHashMap<String, Object> tomcatAttributes =
+ new ConcurrentHashMap<String, Object>();
+
+ public ReplApplContext(ReplicatedContext context) {
+ super(context);
+ }
+
+ protected ReplicatedContext getParent() {
+ return (ReplicatedContext)getContext();
+ }
+
+ @Override
+ protected ServletContext getFacade() {
+ return super.getFacade();
+ }
+
+ public AbstractMap<String,Object> getAttributeMap() {
+ return (AbstractMap<String,Object>)this.attributes;
+ }
+ public void setAttributeMap(AbstractMap<String,Object> map) {
+ this.attributes = map;
+ }
+
+ @Override
+ public void removeAttribute(String name) {
+ tomcatAttributes.remove(name);
+ //do nothing
+ super.removeAttribute(name);
+ }
+
+ @Override
+ public void setAttribute(String name, Object value) {
+ if ( (!getParent().getState().isAvailable()) || "org.apache.jasper.runtime.JspApplicationContextImpl".equals(name) ){
+ tomcatAttributes.put(name,value);
+ } else
+ super.setAttribute(name,value);
+ }
+
+ @Override
+ public Object getAttribute(String name) {
+ if (tomcatAttributes.containsKey(name) )
+ return tomcatAttributes.get(name);
+ else
+ return super.getAttribute(name);
+ }
+
+ @Override
+ public Enumeration<String> getAttributeNames() {
+ return new MultiEnumeration<String>(new Enumeration[] {super.getAttributeNames(),new Enumerator<String>(tomcatAttributes.keySet(), true)});
+ }
+
+ }
+
+ protected static class MultiEnumeration<T> implements Enumeration<T> {
+ Enumeration<T>[] e=null;
+ public MultiEnumeration(Enumeration<T>[] lists) {
+ e = lists;
+ }
+ @Override
+ public boolean hasMoreElements() {
+ for ( int i=0; i<e.length; i++ ) {
+ if ( e[i].hasMoreElements() ) return true;
+ }
+ return false;
+ }
+ @Override
+ public T nextElement() {
+ for ( int i=0; i<e.length; i++ ) {
+ if ( e[i].hasMoreElements() ) return e[i].nextElement();
+ }
+ return null;
+
+ }
+ }
+
+ @Override
+ public void objectMadePrimay(Object key, Object value) {
+ //noop
+ }
+
+
+} \ No newline at end of file
diff --git a/bundles/org.apache.tomcat/src/org/apache/catalina/ha/deploy/Constants.java b/bundles/org.apache.tomcat/src/org/apache/catalina/ha/deploy/Constants.java
new file mode 100644
index 0000000..084c207
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/org/apache/catalina/ha/deploy/Constants.java
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.catalina.ha.deploy;
+
+/**
+ * Manifest constants for the <code>org.apache.catalina.ha.deploy</code>
+ * package.
+ */
+public class Constants {
+
+ public static final String Package = "org.apache.catalina.ha.deploy";
+
+}
diff --git a/bundles/org.apache.tomcat/src/org/apache/catalina/ha/deploy/FarmWarDeployer.java b/bundles/org.apache.tomcat/src/org/apache/catalina/ha/deploy/FarmWarDeployer.java
new file mode 100644
index 0000000..bb903d5
--- /dev/null
+++ b/bundles/org.apache.tomcat/src/org/apache/catalina/ha/deploy/FarmWarDeployer.java
@@ -0,0 +1,741 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.catalina.ha.deploy;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.HashMap;
+
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+
+import org.apache.catalina.Container;
+import org.apache.catalina.Context;
+import org.apache.catalina.Engine;
+import org.apache.catalina.Globals;
+import org.apache.catalina.Host;
+import org.apache.catalina.LifecycleException;
+import org.apache.catalina.ha.ClusterDeployer;
+import org.apache.catalina.ha.ClusterListener;
+import org.apache.catalina.ha.ClusterMessage;
+import org.apache.catalina.tribes.Member;
+import org.apache.catalina.util.ContextName;
+import org.apache.juli.logging.Log;
+import org.apache.juli.logging.LogFactory;
+import org.apache.tomcat.util.modeler.Registry;
+import org.apache.tomcat.util.res.StringManager;
+
+
+/**
+ * <p>
+ * A farm war deployer is a class that is able to deploy/undeploy web
+ * applications in WAR from within the cluster.
+ * </p>
+ * Any host can act as the admin, and will have three directories
+ * <ul>
+ * <li>deployDir - the directory where we watch for changes</li>
+ * <li>applicationDir - the directory where we install applications</li>
+ * <li>tempDir - a temporaryDirectory to store binary data when downloading a
+ * war from the cluster</li>
+ * </ul>
+ * Currently we only support deployment of WAR files since they are easier to
+ * send across the wire.
+ *
+ * @author Filip Hanik
+ * @author Peter Rossbach
+ * @version $Revision: 1.1 $
+ */
+public class FarmWarDeployer extends ClusterListener
+ implements ClusterDeployer, FileChangeListener {
+ /*--Static Variables----------------------------------------*/
+ private static final Log log = LogFactory.getLog(FarmWarDeployer.class);
+ private static final StringManager sm =
+ StringManager.getManager(Constants.Package);
+
+ /**
+ * The descriptive information about this implementation.
+ */
+ private static final String info = "FarmWarDeployer/1.2";
+
+ /*--Instance Variables--------------------------------------*/
+ protected boolean started = false; //default 5 seconds
+
+ protected HashMap<String, FileMessageFactory> fileFactories =
+ new HashMap<String, FileMessageFactory>();
+
+ protected String deployDir;
+
+ protected String tempDir;
+
+ protected String watchDir;
+
+ protected boolean watchEnabled = false;
+
+ protected WarWatcher watcher = null;
+
+ /**
+ * Iteration count for background processing.
+ */
+ private int count = 0;
+
+ /**
+ * Frequency of the Farm watchDir check. Cluster wide deployment will be
+ * done once for the specified amount of backgrondProcess calls (ie, the
+ * lower the amount, the most often the checks will occur).
+ */
+ protected int processDeployFrequency = 2;
+
+ /**
+ * Path where context descriptors should be deployed.
+ */
+ protected File configBase = null;
+
+ /**
+ * The associated host.
+ */
+ protected Host host = null;
+
+ /**
+ * The host appBase.
+ */
+ protected File appBase = null;
+
+ /**
+ * MBean server.
+ */
+ protected MBeanServer mBeanServer = null;
+
+ /**
+ * The associated deployer ObjectName.
+ */
+ protected ObjectName oname = null;
+
+ /*--Constructor---------------------------------------------*/
+ public FarmWarDeployer() {
+ }
+
+ /**
+ * Return descriptive information about this deployer implementation and the
+ * corresponding version number, in the format
+ * <code>&lt;description&gt;/&lt;version&gt;</code>.
+ */
+ public String getInfo() {
+
+ return (info);
+
+ }
+
+ /*--Logic---------------------------------------------------*/
+ @Override
+ public void start() throws Exception {
+ if (started)
+ return;
+ Container hcontainer = getCluster().getContainer();
+ if(!(hcontainer instanceof Host)) {
+ log.error(sm.getString("farmWarDeployer.hostOnly"));
+ return ;
+ }
+ host = (Host) hcontainer;
+
+ // Check to correct engine and host setup
+ Container econtainer = host.getParent();
+ if(!(econtainer instanceof Engine)) {
+ log.error(sm.getString("farmWarDeployer.hostParentEngine",
+ host.getName()));
+ return ;
+ }
+ Engine engine = (Engine) econtainer;
+ String hostname = null;
+ hostname = host.getName();
+ try {
+ oname = new ObjectName(engine.getName() + ":type=Deployer,host="
+ + hostname);
+ } catch (Exception e) {
+ log.error(sm.getString("farmWarDeployer