List of usage examples for org.apache.commons.httpclient URI URI
public URI(String scheme, String userinfo, String host, int port, String path, String query) throws URIException
From source file:ru.org.linux.util.LorURI.java
/** * url ? ?\//w ww .j a v a 2s.c o m * @param messageDao ? ? * @param secure https * @return url ? ?? ? * @throws MessageNotFoundException ? ?? * @throws BadGroupException ? * @throws URIException ? url */ public String formatJump(TopicDao messageDao, boolean secure) throws MessageNotFoundException, URIException { if (messageUrl) { Topic message = messageDao.getById(messageId); Group group = null; try { group = messageDao.getGroup(message); } catch (BadGroupException e) { throw new RuntimeException("Invalid group id msgid=" + messageId, e); } String scheme; if (secure) { scheme = "https"; } else { scheme = "http"; } String host = mainURI.getHost(); int port = mainURI.getPort(); String path = group.getUrl() + messageId; String query = ""; if (commentUrl) { query = "cid=" + commentId; } URI jumpUri = new URI(scheme, null, host, port, path, query); return jumpUri.getEscapedURI(); } return ""; }
From source file:ru.org.linux.util.LorURL.java
/** * url ? ?\// w w w . j a v a2 s . c o m * @param messageDao ? ? * @param canonical ? URL ? * @return url ? ?? ? * @throws MessageNotFoundException ? ?? * @throws URIException ? url */ public String formatJump(TopicDao messageDao, URI canonical) throws MessageNotFoundException, URIException { if (_topic_id != -1) { Topic message = messageDao.getById(_topic_id); Group group = messageDao.getGroup(message); String scheme = canonical.getScheme(); String host = canonical.getHost(); int port = canonical.getPort(); String path = group.getUrl() + _topic_id; String query = ""; if (_comment_id != -1) { query = "cid=" + _comment_id; } URI jumpUri = new URI(scheme, null, host, port, path, query); return jumpUri.getEscapedURI(); } return ""; }