本文整理了Java中org.eclipse.jetty.server.Request.getContext
方法的一些代码示例,展示了Request.getContext
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Request.getContext
方法的具体详情如下:
包路径:org.eclipse.jetty.server.Request
类名称:Request
方法名:getContext
暂无
代码示例来源:origin: stackoverflow.com
import java.util.Arrays;
import java.lang.reflect.Field;
import org.apache.catalina.connector.Request;
import org.apache.catalina.connector.RequestFacade;
import org.apache.catalina.core.StandardContext;
...
// ugly reflection hack - do NOT use
final RequestFacade tomcatRequestFacade = (RequestFacade) req;
final Class<? extends RequestFacade> requestFacadeClass =
tomcatRequestFacade.getClass();
try {
final Field field = requestFacadeClass.getDeclaredField("request");
field.setAccessible(true);
final Request tomcatRequest = (Request) field.get(tomcatRequestFacade);
final StandardContext standardContext =
(StandardContext) tomcatRequest.getContext();
final String[] mappings = standardContext.findMimeMappings();
logger.info("mapping list: {}", Arrays.asList(mappings));
} catch (final Exception e) {
logger.error("", e);
}
代码示例来源:origin: Nextdoor/bender
/**
* @see javax.servlet.http.HttpServletRequest#upgrade(java.lang.Class)
*/
@Override
public <T extends HttpUpgradeHandler> T upgrade(Class<T> handlerClass) throws IOException, ServletException
{
if (getContext() == null)
throw new ServletException ("Unable to instantiate "+handlerClass);
try
{
//Instantiate an instance and inject it
T h = getContext().createInstance(handlerClass);
//TODO handle the rest of the upgrade process
return h;
}
catch (Exception e)
{
if (e instanceof ServletException)
throw (ServletException)e;
throw new ServletException(e);
}
}
}
代码示例来源:origin: jenkinsci/winstone
public MultiPartsHttpParser(InputStream in, String contentType, MultipartConfigElement config, File contextTmpDir, Request request) throws IOException
{
_httpParser = new MultiPartFormInputStream(in, contentType, config, contextTmpDir);
_context = request.getContext();
_httpParser.getParts();
}
代码示例来源:origin: theonedev/onedev
@Override
public void setLocale(Locale locale)
{
if (locale == null || isCommitted() || isIncluding())
return;
_locale = locale;
_fields.put(HttpHeader.CONTENT_LANGUAGE, locale.toString().replace('_', '-'));
if (_outputType != OutputType.NONE)
return;
if (_channel.getRequest().getContext() == null)
return;
String charset = _channel.getRequest().getContext().getContextHandler().getLocaleEncoding(locale);
if (charset != null && charset.length() > 0 && __localeOverride.contains(_encodingFrom))
setCharacterEncoding(charset,EncodingFrom.SET_LOCALE);
}
代码示例来源:origin: com.ovea.tajin.servers/tajin-server-jetty9
@Override
public void setLocale(Locale locale)
{
if (locale == null || isCommitted() || isIncluding())
return;
_locale = locale;
_fields.put(HttpHeader.CONTENT_LANGUAGE, locale.toString().replace('_', '-'));
if (_outputType != OutputType.NONE)
return;
if (_channel.getRequest().getContext() == null)
return;
String charset = _channel.getRequest().getContext().getContextHandler().getLocaleEncoding(locale);
if (charset != null && charset.length() > 0 && _characterEncoding == null)
setCharacterEncoding(charset);
}
代码示例来源:origin: jenkinsci/winstone
@Override
public void setLocale(Locale locale)
{
if (locale == null || isCommitted() || isIncluding())
return;
_locale = locale;
_fields.put(HttpHeader.CONTENT_LANGUAGE, locale.toString().replace('_', '-'));
if (_outputType != OutputType.NONE)
return;
if (_channel.getRequest().getContext() == null)
return;
String charset = _channel.getRequest().getContext().getContextHandler().getLocaleEncoding(locale);
if (charset != null && charset.length() > 0 && __localeOverride.contains(_encodingFrom))
setCharacterEncoding(charset,EncodingFrom.SET_LOCALE);
}
代码示例来源:origin: com.ovea.tajin.server/tajin-server-jetty9
@Override
public void setLocale(Locale locale)
{
if (locale == null || isCommitted() || isIncluding())
return;
_locale = locale;
_fields.put(HttpHeader.CONTENT_LANGUAGE, locale.toString().replace('_', '-'));
if (_outputType != OutputType.NONE)
return;
if (_channel.getRequest().getContext() == null)
return;
String charset = _channel.getRequest().getContext().getContextHandler().getLocaleEncoding(locale);
if (charset != null && charset.length() > 0 && _characterEncoding == null)
setCharacterEncoding(charset);
}
代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.eclipse.jetty.server
@Override
public void setLocale(Locale locale)
{
if (locale == null || isCommitted() || isIncluding())
return;
_locale = locale;
_fields.put(HttpHeader.CONTENT_LANGUAGE, locale.toString().replace('_', '-'));
if (_outputType != OutputType.NONE)
return;
if (_channel.getRequest().getContext() == null)
return;
String charset = _channel.getRequest().getContext().getContextHandler().getLocaleEncoding(locale);
if (charset != null && charset.length() > 0 && !_explicitEncoding)
setCharacterEncoding(charset,false);
}
代码示例来源:origin: Nextdoor/bender
@Override
public void setLocale(Locale locale)
{
if (locale == null || isCommitted() || isIncluding())
return;
_locale = locale;
_fields.put(HttpHeader.CONTENT_LANGUAGE, locale.toString().replace('_', '-'));
if (_outputType != OutputType.NONE)
return;
if (_channel.getRequest().getContext() == null)
return;
String charset = _channel.getRequest().getContext().getContextHandler().getLocaleEncoding(locale);
if (charset != null && charset.length() > 0 && !_explicitEncoding)
setCharacterEncoding(charset,false);
}
代码示例来源:origin: jenkinsci/winstone
public MultiPartsUtilParser(InputStream in, String contentType, MultipartConfigElement config, File contextTmpDir, Request request) throws IOException
{
_utilParser = new MultiPartInputStreamParser(in, contentType, config, contextTmpDir);
_context = request.getContext();
_utilParser.getParts();
EnumSet<NonCompliance> nonComplianceWarnings = _utilParser.getNonComplianceWarnings();
if (!nonComplianceWarnings.isEmpty())
{
@SuppressWarnings("unchecked")
List<String> violations = (List<String>)request.getAttribute(HttpCompliance.VIOLATIONS_ATTR);
if (violations==null)
{
violations = new ArrayList<>();
request.setAttribute(HttpCompliance.VIOLATIONS_ATTR,violations);
}
for(NonCompliance nc : nonComplianceWarnings)
violations.add(nc.name()+": "+nc.getURL());
}
}
代码示例来源:origin: stackoverflow.com
context = request.getContext();
Principal principal = context.getRealm().authenticate("*", "*");
代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-all-server
return;
if (_connection.getRequest().getContext()==null)
return;
String charset = _connection.getRequest().getContext().getContextHandler().getLocaleEncoding(locale);
代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-webapp
return;
if (_connection.getRequest().getContext()==null)
return;
String charset = _connection.getRequest().getContext().getContextHandler().getLocaleEncoding(locale);
代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-server
return;
if (_connection.getRequest().getContext()==null)
return;
String charset = _connection.getRequest().getContext().getContextHandler().getLocaleEncoding(locale);
代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-plus
return;
if (_connection.getRequest().getContext()==null)
return;
String charset = _connection.getRequest().getContext().getContextHandler().getLocaleEncoding(locale);
代码示例来源:origin: org.eclipse.jetty/server
return;
if (_connection.getRequest().getContext()==null)
return;
String charset = _connection.getRequest().getContext().getContextHandler().getLocaleEncoding(locale);
代码示例来源:origin: jenkinsci/winstone
code != SC_PARTIAL_CONTENT && code >= SC_OK)
ContextHandler.Context context = request.getContext();
ContextHandler contextHandler = context == null ? _channel.getState().getContextHandler() : context.getContextHandler();
request.setAttribute(RequestDispatcher.ERROR_STATUS_CODE, code);
代码示例来源:origin: theonedev/onedev
code>=SC_OK)
ErrorHandler error_handler = ErrorHandler.getErrorHandler(_channel.getServer(),request.getContext()==null?null:request.getContext().getContextHandler());
if (error_handler!=null)
代码示例来源:origin: Nextdoor/bender
code>=SC_OK)
ErrorHandler error_handler = ErrorHandler.getErrorHandler(_channel.getServer(),request.getContext()==null?null:request.getContext().getContextHandler());
if (error_handler!=null)
代码示例来源:origin: com.ovea.tajin.servers/tajin-server-jetty9
ContextHandler.Context context = request.getContext();
if (context!=null)
error_handler=context.getContextHandler().getErrorHandler();
内容来源于网络,如有侵权,请联系作者删除!