Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Adding MultiPrefer type to handle multiple Prefer headers
- Loading branch information
Showing
2 changed files
with
53 additions
and
10 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
fcrepo-http-commons/src/main/java/org/fcrepo/http/commons/domain/MultiPrefer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
|
||
package org.fcrepo.http.commons.domain; | ||
|
||
import java.text.ParseException; | ||
import java.util.Iterator; | ||
import java.util.Set; | ||
|
||
import javax.ws.rs.HeaderParam; | ||
|
||
/** | ||
* Aggregate information from multiple Prefer HTTP headers. | ||
* | ||
* @author ajs6f | ||
*/ | ||
public class MultiPrefer { | ||
|
||
Prefer kernel; | ||
|
||
public MultiPrefer(@HeaderParam("Prefer") Set<Prefer> prefers) throws ParseException { | ||
Iterator<Prefer> iprefers = prefers.iterator(); | ||
kernel = new Prefer(iprefers.next()); | ||
while (iprefers.hasNext()) { | ||
kernel = new Prefer(kernel, iprefers.next()); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters