├── .baseline
├── checkstyle
│ ├── checkstyle-suppressions.xml
│ └── checkstyle.xml
├── copyright
│ └── apache-2.0.txt
├── eclipse
│ ├── dynamic
│ │ ├── dotfile.checkstyle
│ │ └── dotfile.settings
│ │ │ └── edu.umd.cs.findbugs.core.prefs
│ ├── org.eclipse.jdt.core.prefs
│ └── static
│ │ └── dotfile.settings
│ │ ├── edu.umd.cs.findbugs.plugin.eclipse.prefs
│ │ └── org.eclipse.jdt.ui.prefs
├── findbugs
│ └── excludeFilter.xml
└── idea
│ └── intellij-java-palantir-style.xml
├── .gitignore
├── CONTRIBUTING.md
├── LICENSE
├── README.md
├── build.gradle
├── circle.yml
├── dropwizard-index-page-example
├── ExampleApplication.launch
├── build.gradle
├── example.yml
├── service
│ └── web
│ │ └── index.html
└── src
│ └── main
│ ├── java
│ └── com
│ │ └── palantir
│ │ └── indexpage
│ │ └── example
│ │ └── ExampleApplication.java
│ └── resources
│ └── service
│ └── web
│ └── index.html
├── dropwizard-index-page
├── build.gradle
└── src
│ ├── main
│ └── java
│ │ └── com
│ │ └── palantir
│ │ └── indexpage
│ │ ├── ClasspathIndexPage.java
│ │ ├── FileSystemIndexPage.java
│ │ ├── IndexPage.java
│ │ ├── IndexPageBundle.java
│ │ ├── IndexPageConfigurable.java
│ │ └── IndexPageServlet.java
│ └── test
│ ├── java
│ └── com
│ │ └── palantir
│ │ └── indexpage
│ │ ├── ClassPathIndexPageTests.java
│ │ ├── FileSystemIndexPageTests.java
│ │ ├── IndexPageBundleServingFromClasspathTest.java
│ │ ├── IndexPageBundleServingFromFileSystemTest.java
│ │ ├── IndexPageBundleTests.java
│ │ ├── IndexPageResources.java
│ │ ├── IndexPageServletTests.java
│ │ ├── TemporaryFile.java
│ │ └── TestApp.java
│ └── resources
│ ├── example-default.yml
│ ├── example.yml
│ └── service
│ └── web
│ ├── index.html
│ ├── index2.html
│ └── indexInvalid.html
├── gradle.properties
├── gradle
├── jacoco.gradle
├── publish.gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── palantir_corporate_cla.pdf
├── palantir_individual_cla.pdf
└── settings.gradle
/.baseline/checkstyle/checkstyle-suppressions.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
7 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/.baseline/checkstyle/checkstyle.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 |
205 |
206 |
207 |
208 |
209 |
210 |
211 |
212 |
213 |
214 |
215 |
216 |
217 |
218 |
219 |
220 |
221 |
222 |
223 |
224 |
225 |
226 |
227 |
228 |
229 |
230 |
231 |
232 |
233 |
234 |
235 |
236 |
237 |
238 |
239 |
240 |
241 |
242 |
243 |
244 |
245 |
246 |
247 |
248 |
249 |
250 |
251 |
252 |
253 |
254 |
255 |
256 |
257 |
258 |
259 |
260 |
261 |
262 |
263 |
264 |
265 |
266 |
267 |
268 |
269 |
270 |
271 |
272 |
273 |
274 |
275 |
276 |
277 |
278 |
279 |
280 |
281 |
282 |
283 |
284 |
285 |
286 |
287 |
288 |
289 |
290 |
291 |
292 |
293 |
294 |
295 |
296 |
297 |
298 |
299 |
300 |
301 |
302 |
303 |
304 |
305 |
306 |
307 |
308 |
309 |
310 |
311 |
312 |
313 |
314 |
315 |
316 |
317 |
318 |
319 |
320 |
321 |
322 |
323 |
324 |
325 |
326 |
327 |
328 |
329 |
330 |
331 |
332 |
333 |
334 |
335 |
336 |
337 |
338 |
339 |
340 |
341 |
342 |
343 |
344 |
345 |
346 |
347 |
348 |
349 |
350 |
351 |
352 |
353 |
354 |
355 |
356 |
357 |
358 |
359 |
360 |
361 |
--------------------------------------------------------------------------------
/.baseline/copyright/apache-2.0.txt:
--------------------------------------------------------------------------------
1 | Copyright ${today.year} Palantir Technologies, Inc. All rights reserved.
2 |
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
--------------------------------------------------------------------------------
/.baseline/eclipse/dynamic/dotfile.checkstyle:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/.baseline/eclipse/dynamic/dotfile.settings/edu.umd.cs.findbugs.core.prefs:
--------------------------------------------------------------------------------
1 | #FindBugs User Preferences
2 | #Sun Mar 02 18:15:35 EST 2014
3 | cloud_id=edu.umd.cs.findbugs.cloud.doNothingCloud
4 | detectorAppendingToAnObjectOutputStream=AppendingToAnObjectOutputStream|true
5 | detectorAtomicityProblem=AtomicityProblem|true
6 | detectorBadAppletConstructor=BadAppletConstructor|false
7 | detectorBadResultSetAccess=BadResultSetAccess|true
8 | detectorBadSyntaxForRegularExpression=BadSyntaxForRegularExpression|true
9 | detectorBadUseOfReturnValue=BadUseOfReturnValue|true
10 | detectorBadlyOverriddenAdapter=BadlyOverriddenAdapter|true
11 | detectorBooleanReturnNull=BooleanReturnNull|true
12 | detectorBuildInterproceduralCallGraph=BuildInterproceduralCallGraph|false
13 | detectorBuildObligationPolicyDatabase=BuildObligationPolicyDatabase|true
14 | detectorCallToUnsupportedMethod=CallToUnsupportedMethod|false
15 | detectorCalledMethods=CalledMethods|true
16 | detectorCheckCalls=CheckCalls|false
17 | detectorCheckExpectedWarnings=CheckExpectedWarnings|false
18 | detectorCheckImmutableAnnotation=CheckImmutableAnnotation|true
19 | detectorCheckRelaxingNullnessAnnotation=CheckRelaxingNullnessAnnotation|true
20 | detectorCheckTypeQualifiers=CheckTypeQualifiers|true
21 | detectorCloneIdiom=CloneIdiom|true
22 | detectorComparatorIdiom=ComparatorIdiom|true
23 | detectorConfusedInheritance=ConfusedInheritance|true
24 | detectorConfusionBetweenInheritedAndOuterMethod=ConfusionBetweenInheritedAndOuterMethod|true
25 | detectorCovariantArrayAssignment=CovariantArrayAssignment|false
26 | detectorCrossSiteScripting=CrossSiteScripting|true
27 | detectorDefaultEncodingDetector=DefaultEncodingDetector|true
28 | detectorDoInsideDoPrivileged=DoInsideDoPrivileged|true
29 | detectorDontCatchIllegalMonitorStateException=DontCatchIllegalMonitorStateException|true
30 | detectorDontIgnoreResultOfPutIfAbsent=DontIgnoreResultOfPutIfAbsent|true
31 | detectorDontUseEnum=DontUseEnum|true
32 | detectorDroppedException=DroppedException|true
33 | detectorDumbMethodInvocations=DumbMethodInvocations|true
34 | detectorDumbMethods=DumbMethods|true
35 | detectorDuplicateBranches=DuplicateBranches|true
36 | detectorEmptyZipFileEntry=EmptyZipFileEntry|true
37 | detectorEqualsOperandShouldHaveClassCompatibleWithThis=EqualsOperandShouldHaveClassCompatibleWithThis|true
38 | detectorExplicitSerialization=ExplicitSerialization|true
39 | detectorFieldItemSummary=FieldItemSummary|true
40 | detectorFinalizerNullsFields=FinalizerNullsFields|true
41 | detectorFindBadCast2=FindBadCast2|true
42 | detectorFindBadForLoop=FindBadForLoop|true
43 | detectorFindBugsSummaryStats=FindBugsSummaryStats|true
44 | detectorFindCircularDependencies=FindCircularDependencies|false
45 | detectorFindComparatorProblems=FindComparatorProblems|true
46 | detectorFindDeadLocalStores=FindDeadLocalStores|true
47 | detectorFindDoubleCheck=FindDoubleCheck|true
48 | detectorFindEmptySynchronizedBlock=FindEmptySynchronizedBlock|true
49 | detectorFindFieldSelfAssignment=FindFieldSelfAssignment|true
50 | detectorFindFinalizeInvocations=FindFinalizeInvocations|true
51 | detectorFindFloatEquality=FindFloatEquality|true
52 | detectorFindHEmismatch=FindHEmismatch|true
53 | detectorFindInconsistentSync2=FindInconsistentSync2|true
54 | detectorFindJSR166LockMonitorenter=FindJSR166LockMonitorenter|true
55 | detectorFindLocalSelfAssignment2=FindLocalSelfAssignment2|true
56 | detectorFindMaskedFields=FindMaskedFields|true
57 | detectorFindMismatchedWaitOrNotify=FindMismatchedWaitOrNotify|true
58 | detectorFindNakedNotify=FindNakedNotify|true
59 | detectorFindNonShortCircuit=FindNonShortCircuit|true
60 | detectorFindNullDeref=FindNullDeref|true
61 | detectorFindNullDerefsInvolvingNonShortCircuitEvaluation=FindNullDerefsInvolvingNonShortCircuitEvaluation|true
62 | detectorFindOpenStream=FindOpenStream|true
63 | detectorFindPuzzlers=FindPuzzlers|true
64 | detectorFindRefComparison=FindRefComparison|true
65 | detectorFindReturnRef=FindReturnRef|true
66 | detectorFindRoughConstants=FindRoughConstants|true
67 | detectorFindRunInvocations=FindRunInvocations|true
68 | detectorFindSelfComparison=FindSelfComparison|true
69 | detectorFindSelfComparison2=FindSelfComparison2|true
70 | detectorFindSleepWithLockHeld=FindSleepWithLockHeld|true
71 | detectorFindSpinLoop=FindSpinLoop|true
72 | detectorFindSqlInjection=FindSqlInjection|true
73 | detectorFindTwoLockWait=FindTwoLockWait|true
74 | detectorFindUncalledPrivateMethods=FindUncalledPrivateMethods|true
75 | detectorFindUnconditionalWait=FindUnconditionalWait|true
76 | detectorFindUninitializedGet=FindUninitializedGet|true
77 | detectorFindUnrelatedTypesInGenericContainer=FindUnrelatedTypesInGenericContainer|true
78 | detectorFindUnreleasedLock=FindUnreleasedLock|true
79 | detectorFindUnsatisfiedObligation=FindUnsatisfiedObligation|true
80 | detectorFindUnsyncGet=FindUnsyncGet|true
81 | detectorFindUseOfNonSerializableValue=FindUseOfNonSerializableValue|true
82 | detectorFindUselessControlFlow=FindUselessControlFlow|true
83 | detectorFindUselessObjects=FindUselessObjects|true
84 | detectorFormatStringChecker=FormatStringChecker|true
85 | detectorFunctionsThatMightBeMistakenForProcedures=FunctionsThatMightBeMistakenForProcedures|true
86 | detectorHugeSharedStringConstants=HugeSharedStringConstants|true
87 | detectorIDivResultCastToDouble=IDivResultCastToDouble|true
88 | detectorIncompatMask=IncompatMask|true
89 | detectorInconsistentAnnotations=InconsistentAnnotations|true
90 | detectorInefficientMemberAccess=InefficientMemberAccess|false
91 | detectorInefficientToArray=InefficientToArray|true
92 | detectorInfiniteLoop=InfiniteLoop|true
93 | detectorInfiniteRecursiveLoop=InfiniteRecursiveLoop|true
94 | detectorInheritanceUnsafeGetResource=InheritanceUnsafeGetResource|true
95 | detectorInitializationChain=InitializationChain|true
96 | detectorInitializeNonnullFieldsInConstructor=InitializeNonnullFieldsInConstructor|true
97 | detectorInstantiateStaticClass=InstantiateStaticClass|true
98 | detectorIntCast2LongAsInstant=IntCast2LongAsInstant|true
99 | detectorInvalidJUnitTest=InvalidJUnitTest|true
100 | detectorIteratorIdioms=IteratorIdioms|true
101 | detectorLazyInit=LazyInit|true
102 | detectorLoadOfKnownNullValue=LoadOfKnownNullValue|true
103 | detectorLostLoggerDueToWeakReference=LostLoggerDueToWeakReference|true
104 | detectorMethodReturnCheck=MethodReturnCheck|true
105 | detectorMethods=Methods|true
106 | detectorMultithreadedInstanceAccess=MultithreadedInstanceAccess|true
107 | detectorMutableEnum=MutableEnum|true
108 | detectorMutableLock=MutableLock|true
109 | detectorMutableStaticFields=MutableStaticFields|true
110 | detectorNaming=Naming|true
111 | detectorNoise=Noise|false
112 | detectorNoiseNullDeref=NoiseNullDeref|false
113 | detectorNoteAnnotationRetention=NoteAnnotationRetention|true
114 | detectorNoteCheckReturnValueAnnotations=NoteCheckReturnValueAnnotations|true
115 | detectorNoteDirectlyRelevantTypeQualifiers=NoteDirectlyRelevantTypeQualifiers|true
116 | detectorNoteJCIPAnnotation=NoteJCIPAnnotation|true
117 | detectorNoteNonNullAnnotations=NoteNonNullAnnotations|true
118 | detectorNoteNonnullReturnValues=NoteNonnullReturnValues|true
119 | detectorNoteSuppressedWarnings=NoteSuppressedWarnings|true
120 | detectorNoteUnconditionalParamDerefs=NoteUnconditionalParamDerefs|true
121 | detectorNumberConstructor=NumberConstructor|true
122 | detectorOptionalReturnNull=OptionalReturnNull|true
123 | detectorOverridingEqualsNotSymmetrical=OverridingEqualsNotSymmetrical|true
124 | detectorPreferZeroLengthArrays=PreferZeroLengthArrays|true
125 | detectorPublicSemaphores=PublicSemaphores|false
126 | detectorQuestionableBooleanAssignment=QuestionableBooleanAssignment|true
127 | detectorReadOfInstanceFieldInMethodInvokedByConstructorInSuperclass=ReadOfInstanceFieldInMethodInvokedByConstructorInSuperclass|true
128 | detectorReadReturnShouldBeChecked=ReadReturnShouldBeChecked|true
129 | detectorRedundantConditions=RedundantConditions|true
130 | detectorRedundantInterfaces=RedundantInterfaces|true
131 | detectorReflectiveClasses=ReflectiveClasses|true
132 | detectorRepeatedConditionals=RepeatedConditionals|true
133 | detectorResolveAllReferences=ResolveAllReferences|false
134 | detectorRuntimeExceptionCapture=RuntimeExceptionCapture|true
135 | detectorSerializableIdiom=SerializableIdiom|true
136 | detectorStartInConstructor=StartInConstructor|true
137 | detectorStaticCalendarDetector=StaticCalendarDetector|true
138 | detectorStringConcatenation=StringConcatenation|true
139 | detectorSuperfluousInstanceOf=SuperfluousInstanceOf|true
140 | detectorSuspiciousThreadInterrupted=SuspiciousThreadInterrupted|true
141 | detectorSwitchFallthrough=SwitchFallthrough|true
142 | detectorSynchronizationOnSharedBuiltinConstant=SynchronizationOnSharedBuiltinConstant|true
143 | detectorSynchronizeAndNullCheckField=SynchronizeAndNullCheckField|true
144 | detectorSynchronizeOnClassLiteralNotGetClass=SynchronizeOnClassLiteralNotGetClass|true
145 | detectorSynchronizingOnContentsOfFieldToProtectField=SynchronizingOnContentsOfFieldToProtectField|true
146 | detectorTestASM=TestASM|false
147 | detectorTestDataflowAnalysis=TestDataflowAnalysis|false
148 | detectorTestingGround=TestingGround|false
149 | detectorTestingGround2=TestingGround2|false
150 | detectorTrainFieldStoreTypes=TrainFieldStoreTypes|true
151 | detectorTrainLongInstantfParams=TrainLongInstantfParams|true
152 | detectorTrainNonNullAnnotations=TrainNonNullAnnotations|true
153 | detectorTrainUnconditionalDerefParams=TrainUnconditionalDerefParams|true
154 | detectorURLProblems=URLProblems|true
155 | detectorUncallableMethodOfAnonymousClass=UncallableMethodOfAnonymousClass|true
156 | detectorUnnecessaryMath=UnnecessaryMath|true
157 | detectorUnreadFields=UnreadFields|true
158 | detectorUselessSubclassMethod=UselessSubclassMethod|true
159 | detectorVarArgsProblems=VarArgsProblems|true
160 | detectorVolatileUsage=VolatileUsage|true
161 | detectorWaitInLoop=WaitInLoop|true
162 | detectorWrongMapIterator=WrongMapIterator|true
163 | detectorXMLFactoryBypass=XMLFactoryBypass|true
164 | detector_threshold=2
165 | effort=max
166 | excludefilter0=${configDir}/findbugs/excludeFilter.xml|true
167 | filter_settings=Medium|BAD_PRACTICE,CORRECTNESS,EXPERIMENTAL,I18N,MALICIOUS_CODE,MT_CORRECTNESS,PERFORMANCE,SECURITY,STYLE|false|20
168 | filter_settings_neg=NOISE|
169 | plugin0=edu.umd.cs.findbugs.plugins.findbugsCommunalCloud|false
170 | plugin1=edu.umd.cs.findbugs.plugins.webCloud|false
171 | run_at_full_build=true
172 |
--------------------------------------------------------------------------------
/.baseline/eclipse/org.eclipse.jdt.core.prefs:
--------------------------------------------------------------------------------
1 | org.eclipse.jdt.core.codeComplete.argumentPrefixes=
2 | org.eclipse.jdt.core.codeComplete.argumentSuffixes=
3 | org.eclipse.jdt.core.codeComplete.fieldPrefixes=
4 | org.eclipse.jdt.core.codeComplete.fieldSuffixes=
5 | org.eclipse.jdt.core.codeComplete.localPrefixes=
6 | org.eclipse.jdt.core.codeComplete.localSuffixes=
7 | org.eclipse.jdt.core.codeComplete.staticFieldPrefixes=
8 | org.eclipse.jdt.core.codeComplete.staticFieldSuffixes=
9 | org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes=
10 | org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes=
11 | org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=enabled
12 | org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
13 | org.eclipse.jdt.core.compiler.annotation.nonnull=javax.annotation.Nonnull
14 | org.eclipse.jdt.core.compiler.annotation.nullable=javax.annotation.CheckForNull
15 | org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
16 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
17 | org.eclipse.jdt.core.compiler.codegen.methodParameters=generate
18 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=${javaTargetVersion}
19 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
20 | org.eclipse.jdt.core.compiler.compliance=${javaTargetVersion}
21 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate
22 | org.eclipse.jdt.core.compiler.debug.localVariable=generate
23 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate
24 | org.eclipse.jdt.core.compiler.doc.comment.support=enabled
25 | org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=ignore
26 | org.eclipse.jdt.core.compiler.processAnnotations=enabled
27 | org.eclipse.jdt.core.compiler.source=${javaSourceVersion}
28 | org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
29 | org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
30 | org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
31 | org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
32 | org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
33 | org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
34 | org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
35 | org.eclipse.jdt.core.formatter.alignment_for_assignment=32
36 | org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
37 | org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
38 | org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
39 | org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
40 | org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
41 | org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
42 | org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
43 | org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
44 | org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
45 | org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80
46 | org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
47 | org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
48 | org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
49 | org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
50 | org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
51 | org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
52 | org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16
53 | org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
54 | org.eclipse.jdt.core.formatter.blank_lines_after_package=1
55 | org.eclipse.jdt.core.formatter.blank_lines_before_field=0
56 | org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
57 | org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
58 | org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
59 | org.eclipse.jdt.core.formatter.blank_lines_before_method=1
60 | org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
61 | org.eclipse.jdt.core.formatter.blank_lines_before_package=0
62 | org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
63 | org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
64 | org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
65 | org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
66 | org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
67 | org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
68 | org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
69 | org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
70 | org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
71 | org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
72 | org.eclipse.jdt.core.formatter.brace_position_for_lambda_body=end_of_line
73 | org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
74 | org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
75 | org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
76 | org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
77 | org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
78 | org.eclipse.jdt.core.formatter.comment.format_block_comments=true
79 | org.eclipse.jdt.core.formatter.comment.format_header=false
80 | org.eclipse.jdt.core.formatter.comment.format_html=true
81 | org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true
82 | org.eclipse.jdt.core.formatter.comment.format_line_comments=true
83 | org.eclipse.jdt.core.formatter.comment.format_source_code=true
84 | org.eclipse.jdt.core.formatter.comment.indent_parameter_description=false
85 | org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
86 | org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
87 | org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert
88 | org.eclipse.jdt.core.formatter.comment.line_length=120
89 | org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true
90 | org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
91 | org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false
92 | org.eclipse.jdt.core.formatter.compact_else_if=true
93 | org.eclipse.jdt.core.formatter.continuation_indentation=2
94 | org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
95 | org.eclipse.jdt.core.formatter.disabling_tag=@formatter\\:off
96 | org.eclipse.jdt.core.formatter.enabling_tag=@formatter\\:on
97 | org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
98 | org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true
99 | org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
100 | org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
101 | org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
102 | org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
103 | org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
104 | org.eclipse.jdt.core.formatter.indent_empty_lines=false
105 | org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
106 | org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
107 | org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
108 | org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true
109 | org.eclipse.jdt.core.formatter.indentation.size=4
110 | org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
111 | org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
112 | org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
113 | org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert
114 | org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
115 | org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
116 | org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert
117 | org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
118 | org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation=do not insert
119 | org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=insert
120 | org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
121 | org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
122 | org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
123 | org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
124 | org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
125 | org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=do not insert
126 | org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert
127 | org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=do not insert
128 | org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=do not insert
129 | org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=do not insert
130 | org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=do not insert
131 | org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=do not insert
132 | org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
133 | org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
134 | org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
135 | org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
136 | org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
137 | org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=do not insert
138 | org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
139 | org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
140 | org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
141 | org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
142 | org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
143 | org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
144 | org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
145 | org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
146 | org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
147 | org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
148 | org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
149 | org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
150 | org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
151 | org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
152 | org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
153 | org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
154 | org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
155 | org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
156 | org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
157 | org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
158 | org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
159 | org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
160 | org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
161 | org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
162 | org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
163 | org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
164 | org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
165 | org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
166 | org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert
167 | org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
168 | org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
169 | org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
170 | org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=do not insert
171 | org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
172 | org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
173 | org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
174 | org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
175 | org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
176 | org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
177 | org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
178 | org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
179 | org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
180 | org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
181 | org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
182 | org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
183 | org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
184 | org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
185 | org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert
186 | org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
187 | org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
188 | org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
189 | org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
190 | org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
191 | org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
192 | org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert
193 | org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
194 | org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
195 | org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
196 | org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
197 | org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
198 | org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
199 | org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
200 | org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
201 | org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=do not insert
202 | org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
203 | org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
204 | org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
205 | org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
206 | org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
207 | org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
208 | org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
209 | org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
210 | org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
211 | org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
212 | org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
213 | org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
214 | org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
215 | org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
216 | org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert
217 | org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
218 | org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
219 | org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
220 | org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
221 | org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
222 | org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
223 | org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
224 | org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
225 | org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
226 | org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
227 | org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
228 | org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
229 | org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
230 | org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
231 | org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
232 | org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
233 | org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
234 | org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
235 | org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
236 | org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
237 | org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
238 | org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
239 | org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
240 | org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
241 | org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
242 | org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
243 | org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
244 | org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert
245 | org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
246 | org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
247 | org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
248 | org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
249 | org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
250 | org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
251 | org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
252 | org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
253 | org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
254 | org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
255 | org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
256 | org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
257 | org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
258 | org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
259 | org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
260 | org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
261 | org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
262 | org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
263 | org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
264 | org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
265 | org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
266 | org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
267 | org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
268 | org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
269 | org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
270 | org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
271 | org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
272 | org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
273 | org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert
274 | org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
275 | org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
276 | org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
277 | org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
278 | org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
279 | org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
280 | org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
281 | org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
282 | org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
283 | org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert
284 | org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
285 | org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
286 | org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
287 | org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
288 | org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
289 | org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
290 | org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
291 | org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
292 | org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
293 | org.eclipse.jdt.core.formatter.join_lines_in_comments=true
294 | org.eclipse.jdt.core.formatter.join_wrapped_lines=false
295 | org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
296 | org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
297 | org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
298 | org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
299 | org.eclipse.jdt.core.formatter.lineSplit=120
300 | org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
301 | org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
302 | org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
303 | org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
304 | org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
305 | org.eclipse.jdt.core.formatter.tabulation.char=space
306 | org.eclipse.jdt.core.formatter.tabulation.size=4
307 | org.eclipse.jdt.core.formatter.use_on_off_tags=false
308 | org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
309 | org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
310 | org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true
311 | org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
312 |
--------------------------------------------------------------------------------
/.baseline/eclipse/static/dotfile.settings/edu.umd.cs.findbugs.plugin.eclipse.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | edu.umd.cs.findbugs.plugin.eclipse.findbugsMarkerOfConcern=Warning
3 | edu.umd.cs.findbugs.plugin.eclipse.findbugsMarkerScariest=Error
4 | edu.umd.cs.findbugs.plugin.eclipse.findbugsMarkerScary=Warning
5 | edu.umd.cs.findbugs.plugin.eclipse.findbugsMarkerTroubling=Warning
6 |
--------------------------------------------------------------------------------
/.baseline/eclipse/static/dotfile.settings/org.eclipse.jdt.ui.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
3 | formatter_profile=_Baseline Profile
4 | formatter_settings_version=12
5 | org.eclipse.jdt.ui.exception.name=e
6 | org.eclipse.jdt.ui.gettersetter.use.is=false
7 | org.eclipse.jdt.ui.ignorelowercasenames=true
8 | org.eclipse.jdt.ui.importorder=;
9 | org.eclipse.jdt.ui.javadoc=false
10 | org.eclipse.jdt.ui.keywordthis=false
11 | org.eclipse.jdt.ui.ondemandthreshold=99
12 | org.eclipse.jdt.ui.overrideannotation=true
13 | org.eclipse.jdt.ui.staticondemandthreshold=99
14 | org.eclipse.jdt.ui.text.custom_code_templates=/**\n * @return the ${bare_field_name}\n */ /**\n * @param ${param} the ${bare_field_name} to set\n */ /**\n * ${tags}\n */ /**\n * ${tags}\n */ /**\n * ${tags}\n */ /* (non-Javadoc)\n * ${see_to_overridden}\n */ /**\n * ${tags}\n * ${see_to_target}\n */ /*\n * Copyright 2016 Palantir Technologies, Inc. All rights reserved.\n */\n\n${package_declaration}\n\n/**\n * \n */\n${typecomment}\n${type_declaration} \n \n \n \n throw new RuntimeException(${exception_var}); ${body_statement} ${body_statement} return ${field}; ${field} \= ${param};
15 | sp_cleanup.add_default_serial_version_id=true
16 | sp_cleanup.add_generated_serial_version_id=false
17 | sp_cleanup.add_missing_annotations=true
18 | sp_cleanup.add_missing_deprecated_annotations=true
19 | sp_cleanup.add_missing_methods=false
20 | sp_cleanup.add_missing_nls_tags=false
21 | sp_cleanup.add_missing_override_annotations=true
22 | sp_cleanup.add_missing_override_annotations_interface_methods=true
23 | sp_cleanup.add_serial_version_id=false
24 | sp_cleanup.always_use_blocks=true
25 | sp_cleanup.always_use_parentheses_in_expressions=false
26 | sp_cleanup.always_use_this_for_non_static_field_access=false
27 | sp_cleanup.always_use_this_for_non_static_method_access=false
28 | sp_cleanup.convert_to_enhanced_for_loop=false
29 | sp_cleanup.correct_indentation=false
30 | sp_cleanup.format_source_code=false
31 | sp_cleanup.format_source_code_changes_only=false
32 | sp_cleanup.make_local_variable_final=false
33 | sp_cleanup.make_parameters_final=false
34 | sp_cleanup.make_private_fields_final=true
35 | sp_cleanup.make_type_abstract_if_missing_method=false
36 | sp_cleanup.make_variable_declarations_final=false
37 | sp_cleanup.never_use_blocks=false
38 | sp_cleanup.never_use_parentheses_in_expressions=true
39 | sp_cleanup.on_save_use_additional_actions=true
40 | sp_cleanup.organize_imports=true
41 | sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
42 | sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
43 | sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
44 | sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
45 | sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
46 | sp_cleanup.remove_private_constructors=true
47 | sp_cleanup.remove_trailing_whitespaces=true
48 | sp_cleanup.remove_trailing_whitespaces_all=true
49 | sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
50 | sp_cleanup.remove_unnecessary_casts=true
51 | sp_cleanup.remove_unnecessary_nls_tags=false
52 | sp_cleanup.remove_unused_imports=true
53 | sp_cleanup.remove_unused_local_variables=false
54 | sp_cleanup.remove_unused_private_fields=true
55 | sp_cleanup.remove_unused_private_members=false
56 | sp_cleanup.remove_unused_private_methods=true
57 | sp_cleanup.remove_unused_private_types=true
58 | sp_cleanup.sort_members=false
59 | sp_cleanup.sort_members_all=false
60 | sp_cleanup.use_blocks=false
61 | sp_cleanup.use_blocks_only_for_return_and_throw=false
62 | sp_cleanup.use_parentheses_in_expressions=false
63 | sp_cleanup.use_this_for_non_static_field_access=false
64 | sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
65 | sp_cleanup.use_this_for_non_static_method_access=false
66 | sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
67 |
--------------------------------------------------------------------------------
/.baseline/findbugs/excludeFilter.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/.baseline/idea/intellij-java-palantir-style.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 | true
103 | true
104 | true
105 | true
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 | true
115 | true
116 | true
117 | true
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 | true
127 | true
128 | true
129 | true
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 | true
139 | true
140 | true
141 | true
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 | true
151 | true
152 | true
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 | true
162 | true
163 | true
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 | true
173 | true
174 | true
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 | true
184 | true
185 | true
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 | true
195 | true
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 | true
205 | true
206 | true
207 |
208 |
209 |
210 |
211 |
212 |
213 |
214 |
215 | true
216 | true
217 | true
218 |
219 |
220 |
221 |
222 |
223 |
224 |
225 |
226 | true
227 | true
228 | true
229 |
230 |
231 |
232 |
233 |
234 |
235 |
236 |
237 | true
238 | true
239 | true
240 |
241 |
242 |
243 |
244 |
245 |
246 |
247 |
248 | true
249 | true
250 |
251 |
252 |
253 |
254 |
255 |
256 |
257 |
258 | true
259 | true
260 |
261 |
262 |
263 |
264 |
265 |
266 |
267 |
268 | true
269 | true
270 |
271 |
272 |
273 |
274 |
275 |
276 |
277 |
278 | true
279 | true
280 |
281 |
282 |
283 |
284 |
285 |
286 |
287 | true
288 |
289 |
290 |
291 |
292 |
293 |
294 | true
295 |
296 |
297 |
298 |
299 |
300 |
301 | true
302 |
303 |
304 |
305 |
306 |
307 |
308 |
309 | true
310 | true
311 |
312 |
313 |
314 |
315 |
316 |
317 |
318 | true
319 |
320 |
321 |
322 |
323 |
324 |
325 | true
326 |
327 |
328 |
329 |
330 |
331 |
332 | true
333 |
334 |
335 |
336 |
337 |
338 |
339 |
340 | true
341 | true
342 |
343 |
344 |
345 |
346 |
347 |
348 |
349 | true
350 |
351 |
352 |
353 |
354 |
355 |
356 |
357 | true
358 | true
359 | true
360 |
361 |
362 |
363 |
364 |
365 |
366 |
367 |
368 | true
369 | true
370 | true
371 |
372 |
373 |
374 |
375 |
376 |
377 |
378 |
379 | true
380 | true
381 | true
382 |
383 |
384 |
385 |
386 |
387 |
388 |
389 |
390 | true
391 | true
392 | true
393 |
394 |
395 |
396 |
397 |
398 |
399 |
400 |
401 | true
402 | true
403 | true
404 |
405 |
406 |
407 |
408 |
409 |
410 |
411 |
412 |
413 |
414 |
415 |
416 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Java
2 | *.class
3 |
4 | # Gradle
5 | .gradle/
6 | build/
7 |
8 | # Eclipse
9 | .classpath
10 | .checkstyle
11 | .factorypath
12 | .project
13 | .settings
14 | bin/
15 |
16 | # Idea
17 | *.iml
18 | *.ipr
19 | *.iws
20 | .idea/
21 | out/
22 |
23 | # Codegen
24 | generated_src/
25 | .generated
26 |
27 | # Mac
28 | .DS_Store
29 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | Contributing
2 | ============
3 | All contributions are welcome to be submitted for review for inclusion, but before they will be accepted, we ask that
4 | you follow these simple guidelines:
5 |
6 |
7 | Legal
8 | -----
9 | Fill out the a Contributor License Agreement and send it to opensource@palantir.com:
10 |
11 | - [Individual Contributor License Agreement](palantir_individual_cla.pdf?raw=true)
12 | - [Corporate Contributor License Agreement](palantir_corporate_cla.pdf?raw=true)
13 |
14 |
15 | Code Style
16 | ----------
17 | When submitting code, please make every effort to follow existing conventions and style in order to keep the code as
18 | readable as possible. We realize that the style used in this project might be different that what is used in your
19 | projects, but in the end it makes it easier to merge changes and maintain in the future.
20 |
21 |
22 | Testing
23 | -------
24 | We kindly ask that all new features and fixes for an issue should include any unit tests. Even if it is small
25 | improvement, adding a unit test will help to ensure no regressions or the issue is not re-introduced. If you need help
26 | with writing a test for your feature, please don't be shy and ask!
27 |
28 |
29 | Documentation
30 | -------------
31 | Up-to-date documentation makes all our lives easier. If you are adding a new feature, enhancing an existing feature, or
32 | fixing an issue, please add or modify the documentation as needed and include it with your pull request.
33 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 |
2 | Apache License
3 | Version 2.0, January 2004
4 | http://www.apache.org/licenses/
5 |
6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7 |
8 | 1. Definitions.
9 |
10 | "License" shall mean the terms and conditions for use, reproduction,
11 | and distribution as defined by Sections 1 through 9 of this document.
12 |
13 | "Licensor" shall mean the copyright owner or entity authorized by
14 | the copyright owner that is granting the License.
15 |
16 | "Legal Entity" shall mean the union of the acting entity and all
17 | other entities that control, are controlled by, or are under common
18 | control with that entity. For the purposes of this definition,
19 | "control" means (i) the power, direct or indirect, to cause the
20 | direction or management of such entity, whether by contract or
21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
22 | outstanding shares, or (iii) beneficial ownership of such entity.
23 |
24 | "You" (or "Your") shall mean an individual or Legal Entity
25 | exercising permissions granted by this License.
26 |
27 | "Source" form shall mean the preferred form for making modifications,
28 | including but not limited to software source code, documentation
29 | source, and configuration files.
30 |
31 | "Object" form shall mean any form resulting from mechanical
32 | transformation or translation of a Source form, including but
33 | not limited to compiled object code, generated documentation,
34 | and conversions to other media types.
35 |
36 | "Work" shall mean the work of authorship, whether in Source or
37 | Object form, made available under the License, as indicated by a
38 | copyright notice that is included in or attached to the work
39 | (an example is provided in the Appendix below).
40 |
41 | "Derivative Works" shall mean any work, whether in Source or Object
42 | form, that is based on (or derived from) the Work and for which the
43 | editorial revisions, annotations, elaborations, or other modifications
44 | represent, as a whole, an original work of authorship. For the purposes
45 | of this License, Derivative Works shall not include works that remain
46 | separable from, or merely link (or bind by name) to the interfaces of,
47 | the Work and Derivative Works thereof.
48 |
49 | "Contribution" shall mean any work of authorship, including
50 | the original version of the Work and any modifications or additions
51 | to that Work or Derivative Works thereof, that is intentionally
52 | submitted to Licensor for inclusion in the Work by the copyright owner
53 | or by an individual or Legal Entity authorized to submit on behalf of
54 | the copyright owner. For the purposes of this definition, "submitted"
55 | means any form of electronic, verbal, or written communication sent
56 | to the Licensor or its representatives, including but not limited to
57 | communication on electronic mailing lists, source code control systems,
58 | and issue tracking systems that are managed by, or on behalf of, the
59 | Licensor for the purpose of discussing and improving the Work, but
60 | excluding communication that is conspicuously marked or otherwise
61 | designated in writing by the copyright owner as "Not a Contribution."
62 |
63 | "Contributor" shall mean Licensor and any individual or Legal Entity
64 | on behalf of whom a Contribution has been received by Licensor and
65 | subsequently incorporated within the Work.
66 |
67 | 2. Grant of Copyright License. Subject to the terms and conditions of
68 | this License, each Contributor hereby grants to You a perpetual,
69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70 | copyright license to reproduce, prepare Derivative Works of,
71 | publicly display, publicly perform, sublicense, and distribute the
72 | Work and such Derivative Works in Source or Object form.
73 |
74 | 3. Grant of Patent License. Subject to the terms and conditions of
75 | this License, each Contributor hereby grants to You a perpetual,
76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77 | (except as stated in this section) patent license to make, have made,
78 | use, offer to sell, sell, import, and otherwise transfer the Work,
79 | where such license applies only to those patent claims licensable
80 | by such Contributor that are necessarily infringed by their
81 | Contribution(s) alone or by combination of their Contribution(s)
82 | with the Work to which such Contribution(s) was submitted. If You
83 | institute patent litigation against any entity (including a
84 | cross-claim or counterclaim in a lawsuit) alleging that the Work
85 | or a Contribution incorporated within the Work constitutes direct
86 | or contributory patent infringement, then any patent licenses
87 | granted to You under this License for that Work shall terminate
88 | as of the date such litigation is filed.
89 |
90 | 4. Redistribution. You may reproduce and distribute copies of the
91 | Work or Derivative Works thereof in any medium, with or without
92 | modifications, and in Source or Object form, provided that You
93 | meet the following conditions:
94 |
95 | (a) You must give any other recipients of the Work or
96 | Derivative Works a copy of this License; and
97 |
98 | (b) You must cause any modified files to carry prominent notices
99 | stating that You changed the files; and
100 |
101 | (c) You must retain, in the Source form of any Derivative Works
102 | that You distribute, all copyright, patent, trademark, and
103 | attribution notices from the Source form of the Work,
104 | excluding those notices that do not pertain to any part of
105 | the Derivative Works; and
106 |
107 | (d) If the Work includes a "NOTICE" text file as part of its
108 | distribution, then any Derivative Works that You distribute must
109 | include a readable copy of the attribution notices contained
110 | within such NOTICE file, excluding those notices that do not
111 | pertain to any part of the Derivative Works, in at least one
112 | of the following places: within a NOTICE text file distributed
113 | as part of the Derivative Works; within the Source form or
114 | documentation, if provided along with the Derivative Works; or,
115 | within a display generated by the Derivative Works, if and
116 | wherever such third-party notices normally appear. The contents
117 | of the NOTICE file are for informational purposes only and
118 | do not modify the License. You may add Your own attribution
119 | notices within Derivative Works that You distribute, alongside
120 | or as an addendum to the NOTICE text from the Work, provided
121 | that such additional attribution notices cannot be construed
122 | as modifying the License.
123 |
124 | You may add Your own copyright statement to Your modifications and
125 | may provide additional or different license terms and conditions
126 | for use, reproduction, or distribution of Your modifications, or
127 | for any such Derivative Works as a whole, provided Your use,
128 | reproduction, and distribution of the Work otherwise complies with
129 | the conditions stated in this License.
130 |
131 | 5. Submission of Contributions. Unless You explicitly state otherwise,
132 | any Contribution intentionally submitted for inclusion in the Work
133 | by You to the Licensor shall be under the terms and conditions of
134 | this License, without any additional terms or conditions.
135 | Notwithstanding the above, nothing herein shall supersede or modify
136 | the terms of any separate license agreement you may have executed
137 | with Licensor regarding such Contributions.
138 |
139 | 6. Trademarks. This License does not grant permission to use the trade
140 | names, trademarks, service marks, or product names of the Licensor,
141 | except as required for reasonable and customary use in describing the
142 | origin of the Work and reproducing the content of the NOTICE file.
143 |
144 | 7. Disclaimer of Warranty. Unless required by applicable law or
145 | agreed to in writing, Licensor provides the Work (and each
146 | Contributor provides its Contributions) on an "AS IS" BASIS,
147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148 | implied, including, without limitation, any warranties or conditions
149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150 | PARTICULAR PURPOSE. You are solely responsible for determining the
151 | appropriateness of using or redistributing the Work and assume any
152 | risks associated with Your exercise of permissions under this License.
153 |
154 | 8. Limitation of Liability. In no event and under no legal theory,
155 | whether in tort (including negligence), contract, or otherwise,
156 | unless required by applicable law (such as deliberate and grossly
157 | negligent acts) or agreed to in writing, shall any Contributor be
158 | liable to You for damages, including any direct, indirect, special,
159 | incidental, or consequential damages of any character arising as a
160 | result of this License or out of the use or inability to use the
161 | Work (including but not limited to damages for loss of goodwill,
162 | work stoppage, computer failure or malfunction, or any and all
163 | other commercial damages or losses), even if such Contributor
164 | has been advised of the possibility of such damages.
165 |
166 | 9. Accepting Warranty or Additional Liability. While redistributing
167 | the Work or Derivative Works thereof, You may choose to offer,
168 | and charge a fee for, acceptance of support, warranty, indemnity,
169 | or other liability obligations and/or rights consistent with this
170 | License. However, in accepting such obligations, You may act only
171 | on Your own behalf and on Your sole responsibility, not on behalf
172 | of any other Contributor, and only if You agree to indemnify,
173 | defend, and hold each Contributor harmless for any liability
174 | incurred by, or claims asserted against, such Contributor by reason
175 | of your accepting any such warranty or additional liability.
176 |
177 | END OF TERMS AND CONDITIONS
178 |
179 | APPENDIX: How to apply the Apache License to your work.
180 |
181 | To apply the Apache License to your work, attach the following
182 | boilerplate notice, with the fields enclosed by brackets "[]"
183 | replaced with your own identifying information. (Don't include
184 | the brackets!) The text should be enclosed in the appropriate
185 | comment syntax for the file format. We also recommend that a
186 | file or class name and description of purpose be included on the
187 | same "printed page" as the copyright notice for easier
188 | identification within third-party archives.
189 |
190 | Copyright [yyyy] [name of copyright owner]
191 |
192 | Licensed under the Apache License, Version 2.0 (the "License");
193 | you may not use this file except in compliance with the License.
194 | You may obtain a copy of the License at
195 |
196 | http://www.apache.org/licenses/LICENSE-2.0
197 |
198 | Unless required by applicable law or agreed to in writing, software
199 | distributed under the License is distributed on an "AS IS" BASIS,
200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201 | See the License for the specific language governing permissions and
202 | limitations under the License.
203 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | [](https://circleci.com/gh/palantir/dropwizard-index-page)
2 | [  ](https://bintray.com/palantir/releases/dropwizard-index-page/_latestVersion)
3 |
4 |
5 | Dropwizard Index Page
6 | =====================
7 |
8 | A bundle that serves the *index* page for a single page application. It covers the following areas:
9 |
10 | - Serves the index page for a list of url patterns specified during the bundle creation.
11 | - Templates the index page with the correct base tag value, the context path of your application.
12 | - Add disable caching header when serving the index page.
13 | - `cache-control: no-cache, no-store, max-age=0, must-revalidate`
14 |
15 |
16 | Usage
17 | -----
18 | 1. Add the ``com.palantir.indexpage:dropwizard-index-page:`` dependency to your project's build.gradle file.
19 | The most recent version number can be found by looking at the [Releases Page](https://github.com/palantir/dropwizard-index-page/releases).
20 | The dependencies section should look something like this:
21 |
22 | ```
23 | dependencies {
24 | // ... unrelated dependencies omitted ...
25 | compile "com.palantir.indexpage:dropwizard-index-page:"
26 | }
27 | ```
28 | 2. Ensure the base tag in your ``index.html`` page is set using [mustache](https://mustache.github.io/):
29 |
30 | ```
31 |
32 | ```
33 | 3. Have your configuration implement `IndexPageConfigurable`:
34 |
35 | ```
36 | public final class ExampleApplicationConfiguration extends Configuration implements IndexPageConfigurable {
37 |
38 | private final String indexPagePath;
39 |
40 | @JsonCreator
41 | ExampleConfig(@JsonProperty("indexPagePath") Optional indexPagePath) {
42 | this.indexPagePath = indexPagePath.or("service/web/index.html");
43 | }
44 |
45 | @Override
46 | public String getIndexPagePath() {
47 | return this.indexPagePath;
48 | }
49 | }
50 | ```
51 |
52 | 4. Add the bundle to your application:
53 |
54 | ```
55 | public final class ExampleApplication extends Application {
56 |
57 | @Override
58 | public void initialize(Bootstrap bootstrap) {
59 | bootstrap.addBundle(new IndexPageBundle(ImmutableSet.of("/views/*"));`
60 | }
61 | }
62 | ```
63 |
64 | Configuration
65 | -------------
66 | The default index page path is `service/web/index.html` and you can override the path via the `IndexPageConfigurable` interface.
67 |
68 | **NOTE**: The path for the index page can be either the file sytem path or the classpath and the file system path takes precedence over the classpath if the file exists in both paths.
69 |
70 | Setting up the project with an IDE
71 | ----------------------------------
72 | with Eclipse, import the project and run:
73 |
74 | ./gradlew eclipse
75 |
76 | with IntelliJ, import the project and run:
77 |
78 | ./gradlew idea
79 |
80 | Contributing
81 | ------------
82 | Before working on the code, if you plan to contribute changes, please read the [CONTRIBUTING](CONTRIBUTING.md) document.
83 |
84 |
85 | License
86 | -------
87 | This project is made available under the
88 | [Apache 2.0 License](http://www.apache.org/licenses/LICENSE-2.0).
89 |
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | repositories {
3 | jcenter()
4 | maven { url "http://palantir.bintray.com/releases" }
5 | }
6 |
7 | dependencies {
8 | classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:$bintrayVersion"
9 | classpath "com.palantir.baseline:gradle-baseline-java:$baselineVersion"
10 | }
11 | }
12 |
13 | plugins {
14 | id 'com.palantir.git-version' version '0.7.3'
15 | }
16 |
17 | apply plugin: 'com.palantir.baseline-config'
18 | apply plugin: 'com.palantir.baseline-idea'
19 |
20 | allprojects {
21 | group 'com.palantir.indexpage'
22 | repositories {
23 | jcenter()
24 | }
25 |
26 | version gitVersion()
27 | }
28 |
29 | subprojects {
30 | apply plugin: 'java'
31 | apply plugin: 'com.palantir.baseline-checkstyle'
32 | apply plugin: 'com.palantir.baseline-eclipse'
33 | apply plugin: 'com.palantir.baseline-idea'
34 | }
35 |
36 |
--------------------------------------------------------------------------------
/circle.yml:
--------------------------------------------------------------------------------
1 | machine:
2 | java:
3 | version: oraclejdk8
4 | environment:
5 | TERM: dumb
6 |
7 | general:
8 | artifacts:
9 | - dropwizard-index-page/build/libs
10 |
11 | test:
12 | override:
13 | - ./gradlew build
14 |
15 | deployment:
16 | release:
17 | tag: /[0-9]+(\.[0-9]+)+/
18 | commands:
19 | - ./gradlew -i bintrayUpload
20 |
--------------------------------------------------------------------------------
/dropwizard-index-page-example/ExampleApplication.launch:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/dropwizard-index-page-example/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: "application"
2 |
3 | dependencies {
4 | compile project(":dropwizard-index-page")
5 |
6 | compile "io.dropwizard:dropwizard-core:$dropwizardVersion"
7 | }
8 |
9 | mainClassName = "com.palantir.indexpage.example.ExampleApplication"
10 |
11 | run {
12 | args "server", "example.yml"
13 | }
14 |
15 | test.enabled false
16 |
--------------------------------------------------------------------------------
/dropwizard-index-page-example/example.yml:
--------------------------------------------------------------------------------
1 | # ====================
2 | # Index Page Bundle
3 | # ====================
4 | indexPagePath: service/web/index.html
5 |
6 | server:
7 | applicationContextPath: /example
8 | applicationConnectors:
9 | - type: http
10 | port: 8000
11 | rootPath: /api/*
12 |
--------------------------------------------------------------------------------
/dropwizard-index-page-example/service/web/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Index Page Bundle Example
6 |
7 |
8 |
9 |
10 |
11 |
22 |
25 |
26 |
27 |
60 |
61 |
62 |
--------------------------------------------------------------------------------
/dropwizard-index-page-example/src/main/java/com/palantir/indexpage/example/ExampleApplication.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2016 Palantir Technologies, Inc. All rights reserved.
3 | */
4 |
5 | package com.palantir.indexpage.example;
6 |
7 | import com.fasterxml.jackson.annotation.JsonCreator;
8 | import com.fasterxml.jackson.annotation.JsonProperty;
9 | import com.google.common.base.Optional;
10 | import com.google.common.collect.ImmutableSet;
11 | import com.palantir.indexpage.IndexPageBundle;
12 | import com.palantir.indexpage.IndexPageConfigurable;
13 | import com.palantir.indexpage.example.ExampleApplication.ExampleConfig;
14 | import io.dropwizard.Application;
15 | import io.dropwizard.Configuration;
16 | import io.dropwizard.setup.Bootstrap;
17 | import io.dropwizard.setup.Environment;
18 |
19 | /**
20 | * Example application that consumes {@link IndexPageBundle}.
21 | */
22 | public final class ExampleApplication extends Application {
23 |
24 | public static void main(String[] args) throws Exception {
25 | new ExampleApplication().run(args);
26 | }
27 |
28 | @Override
29 | public void initialize(Bootstrap bootstrap) {
30 | bootstrap.addBundle(new IndexPageBundle(ImmutableSet.of("/hello/*", "/goodbye/*", "/surprise/*")));
31 | }
32 |
33 | @Override
34 | public void run(ExampleConfig configuration, Environment environment) throws Exception {
35 | // intentionally left blank
36 | }
37 |
38 | static class ExampleConfig extends Configuration implements IndexPageConfigurable {
39 |
40 | private final String indexPagePath;
41 |
42 | @JsonCreator
43 | ExampleConfig(@JsonProperty("indexPagePath") Optional indexPagePath) {
44 | this.indexPagePath = indexPagePath.or("./service/web/index.html");
45 | }
46 |
47 | @Override
48 | public String getIndexPagePath() {
49 | return this.indexPagePath;
50 | }
51 | }
52 | }
53 |
54 |
--------------------------------------------------------------------------------
/dropwizard-index-page-example/src/main/resources/service/web/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Index Page Bundle Example
6 |
7 |
8 |
9 |
10 |
11 |
22 |
25 |
26 |
27 |
60 |
61 |
62 |
--------------------------------------------------------------------------------
/dropwizard-index-page/build.gradle:
--------------------------------------------------------------------------------
1 | apply from: "${rootDir}/gradle/jacoco.gradle"
2 | apply from: "${rootDir}/gradle/publish.gradle"
3 |
4 | dependencies {
5 | compile "com.github.spullara.mustache.java:compiler:$mustacheVersion"
6 | compile "com.google.code.findbugs:annotations:$annotationVersion"
7 | compile "io.dropwizard:dropwizard-core:$dropwizardVersion"
8 |
9 | testCompile "io.dropwizard:dropwizard-assets:$dropwizardVersion"
10 | testCompile "io.dropwizard:dropwizard-testing:$dropwizardVersion"
11 | testCompile "junit:junit:$junitVersion"
12 | testCompile "org.hamcrest:hamcrest-library:$hamcrestVersion"
13 | testCompile "org.mockito:mockito-core:$mockitoVersion"
14 | }
15 |
16 |
--------------------------------------------------------------------------------
/dropwizard-index-page/src/main/java/com/palantir/indexpage/ClasspathIndexPage.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2016 Palantir Technologies, Inc. All rights reserved.
3 | */
4 |
5 | package com.palantir.indexpage;
6 |
7 | import static com.google.common.base.Preconditions.checkNotNull;
8 |
9 | import com.github.mustachejava.DefaultMustacheFactory;
10 | import com.github.mustachejava.Mustache;
11 | import com.github.mustachejava.MustacheFactory;
12 | import com.google.common.base.Charsets;
13 | import com.google.common.base.Optional;
14 | import java.io.BufferedReader;
15 | import java.io.IOException;
16 | import java.io.InputStreamReader;
17 | import java.io.StringWriter;
18 | import java.net.URL;
19 | import java.util.Map;
20 |
21 | /**
22 | * Used to represent the index page loaded from the classpath.
23 | */
24 | public final class ClasspathIndexPage implements IndexPage {
25 |
26 | private final Optional content;
27 |
28 | public ClasspathIndexPage(Map templatedContext, URL resource) {
29 | checkNotNull(templatedContext);
30 | checkNotNull(resource);
31 |
32 | content = loadResource(templatedContext, resource);
33 | }
34 |
35 | @Override
36 | public Optional getContent() {
37 | return content;
38 | }
39 |
40 | private static Optional loadResource(Map templateContext, URL resource) {
41 | BufferedReader reader;
42 | try {
43 | reader = new BufferedReader(new InputStreamReader(resource.openStream(), Charsets.UTF_8));
44 | } catch (IOException e) {
45 | throw new RuntimeException("Index page cannot be found at " + resource.getPath(), e);
46 | }
47 |
48 | MustacheFactory factory = new DefaultMustacheFactory();
49 | Mustache mustacheCompiler = factory.compile(reader, IndexPageBundle.INDEX_PAGE_NAME);
50 | StringWriter writer = new StringWriter();
51 | mustacheCompiler.execute(writer, templateContext);
52 | return Optional.of(writer.toString());
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/dropwizard-index-page/src/main/java/com/palantir/indexpage/FileSystemIndexPage.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2016 Palantir Technologies, Inc. All rights reserved.
3 | */
4 |
5 | package com.palantir.indexpage;
6 |
7 | import static com.google.common.base.Preconditions.checkNotNull;
8 |
9 | import com.github.mustachejava.DefaultMustacheFactory;
10 | import com.github.mustachejava.Mustache;
11 | import com.google.common.base.Charsets;
12 | import com.google.common.base.Optional;
13 | import com.google.common.collect.ImmutableMap;
14 | import com.google.common.io.Files;
15 | import java.io.File;
16 | import java.io.FileNotFoundException;
17 | import java.io.IOException;
18 | import java.io.Reader;
19 | import java.io.StringWriter;
20 | import java.util.Map;
21 | import org.slf4j.Logger;
22 | import org.slf4j.LoggerFactory;
23 |
24 | /**
25 | * Used to represent the index page loaded from the file system.
26 | */
27 | public final class FileSystemIndexPage implements IndexPage {
28 | private static final Logger log = LoggerFactory.getLogger(FileSystemIndexPage.class);
29 |
30 | private final Map context;
31 | private final DefaultMustacheFactory factory;
32 | private final File file;
33 |
34 | private Optional state = Optional.absent();
35 |
36 | public FileSystemIndexPage(Map context, File file) {
37 | checkNotNull(context, "context");
38 | checkNotNull(file, "file");
39 |
40 | this.context = ImmutableMap.copyOf(context);
41 | this.factory = new DefaultMustacheFactory();
42 | this.file = file;
43 |
44 | try {
45 | refresh();
46 | } catch (Exception e) {
47 | log.error("Failed to preload index page {}", file, e);
48 | }
49 | }
50 |
51 | @Override
52 | public Optional getContent() {
53 | refresh();
54 | return state.transform(input -> input.content);
55 | }
56 |
57 | private synchronized void refresh() {
58 | if (!state.isPresent() || state.get().lastModified != file.lastModified()) {
59 | log.debug("Reloading index page {}", file.lastModified());
60 | state = loadFile();
61 | }
62 | }
63 |
64 | private Optional loadFile() {
65 | // Guarantee that the modification time did not change between start and end of compilation
66 | for (;;) {
67 | long preLastModified = file.lastModified();
68 | Optional optContent = compileContent();
69 | if (preLastModified == file.lastModified()) {
70 | return optContent.transform(content -> new IndexPageState(content, preLastModified));
71 | }
72 | }
73 | }
74 |
75 | private Optional compileContent() {
76 | StringWriter writer = new StringWriter();
77 |
78 | try (Reader reader = Files.newReader(file, Charsets.UTF_8)) {
79 | Mustache mustacheCompiler = factory.compile(reader, IndexPageBundle.INDEX_PAGE_NAME);
80 | mustacheCompiler.execute(writer, context);
81 | } catch (FileNotFoundException e) {
82 | // the file could be deleted during run time, so return absent in order to handle the behavior gracefully
83 | log.warn("Index page {} does not exist, deferring load", file);
84 | log.debug("Index page {} does not exist, deferring load", file, e);
85 | return Optional.absent();
86 | } catch (IOException e) {
87 | throw new RuntimeException("Failed to load index page " + file, e);
88 | }
89 |
90 | return Optional.of(writer.toString());
91 | }
92 |
93 |
94 | private static final class IndexPageState {
95 | private final String content;
96 | private final long lastModified;
97 |
98 | private IndexPageState(String content, long lastModified) {
99 | this.content = content;
100 | this.lastModified = lastModified;
101 | }
102 | }
103 | }
104 |
--------------------------------------------------------------------------------
/dropwizard-index-page/src/main/java/com/palantir/indexpage/IndexPage.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2016 Palantir Technologies, Inc. All rights reserved.
3 | */
4 |
5 | package com.palantir.indexpage;
6 |
7 | import com.google.common.base.Optional;
8 |
9 | /**
10 | * Simple interface used by both {@link ClasspathIndexPage} and {@link FileSystemIndexPage} to return the index page
11 | * asset.
12 | */
13 | public interface IndexPage {
14 |
15 | Optional getContent();
16 | }
17 |
--------------------------------------------------------------------------------
/dropwizard-index-page/src/main/java/com/palantir/indexpage/IndexPageBundle.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2016 Palantir Technologies, Inc. All rights reserved.
3 | */
4 |
5 | package com.palantir.indexpage;
6 |
7 | import static com.google.common.base.Preconditions.checkArgument;
8 | import static com.google.common.base.Preconditions.checkNotNull;
9 |
10 | import com.google.common.base.Strings;
11 | import com.google.common.collect.ImmutableSet;
12 | import io.dropwizard.ConfiguredBundle;
13 | import io.dropwizard.setup.Bootstrap;
14 | import io.dropwizard.setup.Environment;
15 | import java.util.Set;
16 |
17 | /**
18 | * Applies {@link IndexPageServlet} to the application.
19 | */
20 | public final class IndexPageBundle implements ConfiguredBundle {
21 |
22 | public static final String INDEX_PAGE_NAME = "index.html";
23 |
24 | private static final Set DEFAULT_MAPPING = ImmutableSet.of("");
25 | private static final String DEFAULT_PATH = "service/web/index.html";
26 |
27 | private final String indexPagePath;
28 | private final ImmutableSet mappings;
29 |
30 | /**
31 | * Creates a new {@link IndexPageBundle} which serves up the index page from either the file system or the class
32 | * path using {@code ./service/web/index.html} as the default path.
33 | *
34 | * @param mappings
35 | * the mappings for the {@link IndexPageServlet} which serves up the index page
36 | */
37 | public IndexPageBundle(Set mappings) {
38 | this(DEFAULT_PATH, mappings);
39 | }
40 |
41 | /**
42 | * Creates a new {@link IndexPageBundle} which serves up the index page from either the file system or the class
43 | * path specified by the {@code indexPagePath}.
44 | *
45 | * @param indexPagePath
46 | * the path of the index page
47 | * @param mappings
48 | * the mappings for the {@link IndexPageServlet} which serves up the index page
49 | */
50 | public IndexPageBundle(String indexPagePath, Set mappings) {
51 | checkArgument(!Strings.isNullOrEmpty(indexPagePath));
52 | checkNotNull(mappings);
53 |
54 | this.indexPagePath = indexPagePath;
55 | this.mappings = ImmutableSet.builder().addAll(DEFAULT_MAPPING).addAll(mappings).build();
56 | }
57 |
58 | @Override
59 | public void initialize(Bootstrap> bootstrap) {
60 | // intentionally left blank
61 | }
62 |
63 | @Override
64 | public void run(IndexPageConfigurable configuration, Environment environment) throws Exception {
65 | checkNotNull(configuration);
66 | checkNotNull(environment);
67 |
68 | String overriddenPath = indexPagePath;
69 | String maybeIndexPagePath = configuration.getIndexPagePath();
70 | if (!Strings.isNullOrEmpty(maybeIndexPagePath)) {
71 | overriddenPath = maybeIndexPagePath;
72 | }
73 |
74 | addIndexPageServlet(configuration, environment, overriddenPath, mappings);
75 | }
76 |
77 | private static void addIndexPageServlet(
78 | IndexPageConfigurable configuration, Environment environment, String indexPagePath, Set mappings) {
79 | String contextPath = environment.getApplicationContext().getContextPath();
80 | environment.servlets()
81 | .addServlet(INDEX_PAGE_NAME, new IndexPageServlet(contextPath, indexPagePath))
82 | .addMapping(mappings.toArray(new String[mappings.size()]));
83 | }
84 | }
85 |
--------------------------------------------------------------------------------
/dropwizard-index-page/src/main/java/com/palantir/indexpage/IndexPageConfigurable.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2016 Palantir Technologies, Inc. All rights reserved.
3 | */
4 |
5 | package com.palantir.indexpage;
6 |
7 |
8 | /**
9 | * Used by the application's {@link io.dropwizard.Configuration} to specify the index page path.
10 | */
11 | public interface IndexPageConfigurable {
12 |
13 | String getIndexPagePath();
14 | }
15 |
--------------------------------------------------------------------------------
/dropwizard-index-page/src/main/java/com/palantir/indexpage/IndexPageServlet.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2016 Palantir Technologies, Inc. All rights reserved.
3 | */
4 |
5 | package com.palantir.indexpage;
6 |
7 | import static com.google.common.base.Preconditions.checkArgument;
8 |
9 | import com.google.common.base.Optional;
10 | import com.google.common.base.Strings;
11 | import com.google.common.collect.ImmutableMap;
12 | import com.google.common.net.HttpHeaders;
13 | import com.google.common.net.MediaType;
14 | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
15 | import java.io.File;
16 | import java.io.IOException;
17 | import java.io.PrintWriter;
18 | import java.net.URL;
19 | import javax.servlet.ServletException;
20 | import javax.servlet.http.HttpServletRequest;
21 | import javax.servlet.http.HttpServletResponse;
22 | import org.eclipse.jetty.http.HttpStatus;
23 | import org.eclipse.jetty.servlet.DefaultServlet;
24 |
25 | /**
26 | * Used to serve the index page and set disable cache headers in the HTTP response.
27 | */
28 | public final class IndexPageServlet extends DefaultServlet {
29 |
30 | public static final String BASE_URL = "baseUrl";
31 |
32 | private static final long serialVersionUID = 1L;
33 | private static final String CACHE_CONTROL = "no-cache, no-store, max-age=0, must-revalidate";
34 |
35 | @SuppressFBWarnings("SE_BAD_FIELD")
36 | private final IndexPage indexPage;
37 |
38 | /**
39 | * Creates a new servlet that will try to serve the index page from the local file path. If the page doesn't exist
40 | * on the disk, the servlet will try to load it from the classpath.
41 | *
42 | * @param contextPath the context path used as the base url for the index page
43 | * @param indexPagePath
44 | * the path to the index path and it can either be the classpath or the local file path
45 | * @throws IllegalArgumentException if the index page is not found
46 | */
47 | public IndexPageServlet(String contextPath, String indexPagePath) {
48 | checkArgument(contextPath != null);
49 | checkArgument(!Strings.isNullOrEmpty(indexPagePath));
50 |
51 | String slashedContextPath = contextPath;
52 | if (!contextPath.endsWith("/")) {
53 | slashedContextPath += "/";
54 | }
55 |
56 | ImmutableMap templateContext = ImmutableMap.of(BASE_URL, slashedContextPath);
57 | File indexPageFile = new File(indexPagePath);
58 | if (!indexPageFile.isFile()) {
59 | indexPage = new ClasspathIndexPage(templateContext, getResourcePath(indexPagePath));
60 | } else {
61 | indexPage = new FileSystemIndexPage(templateContext, indexPageFile);
62 | }
63 | }
64 |
65 | @Override
66 | protected void doGet(HttpServletRequest request, HttpServletResponse response)
67 | throws ServletException, IOException {
68 |
69 | Optional maybeContent = indexPage.getContent();
70 | if (!maybeContent.isPresent()) {
71 | response.sendError(HttpStatus.NOT_FOUND_404, "Index page file not found.");
72 | return;
73 | }
74 |
75 | response.setHeader(HttpHeaders.CACHE_CONTROL, CACHE_CONTROL);
76 | response.setHeader(HttpHeaders.CONTENT_TYPE, MediaType.HTML_UTF_8.toString());
77 | try (PrintWriter writer = response.getWriter()) {
78 | writer.write(maybeContent.get());
79 | }
80 | }
81 |
82 | private static URL getResourcePath(String resourcePath) {
83 | ClassLoader loader = Thread.currentThread().getContextClassLoader();
84 | if (loader == null) {
85 | loader = IndexPageServlet.class.getClassLoader();
86 | }
87 | return loader.getResource(resourcePath);
88 | }
89 | }
90 |
--------------------------------------------------------------------------------
/dropwizard-index-page/src/test/java/com/palantir/indexpage/ClassPathIndexPageTests.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2016 Palantir Technologies, Inc. All rights reserved.
3 | */
4 |
5 | package com.palantir.indexpage;
6 |
7 | import static org.junit.Assert.assertEquals;
8 | import static org.junit.Assert.fail;
9 |
10 | import com.google.common.base.Optional;
11 | import com.google.common.collect.ImmutableMap;
12 | import com.google.common.io.Resources;
13 | import java.net.MalformedURLException;
14 | import java.net.URL;
15 | import org.junit.Test;
16 |
17 | /**
18 | * Tests for {@link ClasspathIndexPage}.
19 | */
20 | public final class ClassPathIndexPageTests {
21 |
22 | private static final ImmutableMap CONTEXT = ImmutableMap.of(IndexPageServlet.BASE_URL, "/test/");
23 |
24 | @Test(expected = NullPointerException.class)
25 | public void testCreateClasspathAssetWithInvalidContext() {
26 | new ClasspathIndexPage(null, Resources.getResource("service/web/index.html"));
27 | }
28 |
29 |
30 | @Test(expected = NullPointerException.class)
31 | public void testCreateClasspathAssetWithInvalidResource() {
32 | new ClasspathIndexPage(CONTEXT, null);
33 | }
34 |
35 | @Test
36 | public void testLoadResource() {
37 | ClasspathIndexPage indexPage = new ClasspathIndexPage(CONTEXT, Resources.getResource("service/web/index.html"));
38 | Optional maybeContent1 = indexPage.getContent();
39 | Optional maybeContent2 = indexPage.getContent();
40 |
41 | assertEquals(maybeContent1.get(), maybeContent2.get());
42 | }
43 |
44 | @Test
45 | public void testLoadResourceWithWrongPath() throws MalformedURLException {
46 | String wrongPath = Resources.getResource("service/web/index.html").toString().replace("index.html", "abc.html");
47 | URL url = new URL(wrongPath);
48 |
49 | try {
50 | new ClasspathIndexPage(CONTEXT, url);
51 | fail();
52 | } catch (RuntimeException e) {
53 | assertEquals("Index page cannot be found at " + url.getPath(), e.getMessage());
54 | }
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/dropwizard-index-page/src/test/java/com/palantir/indexpage/FileSystemIndexPageTests.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2016 Palantir Technologies, Inc. All rights reserved.
3 | */
4 |
5 | package com.palantir.indexpage;
6 |
7 | import static org.junit.Assert.assertEquals;
8 | import static org.junit.Assert.assertFalse;
9 | import static org.junit.Assert.assertNotEquals;
10 | import static org.junit.Assert.assertTrue;
11 |
12 | import com.github.mustachejava.MustacheException;
13 | import com.google.common.collect.ImmutableMap;
14 | import java.io.IOException;
15 | import java.util.Map;
16 | import org.junit.Rule;
17 | import org.junit.Test;
18 | import org.junit.rules.ExpectedException;
19 |
20 | /**
21 | * Tests for {@link FileSystemIndexPage}.
22 | */
23 | public final class FileSystemIndexPageTests {
24 |
25 | private static final Map CONTEXT = ImmutableMap.of(IndexPageServlet.BASE_URL, "/example/");
26 |
27 | @Rule
28 | public final TemporaryFile indexFile = new TemporaryFile()
29 | .suffix(".html")
30 | .initialize(file -> IndexPageResources.update(file, IndexPageResources.INDEX_PAGE));
31 |
32 | @Rule
33 | public final ExpectedException thrown = ExpectedException.none();
34 |
35 | @Test
36 | public void testCreateFileSystemAsset() {
37 | thrown.expect(NullPointerException.class);
38 | thrown.expectMessage("file");
39 | new FileSystemIndexPage(CONTEXT, null);
40 | }
41 |
42 | @Test
43 | public void testCreateFileSystemWithInvalidFile() throws IOException {
44 | IndexPageResources.update(indexFile.get(), IndexPageResources.INDEX_PAGE_INVALID);
45 | FileSystemIndexPage page = new FileSystemIndexPage(CONTEXT, indexFile.get());
46 | thrown.expect(MustacheException.class);
47 | page.getContent();
48 | }
49 |
50 | @Test
51 | public void testCreateFileSystemWithAbsentFile() throws IOException {
52 | assertTrue(indexFile.get().delete());
53 | FileSystemIndexPage page = new FileSystemIndexPage(CONTEXT, indexFile.get());
54 | assertFalse(page.getContent().isPresent());
55 | }
56 |
57 | @Test
58 | public void testCreateFileSystemWithAbsentThenPresentFile() throws IOException {
59 | assertTrue(indexFile.get().delete());
60 | FileSystemIndexPage page = new FileSystemIndexPage(CONTEXT, indexFile.get());
61 | assertFalse(page.getContent().isPresent());
62 | IndexPageResources.update(indexFile.get(), IndexPageResources.INDEX_PAGE);
63 | assertTrue(page.getContent().isPresent());
64 | }
65 |
66 | @Test
67 | public void testFileSystemAssetWithChange() throws IOException, InterruptedException {
68 | FileSystemIndexPage indexPage = new FileSystemIndexPage(CONTEXT, indexFile.get());
69 | String content1 = indexPage.getContent().get();
70 | String content2 = indexPage.getContent().get();
71 |
72 | // template should be the same if the file is not changed
73 | assertEquals(content1, content2);
74 |
75 | // modify the file and let FileSystemAsset reload the file
76 | IndexPageResources.update(indexFile.get(), IndexPageResources.INDEX_PAGE_2);
77 |
78 | String content3 = indexPage.getContent().get();
79 | assertNotEquals(content1, content3);
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/dropwizard-index-page/src/test/java/com/palantir/indexpage/IndexPageBundleServingFromClasspathTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2016 Palantir Technologies, Inc. All rights reserved.
3 | */
4 |
5 | package com.palantir.indexpage;
6 |
7 | import static org.junit.Assert.assertEquals;
8 | import static org.junit.Assert.assertTrue;
9 |
10 | import io.dropwizard.testing.junit.DropwizardAppRule;
11 | import javax.ws.rs.client.Client;
12 | import javax.ws.rs.client.ClientBuilder;
13 | import javax.ws.rs.core.Response;
14 | import org.eclipse.jetty.http.HttpStatus;
15 | import org.junit.Rule;
16 | import org.junit.Test;
17 |
18 | /**
19 | * Using default index page path to test the {@link IndexPageBundle}.
20 | */
21 | public final class IndexPageBundleServingFromClasspathTest {
22 | @Rule
23 | public final DropwizardAppRule rule =
24 | new DropwizardAppRule(TestApp.class,
25 | TestApp.class.getClassLoader().getResource("example-default.yml").getPath());
26 |
27 | @Test
28 | public void testGetIndexPage() {
29 | // the app will not be able to find the page using the default path
30 | Client client = ClientBuilder.newClient();
31 | Response response = client.target(String.format("http://localhost:%d/example/", rule.getLocalPort()))
32 | .request()
33 | .get();
34 | assertEquals(HttpStatus.OK_200, response.getStatus());
35 | assertTrue(response.readEntity(String.class).contains(" "));
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/dropwizard-index-page/src/test/java/com/palantir/indexpage/IndexPageBundleServingFromFileSystemTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2016 Palantir Technologies, Inc. All rights reserved.
3 | */
4 |
5 | package com.palantir.indexpage;
6 |
7 | import static org.junit.Assert.assertEquals;
8 | import static org.junit.Assert.assertTrue;
9 |
10 | import io.dropwizard.testing.ConfigOverride;
11 | import io.dropwizard.testing.junit.DropwizardAppRule;
12 | import java.io.IOException;
13 | import javax.ws.rs.client.Client;
14 | import javax.ws.rs.client.ClientBuilder;
15 | import javax.ws.rs.core.Response;
16 | import org.eclipse.jetty.http.HttpStatus;
17 | import org.junit.Rule;
18 | import org.junit.Test;
19 | import org.junit.rules.RuleChain;
20 |
21 | /**
22 | * Used to test reloading of the index page from file system when the page gets modified.
23 | */
24 | public final class IndexPageBundleServingFromFileSystemTest {
25 |
26 | private final TemporaryFile indexFile = new TemporaryFile()
27 | .suffix(".html")
28 | .initialize(file -> IndexPageResources.update(file, IndexPageResources.INDEX_PAGE));
29 |
30 | private final DropwizardAppRule rule =
31 | new DropwizardAppRule<>(TestApp.class,
32 | this.getClass().getResource("/example-default.yml").getPath(),
33 | ConfigOverride.config("indexPagePath",
34 | () -> indexFile.get().getAbsolutePath()));
35 |
36 | @Rule
37 | public final RuleChain rules = RuleChain.outerRule(indexFile)
38 | .around(rule);
39 |
40 | @Test
41 | public void testGetIndexPageWithDynamicContent() throws IOException {
42 | Client client = ClientBuilder.newClient();
43 | Response response = client.target(String.format("http://localhost:%d/example/", rule.getLocalPort()))
44 | .request()
45 | .get();
46 | assertEquals(HttpStatus.OK_200, response.getStatus());
47 | String responseContent = response.readEntity(String.class);
48 | assertTrue(responseContent.contains("Hello World!"));
49 | assertTrue(responseContent.contains(" "));
50 |
51 |
52 | // modify the file and let the bundle reload it
53 | IndexPageResources.update(indexFile.get(), IndexPageResources.INDEX_PAGE_2);
54 |
55 | response = client.target(String.format("http://localhost:%d/example/", rule.getLocalPort()))
56 | .request()
57 | .get();
58 | assertTrue(response.readEntity(String.class).contains("Cruel World!"));
59 |
60 | // delete the file and check if the servlet returns proper response
61 | assertTrue(indexFile.get().delete());
62 | response = client.target(String.format("http://localhost:%d/example/", rule.getLocalPort()))
63 | .request()
64 | .get();
65 | assertEquals(HttpStatus.NOT_FOUND_404, response.getStatus());
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/dropwizard-index-page/src/test/java/com/palantir/indexpage/IndexPageBundleTests.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2016 Palantir Technologies, Inc. All rights reserved.
3 | */
4 |
5 | package com.palantir.indexpage;
6 |
7 | import static org.junit.Assert.assertEquals;
8 | import static org.junit.Assert.assertTrue;
9 | import static org.mockito.Mockito.mock;
10 |
11 | import com.google.common.collect.ImmutableSet;
12 | import io.dropwizard.setup.Environment;
13 | import io.dropwizard.testing.junit.DropwizardAppRule;
14 | import javax.ws.rs.client.Client;
15 | import javax.ws.rs.client.ClientBuilder;
16 | import javax.ws.rs.core.Response;
17 | import org.eclipse.jetty.http.HttpStatus;
18 | import org.junit.Rule;
19 | import org.junit.Test;
20 |
21 | /**
22 | * Tests using configured path for {@link IndexPageBundle}.
23 | */
24 | public final class IndexPageBundleTests {
25 |
26 | @Rule
27 | public final DropwizardAppRule rule =
28 | new DropwizardAppRule(TestApp.class,
29 | TestApp.class.getClassLoader().getResource("example.yml").getPath());
30 |
31 | @Test(expected = NullPointerException.class)
32 | public void testNewWithInvalidMappings() {
33 | new IndexPageBundle(null);
34 | }
35 |
36 | @Test(expected = IllegalArgumentException.class)
37 | public void testNewWithEmptyPath() {
38 | new IndexPageBundle("", ImmutableSet.of());
39 | }
40 |
41 | @Test(expected = IllegalArgumentException.class)
42 | public void testNewWithNullPath() {
43 | new IndexPageBundle(null, ImmutableSet.of());
44 | }
45 |
46 | @Test(expected = NullPointerException.class)
47 | public void testRunWithInvalidEnvironment() throws Exception {
48 | IndexPageBundle bundle = new IndexPageBundle(ImmutableSet.of("/views/*"));
49 | bundle.run(mock(IndexPageConfigurable.class), null);
50 | }
51 |
52 | @Test(expected = NullPointerException.class)
53 | public void testRunWithInvalidConfiguration() throws Exception {
54 | IndexPageBundle bundle = new IndexPageBundle(ImmutableSet.of("/views/*"));
55 | bundle.run(null, mock(Environment.class));
56 | }
57 |
58 | @Test
59 | public void testGetIndexPage() {
60 | Client client = ClientBuilder.newClient();
61 | Response response = client.target(String.format("http://localhost:%d/", rule.getLocalPort()))
62 | .request()
63 | .get();
64 | assertEquals(HttpStatus.OK_200, response.getStatus());
65 | assertTrue(response.readEntity(String.class).contains(" "));
66 | }
67 |
68 | @Test
69 | public void testGetIndexPageWithHome() {
70 | Client client = ClientBuilder.newClient();
71 | Response response = client.target(String.format("http://localhost:%d/home", rule.getLocalPort()))
72 | .request()
73 | .get();
74 | assertEquals(HttpStatus.OK_200, response.getStatus());
75 | }
76 |
77 | @Test
78 | public void testGetIndexPageWithWrongPath() {
79 | Client client = ClientBuilder.newClient();
80 | Response response = client.target(String.format("http://localhost:%d/wrongpath", rule.getLocalPort()))
81 | .request()
82 | .get();
83 | assertEquals(HttpStatus.NOT_FOUND_404, response.getStatus());
84 | }
85 | }
86 |
--------------------------------------------------------------------------------
/dropwizard-index-page/src/test/java/com/palantir/indexpage/IndexPageResources.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 Palantir Technologies, Inc. All rights reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.palantir.indexpage;
18 |
19 | import static org.junit.Assert.assertTrue;
20 |
21 | import com.google.common.io.ByteStreams;
22 | import com.google.common.io.Resources;
23 | import java.io.File;
24 | import java.io.IOException;
25 | import java.io.InputStream;
26 | import java.io.OutputStream;
27 | import java.net.URL;
28 | import java.nio.file.Files;
29 |
30 | public final class IndexPageResources {
31 |
32 | public static final URL INDEX_PAGE = Resources.getResource("service/web/index.html");
33 | public static final URL INDEX_PAGE_2 = Resources.getResource("service/web/index2.html");
34 | public static final URL INDEX_PAGE_INVALID = Resources.getResource("service/web/indexInvalid.html");
35 |
36 | // Java only guarantees 1 second modification time precision
37 | private static final long MINIMUM_MODIFY_TIME_INCREMENT = 1000L;
38 |
39 | private IndexPageResources() {
40 | // utils
41 | }
42 |
43 | public static void update(File file, URL resource) throws IOException {
44 | long originalLastModified = file.lastModified();
45 | try (InputStream input = resource.openStream();
46 | OutputStream output = Files.newOutputStream(file.toPath())) {
47 | ByteStreams.copy(input, output);
48 | }
49 | // Kludge: Unit tests are too fast, and modification time precision may not reflect change.
50 | // Force modification time to update at least as much as minimum precision specifies.
51 | if (originalLastModified != 0L) {
52 | long minimumNewModifiedTime = originalLastModified + MINIMUM_MODIFY_TIME_INCREMENT;
53 | if (file.lastModified() < minimumNewModifiedTime) {
54 | assertTrue(file.setLastModified(minimumNewModifiedTime));
55 | }
56 | }
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/dropwizard-index-page/src/test/java/com/palantir/indexpage/IndexPageServletTests.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2016 Palantir Technologies, Inc. All rights reserved.
3 | */
4 |
5 | package com.palantir.indexpage;
6 |
7 | import static org.junit.Assert.assertTrue;
8 | import static org.mockito.Matchers.any;
9 | import static org.mockito.Matchers.eq;
10 | import static org.mockito.Mockito.mock;
11 | import static org.mockito.Mockito.when;
12 |
13 | import com.google.common.base.Charsets;
14 | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
15 | import java.io.ByteArrayOutputStream;
16 | import java.io.IOException;
17 | import java.io.PrintWriter;
18 | import javax.servlet.RequestDispatcher;
19 | import javax.servlet.ServletConfig;
20 | import javax.servlet.ServletException;
21 | import javax.servlet.http.HttpServletRequest;
22 | import javax.servlet.http.HttpServletResponse;
23 | import org.eclipse.jetty.server.Handler;
24 | import org.eclipse.jetty.server.handler.ContextHandler;
25 | import org.eclipse.jetty.servlet.ServletHandler;
26 | import org.eclipse.jetty.servlet.ServletHolder;
27 | import org.junit.Before;
28 | import org.junit.Test;
29 |
30 | /**
31 | * Tests for {@link IndexPageServlet}.
32 | */
33 | @SuppressWarnings("unchecked")
34 | public final class IndexPageServletTests {
35 |
36 | private final ServletConfig mockConfig = mock(ServletConfig.class);
37 | private final HttpServletResponse mockResponse = mock(HttpServletResponse.class);
38 | private final HttpServletRequest mockRequest = mock(HttpServletRequest.class);
39 | private final RequestDispatcher mockRequestDispatcher = mock(RequestDispatcher.class);
40 |
41 | @Before
42 |
43 | public void setUp() throws ServletException {
44 | ContextHandler.Context mockContext = mock(ContextHandler.Context.class);
45 | ContextHandler mockContextHandler = mock(ContextHandler.class);
46 | ServletHandler mockServletHandler = mock(ServletHandler.class);
47 |
48 | when(mockConfig.getServletContext()).thenReturn(mockContext);
49 | when(mockContext.getContextHandler()).thenReturn(mockContextHandler);
50 | when(mockContext.getRequestDispatcher(eq("/"))).thenReturn(mockRequestDispatcher);
51 | when(mockContextHandler.getChildHandlerByClass((Class) any(Class.class)))
52 | .thenReturn(mockServletHandler);
53 | when(mockServletHandler.getServlets()).thenReturn(new ServletHolder[0]);
54 | }
55 |
56 | @Test(expected = IllegalArgumentException.class)
57 | public void testNewWithEmptyContextPath() {
58 | new IndexPageServlet(null, "");
59 | }
60 |
61 | @Test(expected = IllegalArgumentException.class)
62 | public void testNewWithEmptyIndexPagePath() {
63 | new IndexPageServlet("", "");
64 | }
65 |
66 | @SuppressFBWarnings("NP_NULL_PARAM_DEREF_NONVIRTUAL")
67 | @Test(expected = IllegalArgumentException.class)
68 | public void testNewWithNullIndexPagePath() {
69 | new IndexPageServlet("", null);
70 | }
71 |
72 | @Test
73 | @SuppressFBWarnings("DM_DEFAULT_ENCODING")
74 | public void testDoGetUsingPath() throws IOException, ServletException {
75 | String indexPagePath =
76 | IndexPageServletTests.class.getClassLoader().getResource("service/web/index.html").getPath();
77 | IndexPageServlet servlet = new IndexPageServlet("/testBaseUrl", indexPagePath);
78 | ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
79 | PrintWriter writer = new PrintWriter(outputStream);
80 |
81 | when(mockResponse.getWriter()).thenReturn(writer);
82 | servlet.init(mockConfig);
83 | servlet.doGet(mockRequest, mockResponse);
84 |
85 | String templatedPage = outputStream.toString(Charsets.UTF_8.name());
86 | assertTrue(templatedPage.contains(" "));
87 | }
88 | }
89 |
--------------------------------------------------------------------------------
/dropwizard-index-page/src/test/java/com/palantir/indexpage/TemporaryFile.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 Palantir Technologies, Inc. All rights reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.palantir.indexpage;
18 |
19 | import static com.google.common.base.Preconditions.checkNotNull;
20 |
21 | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
22 | import java.io.File;
23 | import java.io.IOException;
24 | import java.util.function.Supplier;
25 | import org.junit.rules.ExternalResource;
26 |
27 | public final class TemporaryFile extends ExternalResource implements Supplier {
28 | private String prefix = "junit";
29 | private String suffix = "";
30 | private Initializer initializer = dummy -> {};
31 |
32 | private File file;
33 |
34 | public TemporaryFile prefix(String prefixParam) {
35 | this.prefix = prefixParam;
36 | return this;
37 | }
38 |
39 | public TemporaryFile suffix(String suffixParam) {
40 | this.suffix = suffixParam;
41 | return this;
42 | }
43 |
44 | public TemporaryFile initialize(Initializer initializerParam) {
45 | this.initializer = initializerParam;
46 | return this;
47 | }
48 |
49 | @Override
50 | public File get() {
51 | return checkNotNull(file, "Cannot retrieve temp file before initialization");
52 | }
53 |
54 | @Override
55 | protected void before() throws Throwable {
56 | file = File.createTempFile(prefix, suffix);
57 | initializer.initialize(file);
58 | }
59 |
60 | @SuppressFBWarnings("RV_RETURN_VALUE_IGNORED_BAD_PRACTICE")
61 | @Override
62 | protected void after() {
63 | file.delete();
64 | file = null;
65 | }
66 |
67 | @FunctionalInterface
68 | public interface Initializer {
69 | void initialize(File file) throws IOException;
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/dropwizard-index-page/src/test/java/com/palantir/indexpage/TestApp.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2016 Palantir Technologies, Inc. All rights reserved.
3 | */
4 |
5 | package com.palantir.indexpage;
6 |
7 | import com.fasterxml.jackson.annotation.JsonCreator;
8 | import com.fasterxml.jackson.annotation.JsonProperty;
9 | import com.google.common.base.Optional;
10 | import com.google.common.collect.ImmutableSet;
11 | import com.palantir.indexpage.TestApp.TestConfiguration;
12 | import io.dropwizard.Application;
13 | import io.dropwizard.Configuration;
14 | import io.dropwizard.setup.Bootstrap;
15 | import io.dropwizard.setup.Environment;
16 |
17 | /**
18 | * Test app for {@link IndexPageBundle}.
19 | */
20 | public final class TestApp extends Application {
21 |
22 | @Override
23 | public void initialize(Bootstrap bootstrap) {
24 | bootstrap.addBundle(new IndexPageBundle(ImmutableSet.of("/home")));
25 | }
26 |
27 | @Override
28 | public void run(TestConfiguration configuration, Environment environment) throws Exception {
29 | // intentionally left blank
30 | }
31 |
32 | public static final class TestConfiguration extends Configuration implements IndexPageConfigurable {
33 |
34 | private final String indexPagePath;
35 |
36 | @JsonCreator
37 | public TestConfiguration(@JsonProperty("indexPagePath") Optional indexPagePath) {
38 | this.indexPagePath = indexPagePath.or("./service/web/index.html");
39 | }
40 |
41 | @Override
42 | public String getIndexPagePath() {
43 | return this.indexPagePath;
44 | }
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/dropwizard-index-page/src/test/resources/example-default.yml:
--------------------------------------------------------------------------------
1 | server:
2 | applicationContextPath: /example
3 | rootPath: /api/*
4 |
5 | applicationConnectors:
6 | - type: http
7 | port: 0
8 |
--------------------------------------------------------------------------------
/dropwizard-index-page/src/test/resources/example.yml:
--------------------------------------------------------------------------------
1 | indexPagePath: src/test/resources/service/web/index.html
2 |
3 | server:
4 | rootPath: /api/*
5 |
6 | applicationConnectors:
7 | - type: http
8 | port: 0
9 |
--------------------------------------------------------------------------------
/dropwizard-index-page/src/test/resources/service/web/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Index Page Test Example
6 |
7 |
8 |
9 | Hello World!
10 |
11 |
12 |
--------------------------------------------------------------------------------
/dropwizard-index-page/src/test/resources/service/web/index2.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Index Page Test Example 2
6 |
7 |
8 |
9 | Cruel World!
10 |
11 |
12 |
--------------------------------------------------------------------------------
/dropwizard-index-page/src/test/resources/service/web/indexInvalid.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Index Page Test Invalid
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # buildscript
2 | baselineVersion=0.14.0
3 | bintrayVersion=1.4
4 |
5 | # compile
6 | dropwizardVersion=1.0.5
7 | mustacheVersion=0.9.1
8 |
9 | # testCompile
10 | annotationVersion=3.0.1
11 | hamcrestVersion=1.3
12 | junitVersion=4.12
13 | mockitoVersion=1.10.19
14 |
15 |
--------------------------------------------------------------------------------
/gradle/jacoco.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: "jacoco"
2 |
3 | jacocoTestReport {
4 | dependsOn test
5 | reports {
6 | xml.enabled true
7 | csv.enabled false
8 | html.destination "${buildDir}/reports/jacoco/"
9 | }
10 | }
11 |
12 | project.ext.whitelistedInstructionClasses = []
13 | project.ext.whitelistedBranchClasses = []
14 |
15 | afterEvaluate {
16 | jacocoTestCoverageVerification {
17 | violationRules {
18 | rule {
19 | element = 'CLASS'
20 | excludes = project.whitelistedInstructionClasses
21 | limit {
22 | counter = 'INSTRUCTION'
23 | minimum = 0.60
24 | }
25 | }
26 |
27 | rule {
28 | element = 'CLASS'
29 | excludes = project.whitelistedBranchClasses
30 | limit {
31 | counter = 'BRANCH'
32 | minimum = 0.60
33 | }
34 | }
35 | }
36 | }
37 |
38 | jacocoTestCoverageVerification.dependsOn jacocoTestReport
39 | check.dependsOn jacocoTestCoverageVerification
40 | }
41 |
--------------------------------------------------------------------------------
/gradle/publish.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'maven-publish'
2 | apply plugin: 'com.jfrog.bintray'
3 |
4 | task sourceJar(type: Jar) {
5 | from sourceSets.main.allSource
6 | classifier 'sources'
7 | }
8 |
9 | task javadocJar(type: Jar, dependsOn: javadoc) {
10 | classifier = 'javadoc'
11 | from javadoc.destinationDir
12 | destinationDir rootProject.file("${buildDir}/libs")
13 | }
14 |
15 | tasks.build.dependsOn sourceJar, javadocJar
16 |
17 | publishing {
18 | publications {
19 | bintray(MavenPublication) {
20 | from components.java
21 | artifact(sourceJar)
22 | artifact(javadocJar)
23 | version project.version.replaceAll(/-.*/, '-SNAPSHOT')
24 | }
25 | }
26 | }
27 |
28 | bintray {
29 | user = System.env.BINTRAY_USER
30 | key = System.env.BINTRAY_KEY
31 | publish = true
32 | pkg {
33 | repo = 'releases'
34 | name = 'dropwizard-index-page'
35 | userOrg = 'palantir'
36 | licenses = ['Apache-2.0']
37 | vcsUrl = 'https://github.com/palantir/dropwizard-index-page.git'
38 | publications = ['bintray']
39 | }
40 | }
41 |
42 | bintrayUpload.onlyIf {
43 | System.env.BINTRAY_USER && System.env.BINTRAY_KEY && project.version ==~ /\d+\.\d+\.\d+/
44 | }
45 |
46 | bintrayUpload.dependsOn 'generatePomFileForBintrayPublication', 'build'
47 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/palantir/dropwizard-index-page/9aae21c19bb2f5ca743a567ff644d45fc24847dd/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Thu May 25 17:15:50 EDT 2017
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-3.5-bin.zip
7 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Attempt to set APP_HOME
10 | # Resolve links: $0 may be a link
11 | PRG="$0"
12 | # Need this for relative symlinks.
13 | while [ -h "$PRG" ] ; do
14 | ls=`ls -ld "$PRG"`
15 | link=`expr "$ls" : '.*-> \(.*\)$'`
16 | if expr "$link" : '/.*' > /dev/null; then
17 | PRG="$link"
18 | else
19 | PRG=`dirname "$PRG"`"/$link"
20 | fi
21 | done
22 | SAVED="`pwd`"
23 | cd "`dirname \"$PRG\"`/" >/dev/null
24 | APP_HOME="`pwd -P`"
25 | cd "$SAVED" >/dev/null
26 |
27 | APP_NAME="Gradle"
28 | APP_BASE_NAME=`basename "$0"`
29 |
30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
31 | DEFAULT_JVM_OPTS=""
32 |
33 | # Use the maximum available, or set MAX_FD != -1 to use that value.
34 | MAX_FD="maximum"
35 |
36 | warn ( ) {
37 | echo "$*"
38 | }
39 |
40 | die ( ) {
41 | echo
42 | echo "$*"
43 | echo
44 | exit 1
45 | }
46 |
47 | # OS specific support (must be 'true' or 'false').
48 | cygwin=false
49 | msys=false
50 | darwin=false
51 | nonstop=false
52 | case "`uname`" in
53 | CYGWIN* )
54 | cygwin=true
55 | ;;
56 | Darwin* )
57 | darwin=true
58 | ;;
59 | MINGW* )
60 | msys=true
61 | ;;
62 | NONSTOP* )
63 | nonstop=true
64 | ;;
65 | esac
66 |
67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
68 |
69 | # Determine the Java command to use to start the JVM.
70 | if [ -n "$JAVA_HOME" ] ; then
71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
72 | # IBM's JDK on AIX uses strange locations for the executables
73 | JAVACMD="$JAVA_HOME/jre/sh/java"
74 | else
75 | JAVACMD="$JAVA_HOME/bin/java"
76 | fi
77 | if [ ! -x "$JAVACMD" ] ; then
78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
79 |
80 | Please set the JAVA_HOME variable in your environment to match the
81 | location of your Java installation."
82 | fi
83 | else
84 | JAVACMD="java"
85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
86 |
87 | Please set the JAVA_HOME variable in your environment to match the
88 | location of your Java installation."
89 | fi
90 |
91 | # Increase the maximum file descriptors if we can.
92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
93 | MAX_FD_LIMIT=`ulimit -H -n`
94 | if [ $? -eq 0 ] ; then
95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
96 | MAX_FD="$MAX_FD_LIMIT"
97 | fi
98 | ulimit -n $MAX_FD
99 | if [ $? -ne 0 ] ; then
100 | warn "Could not set maximum file descriptor limit: $MAX_FD"
101 | fi
102 | else
103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
104 | fi
105 | fi
106 |
107 | # For Darwin, add options to specify how the application appears in the dock
108 | if $darwin; then
109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
110 | fi
111 |
112 | # For Cygwin, switch paths to Windows format before running java
113 | if $cygwin ; then
114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
116 | JAVACMD=`cygpath --unix "$JAVACMD"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
158 | function splitJvmOpts() {
159 | JVM_OPTS=("$@")
160 | }
161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
163 |
164 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
165 | if [[ "$(uname)" == "Darwin" ]] && [[ "$HOME" == "$PWD" ]]; then
166 | cd "$(dirname "$0")"
167 | fi
168 |
169 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
170 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | set DIRNAME=%~dp0
12 | if "%DIRNAME%" == "" set DIRNAME=.
13 | set APP_BASE_NAME=%~n0
14 | set APP_HOME=%DIRNAME%
15 |
16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17 | set DEFAULT_JVM_OPTS=
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windows variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 |
53 | :win9xME_args
54 | @rem Slurp the command line arguments.
55 | set CMD_LINE_ARGS=
56 | set _SKIP=2
57 |
58 | :win9xME_args_slurp
59 | if "x%~1" == "x" goto execute
60 |
61 | set CMD_LINE_ARGS=%*
62 |
63 | :execute
64 | @rem Setup the command line
65 |
66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67 |
68 | @rem Execute Gradle
69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70 |
71 | :end
72 | @rem End local scope for the variables with windows NT shell
73 | if "%ERRORLEVEL%"=="0" goto mainEnd
74 |
75 | :fail
76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77 | rem the _cmd.exe /c_ return code!
78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79 | exit /b 1
80 |
81 | :mainEnd
82 | if "%OS%"=="Windows_NT" endlocal
83 |
84 | :omega
85 |
--------------------------------------------------------------------------------
/palantir_corporate_cla.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/palantir/dropwizard-index-page/9aae21c19bb2f5ca743a567ff644d45fc24847dd/palantir_corporate_cla.pdf
--------------------------------------------------------------------------------
/palantir_individual_cla.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/palantir/dropwizard-index-page/9aae21c19bb2f5ca743a567ff644d45fc24847dd/palantir_individual_cla.pdf
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include "dropwizard-index-page"
2 | include "dropwizard-index-page-example"
3 |
--------------------------------------------------------------------------------