|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT | |||||||||
@Retention(value=RUNTIME) @Target(value=TYPE) public @interface WebServlet
This annotation is used to declare the configuration of an
Servlet. This feature is only supported for Servlet API 3.0
and onwards.
If the name attribute is not defined, the fully qualified name of the class
is used.
At least one URL pattern MUST be declared in either the value or
urlPattern attribute of the annotation, but not both.
The value attribute is recommended for use when the URL pattern is
the only attribute being set, otherwise the urlPattern attribute
should be used.
The class on which this annotation is declared MUST extend
HttpServlet.
E.g. @WebServlet("/path")}
public class TestServlet extends HttpServlet ... {
E.g.
@WebServlet(name="TestServlet", urlPatterns={"/path", "/alt"})
public class TestServlet extends HttpServlet ... {
<beanlet type="com.google.gwt.user.server.rpc.RemoteServiceServlet">
<web:servlet name="TestServlet" create-servlet="false">
<web:url-pattern value="/test/TestServlet"/>
<web:init-param key="test-user" value="john"/>
</web:servlet>
<inject constructor="true" index="0">
<beanlet type="com.acme.servlet.TestService"/>
</inject>
</beanlet>
<beanlet type="com.google.gwt.user.server.rpc.RemoteServiceServlet">
<web:servlet name="TestServlet" create-servlet="true">
<web:url-patterns>
<web:url-pattern value="/test/TestServlet"/>
<web:url-pattern value="/test/ProductionServlet"/>
</web:url-patterns>
<web:init-params>
<web:init-param key="test-user" value="john"/>
<web:init-param key="production-user" value="john"/>
</web:init-params>
</web:servlet>
</beanlet>
| Optional Element Summary | |
|---|---|
boolean |
asyncSupported
|
boolean |
createServlet
|
String |
description
|
String |
displayName
|
javax.servlet.annotation.WebInitParam[] |
initParams
|
String |
largeIcon
|
int |
loadOnStartup
|
String |
name
|
String |
smallIcon
|
String[] |
urlPatterns
|
String[] |
value
A convenience method, to allow extremely simple annotation of a class. |
public abstract boolean createServlet
true if instance is created by Servlet container.public abstract String name
public abstract String[] value
urlPatterns()public abstract String[] urlPatterns
public abstract int loadOnStartup
public abstract javax.servlet.annotation.WebInitParam[] initParams
public abstract boolean asyncSupported
public abstract String smallIcon
public abstract String largeIcon
public abstract String description
public abstract String displayName
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT | |||||||||