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
#!/usr/bin/env python | |
import redis | |
from optparse import OptionParser | |
from time import sleep | |
def options(): | |
parser = OptionParser() | |
parser.add_option("--host", default="localhost") | |
parser.add_option("--port", type="int", default=6379) |
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
package com.google.sitebricks.binding; | |
import com.google.inject.Inject; | |
import com.google.inject.Provider; | |
import com.google.inject.servlet.SessionScoped; | |
import net.jcip.annotations.ThreadSafe; | |
import javax.servlet.http.HttpSession; | |
import java.io.Serializable; |
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
class CommaNegotiator implements ContentNegotiator { | |
@Inject | |
Provider<HttpServletResponse> responseProvider; | |
public boolean shouldCall(Map<String, String> negotiations, HttpServletRequest request) { | |
for (Map.Entry<String, String> negotiate : negotiations.entrySet()) { | |
@SuppressWarnings("unchecked") // Guaranteed by servlet spec. | |
Enumeration<String> headerValues = request.getHeaders(negotiate.getKey()); |