blob: a888344814090b9af3b8d0e4f60047dcbdc202fe [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="shortcut icon" type="image/x-icon" href="../../../../favicon.ico" />
<title>
ServletModule
| Guice
</title>
<link href="../../../../../javadoc/assets/android-developer-docs.css" rel="stylesheet" type="text/css" />
<link href="../../../../../javadoc/assets/customizations.css" rel="stylesheet" type="text/css" />
<script src="../../../../../javadoc/assets/search_autocomplete.js" type="text/javascript"></script>
<script src="../../../../../javadoc/assets/jquery-resizable.min.js" type="text/javascript"></script>
<script src="../../../../../javadoc/assets/android-developer-docs.js" type="text/javascript"></script>
<script src="../../../../../javadoc/assets/prettify.js" type="text/javascript"></script>
<script type="text/javascript">
setToRoot("../../../../", "../../../../../javadoc/assets/");
</script>
<script src="../../../../../javadoc/assets/android-developer-reference.js" type="text/javascript"></script>
<script src="../../../../../javadoc/assets/navtree_data.js" type="text/javascript"></script>
<script src="../../../../../javadoc/assets/customizations.js" type="text/javascript"></script>
<noscript>
<style type="text/css">
html,body{overflow:auto;}
#body-content{position:relative; top:0;}
#doc-content{overflow:visible;border-left:3px solid #666;}
#side-nav{padding:0;}
#side-nav .toggle-list ul {display:block;}
#resize-packages-nav{border-bottom:3px solid #666;}
</style>
</noscript>
</head>
<body class="Guice_1.0">
<div id="header">
<div id="headerLeft">
<span id="masthead-title">Guice</span>
</div>
<div id="headerRight">
<div id="search" >
<div id="searchForm">
<form accept-charset="utf-8" class="gsc-search-box"
onsubmit="return submit_search()">
<table class="gsc-search-box" cellpadding="0" cellspacing="0"><tbody>
<tr>
<td class="gsc-input">
<input id="search_autocomplete" class="gsc-input" type="text" size="33" autocomplete="off"
title="search developer docs" name="q"
value="search developer docs"
onFocus="search_focus_changed(this, true)"
onBlur="search_focus_changed(this, false)"
onkeydown="return search_changed(event, true, '../../../../')"
onkeyup="return search_changed(event, false, '../../../../')" />
<div id="search_filtered_div" class="no-display">
<table id="search_filtered" cellspacing=0>
</table>
</div>
</td>
<td class="gsc-search-button">
<input type="submit" value="Search" title="search" id="search-button" class="gsc-search-button" />
</td>
<td class="gsc-clear-button">
<div title="clear results" class="gsc-clear-button">&nbsp;</div>
</td>
</tr></tbody>
</table>
</form>
</div><!-- searchForm -->
</div><!-- search -->
<div id="api-level-toggle">
<input type="checkbox" id="apiLevelCheckbox" onclick="toggleApiLevelSelector(this)" />
<label for="apiLevelCheckbox" class="disabled">Filter by API Level: </label>
<select id="apiLevelSelector">
<!-- option elements added by buildApiLevelSelector() -->
</select>
</div>
<script>
var SINCE_DATA = [ 'Guice_1.0', 'Guice_2.0', 'Guice_3.0' ];
var SINCE_LABELS = [ 'Guice_1.0', 'Guice_2.0', 'Guice_3.0' ];
buildApiLevelSelector();
addLoadEvent(changeApiLevel);
</script>
</div>
</div><!-- header -->
<div class="g-section g-tpl-240" id="body-content">
<div class="g-unit g-first side-nav-resizable" id="side-nav">
<div id="swapper">
<div id="nav-panels">
<div id="resize-packages-nav">
<div id="packages-nav">
<div id="index-links"><nobr>
<a href="../../../../packages.html" >Package Index</a> |
<a href="../../../../classes.html" >Class Index</a></nobr>
</div>
<ul>
<li class="api apilevel-Guice_1.0">
<a href="../../../../com/google/inject/package-summary.html">com.google.inject</a></li>
<li class="api apilevel-Guice_2.0">
<a href="../../../../com/google/inject/assistedinject/package-summary.html">com.google.inject.assistedinject</a></li>
<li class="api apilevel-Guice_1.0">
<a href="../../../../com/google/inject/binder/package-summary.html">com.google.inject.binder</a></li>
<li class="api apilevel-Guice_1.0">
<a href="../../../../com/google/inject/jndi/package-summary.html">com.google.inject.jndi</a></li>
<li class="api apilevel-Guice_1.0">
<a href="../../../../com/google/inject/matcher/package-summary.html">com.google.inject.matcher</a></li>
<li class="api apilevel-Guice_2.0">
<a href="../../../../com/google/inject/multibindings/package-summary.html">com.google.inject.multibindings</a></li>
<li class="api apilevel-Guice_1.0">
<a href="../../../../com/google/inject/name/package-summary.html">com.google.inject.name</a></li>
<li class="api apilevel-Guice_3.0">
<a href="../../../../com/google/inject/persist/package-summary.html">com.google.inject.persist</a></li>
<li class="api apilevel-Guice_3.0">
<a href="../../../../com/google/inject/persist/finder/package-summary.html">com.google.inject.persist.finder</a></li>
<li class="api apilevel-Guice_3.0">
<a href="../../../../com/google/inject/persist/jpa/package-summary.html">com.google.inject.persist.jpa</a></li>
<li class="selected api apilevel-Guice_1.0">
<a href="../../../../com/google/inject/servlet/package-summary.html">com.google.inject.servlet</a></li>
<li class="api apilevel-Guice_1.0">
<a href="../../../../com/google/inject/spi/package-summary.html">com.google.inject.spi</a></li>
<li class="api apilevel-Guice_2.0">
<a href="../../../../com/google/inject/spring/package-summary.html">com.google.inject.spring</a></li>
<li class="api apilevel-Guice_2.0">
<a href="../../../../com/google/inject/throwingproviders/package-summary.html">com.google.inject.throwingproviders</a></li>
<li class="api apilevel-Guice_1.0">
<a href="../../../../com/google/inject/tools/jmx/package-summary.html">com.google.inject.tools.jmx</a></li>
<li class="api apilevel-Guice_2.0">
<a href="../../../../com/google/inject/util/package-summary.html">com.google.inject.util</a></li>
</ul><br/>
</div> <!-- end packages -->
</div> <!-- end resize-packages -->
<div id="classes-nav">
<ul>
<li><h2>Interfaces</h2>
<ul>
<li class="api apilevel-Guice_3.0"><a href="../../../../com/google/inject/servlet/InstanceFilterBinding.html">InstanceFilterBinding</a></li>
<li class="api apilevel-Guice_3.0"><a href="../../../../com/google/inject/servlet/InstanceServletBinding.html">InstanceServletBinding</a></li>
<li class="api apilevel-Guice_3.0"><a href="../../../../com/google/inject/servlet/LinkedFilterBinding.html">LinkedFilterBinding</a></li>
<li class="api apilevel-Guice_3.0"><a href="../../../../com/google/inject/servlet/LinkedServletBinding.html">LinkedServletBinding</a></li>
<li class="api apilevel-Guice_2.0"><a href="../../../../com/google/inject/servlet/ServletModule.FilterKeyBindingBuilder.html">ServletModule.FilterKeyBindingBuilder</a></li>
<li class="api apilevel-Guice_2.0"><a href="../../../../com/google/inject/servlet/ServletModule.ServletKeyBindingBuilder.html">ServletModule.ServletKeyBindingBuilder</a></li>
<li class="api apilevel-Guice_3.0"><a href="../../../../com/google/inject/servlet/ServletModuleTargetVisitor.html">ServletModuleTargetVisitor</a>&lt;T,&nbsp;V&gt;</li>
</ul>
</li>
<li><h2>Classes</h2>
<ul>
<li class="api apilevel-Guice_1.0"><a href="../../../../com/google/inject/servlet/GuiceFilter.html">GuiceFilter</a></li>
<li class="api apilevel-Guice_2.0"><a href="../../../../com/google/inject/servlet/GuiceServletContextListener.html">GuiceServletContextListener</a></li>
<li class="selected api apilevel-Guice_1.0"><a href="../../../../com/google/inject/servlet/ServletModule.html">ServletModule</a></li>
<li class="api apilevel-Guice_1.0"><a href="../../../../com/google/inject/servlet/ServletScopes.html">ServletScopes</a></li>
</ul>
</li>
<li><h2>Annotations</h2>
<ul>
<li class="api apilevel-Guice_1.0"><a href="../../../../com/google/inject/servlet/RequestParameters.html">RequestParameters</a></li>
<li class="api apilevel-Guice_1.0"><a href="../../../../com/google/inject/servlet/RequestScoped.html">RequestScoped</a></li>
<li class="api apilevel-Guice_1.0"><a href="../../../../com/google/inject/servlet/SessionScoped.html">SessionScoped</a></li>
</ul>
</li>
<li><h2>Enums</h2>
<ul>
<li class="api apilevel-Guice_3.0"><a href="../../../../com/google/inject/servlet/UriPatternType.html">UriPatternType</a></li>
</ul>
</li>
</ul><br/>
</div><!-- end classes -->
</div><!-- end nav-panels -->
<div id="nav-tree" style="display:none">
<div id="index-links"><nobr>
<a href="../../../../packages.html" >Package Index</a> |
<a href="../../../../classes.html" >Class Index</a></nobr>
</div>
</div><!-- end nav-tree -->
</div><!-- end swapper -->
</div> <!-- end side-nav -->
<script>
if (!isMobile) {
$("<a href='#' id='nav-swap' onclick='swapNav();return false;' style='font-size:10px;line-height:9px;margin-left:1em;text-decoration:none;'><span id='tree-link'>Use Tree Navigation</span><span id='panel-link' style='display:none'>Use Panel Navigation</span></a>").appendTo("#side-nav");
chooseDefaultNav();
if ($("#nav-tree").is(':visible')) {
init_default_navtree("../../../../");
} else {
addLoadEvent(function() {
scrollIntoView("packages-nav");
scrollIntoView("classes-nav");
});
}
$("#swapper").css({borderBottom:"2px solid #aaa"});
} else {
swapNav(); // tree view should be used on mobile
}
</script>
<div class="g-unit" id="doc-content">
<div id="api-info-block">
<div class="sum-details-links">
Summary:
<a href="#nestedclasses">Nested Classes</a>
&#124; <a href="#pubctors">Ctors</a>
&#124; <a href="#promethods">Protected Methods</a>
&#124; <a href="#inhmethods">Inherited Methods</a>
&#124; <a href="#" onclick="return toggleAllClassInherited()" id="toggleAllClassInherited">[Expand All]</a>
</div><!-- end sum-details-links -->
<div class="api-level">
Since: <a href="../../../../guide/appendix/api-levels.html#levelGuice_1.0">API Level Guice_1.0</a>
</div>
</div><!-- end api-info-block -->
<!-- ======== START OF CLASS DATA ======== -->
<div id="jd-header">
public
class
<h1>ServletModule</h1>
extends <a href="../../../../com/google/inject/AbstractModule.html">AbstractModule</a><br/>
</div><!-- end header -->
<div id="naMessage"></div>
<div id="jd-content" class="api apilevel-Guice_1.0">
<table class="jd-inheritance-table">
<tr>
<td colspan="3" class="jd-inheritance-class-cell">java.lang.Object</td>
</tr>
<tr>
<td class="jd-inheritance-space">&nbsp;&nbsp;&nbsp;&#x21b3;</td>
<td colspan="2" class="jd-inheritance-class-cell"><a href="../../../../com/google/inject/AbstractModule.html">com.google.inject.AbstractModule</a></td>
</tr>
<tr>
<td class="jd-inheritance-space">&nbsp;</td>
<td class="jd-inheritance-space">&nbsp;&nbsp;&nbsp;&#x21b3;</td>
<td colspan="1" class="jd-inheritance-class-cell">com.google.inject.servlet.ServletModule</td>
</tr>
</table>
<div class="jd-descr">
<h2>Class Overview</h2>
<p>Configures the servlet scopes and creates bindings for the servlet API
objects so you can inject the request, response, session, etc.
<p>
You should subclass this module to register servlets and
filters in the <code><a href="../../../../com/google/inject/servlet/ServletModule.html#configureServlets()">configureServlets()</a></code> method.</p>
</div><!-- jd-descr -->
<div class="jd-descr">
<h2>Summary</h2>
<!-- ======== NESTED CLASS SUMMARY ======== -->
<table id="nestedclasses" class="jd-sumtable"><tr><th colspan="12">Nested Classes</th></tr>
<tr class="alt-color api apilevel-Guice_2.0" >
<td class="jd-typecol"><nobr>
interface</nobr></td>
<td class="jd-linkcol"><a href="../../../../com/google/inject/servlet/ServletModule.FilterKeyBindingBuilder.html">ServletModule.FilterKeyBindingBuilder</a></td>
<td class="jd-descrcol" width="100%">See the EDSL examples at <code><a href="../../../../com/google/inject/servlet/ServletModule.html#configureServlets()">configureServlets()</a></code>&nbsp;</td>
</tr>
<tr class=" api apilevel-Guice_2.0" >
<td class="jd-typecol"><nobr>
interface</nobr></td>
<td class="jd-linkcol"><a href="../../../../com/google/inject/servlet/ServletModule.ServletKeyBindingBuilder.html">ServletModule.ServletKeyBindingBuilder</a></td>
<td class="jd-descrcol" width="100%">See the EDSL examples at <code><a href="../../../../com/google/inject/servlet/ServletModule.html#configureServlets()">configureServlets()</a></code>&nbsp;</td>
</tr>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<table id="pubctors" class="jd-sumtable"><tr><th colspan="12">Public Constructors</th></tr>
<tr class="alt-color api apilevel-Guice_1.0" >
<td class="jd-typecol"><nobr>
</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="../../../../com/google/inject/servlet/ServletModule.html#ServletModule()">ServletModule</a></span>()</nobr>
</td></tr>
</table>
<!-- ========== METHOD SUMMARY =========== -->
<table id="promethods" class="jd-sumtable"><tr><th colspan="12">Protected Methods</th></tr>
<tr class="alt-color api apilevel-Guice_1.0" >
<td class="jd-typecol"><nobr>
final
void</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="../../../../com/google/inject/servlet/ServletModule.html#configure()">configure</a></span>()</nobr>
<div class="jd-descrdiv">Configures a <code><a href="../../../../com/google/inject/Binder.html">Binder</a></code> via the exposed methods.</div>
</td></tr>
<tr class=" api apilevel-Guice_2.0" >
<td class="jd-typecol"><nobr>
void</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="../../../../com/google/inject/servlet/ServletModule.html#configureServlets()">configureServlets</a></span>()</nobr>
<div class="jd-descrdiv"><h3>Servlet Mapping EDSL</h3>
<p> Part of the EDSL builder language for configuring servlets
and filters with guice-servlet.</div>
</td></tr>
<tr class="alt-color api apilevel-Guice_2.0" >
<td class="jd-typecol"><nobr>
final
<a href="../../../../com/google/inject/servlet/ServletModule.FilterKeyBindingBuilder.html">ServletModule.FilterKeyBindingBuilder</a></nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="../../../../com/google/inject/servlet/ServletModule.html#filter(java.lang.String, java.lang.String...)">filter</a></span>(String urlPattern, String... morePatterns)</nobr>
</td></tr>
<tr class=" api apilevel-Guice_2.0" >
<td class="jd-typecol"><nobr>
final
<a href="../../../../com/google/inject/servlet/ServletModule.FilterKeyBindingBuilder.html">ServletModule.FilterKeyBindingBuilder</a></nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="../../../../com/google/inject/servlet/ServletModule.html#filterRegex(java.lang.String, java.lang.String...)">filterRegex</a></span>(String regex, String... regexes)</nobr>
</td></tr>
<tr class="alt-color api apilevel-Guice_3.0" >
<td class="jd-typecol"><nobr>
final
ServletContext</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="../../../../com/google/inject/servlet/ServletModule.html#getServletContext()">getServletContext</a></span>()</nobr>
<div class="jd-descrdiv">This method only works if you are using the <code><a href="../../../../com/google/inject/servlet/GuiceServletContextListener.html">GuiceServletContextListener</a></code> to
create your injector.</div>
</td></tr>
<tr class=" api apilevel-Guice_2.0" >
<td class="jd-typecol"><nobr>
final
<a href="../../../../com/google/inject/servlet/ServletModule.ServletKeyBindingBuilder.html">ServletModule.ServletKeyBindingBuilder</a></nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="../../../../com/google/inject/servlet/ServletModule.html#serve(java.lang.String, java.lang.String...)">serve</a></span>(String urlPattern, String... morePatterns)</nobr>
</td></tr>
<tr class="alt-color api apilevel-Guice_2.0" >
<td class="jd-typecol"><nobr>
final
<a href="../../../../com/google/inject/servlet/ServletModule.ServletKeyBindingBuilder.html">ServletModule.ServletKeyBindingBuilder</a></nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="../../../../com/google/inject/servlet/ServletModule.html#serveRegex(java.lang.String, java.lang.String...)">serveRegex</a></span>(String regex, String... regexes)</nobr>
</td></tr>
</table>
<!-- ========== METHOD SUMMARY =========== -->
<table id="inhmethods" class="jd-sumtable"><tr><th>
<a href="#" class="toggle-all" onclick="return toggleAllInherited(this, null)">[Expand]</a>
<div style="clear:left;">Inherited Methods</div></th></tr>
<tr class="api apilevel-" >
<td colspan="12">
<a href="#" onclick="return toggleInherited(this, null)" id="inherited-methods-com.google.inject.AbstractModule" class="jd-expando-trigger closed"
><img id="inherited-methods-com.google.inject.AbstractModule-trigger"
src="../../../../../javadoc/assets/images/triangle-closed.png"
class="jd-expando-trigger-img" /></a>
From class
<a href="../../../../com/google/inject/AbstractModule.html">com.google.inject.AbstractModule</a>
<div id="inherited-methods-com.google.inject.AbstractModule">
<div id="inherited-methods-com.google.inject.AbstractModule-list"
class="jd-inheritedlinks">
</div>
<div id="inherited-methods-com.google.inject.AbstractModule-summary" style="display: none;">
<table class="jd-sumtable-expando">
<tr class="alt-color api apilevel-Guice_2.0" >
<td class="jd-typecol"><nobr>
void</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="../../../../com/google/inject/AbstractModule.html#addError(com.google.inject.spi.Message)">addError</a></span>(<a href="../../../../com/google/inject/spi/Message.html">Message</a> message)</nobr>
</td></tr>
<tr class=" api apilevel-Guice_1.0" >
<td class="jd-typecol"><nobr>
void</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="../../../../com/google/inject/AbstractModule.html#addError(java.lang.String, java.lang.Object...)">addError</a></span>(String message, Object... arguments)</nobr>
</td></tr>
<tr class="alt-color api apilevel-Guice_1.0" >
<td class="jd-typecol"><nobr>
void</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="../../../../com/google/inject/AbstractModule.html#addError(java.lang.Throwable)">addError</a></span>(Throwable t)</nobr>
</td></tr>
<tr class=" api apilevel-Guice_1.0" >
<td class="jd-typecol"><nobr>
&lt;T&gt;
<a href="../../../../com/google/inject/binder/LinkedBindingBuilder.html">LinkedBindingBuilder</a>&lt;T&gt;</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="../../../../com/google/inject/AbstractModule.html#bind(com.google.inject.Key<T>)">bind</a></span>(<a href="../../../../com/google/inject/Key.html">Key</a>&lt;T&gt; key)</nobr>
</td></tr>
<tr class="alt-color api apilevel-Guice_1.0" >
<td class="jd-typecol"><nobr>
&lt;T&gt;
<a href="../../../../com/google/inject/binder/AnnotatedBindingBuilder.html">AnnotatedBindingBuilder</a>&lt;T&gt;</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="../../../../com/google/inject/AbstractModule.html#bind(com.google.inject.TypeLiteral<T>)">bind</a></span>(<a href="../../../../com/google/inject/TypeLiteral.html">TypeLiteral</a>&lt;T&gt; typeLiteral)</nobr>
</td></tr>
<tr class=" api apilevel-Guice_1.0" >
<td class="jd-typecol"><nobr>
&lt;T&gt;
<a href="../../../../com/google/inject/binder/AnnotatedBindingBuilder.html">AnnotatedBindingBuilder</a>&lt;T&gt;</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="../../../../com/google/inject/AbstractModule.html#bind(java.lang.Class<T>)">bind</a></span>(Class&lt;T&gt; clazz)</nobr>
</td></tr>
<tr class="alt-color api apilevel-Guice_1.0" >
<td class="jd-typecol"><nobr>
<a href="../../../../com/google/inject/binder/AnnotatedConstantBindingBuilder.html">AnnotatedConstantBindingBuilder</a></nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="../../../../com/google/inject/AbstractModule.html#bindConstant()">bindConstant</a></span>()</nobr>
</td></tr>
<tr class=" api apilevel-Guice_2.0" >
<td class="jd-typecol"><nobr>
void</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="../../../../com/google/inject/AbstractModule.html#bindInterceptor(com.google.inject.matcher.Matcher<? super java.lang.Class<?>>, com.google.inject.matcher.Matcher<? super java.lang.reflect.Method>, org.aopalliance.intercept.MethodInterceptor...)">bindInterceptor</a></span>(<a href="../../../../com/google/inject/matcher/Matcher.html">Matcher</a>&lt;?&nbsp;super&nbsp;Class&lt;?&gt;&gt; classMatcher, <a href="../../../../com/google/inject/matcher/Matcher.html">Matcher</a>&lt;?&nbsp;super&nbsp;Method&gt; methodMatcher, MethodInterceptor... interceptors)</nobr>
</td></tr>
<tr class="alt-color api apilevel-Guice_2.0" >
<td class="jd-typecol"><nobr>
void</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="../../../../com/google/inject/AbstractModule.html#bindListener(com.google.inject.matcher.Matcher<? super com.google.inject.TypeLiteral<?>>, com.google.inject.spi.TypeListener)">bindListener</a></span>(<a href="../../../../com/google/inject/matcher/Matcher.html">Matcher</a>&lt;?&nbsp;super&nbsp;<a href="../../../../com/google/inject/TypeLiteral.html">TypeLiteral</a>&lt;?&gt;&gt; typeMatcher, <a href="../../../../com/google/inject/spi/TypeListener.html">TypeListener</a> listener)</nobr>
</td></tr>
<tr class=" api apilevel-Guice_1.0" >
<td class="jd-typecol"><nobr>
void</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="../../../../com/google/inject/AbstractModule.html#bindScope(java.lang.Class<? extends java.lang.annotation.Annotation>, com.google.inject.Scope)">bindScope</a></span>(Class&lt;?&nbsp;extends&nbsp;Annotation&gt; scopeAnnotation, <a href="../../../../com/google/inject/Scope.html">Scope</a> scope)</nobr>
</td></tr>
<tr class="alt-color api apilevel-Guice_1.0" >
<td class="jd-typecol"><nobr>
<a href="../../../../com/google/inject/Binder.html">Binder</a></nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="../../../../com/google/inject/AbstractModule.html#binder()">binder</a></span>()</nobr>
<div class="jd-descrdiv">Gets direct access to the underlying <code>Binder</code>.</div>
</td></tr>
<tr class=" api apilevel-Guice_1.0" >
<td class="jd-typecol"><nobr>
abstract
void</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="../../../../com/google/inject/AbstractModule.html#configure()">configure</a></span>()</nobr>
<div class="jd-descrdiv">Configures a <code><a href="../../../../com/google/inject/Binder.html">Binder</a></code> via the exposed methods.</div>
</td></tr>
<tr class="alt-color api apilevel-Guice_1.0" >
<td class="jd-typecol"><nobr>
synchronized
final
void</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="../../../../com/google/inject/AbstractModule.html#configure(com.google.inject.Binder)">configure</a></span>(<a href="../../../../com/google/inject/Binder.html">Binder</a> builder)</nobr>
<div class="jd-descrdiv">Contributes bindings and other configurations for this module to <code>binder</code>.</div>
</td></tr>
<tr class=" api apilevel-Guice_2.0" >
<td class="jd-typecol"><nobr>
void</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="../../../../com/google/inject/AbstractModule.html#convertToTypes(com.google.inject.matcher.Matcher<? super com.google.inject.TypeLiteral<?>>, com.google.inject.spi.TypeConverter)">convertToTypes</a></span>(<a href="../../../../com/google/inject/matcher/Matcher.html">Matcher</a>&lt;?&nbsp;super&nbsp;<a href="../../../../com/google/inject/TypeLiteral.html">TypeLiteral</a>&lt;?&gt;&gt; typeMatcher, <a href="../../../../com/google/inject/spi/TypeConverter.html">TypeConverter</a> converter)</nobr>
</td></tr>
<tr class="alt-color api apilevel-Guice_2.0" >
<td class="jd-typecol"><nobr>
<a href="../../../../com/google/inject/Stage.html">Stage</a></nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="../../../../com/google/inject/AbstractModule.html#currentStage()">currentStage</a></span>()</nobr>
</td></tr>
<tr class=" api apilevel-Guice_2.0" >
<td class="jd-typecol"><nobr>
&lt;T&gt;
<a href="../../../../com/google/inject/MembersInjector.html">MembersInjector</a>&lt;T&gt;</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="../../../../com/google/inject/AbstractModule.html#getMembersInjector(com.google.inject.TypeLiteral<T>)">getMembersInjector</a></span>(<a href="../../../../com/google/inject/TypeLiteral.html">TypeLiteral</a>&lt;T&gt; type)</nobr>
</td></tr>
<tr class="alt-color api apilevel-Guice_2.0" >
<td class="jd-typecol"><nobr>
&lt;T&gt;
<a href="../../../../com/google/inject/MembersInjector.html">MembersInjector</a>&lt;T&gt;</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="../../../../com/google/inject/AbstractModule.html#getMembersInjector(java.lang.Class<T>)">getMembersInjector</a></span>(Class&lt;T&gt; type)</nobr>
</td></tr>
<tr class=" api apilevel-Guice_2.0" >
<td class="jd-typecol"><nobr>
&lt;T&gt;
<a href="../../../../com/google/inject/Provider.html">Provider</a>&lt;T&gt;</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="../../../../com/google/inject/AbstractModule.html#getProvider(com.google.inject.Key<T>)">getProvider</a></span>(<a href="../../../../com/google/inject/Key.html">Key</a>&lt;T&gt; key)</nobr>
</td></tr>
<tr class="alt-color api apilevel-Guice_2.0" >
<td class="jd-typecol"><nobr>
&lt;T&gt;
<a href="../../../../com/google/inject/Provider.html">Provider</a>&lt;T&gt;</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="../../../../com/google/inject/AbstractModule.html#getProvider(java.lang.Class<T>)">getProvider</a></span>(Class&lt;T&gt; type)</nobr>
</td></tr>
<tr class=" api apilevel-Guice_1.0" >
<td class="jd-typecol"><nobr>
void</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="../../../../com/google/inject/AbstractModule.html#install(com.google.inject.Module)">install</a></span>(<a href="../../../../com/google/inject/Module.html">Module</a> module)</nobr>
</td></tr>
<tr class="alt-color api apilevel-Guice_2.0" >
<td class="jd-typecol"><nobr>
void</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="../../../../com/google/inject/AbstractModule.html#requestInjection(java.lang.Object)">requestInjection</a></span>(Object instance)</nobr>
</td></tr>
<tr class=" api apilevel-Guice_1.0" >
<td class="jd-typecol"><nobr>
void</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="../../../../com/google/inject/AbstractModule.html#requestStaticInjection(java.lang.Class<?>...)">requestStaticInjection</a></span>(Class...&lt;?&gt; types)</nobr>
</td></tr>
<tr class="alt-color api apilevel-Guice_2.0" >
<td class="jd-typecol"><nobr>
void</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="../../../../com/google/inject/AbstractModule.html#requireBinding(com.google.inject.Key<?>)">requireBinding</a></span>(<a href="../../../../com/google/inject/Key.html">Key</a>&lt;?&gt; key)</nobr>
<div class="jd-descrdiv">Adds a dependency from this module to <code>key</code>.</div>
</td></tr>
<tr class=" api apilevel-Guice_2.0" >
<td class="jd-typecol"><nobr>
void</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="../../../../com/google/inject/AbstractModule.html#requireBinding(java.lang.Class<?>)">requireBinding</a></span>(Class&lt;?&gt; type)</nobr>
<div class="jd-descrdiv">Adds a dependency from this module to <code>type</code>.</div>
</td></tr>
</table>
</div>
</div>
</td></tr>
<tr class="api apilevel-" >
<td colspan="12">
<a href="#" onclick="return toggleInherited(this, null)" id="inherited-methods-java.lang.Object" class="jd-expando-trigger closed"
><img id="inherited-methods-java.lang.Object-trigger"
src="../../../../../javadoc/assets/images/triangle-closed.png"
class="jd-expando-trigger-img" /></a>
From class
java.lang.Object
<div id="inherited-methods-java.lang.Object">
<div id="inherited-methods-java.lang.Object-list"
class="jd-inheritedlinks">
</div>
<div id="inherited-methods-java.lang.Object-summary" style="display: none;">
<table class="jd-sumtable-expando">
<tr class="alt-color api apilevel-" >
<td class="jd-typecol"><nobr>
Object</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad">clone</span>()</nobr>
</td></tr>
<tr class=" api apilevel-" >
<td class="jd-typecol"><nobr>
boolean</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad">equals</span>(Object arg0)</nobr>
</td></tr>
<tr class="alt-color api apilevel-" >
<td class="jd-typecol"><nobr>
void</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad">finalize</span>()</nobr>
</td></tr>
<tr class=" api apilevel-" >
<td class="jd-typecol"><nobr>
final
Class&lt;?&gt;</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad">getClass</span>()</nobr>
</td></tr>
<tr class="alt-color api apilevel-" >
<td class="jd-typecol"><nobr>
int</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad">hashCode</span>()</nobr>
</td></tr>
<tr class=" api apilevel-" >
<td class="jd-typecol"><nobr>
final
void</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad">notify</span>()</nobr>
</td></tr>
<tr class="alt-color api apilevel-" >
<td class="jd-typecol"><nobr>
final
void</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad">notifyAll</span>()</nobr>
</td></tr>
<tr class=" api apilevel-" >
<td class="jd-typecol"><nobr>
String</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad">toString</span>()</nobr>
</td></tr>
<tr class="alt-color api apilevel-" >
<td class="jd-typecol"><nobr>
final
void</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad">wait</span>()</nobr>
</td></tr>
<tr class=" api apilevel-" >
<td class="jd-typecol"><nobr>
final
void</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad">wait</span>(long arg0)</nobr>
</td></tr>
<tr class="alt-color api apilevel-" >
<td class="jd-typecol"><nobr>
final
void</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad">wait</span>(long arg0, int arg1)</nobr>
</td></tr>
</table>
</div>
</div>
</td></tr>
<tr class="api apilevel-" >
<td colspan="12">
<a href="#" onclick="return toggleInherited(this, null)" id="inherited-methods-com.google.inject.Module" class="jd-expando-trigger closed"
><img id="inherited-methods-com.google.inject.Module-trigger"
src="../../../../../javadoc/assets/images/triangle-closed.png"
class="jd-expando-trigger-img" /></a>
From interface
<a href="../../../../com/google/inject/Module.html">com.google.inject.Module</a>
<div id="inherited-methods-com.google.inject.Module">
<div id="inherited-methods-com.google.inject.Module-list"
class="jd-inheritedlinks">
</div>
<div id="inherited-methods-com.google.inject.Module-summary" style="display: none;">
<table class="jd-sumtable-expando">
<tr class="alt-color api apilevel-Guice_1.0" >
<td class="jd-typecol"><nobr>
abstract
void</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad"><a href="../../../../com/google/inject/Module.html#configure(com.google.inject.Binder)">configure</a></span>(<a href="../../../../com/google/inject/Binder.html">Binder</a> binder)</nobr>
<div class="jd-descrdiv">Contributes bindings and other configurations for this module to <code>binder</code>.</div>
</td></tr>
</table>
</div>
</div>
</td></tr>
</table>
</div><!-- jd-descr (summary) -->
<!-- Details -->
<!-- XML Attributes -->
<!-- Enum Values -->
<!-- Constants -->
<!-- Fields -->
<!-- Public ctors -->
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<h2>Public Constructors</h2>
<A NAME="ServletModule()"></A>
<div class="jd-details api apilevel-Guice_1.0">
<h4 class="jd-details-title">
<span class="normal">
public
</span>
<span class="sympad">ServletModule</span>
<span class="normal">()</span>
</h4>
<div class="api-level">
<div>
Since: <a href="../../../../guide/appendix/api-levels.html#levelGuice_1.0">API Level Guice_1.0</a>
</div>
</div>
<div class="jd-details-descr">
<div class="jd-tagdata jd-tagdescr"><p></p></div>
</div>
</div>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<!-- Protected ctors -->
<!-- ========= METHOD DETAIL ======== -->
<!-- Public methdos -->
<!-- ========= METHOD DETAIL ======== -->
<h2>Protected Methods</h2>
<A NAME="configure()"></A>
<div class="jd-details api apilevel-Guice_1.0">
<h4 class="jd-details-title">
<span class="normal">
protected
final
void
</span>
<span class="sympad">configure</span>
<span class="normal">()</span>
</h4>
<div class="api-level">
<div>
Since: <a href="../../../../guide/appendix/api-levels.html#levelGuice_1.0">API Level Guice_1.0</a>
</div>
</div>
<div class="jd-details-descr">
<div class="jd-tagdata jd-tagdescr"><p>Configures a <code><a href="../../../../com/google/inject/Binder.html">Binder</a></code> via the exposed methods.
</p></div>
</div>
</div>
<A NAME="configureServlets()"></A>
<div class="jd-details api apilevel-Guice_2.0">
<h4 class="jd-details-title">
<span class="normal">
protected
void
</span>
<span class="sympad">configureServlets</span>
<span class="normal">()</span>
</h4>
<div class="api-level">
<div>
Since: <a href="../../../../guide/appendix/api-levels.html#levelGuice_2.0">API Level Guice_2.0</a>
</div>
</div>
<div class="jd-details-descr">
<div class="jd-tagdata jd-tagdescr"><p><h3>Servlet Mapping EDSL</h3>
<p> Part of the EDSL builder language for configuring servlets
and filters with guice-servlet. Think of this as an in-code replacement for web.xml.
Filters and servlets are configured here using simple java method calls. Here is a typical
example of registering a filter when creating your Guice injector:
<pre>
Guice.createInjector(..., new ServletModule() {
@Override
protected void configureServlets() {
<b>serve("*.html").with(MyServlet.class)</b>
}
}
</pre>
This registers a servlet (subclass of <code>HttpServlet</code>) called <code>MyServlet</code> to service
any web pages ending in <code>.html</code>. You can also use a path-style syntax to register
servlets:
<pre>
<b>serve("/my/*").with(MyServlet.class)</b>
</pre>
Every servlet (or filter) is required to be a singleton. If you cannot annotate the class
directly, you should add a separate <code>bind(..).in(Singleton.class)</code> rule elsewhere in
your module. Mapping a servlet that is bound under any other scope is an error.
<p>
<h4>Dispatch Order</h4>
You are free to register as many servlets and filters as you like this way. They will
be compared and dispatched in the order in which the filter methods are called:
<pre>
Guice.createInjector(..., new ServletModule() {
@Override
protected void configureServlets() {
filter("/*").through(MyFilter.class);
filter("*.css").through(MyCssFilter.class);
filter("*.jpg").through(new MyJpgFilter());
// etc..
serve("*.html").with(MyServlet.class);
serve("/my/*").with(MyServlet.class);
serve("*.jpg").with(new MyServlet());
// etc..
}
}
</pre>
This will traverse down the list of rules in lexical order. For example, a url
"<code>/my/file.js</code>" (after it runs through the matching filters) will first
be compared against the servlet mapping:
<pre>
serve("*.html").with(MyServlet.class);
</pre>
And failing that, it will descend to the next servlet mapping:
<pre>
serve("/my/*").with(MyServlet.class);
</pre>
Since this rule matches, Guice Servlet will dispatch to <code>MyServlet</code>. These
two mapping rules can also be written in more compact form using varargs syntax:
<pre>
serve(<b>"*.html", "/my/*"</b>).with(MyServlet.class);
</pre>
This way you can map several URI patterns to the same servlet. A similar syntax is
also available for filter mappings.
<p>
<h4>Regular Expressions</h4>
You can also map servlets (or filters) to URIs using regular expressions:
<pre>
<b>serveRegex("(.)*ajax(.)*").with(MyAjaxServlet.class)</b>
</pre>
This will map any URI containing the text "ajax" in it to <code>MyAjaxServlet</code>. Such as:
<ul>
<li>http://www.google.com/ajax.html</li>
<li>http://www.google.com/content/ajax/index</li>
<li>http://www.google.com/it/is_totally_ajaxian</li>
</ul>
<h3>Initialization Parameters</h3>
Servlets (and filters) allow you to pass in init params
using the <code>&lt;init-param&gt;</code> tag in web.xml. You can similarly pass in parameters to
Servlets and filters registered in Guice-servlet using a java.util.Map of parameter
name/value pairs. For example, to initialize <code>MyServlet</code> with two parameters
(<code>name="Dhanji", site="google.com"</code>) you could write:
<pre>
Map&lt;String, String&gt; params = new HashMap&lt;String, String&gt;();
params.put("name", "Dhanji");
params.put("site", "google.com");
...
serve("/*").with(MyServlet.class, <b>params</b>)
</pre>
<p>
<h3>Binding Keys</h3>
You can also bind keys rather than classes. This lets you hide
implementations with package-local visbility and expose them using
only a Guice module and an annotation:
<pre>
...
filter("/*").through(<b>Key.get(Filter.class, Fave.class)</b>);
</pre>
Where <code>Filter.class</code> refers to the Servlet API interface and <code>Fave.class</code> is a
custom binding annotation. Elsewhere (in one of your own modules) you can bind this
filter's implementation:
<pre>
bind(Filter.class)<b>.annotatedWith(Fave.class)</b>.to(MyFilterImpl.class);
</pre>
See <code><a href="../../../../com/google/inject/Binder.html">Binder</a></code> for more information on binding syntax.
<p>
<h3>Multiple Modules</h3>
It is sometimes useful to capture servlet and filter mappings from multiple different
modules. This is essential if you want to package and offer drop-in Guice plugins that
provide servlet functionality.
<p>
Guice Servlet allows you to register several instances of <code>ServletModule</code> to your
injector. The order in which these modules are installed determines the dispatch order
of filters and the precedence order of servlets. For example, if you had two servlet modules,
<code>RpcModule</code> and <code>WebServiceModule</code> and they each contained a filter that mapped
to the same URI pattern, <code>"/*"</code>:
<p>
In <code>RpcModule</code>:
<pre>
filter("/*").through(RpcFilter.class);
</pre>
In <code>WebServiceModule</code>:
<pre>
filter("/*").through(WebServiceFilter.class);
</pre>
Then the order in which these filters are dispatched is determined by the order in which
the modules are installed:
<pre>
<b>install(new WebServiceModule());</b>
install(new RpcModule());
</pre>
In the case shown above <code>WebServiceFilter</code> will run first.</p></div>
</div>
</div>
<A NAME="filter(java.lang.String, java.lang.String...)"></A>
<div class="jd-details api apilevel-Guice_2.0">
<h4 class="jd-details-title">
<span class="normal">
protected
final
<a href="../../../../com/google/inject/servlet/ServletModule.FilterKeyBindingBuilder.html">ServletModule.FilterKeyBindingBuilder</a>
</span>
<span class="sympad">filter</span>
<span class="normal">(String urlPattern, String... morePatterns)</span>
</h4>
<div class="api-level">
<div>
Since: <a href="../../../../guide/appendix/api-levels.html#levelGuice_2.0">API Level Guice_2.0</a>
</div>
</div>
<div class="jd-details-descr">
<div class="jd-tagdata jd-tagdescr"><p></p></div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Parameters</h5>
<table class="jd-tagtable">
<tr>
<th>urlPattern</td>
<td>Any Servlet-style pattern. examples: /*, /html/*, *.html, etc.</td>
</tr>
</table>
</div>
</div>
</div>
<A NAME="filterRegex(java.lang.String, java.lang.String...)"></A>
<div class="jd-details api apilevel-Guice_2.0">
<h4 class="jd-details-title">
<span class="normal">
protected
final
<a href="../../../../com/google/inject/servlet/ServletModule.FilterKeyBindingBuilder.html">ServletModule.FilterKeyBindingBuilder</a>
</span>
<span class="sympad">filterRegex</span>
<span class="normal">(String regex, String... regexes)</span>
</h4>
<div class="api-level">
<div>
Since: <a href="../../../../guide/appendix/api-levels.html#levelGuice_2.0">API Level Guice_2.0</a>
</div>
</div>
<div class="jd-details-descr">
<div class="jd-tagdata jd-tagdescr"><p></p></div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Parameters</h5>
<table class="jd-tagtable">
<tr>
<th>regex</td>
<td>Any Java-style regular expression.</td>
</tr>
</table>
</div>
</div>
</div>
<A NAME="getServletContext()"></A>
<div class="jd-details api apilevel-Guice_3.0">
<h4 class="jd-details-title">
<span class="normal">
protected
final
ServletContext
</span>
<span class="sympad">getServletContext</span>
<span class="normal">()</span>
</h4>
<div class="api-level">
<div>
Since: <a href="../../../../guide/appendix/api-levels.html#levelGuice_3.0">API Level Guice_3.0</a>
</div>
</div>
<div class="jd-details-descr">
<div class="jd-tagdata jd-tagdescr"><p>This method only works if you are using the <code><a href="../../../../com/google/inject/servlet/GuiceServletContextListener.html">GuiceServletContextListener</a></code> to
create your injector. Otherwise, it returns null.</p></div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Returns</h5>
<ul class="nolist"><li>The current servlet context.</li></ul>
</div>
</div>
</div>
<A NAME="serve(java.lang.String, java.lang.String...)"></A>
<div class="jd-details api apilevel-Guice_2.0">
<h4 class="jd-details-title">
<span class="normal">
protected
final
<a href="../../../../com/google/inject/servlet/ServletModule.ServletKeyBindingBuilder.html">ServletModule.ServletKeyBindingBuilder</a>
</span>
<span class="sympad">serve</span>
<span class="normal">(String urlPattern, String... morePatterns)</span>
</h4>
<div class="api-level">
<div>
Since: <a href="../../../../guide/appendix/api-levels.html#levelGuice_2.0">API Level Guice_2.0</a>
</div>
</div>
<div class="jd-details-descr">
<div class="jd-tagdata jd-tagdescr"><p></p></div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Parameters</h5>
<table class="jd-tagtable">
<tr>
<th>urlPattern</td>
<td>Any Servlet-style pattern. examples: /*, /html/*, *.html, etc.</td>
</tr>
</table>
</div>
</div>
</div>
<A NAME="serveRegex(java.lang.String, java.lang.String...)"></A>
<div class="jd-details api apilevel-Guice_2.0">
<h4 class="jd-details-title">
<span class="normal">
protected
final
<a href="../../../../com/google/inject/servlet/ServletModule.ServletKeyBindingBuilder.html">ServletModule.ServletKeyBindingBuilder</a>
</span>
<span class="sympad">serveRegex</span>
<span class="normal">(String regex, String... regexes)</span>
</h4>
<div class="api-level">
<div>
Since: <a href="../../../../guide/appendix/api-levels.html#levelGuice_2.0">API Level Guice_2.0</a>
</div>
</div>
<div class="jd-details-descr">
<div class="jd-tagdata jd-tagdescr"><p></p></div>
<div class="jd-tagdata">
<h5 class="jd-tagtitle">Parameters</h5>
<table class="jd-tagtable">
<tr>
<th>regex</td>
<td>Any Java-style regular expression.</td>
</tr>
</table>
</div>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<A NAME="navbar_top"></A>
<div id="footer">
Generated by <a href="http://code.google.com/p/doclava/">Doclava</a>.
</div> <!-- end footer -->
</div> <!-- jd-content -->
</div><!-- end doc-content -->
</div> <!-- end body-content -->
<script type="text/javascript">
init(); /* initialize android-developer-docs.js */
</script>
</body>
</html>