我有一个pom.xml文件,在其中我看到他们是3个依赖项引用相同<artifactId>的差异在标签中
<classifier>sources</classifier>
<classifier>javadoc</classifier>
Run Code Online (Sandbox Code Playgroud)
我删除了具有SOURCES/JAVADOC唯一依赖项的依赖项.我测试了我的应用程序,每件事情都很好.
使用此分类器标签的目的是什么?以及为什么我需要两次复制依赖项以添加<classifier>标记SOURCES/JAVADOC.
<dependency>
<groupId>oauth.signpost</groupId>
<artifactId>signpost-commonshttp4</artifactId>
<version>1.2.1.2</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>oauth.signpost</groupId>
<artifactId>signpost-commonshttp4</artifactId>
<version>1.2.1.2</version>
<type>jar</type>
***<classifier>javadoc</classifier>***
<scope>compile</scope>
</dependency>
<dependency>
<groupId>oauth.signpost</groupId>
<artifactId>signpost-commonshttp4</artifactId>
<version>1.2.1.2</version>
<type>jar</type>
***<classifier>sources</classifier>***
<scope>compile</scope>
</dependency>
Run Code Online (Sandbox Code Playgroud) 这个的构造函数enum是私有的.那是什么意思?
public enum SLocale {
EN_US(Locale.US, "www.abc.com", "www.edc.com", "www.vvv.com",
"www.earn.com");
List<String> domains;
Locale loc;
IMap map;
private SLocale(Locale loc, String... domains) {
this.domains = Arrays.asList(domains);
this.loc = loc;
this.siteMap = Factory.getMap(loc);
}
public List<String> getDomains() {
return domains;
}
public Locale getLoc() {
return loc;
}
public ISiteMap getMap() {
return map;
}
}
Run Code Online (Sandbox Code Playgroud) 在(- >)中自动构建选项的目的是什么?我总是会检查我的.但是,当我有一些Java代码更改时,我仍然需要进行完整的构建.我被告知应该经常检查.这样做我认为没有任何好处.请一些机构解释.EclipseProjectBuild Automatically
我需要为我们对服务(而不是Web服务)发出的Http请求设置时间.我们正在使用Apache HTTP Client.我添加了这两行代码来设置请求和响应服务的超时时间.
HttpConnectionParams.setConnectionTimeout(params, 10000);
HttpConnectionParams.setSoTimeout(params, 10000);
Run Code Online (Sandbox Code Playgroud)
1)目前我已将10秒设置为超时,因为我几乎立即看到来自服务的响应.我应该增加还是减少时间?
2)响应时间超过10秒会发生什么?它会抛出异常,会有什么异常吗?在下面的代码中是否还需要添加任何其他内容来设置超时.
public HashMap<String, Object> getJSONData(String url) throw Exception{
DefaultHttpClient httpClient = new DefaultHttpClient();
HttpParams params = httpClient.getParams();
HttpConnectionParams.setConnectionTimeout(params, 10000);
HttpConnectionParams.setSoTimeout(params, 10000);
HttpHost proxy = new HttpHost(getProxy(), getProxyPort());
ConnRouteParams.setDefaultProxy(params, proxy);
URI uri;
InputStream data = null;
try {
uri = new URI(url);
HttpGet method = new HttpGet(uri);
HttpResponse response = httpClient.execute(method);
data = response.getEntity().getContent();
}
catch (Exception e) {
e.printStackTrace();
}
Reader r = new InputStreamReader(data);
HashMap<String, Object> jsonObj = (HashMap<String, Object>) GenericJSONUtil.fromJson(r); …Run Code Online (Sandbox Code Playgroud) a build and deploy 和re-deploy?有什么区别?如果您只是进行了一些HTML更改而没有Java更改代码,应该怎么做?我应该做一个build and deploy还是只做一个re-deploy?
下面显示的是单例对象的创建.
public class Map_en_US extends mapTree {
private static Map_en_US m_instance;
private Map_en_US() {}
static{
m_instance = new Map_en_US();
m_instance.init();
}
public static Map_en_US getInstance(){
return m_instance;
}
@Override
protected void init() {
//some code;
}
}
Run Code Online (Sandbox Code Playgroud)
我的问题是使用静态块进行实例化的原因是什么.我熟悉下面的单例实例化形式.
public static Map_en_US getInstance(){
if(m_instance==null)
m_instance = new Map_en_US();
}
Run Code Online (Sandbox Code Playgroud) 我在搜索我的网站时有一个自动完成/提前输入功能.我看到有一段时间他们是与之相关的例外.我们正在使用代理服务器.
org.apache.http.conn.HttpHostConnectException: Connection to http://proxy.xyz.com:60 refused
at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:159)
at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:149)
at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:108)
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:415)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:641)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:576)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:554)
at com.xxx.dd.sone.integration.SearchDAO.getJSONData(SearchDAO.java:60)
at com.xxx.dd.sone.integration.SearchDAO.searchAutoCompleteResults(SearchDAO.java:560)
at com.xxx.dd.sone.presentation.util.SearchAutoCompleteUtil.doGet(SearchAutoCompleteUtil.java:26)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:845)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:242)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:352)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:236)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3254)
at weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:57)
at weblogic.servlet.internal.WebAppServletContext.doSecuredExecute(WebAppServletContext.java:2163)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2074)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1512)
at weblogic.servlet.provider.ContainerSupportProviderImpl$WlsRequestExecutor.run(ContainerSupportProviderImpl.java:255)
at weblogic.work.ExecuteRequestAdapter.execute(ExecuteRequestAdapter.java:22)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:147)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:119)
Run Code Online (Sandbox Code Playgroud)
引起:java.net.ConnectException:连接被拒绝
这是我编码的方式
public HashMap<String, Object> getJSONData(String url)throws Exception {
DefaultHttpClient httpClient = new DefaultHttpClient();
HttpParams params = httpClient.getParams();
try {
HttpConnectionParams.setConnectionTimeout(params, 10000);
HttpConnectionParams.setSoTimeout(params, 10000);
} catch …Run Code Online (Sandbox Code Playgroud) 我遇到了ajax缓存的问题,这也是IE浏览器中的问题,但我通过编写以下代码修复了它.
response.setHeader("Cache-Control", "no-cache");
response.setHeader("expires","-1");
response.setHeader("pragma","no-cache");
Run Code Online (Sandbox Code Playgroud)
但我看到MAC上的Safari4.0正在缓存Ajax请求(我们有一个要求支持这一点).火狐永远不会有问题.关于这个"Expire"我将它设置为-1,我看到很多地方设置0或者过去的旧日期.它会有所作为吗?
任何人都可以提供一些想法/逻辑来为我正在研究的搜索页面编写分页逻辑吗?我所拥有的信息是该搜索的总页数 - 每页10条记录我也被发送了前一页和下一页的编号(没有问题写我需要做的逻辑我拉这些信息并填充.我是也获取我所在页面的信息.我只能显示10页,如下所示
<previous 1 |2 |3 | 4| 5 | 6 | 7 | 8 | 9 | 10 next>
Run Code Online (Sandbox Code Playgroud)
假设总页数为15,当用户点击下一步时,我需要显示如下
<previous 2 |3 |4 |5 |6 |7 |8 |9 |10 |11 next>
Run Code Online (Sandbox Code Playgroud)
在任何时候我只需要在分页中显示10页.
#set($start = 1)
#set($end = $Integer.parseInt($searchTO.getPagination().getNumberofPages()))
#set($range = [$start..$end])
#set($iter = 1)
#foreach($i in $range)
#foreach($link in $searchTO.getPagination().getDirectPageLinks())
#if($i == $iter)
#if ($Integer.parseInt($searchTO.getPagination().getPageNumber())==$iter)
<a class="search_current" href="/?_page=SEARCH&_action=SEARCH$link">$i  |</a>
#else
<a href="/?_page=SEARCH&_action=SEARCH$link">$i  |</a>
#end
#set($iter = 1)
#break
#else
#set($iter=$iter+1)
#end
#end
#end
Run Code Online (Sandbox Code Playgroud) 我在执行此代码时收到ConcurrentModificationException.我无法弄清楚它为什么会发生?
private void verifyBookingIfAvailable(ArrayList<Integer> list, int id) {
Iterator<Integer> iterator = list.iterator();
while (iterator.hasNext()) {
int value = iterator.next();
if (value == id) {
int index = list.indexOf(id);
if (index != -1) {
list.remove(index);
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
提前致谢.
java ×9
build ×2
ajax ×1
arraylist ×1
caching ×1
deployment ×1
eclipse ×1
enums ×1
exception ×1
http-host ×1
javascript ×1
list ×1
listiterator ×1
maven ×1
pagination ×1
safari ×1
singleton ×1
velocity ×1