HTTPServerPolicy p = new HTTPServerPolicy(); if (p1.isSetCacheControl()) { p.setCacheControl(p1.getCacheControl()); } else if (p2.isSetCacheControl()) { p.setCacheControl(p2.getCacheControl()); p.setContentEncoding(StringUtils.combine(p1.getContentEncoding(), p2.getContentEncoding())); p.setContentLocation(StringUtils.combine(p1.getContentLocation(), p2.getContentLocation())); if (p1.isSetContentType()) { p.setContentType(p1.getContentType()); } else if (p2.isSetContentType()) { p.setContentType(p2.getContentType()); if (p1.isSetHonorKeepAlive()) { p.setHonorKeepAlive(p1.isHonorKeepAlive()); } else if (p2.isSetHonorKeepAlive()) { p.setHonorKeepAlive(p2.isHonorKeepAlive()); if (p1.isSetKeepAliveParameters()) { p.setKeepAliveParameters(p1.getKeepAliveParameters()); } else if (p2.isSetKeepAliveParameters()) { p.setKeepAliveParameters(p2.getKeepAliveParameters()); if (p1.isSetReceiveTimeout() || p2.isSetReceiveTimeout()) { p.setReceiveTimeout(Math.min(p1.getReceiveTimeout(), p2.getReceiveTimeout())); p.setRedirectURL(StringUtils.combine(p1.getRedirectURL(), p2.getRedirectURL())); p.setServerType(StringUtils.combine(p1.getServerType(), p2.getServerType())); if (p1.isSetSuppressClientReceiveErrors()) {
public static String toString(HTTPServerPolicy p) { StringBuilder buf = new StringBuilder(); buf.append(p); buf.append("[ContentType=\""); buf.append(p.getContentType()); buf.append("\", ReceiveTimeout="); buf.append(p.getReceiveTimeout()); buf.append("])"); return buf.toString(); } }
/** * Determines if two HTTPServerPolicy objects are equal. REVISIT: Check if * this can be replaced by a generated equals method. * * @param p1 one server policy * @param p2 another server policy * @return true iff the two policies are equal */ public boolean equals(HTTPServerPolicy p1, HTTPServerPolicy p2) { if (p1 == p2) { return true; } boolean result = true; result &= (p1.isHonorKeepAlive() == p2.isHonorKeepAlive()) && (p1.getCacheControl() == null ? p2.getCacheControl() == null : p1.getCacheControl() .equals(p2.getCacheControl())) && StringUtils.equals(p1.getContentEncoding(), p2.getContentEncoding()) && StringUtils.equals(p1.getContentLocation(), p2.getContentLocation()) && StringUtils.equals(p1.getContentType(), p2.getContentType()) && StringUtils.equals(p1.getKeepAliveParameters(), p2.getKeepAliveParameters()); if (!result) { return false; } result &= (p1.getReceiveTimeout() == p2.getReceiveTimeout()) && StringUtils.equals(p1.getRedirectURL(), p2.getRedirectURL()) && StringUtils.equals(p1.getServerType(), p2.getServerType()) && (p1.isSuppressClientReceiveErrors() == p2.isSuppressClientReceiveErrors()) && (p1.isSuppressClientSendErrors() == p2.isSuppressClientSendErrors()); return result; }
void setFromServerPolicy(HTTPServerPolicy policy) { if (policy.isSetCacheControl()) { headers.put("Cache-Control", createMutableList(policy.getCacheControl())); if (policy.isSetContentLocation()) { headers.put("Content-Location", createMutableList(policy.getContentLocation())); if (policy.isSetContentEncoding()) { headers.put("Content-Encoding", createMutableList(policy.getContentEncoding())); if (policy.isSetContentType()) { headers.put(HttpHeaderHelper.CONTENT_TYPE, createMutableList(policy.getContentType())); if (policy.isSetServerType()) { headers.put("Server", createMutableList(policy.getServerType())); if (policy.isSetHonorKeepAlive() && !policy.isHonorKeepAlive()) { headers.put("Connection", createMutableList("close")); } else if (policy.isSetKeepAliveParameters()) { headers.put("Keep-Alive", createMutableList(policy.getKeepAliveParameters()));
protected void doService(ServletContext context, HttpServletRequest req, HttpServletResponse resp) throws IOException { if (context == null) { context = servletContext; } HTTPServerPolicy sp = getServer(); if (sp.isSetRedirectURL()) { resp.sendRedirect(sp.getRedirectURL()); resp.flushBuffer(); return; } ClassLoaderHolder origLoader = null; Bus origBus = BusFactory.getAndSetThreadDefaultBus(bus); try { if (loader != null) { origLoader = ClassLoaderUtils.setThreadContextClassloader(loader); } invoke(null, context, req, resp); } finally { if (origBus != bus) { BusFactory.setThreadDefaultBus(origBus); } if (origLoader != null) { origLoader.reset(); } } }
/** * Create an instance of {@link HTTPServerPolicy } * */ public HTTPServerPolicy createHTTPServerPolicy() { return new HTTPServerPolicy(); }
compatible &= !p1.isSetCacheControl() || !p2.isSetCacheControl() || p1.getCacheControl().equals(p2.getCacheControl()); compatible &= StringUtils.compatible(p1.getContentEncoding(), p2.getContentEncoding()); compatible &= StringUtils.compatible(p1.getContentLocation(), p2.getContentLocation()); compatible &= StringUtils.compatible(p1.getContentType(), p2.getContentType()); compatible &= StringUtils.compatible(p1.getRedirectURL(), p2.getRedirectURL()); compatible &= StringUtils.compatible(p1.getServerType(), p2.getServerType()); compatible &= p1.isHonorKeepAlive() == p2.isHonorKeepAlive(); compatible &= p1.isSuppressClientReceiveErrors() == p2.isSuppressClientReceiveErrors(); compatible &= p1.isSuppressClientSendErrors() == p2.isSuppressClientSendErrors(); compatible &= StringUtils.compatible(p1.getKeepAliveParameters(), p2.getKeepAliveParameters());
void setFromServerPolicy(HTTPServerPolicy policy) { if (policy.isSetCacheControl()) { headers.put("Cache-Control", createMutableList(policy.getCacheControl())); if (policy.isSetContentLocation()) { headers.put("Content-Location", createMutableList(policy.getContentLocation())); if (policy.isSetContentEncoding()) { headers.put("Content-Encoding", createMutableList(policy.getContentEncoding())); if (policy.isSetContentType()) { headers.put(HttpHeaderHelper.CONTENT_TYPE, createMutableList(policy.getContentType())); if (policy.isSetServerType()) { headers.put("Server", createMutableList(policy.getServerType())); if (policy.isSetHonorKeepAlive() && !policy.isHonorKeepAlive()) { headers.put("Connection", createMutableList("close")); } else if (policy.isSetKeepAliveParameters()) { headers.put("Keep-Alive", createMutableList(policy.getKeepAliveParameters()));
protected void doService(ServletContext context, HttpServletRequest req, HttpServletResponse resp) throws IOException { if (context == null) { context = servletContext; } HTTPServerPolicy sp = getServer(); if (sp.isSetRedirectURL()) { resp.sendRedirect(sp.getRedirectURL()); resp.flushBuffer(); return; } ClassLoaderHolder origLoader = null; Bus origBus = BusFactory.getAndSetThreadDefaultBus(bus); try { if (loader != null) { origLoader = ClassLoaderUtils.setThreadContextClassloader(loader); } invoke(null, context, req, resp); } finally { if (origBus != bus) { BusFactory.setThreadDefaultBus(origBus); } if (origLoader != null) { origLoader.reset(); } } }
public static String toString(HTTPServerPolicy p) { StringBuilder buf = new StringBuilder(); buf.append(p); buf.append("[ContentType=\""); buf.append(p.getContentType()); buf.append("\", ReceiveTimeout="); buf.append(p.getReceiveTimeout()); buf.append("])"); return buf.toString(); } }
private synchronized HTTPServerPolicy calcServerPolicyInternal(Message m) { HTTPServerPolicy sp = serverPolicy; if (!serverPolicyCalced) { PolicyDataEngine pde = bus.getExtension(PolicyDataEngine.class); if (pde != null) { sp = pde.getServerEndpointPolicy(m, endpointInfo, this, new ServerPolicyCalculator()); } if (null == sp) { sp = endpointInfo.getTraversedExtensor( new HTTPServerPolicy(), HTTPServerPolicy.class); } serverPolicy = sp; serverPolicyCalced = true; } return sp; } private HTTPServerPolicy calcServerPolicy(Message m) {
HTTPServerPolicy p = new HTTPServerPolicy(); if (p1.isSetCacheControl()) { p.setCacheControl(p1.getCacheControl()); } else if (p2.isSetCacheControl()) { p.setCacheControl(p2.getCacheControl()); p.setContentEncoding(StringUtils.combine(p1.getContentEncoding(), p2.getContentEncoding())); p.setContentLocation(StringUtils.combine(p1.getContentLocation(), p2.getContentLocation())); if (p1.isSetContentType()) { p.setContentType(p1.getContentType()); } else if (p2.isSetContentType()) { p.setContentType(p2.getContentType()); if (p1.isSetHonorKeepAlive()) { p.setHonorKeepAlive(p1.isHonorKeepAlive()); } else if (p2.isSetHonorKeepAlive()) { p.setHonorKeepAlive(p2.isHonorKeepAlive()); if (p1.isSetKeepAliveParameters()) { p.setKeepAliveParameters(p1.getKeepAliveParameters()); } else if (p2.isSetKeepAliveParameters()) { p.setKeepAliveParameters(p2.getKeepAliveParameters()); if (p1.isSetReceiveTimeout() || p2.isSetReceiveTimeout()) { p.setReceiveTimeout(Math.min(p1.getReceiveTimeout(), p2.getReceiveTimeout())); p.setRedirectURL(StringUtils.combine(p1.getRedirectURL(), p2.getRedirectURL())); p.setServerType(StringUtils.combine(p1.getServerType(), p2.getServerType())); if (p1.isSetSuppressClientReceiveErrors()) {
/** * Determines if two HTTPServerPolicy objects are equal. REVISIT: Check if * this can be replaced by a generated equals method. * * @param p1 one server policy * @param p2 another server policy * @return true iff the two policies are equal */ public boolean equals(HTTPServerPolicy p1, HTTPServerPolicy p2) { if (p1 == p2) { return true; } boolean result = true; result &= (p1.isHonorKeepAlive() == p2.isHonorKeepAlive()) && (p1.getCacheControl() == null ? p2.getCacheControl() == null : p1.getCacheControl() .equals(p2.getCacheControl())) && StringUtils.equals(p1.getContentEncoding(), p2.getContentEncoding()) && StringUtils.equals(p1.getContentLocation(), p2.getContentLocation()) && StringUtils.equals(p1.getContentType(), p2.getContentType()) && StringUtils.equals(p1.getKeepAliveParameters(), p2.getKeepAliveParameters()); if (!result) { return false; } result &= (p1.getReceiveTimeout() == p2.getReceiveTimeout()) && StringUtils.equals(p1.getRedirectURL(), p2.getRedirectURL()) && StringUtils.equals(p1.getServerType(), p2.getServerType()) && (p1.isSuppressClientReceiveErrors() == p2.isSuppressClientReceiveErrors()) && (p1.isSuppressClientSendErrors() == p2.isSuppressClientSendErrors()); return result; }
void setFromServerPolicy(HTTPServerPolicy policy) { if (policy.isSetCacheControl()) { headers.put("Cache-Control", createMutableList(policy.getCacheControl())); if (policy.isSetContentLocation()) { headers.put("Content-Location", createMutableList(policy.getContentLocation())); if (policy.isSetContentEncoding()) { headers.put("Content-Encoding", createMutableList(policy.getContentEncoding())); if (policy.isSetContentType()) { headers.put(HttpHeaderHelper.CONTENT_TYPE, createMutableList(policy.getContentType())); if (policy.isSetServerType()) { headers.put("Server", createMutableList(policy.getServerType())); if (policy.isSetHonorKeepAlive() && !policy.isHonorKeepAlive()) { headers.put("Connection", createMutableList("close")); } else if (policy.isSetKeepAliveParameters()) { headers.put("Keep-Alive", createMutableList(policy.getKeepAliveParameters()));
protected void doService(ServletContext context, HttpServletRequest req, HttpServletResponse resp) throws IOException { if (context == null) { context = servletContext; } if (getServer().isSetRedirectURL()) { resp.sendRedirect(getServer().getRedirectURL()); resp.flushBuffer(); return; } // REVISIT: service on executor if associated with endpoint ClassLoaderHolder origLoader = null; Bus origBus = BusFactory.getAndSetThreadDefaultBus(bus); try { if (loader != null) { origLoader = ClassLoaderUtils.setThreadContextClassloader(loader); } invoke(null, context, req, resp); } finally { if (origBus != bus) { BusFactory.setThreadDefaultBus(origBus); } if (origLoader != null) { origLoader.reset(); } } }
public static String toString(HTTPServerPolicy p) { StringBuilder buf = new StringBuilder(); buf.append(p); buf.append("[ContentType=\""); buf.append(p.getContentType()); buf.append("\", ReceiveTimeout="); buf.append(p.getReceiveTimeout()); buf.append("])"); return buf.toString(); } }
/** * Create an instance of {@link HTTPServerPolicy } * */ public HTTPServerPolicy createHTTPServerPolicy() { return new HTTPServerPolicy(); }
HTTPServerPolicy p = new HTTPServerPolicy(); if (p1.isSetCacheControl()) { p.setCacheControl(p1.getCacheControl()); } else if (p2.isSetCacheControl()) { p.setCacheControl(p2.getCacheControl()); p.setContentEncoding(StringUtils.combine(p1.getContentEncoding(), p2.getContentEncoding())); p.setContentLocation(StringUtils.combine(p1.getContentLocation(), p2.getContentLocation())); if (p1.isSetContentType()) { p.setContentType(p1.getContentType()); } else if (p2.isSetContentType()) { p.setContentType(p2.getContentType()); if (p1.isSetHonorKeepAlive()) { p.setHonorKeepAlive(p1.isHonorKeepAlive()); } else if (p2.isSetHonorKeepAlive()) { p.setHonorKeepAlive(p2.isHonorKeepAlive()); if (p1.isSetKeepAliveParameters()) { p.setKeepAliveParameters(p1.getKeepAliveParameters()); } else if (p2.isSetKeepAliveParameters()) { p.setKeepAliveParameters(p2.getKeepAliveParameters()); if (p1.isSetReceiveTimeout() || p2.isSetReceiveTimeout()) { p.setReceiveTimeout(Math.min(p1.getReceiveTimeout(), p2.getReceiveTimeout())); p.setRedirectURL(StringUtils.combine(p1.getRedirectURL(), p2.getRedirectURL())); p.setServerType(StringUtils.combine(p1.getServerType(), p2.getServerType())); if (p1.isSetSuppressClientReceiveErrors()) {
/** * Determines if two HTTPServerPolicy objects are equal. REVISIT: Check if * this can be replaced by a generated equals method. * * @param p1 one server policy * @param p2 another server policy * @return true iff the two policies are equal */ public boolean equals(HTTPServerPolicy p1, HTTPServerPolicy p2) { if (p1 == p2) { return true; } boolean result = true; result &= (p1.isHonorKeepAlive() == p2.isHonorKeepAlive()) && (p1.getCacheControl() == null ? p2.getCacheControl() == null : p1.getCacheControl() .equals(p2.getCacheControl())) && StringUtils.equals(p1.getContentEncoding(), p2.getContentEncoding()) && StringUtils.equals(p1.getContentLocation(), p2.getContentLocation()) && StringUtils.equals(p1.getContentType(), p2.getContentType()) && StringUtils.equals(p1.getKeepAliveParameters(), p2.getKeepAliveParameters()); if (!result) { return false; } result &= (p1.getReceiveTimeout() == p2.getReceiveTimeout()) && StringUtils.equals(p1.getRedirectURL(), p2.getRedirectURL()) && StringUtils.equals(p1.getServerType(), p2.getServerType()) && (p1.isSuppressClientReceiveErrors() == p2.isSuppressClientReceiveErrors()) && (p1.isSuppressClientSendErrors() == p2.isSuppressClientSendErrors()); return result; }
protected void doService(ServletContext context, HttpServletRequest req, HttpServletResponse resp) throws IOException { if (context == null) { context = servletContext; } if (getServer().isSetRedirectURL()) { resp.sendRedirect(getServer().getRedirectURL()); resp.flushBuffer(); return; } // REVISIT: service on executor if associated with endpoint ClassLoaderHolder origLoader = null; Bus origBus = BusFactory.getAndSetThreadDefaultBus(bus); try { if (loader != null) { origLoader = ClassLoaderUtils.setThreadContextClassloader(loader); } invoke(null, context, req, resp); } finally { if (origBus != bus) { BusFactory.setThreadDefaultBus(origBus); } if (origLoader != null) { origLoader.reset(); } } }