diff options
author | Carl Anderson | 2014-03-06 18:55:11 +0000 |
---|---|---|
committer | Carl Anderson | 2014-03-06 18:55:11 +0000 |
commit | a2cd6e1bd58b3eca146a89e949bf713cf8b1eff6 (patch) | |
tree | 12c1804e130f76e6a3050cefda22e5abfb0a0821 | |
parent | 886ce66eb90cdf6543cbbb53d7d9de6fc47ced52 (diff) | |
download | webtools.javaee-a2cd6e1bd58b3eca146a89e949bf713cf8b1eff6.tar.gz webtools.javaee-a2cd6e1bd58b3eca146a89e949bf713cf8b1eff6.tar.xz webtools.javaee-a2cd6e1bd58b3eca146a89e949bf713cf8b1eff6.zip |
[426504] Update New Servlet and Filter wizards to support async optionv201403061900
17 files changed, 369 insertions, 179 deletions
diff --git a/plugins/org.eclipse.jst.j2ee.web/templates/filter_classHeader.template b/plugins/org.eclipse.jst.j2ee.web/templates/filter_classHeader.template index 98cc4f25a..34a20121e 100644 --- a/plugins/org.eclipse.jst.j2ee.web/templates/filter_classHeader.template +++ b/plugins/org.eclipse.jst.j2ee.web/templates/filter_classHeader.template @@ -240,6 +240,12 @@ %>} <% } + else if (key.equals(CreateFilterTemplateModel.ATT_ASYNC_SUPPORT)) { + Boolean value =(Boolean) params.get(key); + if (value){ +%><%= key %> = <%= value %> +<% } + } needComma = true; } %>) diff --git a/plugins/org.eclipse.jst.j2ee.web/templates/servlet_classHeader.template b/plugins/org.eclipse.jst.j2ee.web/templates/servlet_classHeader.template index 63128bf4d..6b820a9f8 100644 --- a/plugins/org.eclipse.jst.j2ee.web/templates/servlet_classHeader.template +++ b/plugins/org.eclipse.jst.j2ee.web/templates/servlet_classHeader.template @@ -159,7 +159,13 @@ } <% } - + + else if (key.equals(CreateServletTemplateModel.ATT_ASYNC_SUPPORT)) { + Boolean value =(Boolean) params.get(key); + if (value){ +%><%= key %> = <%= value %> +<% } + } needComma = true; } %>) diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/CreateFilterTemplateModel.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/CreateFilterTemplateModel.java index 65a6e42c1..e798b4d4c 100644 --- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/CreateFilterTemplateModel.java +++ b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/CreateFilterTemplateModel.java @@ -16,6 +16,7 @@ import static org.eclipse.jst.j2ee.internal.web.operations.INewFilterClassDataMo import static org.eclipse.jst.j2ee.internal.web.operations.INewFilterClassDataModelProperties.FILTER_MAPPINGS; import static org.eclipse.jst.j2ee.internal.web.operations.INewFilterClassDataModelProperties.INIT; import static org.eclipse.jst.j2ee.internal.web.operations.INewFilterClassDataModelProperties.INIT_PARAM; +import static org.eclipse.jst.j2ee.internal.web.operations.INewFilterClassDataModelProperties.ASYNC_SUPPORT; import static org.eclipse.jst.j2ee.web.IServletConstants.DESTROY_SIGNATURE; import static org.eclipse.jst.j2ee.web.IServletConstants.DO_FILTER_SIGNATURE; import static org.eclipse.jst.j2ee.web.IServletConstants.FILTER_INIT_SIGNATURE; @@ -127,6 +128,10 @@ public class CreateFilterTemplateModel extends CreateWebClassTemplateModel { return null; } + public boolean getAsyncSupported(){ + return dataModel.getBooleanProperty(ASYNC_SUPPORT); + } + public String getDispatcherList(IFilterMappingItem mapping) { List<String> list = new ArrayList<String>(); @@ -261,6 +266,11 @@ public class CreateFilterTemplateModel extends CreateWebClassTemplateModel { if (initParams != null && initParams.size() > 0) { result.put(ATT_INIT_PARAMS, initParams); } + + boolean isAsyncSupported = getAsyncSupported(); + if (isAsyncSupported) + result.put(ATT_ASYNC_SUPPORT, isAsyncSupported); + return result; } diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/CreateServletTemplateModel.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/CreateServletTemplateModel.java index e892bc630..61616a774 100644 --- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/CreateServletTemplateModel.java +++ b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/CreateServletTemplateModel.java @@ -30,6 +30,7 @@ import static org.eclipse.jst.j2ee.internal.web.operations.INewServletClassDataM import static org.eclipse.jst.j2ee.internal.web.operations.INewServletClassDataModelProperties.INIT_PARAM; import static org.eclipse.jst.j2ee.internal.web.operations.INewServletClassDataModelProperties.SERVICE; import static org.eclipse.jst.j2ee.internal.web.operations.INewServletClassDataModelProperties.URL_MAPPINGS; +import static org.eclipse.jst.j2ee.internal.web.operations.INewServletClassDataModelProperties.ASYNC_SUPPORT; import static org.eclipse.jst.j2ee.web.IServletConstants.DESTROY_SIGNATURE; import static org.eclipse.jst.j2ee.web.IServletConstants.DO_DELETE_SIGNATURE; import static org.eclipse.jst.j2ee.web.IServletConstants.DO_GET_SIGNATURE; @@ -148,7 +149,7 @@ public class CreateServletTemplateModel extends CreateWebClassTemplateModel { public String getServletClassName() { return super.getClassName(); } - + public boolean shouldGenInit() { return implementImplementedMethod(METHOD_INIT); } @@ -226,6 +227,10 @@ public class CreateServletTemplateModel extends CreateWebClassTemplateModel { return (List) dataModel.getProperty(URL_MAPPINGS); } + public boolean getAsyncSupported(){ + return dataModel.getBooleanProperty(ASYNC_SUPPORT); + } + public String getServletMapping(int index) { List<String[]> mappings = getServletMappings(); if (index < mappings.size()) { @@ -322,6 +327,10 @@ public class CreateServletTemplateModel extends CreateWebClassTemplateModel { if (initParams != null && initParams.size() > 0) { result.put(ATT_INIT_PARAMS, initParams); } + + boolean isAsyncSupported = getAsyncSupported(); + if (isAsyncSupported) + result.put(ATT_ASYNC_SUPPORT, isAsyncSupported); return result; } diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/CreateWebClassTemplateModel.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/CreateWebClassTemplateModel.java index 5187b51e9..1fc9319c7 100644 --- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/CreateWebClassTemplateModel.java +++ b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/CreateWebClassTemplateModel.java @@ -24,6 +24,7 @@ public class CreateWebClassTemplateModel extends public static final String ATT_URL_PATTERNS = "urlPatterns"; //$NON-NLS-1$ public static final String ATT_INIT_PARAMS = "initParams"; //$NON-NLS-1$ + public static final String ATT_ASYNC_SUPPORT = "asyncSupported"; //$NON-NLS-1$ public static final String SERVLET_3 = "3.0"; //$NON-NLS-1$ public static final String SERVLET_3_1 = "3.1"; //$NON-NLS-1$ diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/FilterTemplate.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/FilterTemplate.java index dfc2cda03..455a91ef8 100644 --- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/FilterTemplate.java +++ b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/FilterTemplate.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2011 SAP AG and others. + * Copyright (c) 2007, 2014 SAP AG 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 @@ -94,39 +94,44 @@ public class FilterTemplate protected final String TEXT_68 = NL + "\t\t"; //$NON-NLS-1$ protected final String TEXT_69 = " "; //$NON-NLS-1$ protected final String TEXT_70 = "}" + NL + "\t\t\t\t\t"; //$NON-NLS-1$ //$NON-NLS-2$ - protected final String TEXT_71 = ")"; //$NON-NLS-1$ - protected final String TEXT_72 = NL + "public "; //$NON-NLS-1$ - protected final String TEXT_73 = "abstract "; //$NON-NLS-1$ - protected final String TEXT_74 = "final "; //$NON-NLS-1$ - protected final String TEXT_75 = "class "; //$NON-NLS-1$ - protected final String TEXT_76 = " extends "; //$NON-NLS-1$ - protected final String TEXT_77 = " implements "; //$NON-NLS-1$ - protected final String TEXT_78 = ", "; //$NON-NLS-1$ - protected final String TEXT_79 = " {"; //$NON-NLS-1$ - protected final String TEXT_80 = NL + NL + " /**" + NL + " * Default constructor. " + NL + " */" + NL + " public "; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - protected final String TEXT_81 = "() {" + NL + " // TODO Auto-generated constructor stub" + NL + " }"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - protected final String TEXT_82 = NL + " " + NL + " /**" + NL + " * @see "; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - protected final String TEXT_83 = "#"; //$NON-NLS-1$ - protected final String TEXT_84 = "("; //$NON-NLS-1$ - protected final String TEXT_85 = ")" + NL + " */" + NL + " public "; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - protected final String TEXT_86 = "("; //$NON-NLS-1$ - protected final String TEXT_87 = ") {" + NL + " super("; //$NON-NLS-1$ //$NON-NLS-2$ - protected final String TEXT_88 = ");" + NL + " // TODO Auto-generated constructor stub" + NL + " }"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - protected final String TEXT_89 = NL + NL + "\t/**" + NL + " * @see "; //$NON-NLS-1$ //$NON-NLS-2$ - protected final String TEXT_90 = "#"; //$NON-NLS-1$ - protected final String TEXT_91 = "("; //$NON-NLS-1$ - protected final String TEXT_92 = ")" + NL + " */" + NL + " public "; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - protected final String TEXT_93 = " "; //$NON-NLS-1$ - protected final String TEXT_94 = "("; //$NON-NLS-1$ - protected final String TEXT_95 = ") {" + NL + " // TODO Auto-generated method stub"; //$NON-NLS-1$ //$NON-NLS-2$ - protected final String TEXT_96 = NL + "\t\t\treturn "; //$NON-NLS-1$ - protected final String TEXT_97 = ";"; //$NON-NLS-1$ - protected final String TEXT_98 = NL + " }"; //$NON-NLS-1$ - protected final String TEXT_99 = NL + NL + "\t/**" + NL + "\t * @see Filter#destroy()" + NL + "\t */" + NL + "\tpublic void destroy() {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ - protected final String TEXT_100 = NL + NL + "\t/**" + NL + "\t * @see Filter#doFilter(ServletRequest, ServletResponse, FilterChain)" + NL + "\t */" + NL + "\tpublic void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t\t// place your code here" + NL + "" + NL + "\t\t// pass the request along the filter chain" + NL + "\t\tchain.doFilter(request, response);" + NL + "\t}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$ - protected final String TEXT_101 = NL + NL + "\t/**" + NL + "\t * @see Filter#init(FilterConfig)" + NL + "\t */" + NL + "\tpublic void init(FilterConfig fConfig) throws ServletException {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ - protected final String TEXT_102 = NL + NL + "}"; //$NON-NLS-1$ - protected final String TEXT_103 = NL; + protected final String TEXT_71 = " = "; //$NON-NLS-1$ + protected final String TEXT_72 = ")"; //$NON-NLS-1$ + protected final String TEXT_73 = NL + "public "; //$NON-NLS-1$ + protected final String TEXT_74 = "abstract "; //$NON-NLS-1$ + protected final String TEXT_75 = "final "; //$NON-NLS-1$ + protected final String TEXT_76 = "class "; //$NON-NLS-1$ + protected final String TEXT_77 = " extends "; //$NON-NLS-1$ + protected final String TEXT_78 = " implements "; //$NON-NLS-1$ + protected final String TEXT_79 = ", "; //$NON-NLS-1$ + protected final String TEXT_80 = " {"; //$NON-NLS-1$ + protected final String TEXT_81 = NL + NL + " /**" + NL + " * Default constructor. " + NL + " */" + NL + " public "; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ + protected final String TEXT_82 = "() {" + NL + " // TODO Auto-generated constructor stub" + NL + " }"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + protected final String TEXT_83 = NL + " " + NL + " /**" + NL + " * @see "; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + protected final String TEXT_84 = "#"; //$NON-NLS-1$ + protected final String TEXT_85 = "("; //$NON-NLS-1$ + protected final String TEXT_86 = ")" + NL + " */" + NL + " public "; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + protected final String TEXT_87 = "("; //$NON-NLS-1$ + protected final String TEXT_88 = ") {" + NL + " super("; //$NON-NLS-1$ //$NON-NLS-2$ + protected final String TEXT_89 = ");" + NL + " // TODO Auto-generated constructor stub" + NL + " }"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + protected final String TEXT_90 = NL + NL + "\t/**" + NL + " * @see "; //$NON-NLS-1$ //$NON-NLS-2$ + protected final String TEXT_91 = "#"; //$NON-NLS-1$ + protected final String TEXT_92 = "("; //$NON-NLS-1$ + protected final String TEXT_93 = ")" + NL + " */" + NL + " public "; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + protected final String TEXT_94 = " "; //$NON-NLS-1$ + protected final String TEXT_95 = "("; //$NON-NLS-1$ + protected final String TEXT_96 = ") "; //$NON-NLS-1$ + protected final String TEXT_97 = "throws "; //$NON-NLS-1$ + protected final String TEXT_98 = " { "; //$NON-NLS-1$ + protected final String TEXT_99 = " { "; //$NON-NLS-1$ + protected final String TEXT_100 = NL + " // TODO Auto-generated method stub"; //$NON-NLS-1$ + protected final String TEXT_101 = NL + "\t\t\treturn "; //$NON-NLS-1$ + protected final String TEXT_102 = ";"; //$NON-NLS-1$ + protected final String TEXT_103 = NL + " }"; //$NON-NLS-1$ + protected final String TEXT_104 = NL + NL + "\t/**" + NL + "\t * @see Filter#destroy()" + NL + "\t */" + NL + "\tpublic void destroy() {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ + protected final String TEXT_105 = NL + NL + "\t/**" + NL + "\t * @see Filter#doFilter(ServletRequest, ServletResponse, FilterChain)" + NL + "\t */" + NL + "\tpublic void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t\t// place your code here" + NL + "" + NL + "\t\t// pass the request along the filter chain" + NL + "\t\tchain.doFilter(request, response);" + NL + "\t}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$ + protected final String TEXT_106 = NL + NL + "\t/**" + NL + "\t * @see Filter#init(FilterConfig)" + NL + "\t */" + NL + "\tpublic void init(FilterConfig fConfig) throws ServletException {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ + protected final String TEXT_107 = NL + NL + "}"; //$NON-NLS-1$ + protected final String TEXT_108 = NL; public String generate(Object argument) { @@ -231,7 +236,7 @@ public class FilterTemplate stringBuffer.append(TEXT_26); - if ("3.0".equals(model.getJavaEEVersion()) || "3.1".equals(model.getJavaEEVersion())) { //$NON-NLS-1$ //$NON-NLS-2$ + if ("3.0".equals(model.getJavaEEVersion()) || "3.1".equals(model.getJavaEEVersion())) { //$NON-NLS-1$ //$NON-NLS-2$ stringBuffer.append(TEXT_27); @@ -459,10 +464,19 @@ public class FilterTemplate stringBuffer.append(TEXT_70); } + else if (key.equals(CreateFilterTemplateModel.ATT_ASYNC_SUPPORT)) { + Boolean value =(Boolean) params.get(key); + if (value){ + + stringBuffer.append( key ); + stringBuffer.append(TEXT_71); + stringBuffer.append( value ); + } + } needComma = true; } - stringBuffer.append(TEXT_71); + stringBuffer.append(TEXT_72); } } @@ -470,29 +484,29 @@ public class FilterTemplate if (model.isPublic()) { - stringBuffer.append(TEXT_72); + stringBuffer.append(TEXT_73); } if (model.isAbstract()) { - stringBuffer.append(TEXT_73); + stringBuffer.append(TEXT_74); } if (model.isFinal()) { - stringBuffer.append(TEXT_74); + stringBuffer.append(TEXT_75); } - stringBuffer.append(TEXT_75); + stringBuffer.append(TEXT_76); stringBuffer.append( model.getClassName() ); String superClass = model.getSuperclassName(); if (superClass != null && superClass.length() > 0) { - stringBuffer.append(TEXT_76); + stringBuffer.append(TEXT_77); stringBuffer.append( superClass ); } @@ -500,7 +514,7 @@ public class FilterTemplate List<String> interfaces = model.getInterfaces(); if ( interfaces.size() > 0) { - stringBuffer.append(TEXT_77); + stringBuffer.append(TEXT_78); } @@ -508,7 +522,7 @@ public class FilterTemplate String INTERFACE = interfaces.get(i); if (i > 0) { - stringBuffer.append(TEXT_78); + stringBuffer.append(TEXT_79); } @@ -516,13 +530,13 @@ public class FilterTemplate } - stringBuffer.append(TEXT_79); + stringBuffer.append(TEXT_80); if (!model.hasEmptySuperclassConstructor()) { - stringBuffer.append(TEXT_80); - stringBuffer.append( model.getClassName() ); stringBuffer.append(TEXT_81); + stringBuffer.append( model.getClassName() ); + stringBuffer.append(TEXT_82); } @@ -531,19 +545,19 @@ public class FilterTemplate for (Constructor constructor : constructors) { if (constructor.isPublic() || constructor.isProtected()) { - stringBuffer.append(TEXT_82); - stringBuffer.append( model.getSuperclassName() ); stringBuffer.append(TEXT_83); stringBuffer.append( model.getSuperclassName() ); stringBuffer.append(TEXT_84); - stringBuffer.append( constructor.getParamsForJavadoc() ); + stringBuffer.append( model.getSuperclassName() ); stringBuffer.append(TEXT_85); - stringBuffer.append( model.getClassName() ); + stringBuffer.append( constructor.getParamsForJavadoc() ); stringBuffer.append(TEXT_86); - stringBuffer.append( constructor.getParamsForDeclaration() ); + stringBuffer.append( model.getClassName() ); stringBuffer.append(TEXT_87); - stringBuffer.append( constructor.getParamsForCall() ); + stringBuffer.append( constructor.getParamsForDeclaration() ); stringBuffer.append(TEXT_88); + stringBuffer.append( constructor.getParamsForCall() ); + stringBuffer.append(TEXT_89); } } @@ -553,45 +567,53 @@ public class FilterTemplate if (model.shouldImplementAbstractMethods()) { for (Method method : model.getUnimplementedMethods()) { - stringBuffer.append(TEXT_89); - stringBuffer.append( method.getContainingJavaClass() ); stringBuffer.append(TEXT_90); - stringBuffer.append( method.getName() ); + stringBuffer.append( method.getContainingJavaClass() ); stringBuffer.append(TEXT_91); - stringBuffer.append( method.getParamsForJavadoc() ); + stringBuffer.append( method.getName() ); stringBuffer.append(TEXT_92); - stringBuffer.append( method.getReturnType() ); + stringBuffer.append( method.getParamsForJavadoc() ); stringBuffer.append(TEXT_93); - stringBuffer.append( method.getName() ); + stringBuffer.append( method.getReturnType() ); stringBuffer.append(TEXT_94); - stringBuffer.append( method.getParamsForDeclaration() ); + stringBuffer.append( method.getName() ); stringBuffer.append(TEXT_95); + stringBuffer.append( method.getParamsForDeclaration() ); + stringBuffer.append(TEXT_96); + if (method.getExceptions().length() > 0){ + stringBuffer.append(TEXT_97); + stringBuffer.append(method.getExceptions()); + stringBuffer.append(TEXT_98); + }else { + stringBuffer.append(TEXT_99); + } + stringBuffer.append(TEXT_100); String defaultReturnValue = method.getDefaultReturnValue(); if (defaultReturnValue != null) { - stringBuffer.append(TEXT_96); + stringBuffer.append(TEXT_101); stringBuffer.append( defaultReturnValue ); - stringBuffer.append(TEXT_97); + stringBuffer.append(TEXT_102); } - stringBuffer.append(TEXT_98); + stringBuffer.append(TEXT_103); } } if (model.shouldGenDestroy()) { - stringBuffer.append(TEXT_99); + stringBuffer.append(TEXT_104); } if (model.shouldGenDoFilter()) { - stringBuffer.append(TEXT_100); + stringBuffer.append(TEXT_105); } if (model.shouldGenInit()) { - stringBuffer.append(TEXT_101); + stringBuffer.append(TEXT_106); } - stringBuffer.append(TEXT_102); - stringBuffer.append(TEXT_103); + stringBuffer.append(TEXT_107); + stringBuffer.append(TEXT_108); return stringBuffer.toString(); } } diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/INewFilterClassDataModelProperties.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/INewFilterClassDataModelProperties.java index 029c7c550..6b22077f6 100644 --- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/INewFilterClassDataModelProperties.java +++ b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/INewFilterClassDataModelProperties.java @@ -39,5 +39,10 @@ public interface INewFilterClassDataModelProperties extends INewWebClassDataMode * Optional, List propety used to cache all the filter mappings for this filter on the web application. */ public static final String FILTER_MAPPINGS = "NewFilterClassDataModel.FILTER_MAPPINGS"; //$NON-NLS-1$ + + /** + * Optional, boolean property used to enable asynchronous support for this filter + */ + public static final String ASYNC_SUPPORT = "NewFilterClassDataModel.ASYNC_SUPPORT"; //$NON-NLS-1$ } diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/INewServletClassDataModelProperties.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/INewServletClassDataModelProperties.java index 583f9a547..4420df3a1 100644 --- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/INewServletClassDataModelProperties.java +++ b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/INewServletClassDataModelProperties.java @@ -95,6 +95,12 @@ public interface INewServletClassDataModelProperties extends INewWebClassDataMod * Optional, List propety used to cache all the servlet mappings for this servlet on the web application. */ public static final String URL_MAPPINGS = "NewServletClassDataModel.URL_MAPPINGS"; //$NON-NLS-1$ + + /** + * Optional, boolean property used to enable asynchronous support for this servlet + */ + public static final String ASYNC_SUPPORT = "NewServletClassDataModel.ASYNC_SUPPORT"; //$NON-NLS-1$ + /** * Do not set! The javajet template file used in creating the annotated servlet template class diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/NewFilterClassDataModelProvider.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/NewFilterClassDataModelProvider.java index c928ef946..668f29375 100644 --- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/NewFilterClassDataModelProvider.java +++ b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/NewFilterClassDataModelProvider.java @@ -20,6 +20,7 @@ import static org.eclipse.jst.j2ee.internal.web.operations.INewFilterClassDataMo import static org.eclipse.jst.j2ee.internal.web.operations.INewFilterClassDataModelProperties.INIT; import static org.eclipse.jst.j2ee.internal.web.operations.INewFilterClassDataModelProperties.INIT_PARAM; import static org.eclipse.jst.j2ee.internal.web.operations.INewWebClassDataModelProperties.DISPLAY_NAME; +import static org.eclipse.jst.j2ee.internal.web.operations.INewFilterClassDataModelProperties.ASYNC_SUPPORT; import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_FILTER; import java.util.ArrayList; @@ -91,6 +92,7 @@ public class NewFilterClassDataModelProvider extends propertyNames.add(DO_FILTER); propertyNames.add(INIT_PARAM); propertyNames.add(FILTER_MAPPINGS); + propertyNames.add(ASYNC_SUPPORT); return propertyNames; } diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/NewServletClassDataModelProvider.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/NewServletClassDataModelProvider.java index 9792723bd..63734a300 100644 --- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/NewServletClassDataModelProvider.java +++ b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/NewServletClassDataModelProvider.java @@ -34,6 +34,7 @@ import static org.eclipse.jst.j2ee.internal.web.operations.INewServletClassDataM import static org.eclipse.jst.j2ee.internal.web.operations.INewServletClassDataModelProperties.TEMPLATE_FILE; import static org.eclipse.jst.j2ee.internal.web.operations.INewServletClassDataModelProperties.TO_STRING; import static org.eclipse.jst.j2ee.internal.web.operations.INewServletClassDataModelProperties.URL_MAPPINGS; +import static org.eclipse.jst.j2ee.internal.web.operations.INewServletClassDataModelProperties.ASYNC_SUPPORT; import static org.eclipse.jst.j2ee.internal.web.operations.INewWebClassDataModelProperties.DISPLAY_NAME; import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_HTTP_SERVLET; import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_SERVLET; @@ -150,6 +151,7 @@ public class NewServletClassDataModelProvider extends propertyNames.add(IS_SERVLET_TYPE); propertyNames.add(INIT_PARAM); propertyNames.add(URL_MAPPINGS); + propertyNames.add(ASYNC_SUPPORT); propertyNames.add(NON_ANNOTATED_TEMPLATE_FILE); propertyNames.add(TEMPLATE_FILE); diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/ServletTemplate.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/ServletTemplate.java index 98de959ef..c4eec8fdb 100644 --- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/ServletTemplate.java +++ b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/ServletTemplate.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2011 SAP AG and others. + * Copyright (c) 2007, 2014 SAP AG 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 @@ -75,50 +75,55 @@ public class ServletTemplate protected final String TEXT_49 = "\""; //$NON-NLS-1$ protected final String TEXT_50 = ")"; //$NON-NLS-1$ protected final String TEXT_51 = NL + "\t\t}"; //$NON-NLS-1$ - protected final String TEXT_52 = ")"; //$NON-NLS-1$ - protected final String TEXT_53 = NL + "public "; //$NON-NLS-1$ - protected final String TEXT_54 = "abstract "; //$NON-NLS-1$ - protected final String TEXT_55 = "final "; //$NON-NLS-1$ - protected final String TEXT_56 = "class "; //$NON-NLS-1$ - protected final String TEXT_57 = " extends "; //$NON-NLS-1$ - protected final String TEXT_58 = " implements "; //$NON-NLS-1$ - protected final String TEXT_59 = ", "; //$NON-NLS-1$ - protected final String TEXT_60 = " {"; //$NON-NLS-1$ - protected final String TEXT_61 = NL + "\tprivate static final long serialVersionUID = 1L;"; //$NON-NLS-1$ - protected final String TEXT_62 = NL + NL + " /**" + NL + " * Default constructor. " + NL + " */" + NL + " public "; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - protected final String TEXT_63 = "() {" + NL + " // TODO Auto-generated constructor stub" + NL + " }"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - protected final String TEXT_64 = NL + " " + NL + " /**" + NL + " * @see "; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - protected final String TEXT_65 = "#"; //$NON-NLS-1$ - protected final String TEXT_66 = "("; //$NON-NLS-1$ - protected final String TEXT_67 = ")" + NL + " */" + NL + " public "; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - protected final String TEXT_68 = "("; //$NON-NLS-1$ - protected final String TEXT_69 = ") {" + NL + " super("; //$NON-NLS-1$ //$NON-NLS-2$ - protected final String TEXT_70 = ");" + NL + " // TODO Auto-generated constructor stub" + NL + " }"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - protected final String TEXT_71 = NL + NL + "\t/**" + NL + " * @see "; //$NON-NLS-1$ //$NON-NLS-2$ - protected final String TEXT_72 = "#"; //$NON-NLS-1$ - protected final String TEXT_73 = "("; //$NON-NLS-1$ - protected final String TEXT_74 = ")" + NL + " */" + NL + " public "; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - protected final String TEXT_75 = " "; //$NON-NLS-1$ - protected final String TEXT_76 = "("; //$NON-NLS-1$ - protected final String TEXT_77 = ") {" + NL + " // TODO Auto-generated method stub"; //$NON-NLS-1$ //$NON-NLS-2$ - protected final String TEXT_78 = NL + "\t\t\treturn "; //$NON-NLS-1$ - protected final String TEXT_79 = ";"; //$NON-NLS-1$ - protected final String TEXT_80 = NL + " }"; //$NON-NLS-1$ - protected final String TEXT_81 = NL + NL + "\t/**" + NL + "\t * @see Servlet#init(ServletConfig)" + NL + "\t */" + NL + "\tpublic void init(ServletConfig config) throws ServletException {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ - protected final String TEXT_82 = NL + NL + "\t/**" + NL + "\t * @see Servlet#destroy()" + NL + "\t */" + NL + "\tpublic void destroy() {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ - protected final String TEXT_83 = NL + NL + "\t/**" + NL + "\t * @see Servlet#getServletConfig()" + NL + "\t */" + NL + "\tpublic ServletConfig getServletConfig() {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t\treturn null;" + NL + "\t}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ - protected final String TEXT_84 = NL + NL + "\t/**" + NL + "\t * @see Servlet#getServletInfo()" + NL + "\t */" + NL + "\tpublic String getServletInfo() {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t\treturn null; " + NL + "\t}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ - protected final String TEXT_85 = NL + NL + "\t/**" + NL + "\t * @see Servlet#service(ServletRequest request, ServletResponse response)" + NL + "\t */" + NL + "\tpublic void service(ServletRequest request, ServletResponse response) throws ServletException, IOException {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ - protected final String TEXT_86 = NL + NL + "\t/**" + NL + "\t * @see HttpServlet#service(HttpServletRequest request, HttpServletResponse response)" + NL + "\t */" + NL + "\tprotected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ - protected final String TEXT_87 = NL + NL + "\t/**" + NL + "\t * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)" + NL + "\t */" + NL + "\tprotected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ - protected final String TEXT_88 = NL + NL + "\t/**" + NL + "\t * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)" + NL + "\t */" + NL + "\tprotected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ - protected final String TEXT_89 = NL + NL + "\t/**" + NL + "\t * @see HttpServlet#doPut(HttpServletRequest, HttpServletResponse)" + NL + "\t */" + NL + "\tprotected void doPut(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ - protected final String TEXT_90 = NL + NL + "\t/**" + NL + "\t * @see HttpServlet#doDelete(HttpServletRequest, HttpServletResponse)" + NL + "\t */" + NL + "\tprotected void doDelete(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ - protected final String TEXT_91 = NL + NL + "\t/**" + NL + "\t * @see HttpServlet#doHead(HttpServletRequest, HttpServletResponse)" + NL + "\t */" + NL + "\tprotected void doHead(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ - protected final String TEXT_92 = NL + NL + "\t/**" + NL + "\t * @see HttpServlet#doOptions(HttpServletRequest, HttpServletResponse)" + NL + "\t */" + NL + "\tprotected void doOptions(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ - protected final String TEXT_93 = NL + NL + "\t/**" + NL + "\t * @see HttpServlet#doTrace(HttpServletRequest, HttpServletResponse)" + NL + "\t */" + NL + "\tprotected void doTrace(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ - protected final String TEXT_94 = NL + NL + "}"; //$NON-NLS-1$ - protected final String TEXT_95 = NL; + protected final String TEXT_52 = " = "; //$NON-NLS-1$ + protected final String TEXT_53 = ")"; //$NON-NLS-1$ + protected final String TEXT_54 = NL + "public "; //$NON-NLS-1$ + protected final String TEXT_55 = "abstract "; //$NON-NLS-1$ + protected final String TEXT_56 = "final "; //$NON-NLS-1$ + protected final String TEXT_57 = "class "; //$NON-NLS-1$ + protected final String TEXT_58 = " extends "; //$NON-NLS-1$ + protected final String TEXT_59 = " implements "; //$NON-NLS-1$ + protected final String TEXT_60 = ", "; //$NON-NLS-1$ + protected final String TEXT_61 = " {"; //$NON-NLS-1$ + protected final String TEXT_62 = NL + "\tprivate static final long serialVersionUID = 1L;"; //$NON-NLS-1$ + protected final String TEXT_63 = NL + NL + " /**" + NL + " * Default constructor. " + NL + " */" + NL + " public "; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ + protected final String TEXT_64 = "() {" + NL + " // TODO Auto-generated constructor stub" + NL + " }"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + protected final String TEXT_65 = NL + " " + NL + " /**" + NL + " * @see "; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + protected final String TEXT_66 = "#"; //$NON-NLS-1$ + protected final String TEXT_67 = "("; //$NON-NLS-1$ + protected final String TEXT_68 = ")" + NL + " */" + NL + " public "; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + protected final String TEXT_69 = "("; //$NON-NLS-1$ + protected final String TEXT_70 = ") {" + NL + " super("; //$NON-NLS-1$ //$NON-NLS-2$ + protected final String TEXT_71 = ");" + NL + " // TODO Auto-generated constructor stub" + NL + " }"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + protected final String TEXT_72 = NL + NL + "\t/**" + NL + " * @see "; //$NON-NLS-1$ //$NON-NLS-2$ + protected final String TEXT_73 = "#"; //$NON-NLS-1$ + protected final String TEXT_74 = "("; //$NON-NLS-1$ + protected final String TEXT_75 = ")" + NL + " */" + NL + " public "; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + protected final String TEXT_76 = " "; //$NON-NLS-1$ + protected final String TEXT_77 = "("; //$NON-NLS-1$ + protected final String TEXT_78 = ") "; //$NON-NLS-1$ + protected final String TEXT_79 = "throws "; //$NON-NLS-1$ + protected final String TEXT_80 = " { "; //$NON-NLS-1$ + protected final String TEXT_81 = " { "; //$NON-NLS-1$ + protected final String TEXT_82 = NL + " // TODO Auto-generated method stub"; //$NON-NLS-1$ + protected final String TEXT_83 = NL + "\t\t\treturn "; //$NON-NLS-1$ + protected final String TEXT_84 = ";"; //$NON-NLS-1$ + protected final String TEXT_85 = NL + " }"; //$NON-NLS-1$ + protected final String TEXT_86 = NL + NL + "\t/**" + NL + "\t * @see Servlet#init(ServletConfig)" + NL + "\t */" + NL + "\tpublic void init(ServletConfig config) throws ServletException {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ + protected final String TEXT_87 = NL + NL + "\t/**" + NL + "\t * @see Servlet#destroy()" + NL + "\t */" + NL + "\tpublic void destroy() {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ + protected final String TEXT_88 = NL + NL + "\t/**" + NL + "\t * @see Servlet#getServletConfig()" + NL + "\t */" + NL + "\tpublic ServletConfig getServletConfig() {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t\treturn null;" + NL + "\t}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ + protected final String TEXT_89 = NL + NL + "\t/**" + NL + "\t * @see Servlet#getServletInfo()" + NL + "\t */" + NL + "\tpublic String getServletInfo() {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t\treturn null; " + NL + "\t}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ + protected final String TEXT_90 = NL + NL + "\t/**" + NL + "\t * @see Servlet#service(ServletRequest request, ServletResponse response)" + NL + "\t */" + NL + "\tpublic void service(ServletRequest request, ServletResponse response) throws ServletException, IOException {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ + protected final String TEXT_91 = NL + NL + "\t/**" + NL + "\t * @see HttpServlet#service(HttpServletRequest request, HttpServletResponse response)" + NL + "\t */" + NL + "\tprotected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ + protected final String TEXT_92 = NL + NL + "\t/**" + NL + "\t * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)" + NL + "\t */" + NL + "\tprotected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ + protected final String TEXT_93 = NL + NL + "\t/**" + NL + "\t * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)" + NL + "\t */" + NL + "\tprotected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ + protected final String TEXT_94 = NL + NL + "\t/**" + NL + "\t * @see HttpServlet#doPut(HttpServletRequest, HttpServletResponse)" + NL + "\t */" + NL + "\tprotected void doPut(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ + protected final String TEXT_95 = NL + NL + "\t/**" + NL + "\t * @see HttpServlet#doDelete(HttpServletRequest, HttpServletResponse)" + NL + "\t */" + NL + "\tprotected void doDelete(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ + protected final String TEXT_96 = NL + NL + "\t/**" + NL + "\t * @see HttpServlet#doHead(HttpServletRequest, HttpServletResponse)" + NL + "\t */" + NL + "\tprotected void doHead(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ + protected final String TEXT_97 = NL + NL + "\t/**" + NL + "\t * @see HttpServlet#doOptions(HttpServletRequest, HttpServletResponse)" + NL + "\t */" + NL + "\tprotected void doOptions(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ + protected final String TEXT_98 = NL + NL + "\t/**" + NL + "\t * @see HttpServlet#doTrace(HttpServletRequest, HttpServletResponse)" + NL + "\t */" + NL + "\tprotected void doTrace(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ + protected final String TEXT_99 = NL + NL + "}"; //$NON-NLS-1$ + protected final String TEXT_100 = NL; public String generate(Object argument) { @@ -350,11 +355,20 @@ public class ServletTemplate stringBuffer.append(TEXT_51); } - + + else if (key.equals(CreateServletTemplateModel.ATT_ASYNC_SUPPORT)) { + Boolean value =(Boolean) params.get(key); + if (value){ + + stringBuffer.append( key ); + stringBuffer.append(TEXT_52); + stringBuffer.append( value ); + } + } needComma = true; } - stringBuffer.append(TEXT_52); + stringBuffer.append(TEXT_53); } } @@ -362,29 +376,29 @@ public class ServletTemplate if (model.isPublic()) { - stringBuffer.append(TEXT_53); + stringBuffer.append(TEXT_54); } if (model.isAbstract()) { - stringBuffer.append(TEXT_54); + stringBuffer.append(TEXT_55); } if (model.isFinal()) { - stringBuffer.append(TEXT_55); + stringBuffer.append(TEXT_56); } - stringBuffer.append(TEXT_56); + stringBuffer.append(TEXT_57); stringBuffer.append( model.getClassName() ); String superClass = model.getSuperclassName(); if (superClass != null && superClass.length() > 0) { - stringBuffer.append(TEXT_57); + stringBuffer.append(TEXT_58); stringBuffer.append( superClass ); } @@ -392,7 +406,7 @@ public class ServletTemplate List<String> interfaces = model.getInterfaces(); if ( interfaces.size() > 0) { - stringBuffer.append(TEXT_58); + stringBuffer.append(TEXT_59); } @@ -400,7 +414,7 @@ public class ServletTemplate String INTERFACE = interfaces.get(i); if (i > 0) { - stringBuffer.append(TEXT_59); + stringBuffer.append(TEXT_60); } @@ -408,20 +422,20 @@ public class ServletTemplate } - stringBuffer.append(TEXT_60); + stringBuffer.append(TEXT_61); if (model.isGenericServletSuperclass()) { - stringBuffer.append(TEXT_61); + stringBuffer.append(TEXT_62); } if (!model.hasEmptySuperclassConstructor()) { - stringBuffer.append(TEXT_62); - stringBuffer.append( model.getClassName() ); stringBuffer.append(TEXT_63); + stringBuffer.append( model.getClassName() ); + stringBuffer.append(TEXT_64); } @@ -430,19 +444,19 @@ public class ServletTemplate for (Constructor constructor : constructors) { if (constructor.isPublic() || constructor.isProtected()) { - stringBuffer.append(TEXT_64); - stringBuffer.append( model.getSuperclassName() ); stringBuffer.append(TEXT_65); stringBuffer.append( model.getSuperclassName() ); stringBuffer.append(TEXT_66); - stringBuffer.append( constructor.getParamsForJavadoc() ); + stringBuffer.append( model.getSuperclassName() ); stringBuffer.append(TEXT_67); - stringBuffer.append( model.getClassName() ); + stringBuffer.append( constructor.getParamsForJavadoc() ); stringBuffer.append(TEXT_68); - stringBuffer.append( constructor.getParamsForDeclaration() ); + stringBuffer.append( model.getClassName() ); stringBuffer.append(TEXT_69); - stringBuffer.append( constructor.getParamsForCall() ); + stringBuffer.append( constructor.getParamsForDeclaration() ); stringBuffer.append(TEXT_70); + stringBuffer.append( constructor.getParamsForCall() ); + stringBuffer.append(TEXT_71); } } @@ -452,75 +466,83 @@ public class ServletTemplate if (model.shouldImplementAbstractMethods()) { for (Method method : model.getUnimplementedMethods()) { - stringBuffer.append(TEXT_71); - stringBuffer.append( method.getContainingJavaClass() ); stringBuffer.append(TEXT_72); - stringBuffer.append( method.getName() ); + stringBuffer.append( method.getContainingJavaClass() ); stringBuffer.append(TEXT_73); - stringBuffer.append( method.getParamsForJavadoc() ); + stringBuffer.append( method.getName() ); stringBuffer.append(TEXT_74); - stringBuffer.append( method.getReturnType() ); + stringBuffer.append( method.getParamsForJavadoc() ); stringBuffer.append(TEXT_75); - stringBuffer.append( method.getName() ); + stringBuffer.append( method.getReturnType() ); stringBuffer.append(TEXT_76); - stringBuffer.append( method.getParamsForDeclaration() ); + stringBuffer.append( method.getName() ); stringBuffer.append(TEXT_77); + stringBuffer.append( method.getParamsForDeclaration() ); + stringBuffer.append(TEXT_78); + if (method.getExceptions().length() > 0){ + stringBuffer.append(TEXT_79); + stringBuffer.append(method.getExceptions()); + stringBuffer.append(TEXT_80); + }else { + stringBuffer.append(TEXT_81); + } + stringBuffer.append(TEXT_82); String defaultReturnValue = method.getDefaultReturnValue(); if (defaultReturnValue != null) { - stringBuffer.append(TEXT_78); + stringBuffer.append(TEXT_83); stringBuffer.append( defaultReturnValue ); - stringBuffer.append(TEXT_79); + stringBuffer.append(TEXT_84); } - stringBuffer.append(TEXT_80); + stringBuffer.append(TEXT_85); } } if (model.shouldGenInit()) { - stringBuffer.append(TEXT_81); + stringBuffer.append(TEXT_86); } if (model.shouldGenDestroy()) { - stringBuffer.append(TEXT_82); + stringBuffer.append(TEXT_87); } if (model.shouldGenGetServletConfig()) { - stringBuffer.append(TEXT_83); + stringBuffer.append(TEXT_88); } if (model.shouldGenGetServletInfo()) { - stringBuffer.append(TEXT_84); + stringBuffer.append(TEXT_89); } if (model.shouldGenService() && !model.isHttpServletSuperclass()) { - stringBuffer.append(TEXT_85); + stringBuffer.append(TEXT_90); } if (model.shouldGenService() && model.isHttpServletSuperclass()) { - stringBuffer.append(TEXT_86); + stringBuffer.append(TEXT_91); } if (model.shouldGenDoGet()) { - stringBuffer.append(TEXT_87); + stringBuffer.append(TEXT_92); } if (model.shouldGenDoPost()) { - stringBuffer.append(TEXT_88); + stringBuffer.append(TEXT_93); } if (model.shouldGenDoPut()) { - stringBuffer.append(TEXT_89); + stringBuffer.append(TEXT_94); } if (model.shouldGenDoDelete()) { - stringBuffer.append(TEXT_90); + stringBuffer.append(TEXT_95); } if (model.shouldGenDoHead()) { - stringBuffer.append(TEXT_91); + stringBuffer.append(TEXT_96); } if (model.shouldGenDoOptions()) { - stringBuffer.append(TEXT_92); + stringBuffer.append(TEXT_97); } if (model.shouldGenDoTrace()) { - stringBuffer.append(TEXT_93); + stringBuffer.append(TEXT_98); } - stringBuffer.append(TEXT_94); - stringBuffer.append(TEXT_95); + stringBuffer.append(TEXT_99); + stringBuffer.append(TEXT_100); return stringBuffer.toString(); } } diff --git a/plugins/org.eclipse.jst.servlet.ui/property_files/web_ui.properties b/plugins/org.eclipse.jst.servlet.ui/property_files/web_ui.properties index 4bc6d6a42..524a2af57 100644 --- a/plugins/org.eclipse.jst.servlet.ui/property_files/web_ui.properties +++ b/plugins/org.eclipse.jst.servlet.ui/property_files/web_ui.properties @@ -56,6 +56,7 @@ INIT_PARAM_TITLE=Initialization Parameters INIT_PARAM_LABEL=Initialization ¶meters: URL_MAPPINGS_TITLE=URL Mappings URL_MAPPINGS_LABEL=&URL mappings: +ASYNC_SUPPORT_LABEL = As&ynchronous Support CHOOSE_SERVLET_CLASS=&Choose a JSP file: NEW_SERVLET_WIZARD_WINDOW_TITLE=New Servlet diff --git a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/plugin/WEBUIMessages.java b/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/plugin/WEBUIMessages.java index f34c07561..6814cbed5 100644 --- a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/plugin/WEBUIMessages.java +++ b/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/plugin/WEBUIMessages.java @@ -39,6 +39,7 @@ public class WEBUIMessages extends NLS { public static String ADD_SERVLET_WIZARD_PAGE_TITLE; public static String ADD_FILTER_WIZARD_WINDOW_TITLE; public static String ADD_FILTER_WIZARD_PAGE_TITLE; + public static String ASYNC_SUPPORT_LABEL; public static String JAVA_CLASS_MAIN_CHECKBOX_LABEL; public static String EMPTY_LIST_MSG; public static String ExportWARAction_UI_; diff --git a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/AddFilterWizardPage.java b/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/AddFilterWizardPage.java index 79ca1aea6..c6cc7907e 100644 --- a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/AddFilterWizardPage.java +++ b/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/AddFilterWizardPage.java @@ -12,6 +12,7 @@ package org.eclipse.jst.servlet.ui.internal.wizard; import static org.eclipse.jst.j2ee.internal.web.operations.INewFilterClassDataModelProperties.FILTER_MAPPINGS; import static org.eclipse.jst.j2ee.internal.web.operations.INewFilterClassDataModelProperties.INIT_PARAM; +import static org.eclipse.jst.j2ee.internal.web.operations.INewFilterClassDataModelProperties.ASYNC_SUPPORT; import static org.eclipse.jst.j2ee.internal.web.operations.INewWebClassDataModelProperties.DESCRIPTION; import static org.eclipse.jst.j2ee.internal.web.operations.INewWebClassDataModelProperties.DISPLAY_NAME; import static org.eclipse.jst.j2ee.internal.web.operations.INewWebClassDataModelProperties.USE_EXISTING_CLASS; @@ -33,10 +34,12 @@ import static org.eclipse.wst.common.componentcore.internal.operation.IArtifactE import org.eclipse.core.runtime.IStatus; import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jst.j2ee.internal.web.operations.INewServletClassDataModelProperties; import org.eclipse.jst.j2ee.internal.wizard.StringArrayTableWizardSection; import org.eclipse.swt.SWT; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Text; @@ -54,6 +57,7 @@ public class AddFilterWizardPage extends DataModelWizardPage { private Text displayNameText; FilterMappingsArrayTableWizardSection mappingSection; + private Button asyncSupportCheckBox; public AddFilterWizardPage(IDataModel model, String pageName) { super(model, pageName); @@ -103,6 +107,9 @@ public class AddFilterWizardPage extends DataModelWizardPage { displayNameText.setFocus(); + createAsyncSupportGroup(composite); + + IStatus projectStatus = validateProjectName(); if (!projectStatus.isOK()) { setErrorMessage(projectStatus.getMessage()); @@ -140,6 +147,16 @@ public class AddFilterWizardPage extends DataModelWizardPage { descText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); synchHelper.synchText(descText, DESCRIPTION, null); } + + + private void createAsyncSupportGroup(Composite composite){ + asyncSupportCheckBox = new Button(composite, SWT.CHECK); + asyncSupportCheckBox.setText(IWebWizardConstants.ASYNC_SUPPORT_LABEL); + GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL); + data.horizontalSpan = 3; + asyncSupportCheckBox.setLayoutData(data); + synchHelper.synchCheckbox(asyncSupportCheckBox, ASYNC_SUPPORT, null); + } public String getDisplayName() { return displayNameText.getText(); @@ -157,4 +174,15 @@ public class AddFilterWizardPage extends DataModelWizardPage { return true; } + @Override + public void setVisible(boolean visible) { + super.setVisible(visible); + String javaEEVersion = model.getStringProperty(INewServletClassDataModelProperties.JAVA_EE_VERSION); + if("3.0".equals(javaEEVersion) || "3.1".equals(javaEEVersion)){ //$NON-NLS-1$ //$NON-NLS-2$ + asyncSupportCheckBox.setVisible(true); + } + else + asyncSupportCheckBox.setVisible(false); + } + } diff --git a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/AddListenerWizardPage.java b/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/AddListenerWizardPage.java index 12d8119fe..13fac9025 100644 --- a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/AddListenerWizardPage.java +++ b/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/AddListenerWizardPage.java @@ -50,6 +50,8 @@ public class AddListenerWizardPage extends DataModelWizardPage { private static final Image IMG_INTERFACE = JavaPluginImages.get(JavaPluginImages.IMG_OBJS_INTERFACE); protected ServletDataModelSyncHelper synchHelper2; + private Button changeSessionID, asyncListener; + private Label changeSessionIDIconLabel, changeSessionIDInterfaceLabel, asyncListenerIconLabel, asyncListenerInterfaceLabel; public AddListenerWizardPage(IDataModel model, String pageName) { super(model, pageName); @@ -131,16 +133,10 @@ public class AddListenerWizardPage extends DataModelWizardPage { QUALIFIED_HTTP_SESSION_BINDING_LISTENER, INTERFACES); - String javaEEVersion = model.getStringProperty(INewServletClassDataModelProperties.JAVA_EE_VERSION); - if("3.1".equals(javaEEVersion)){ //$NON-NLS-1$ - createEventListenerRow(group, - ADD_LISTENER_WIZARD_OBJECT_SESSION_ID, - QUALIFIED_HTTP_SESSION_ID_LISTENER, - INTERFACES); - } - - - + createEventListenerRow(group, + ADD_LISTENER_WIZARD_OBJECT_SESSION_ID, + QUALIFIED_HTTP_SESSION_ID_LISTENER, + INTERFACES); } private void createServletRequestEvents(Composite parent) { @@ -156,14 +152,11 @@ public class AddListenerWizardPage extends DataModelWizardPage { QUALIFIED_SERVLET_REQUEST_ATTRIBUTE_LISTENER, INTERFACES); - String javaEEVersion = model.getStringProperty(INewServletClassDataModelProperties.JAVA_EE_VERSION); - if("3.1".equals(javaEEVersion)){ //$NON-NLS-1$ - createEventListenerRow(group, - ADD_LISTENER_WIZARD_ASYNC_EVENTS, - QUALIFIED_SERVLET_REQUEST_ASYNC_EVENT_LISTENER, - INTERFACES); - } - + createEventListenerRow(group, + ADD_LISTENER_WIZARD_ASYNC_EVENTS, + QUALIFIED_SERVLET_REQUEST_ASYNC_EVENT_LISTENER, + INTERFACES); + } @@ -178,9 +171,21 @@ public class AddListenerWizardPage extends DataModelWizardPage { } private void createEventListenerRow(Composite parent, String event, String listener, String property) { - createCheckbox(parent, event, listener, property); - createInterfaceIcon(parent); - createInterfaceLabel(parent, listener); + if (listener.equals(QUALIFIED_HTTP_SESSION_ID_LISTENER)){ + changeSessionID = createCheckbox(parent, event, listener, property); + changeSessionIDIconLabel = createInterfaceIcon(parent); + changeSessionIDInterfaceLabel = createInterfaceLabel(parent, listener); + } + else if (listener.equals(QUALIFIED_SERVLET_REQUEST_ASYNC_EVENT_LISTENER)){ + asyncListener = createCheckbox(parent, event, listener, property); + asyncListenerIconLabel = createInterfaceIcon(parent); + asyncListenerInterfaceLabel = createInterfaceLabel(parent, listener); + } + else{ + createCheckbox(parent, event, listener, property); + createInterfaceIcon(parent); + createInterfaceLabel(parent, listener); + } } private Button createCheckbox(Composite parent, String text, String value, String property) { @@ -265,5 +270,39 @@ public class AddListenerWizardPage extends DataModelWizardPage { synchHelper2.synchUIWithModel(INTERFACES, DataModelEvent.VALUE_CHG); model.notifyPropertyChange(INTERFACES, DataModelEvent.VALUE_CHG); } + + + @Override + public void setVisible(boolean visible) { + super.setVisible(visible); + String javaEEVersion = model.getStringProperty(INewServletClassDataModelProperties.JAVA_EE_VERSION); + if("3.1".equals(javaEEVersion)){ //$NON-NLS-1$ + setServlet31ListenersVisible(true); + } + else{ + setServlet31ListenersVisible(false); + } + } + + + private void setServlet31ListenersVisible(boolean visible){ + changeSessionID.setVisible(visible); + changeSessionIDIconLabel.setVisible(visible); + changeSessionIDInterfaceLabel.setVisible(visible); + asyncListener.setVisible(visible); + asyncListenerIconLabel.setVisible(visible); + asyncListenerInterfaceLabel.setVisible(visible); + + if (!visible){ + List interfaces = (List) model.getProperty(INTERFACES); + if (interfaces != null){ + //remove any selected interfaces + interfaces.remove(QUALIFIED_HTTP_SESSION_ID_LISTENER); + interfaces.remove(QUALIFIED_SERVLET_REQUEST_ASYNC_EVENT_LISTENER); + synchHelper2.synchUIWithModel(INTERFACES, DataModelEvent.VALUE_CHG); + model.notifyPropertyChange(INTERFACES, DataModelEvent.VALUE_CHG); + } + } + } } diff --git a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/AddServletWizardPage.java b/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/AddServletWizardPage.java index 83fdc45ae..9df611ad2 100644 --- a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/AddServletWizardPage.java +++ b/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/AddServletWizardPage.java @@ -14,6 +14,7 @@ package org.eclipse.jst.servlet.ui.internal.wizard; import static org.eclipse.jst.j2ee.internal.web.operations.INewServletClassDataModelProperties.INIT_PARAM; import static org.eclipse.jst.j2ee.internal.web.operations.INewServletClassDataModelProperties.URL_MAPPINGS; +import static org.eclipse.jst.j2ee.internal.web.operations.INewServletClassDataModelProperties.ASYNC_SUPPORT; import static org.eclipse.jst.j2ee.internal.web.operations.INewWebClassDataModelProperties.DESCRIPTION; import static org.eclipse.jst.j2ee.internal.web.operations.INewWebClassDataModelProperties.DISPLAY_NAME; import static org.eclipse.jst.j2ee.internal.web.operations.INewWebClassDataModelProperties.USE_EXISTING_CLASS; @@ -45,12 +46,14 @@ import java.util.List; import org.eclipse.core.runtime.IStatus; import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jst.j2ee.internal.web.operations.INewServletClassDataModelProperties; import org.eclipse.jst.j2ee.internal.wizard.StringArrayTableWizardSection; import org.eclipse.swt.SWT; import org.eclipse.swt.events.ModifyEvent; import org.eclipse.swt.events.ModifyListener; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Text; @@ -67,6 +70,7 @@ public class AddServletWizardPage extends DataModelWizardPage { private Text displayNameText; private StringArrayTableWizardSection urlSection; + private Button asyncSupportCheckBox; public AddServletWizardPage(IDataModel model, String pageName) { super(model, pageName); @@ -130,6 +134,10 @@ public class AddServletWizardPage extends DataModelWizardPage { urlSection.setInput(input); displayNameText.setFocus(); + + createAsyncSupportGroup(composite); + + IStatus projectStatus = validateProjectName(); if (!projectStatus.isOK()) { setErrorMessage(projectStatus.getMessage()); @@ -178,6 +186,16 @@ public class AddServletWizardPage extends DataModelWizardPage { descText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); synchHelper.synchText(descText, DESCRIPTION, null); } + + + private void createAsyncSupportGroup(Composite composite){ + asyncSupportCheckBox = new Button(composite, SWT.CHECK); + asyncSupportCheckBox.setText(IWebWizardConstants.ASYNC_SUPPORT_LABEL); + GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL); + data.horizontalSpan = 3; + asyncSupportCheckBox.setLayoutData(data); + synchHelper.synchCheckbox(asyncSupportCheckBox, ASYNC_SUPPORT, null); + } public String getDisplayName() { return displayNameText.getText(); @@ -195,4 +213,15 @@ public class AddServletWizardPage extends DataModelWizardPage { return true; } + @Override + public void setVisible(boolean visible) { + super.setVisible(visible); + String javaEEVersion = model.getStringProperty(INewServletClassDataModelProperties.JAVA_EE_VERSION); + if("3.0".equals(javaEEVersion) || "3.1".equals(javaEEVersion)){ //$NON-NLS-1$ //$NON-NLS-2$ + asyncSupportCheckBox.setVisible(true); + } + else + asyncSupportCheckBox.setVisible(false); + } + } diff --git a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/IWebWizardConstants.java b/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/IWebWizardConstants.java index e534e0a77..218c7f04d 100644 --- a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/IWebWizardConstants.java +++ b/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/IWebWizardConstants.java @@ -29,6 +29,7 @@ public interface IWebWizardConstants { public final static String INIT_PARAM_LABEL = WEBUIMessages.INIT_PARAM_LABEL; public final static String URL_MAPPINGS_TITLE = WEBUIMessages.URL_MAPPINGS_TITLE; public final static String URL_MAPPINGS_LABEL = WEBUIMessages.URL_MAPPINGS_LABEL; + public final static String ASYNC_SUPPORT_LABEL = WEBUIMessages.ASYNC_SUPPORT_LABEL; public final static String CHOOSE_SERVLET_CLASS = WEBUIMessages.CHOOSE_SERVLET_CLASS; // NewServletWizard |