org.beanlet.web
Annotation Type WebServlet


@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 ... {

XML Representation

The following xml-fragment shows how to express this annotation in xml.
<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.
 

createServlet

public abstract boolean createServlet
Returns:
true if instance is created by Servlet container.
Default:
false

name

public abstract String name
Returns:
name of the Servlet
Default:
""

value

public abstract String[] value
A convenience method, to allow extremely simple annotation of a class.

Returns:
array of URL patterns
See Also:
urlPatterns()
Default:
{}

urlPatterns

public abstract String[] urlPatterns
Returns:
array of URL patterns to which this Filter applies
Default:
{}

loadOnStartup

public abstract int loadOnStartup
Returns:
load on startup ordering hint
Default:
-1

initParams

public abstract javax.servlet.annotation.WebInitParam[] initParams
Returns:
array of initialization params for this Servlet
Default:
{}

asyncSupported

public abstract boolean asyncSupported
Returns:
asynchronous operation supported by this Servlet
Default:
false

smallIcon

public abstract String smallIcon
Returns:
small icon for this Servlet, if present
Default:
""

largeIcon

public abstract String largeIcon
Returns:
large icon for this Servlet, if present
Default:
""

description

public abstract String description
Returns:
description of this Servlet, if present
Default:
""

displayName

public abstract String displayName
Returns:
display name of this Servlet, if present
Default:
""


Copyright © 2006-2012. All Rights Reserved.