小编0x4*_*16e的帖子

使用http-header"Accept"的HttpURLConnection GET请求

我已经阅读了一些相关的问题,但不幸的是他们没有回答我的问题,因为我有具体的要求.

也许这是一个愚蠢的问题,但我如何使用httpURLConnection和http-header"Accept"请求(GET)JSON响应?

我在文档中找到了一个片段,但我不知道怎么做.

Accept = "Accept" ":" #( media-range [ accept-params ] )
Run Code Online (Sandbox Code Playgroud)

java json http-get httpurlconnection

7
推荐指数
1
解决办法
1万
查看次数

Git:在CONNECT之后从代理收到HTTP代码503

我检查了很多与此问题相关的帖子,但似乎没有什么能解决我的问题.所以现在我希望你们能给我神奇的答案.

我正在使用Intellij(但也尝试使用SourceTree)从Fisheye拉/推/克隆存储库.但是我收到错误:

git -c diff.mnemonicprefix=false -c core.quotepath=false fetch origin

fatal: unable to access 'https://myUser@myUrl/fisheye/git/myRepo.git/': Received HTTP code 503 from proxy after CONNECT
Run Code Online (Sandbox Code Playgroud)

关于503的提示意味着因维护而导致的临时停机时间对我不起作用,因为此问题现在持续一周.

关于错误/丢失代理设置的提示似乎也不起作用.我为系统git和IDE(Intellij)设置了http和https代理.

它以前工作过,我能够克隆存储库.然后我创建了一个新的分支,进行了一些更改,并希望将其推回到主服务器.

我真的很期待一些聪明的提示.

谢谢到目前为止

UPDATE

我补充说:

export GIT_TRACE_PACKET=1 export GIT_TRACE=1 export GIT_CURL_VERBOSE=1

我收到了以下日志:

$ git fetch
trace: built-in: git 'fetch'
trace: run_command: 'git-remote-https' 'origin' 'https://Username@myWebService.de/randomGit.git/'
* Couldn't find host myWebService in the _netrc file; using defaults
*   Trying 15.46.16.11...
* Connected to myProxy.com (15.46.16.11) port 8080 (#0)
* Establish HTTP proxy tunnel to myWebService.de:443
> …
Run Code Online (Sandbox Code Playgroud)

git proxy intellij-idea http-status-code-503 atlassian-sourcetree

6
推荐指数
1
解决办法
2万
查看次数

iText - 阅读使用未知随机所有者密码创建的 PDF

执行此代码时出现以下异常:

public byte[] watermarking(byte[] orig) throws IOException {
        PdfReader pdfReader = new PdfReader(orig);
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        PdfStamper pdfStamper = null;

        try {
            pdfStamper = new PdfStamper(pdfReader, baos); //exc here
            ...
            }
            ...
        } catch (DocumentException var8) {
            ...
        }
    }
Run Code Online (Sandbox Code Playgroud)

例外:

11:43:11,094 ERROR [de.mlp.xbg.pa.rest.SessionRR] (http-/127.0.0.1:8081-6) PdfReader not opened with owner password: java.lang.IllegalArgumentException: PdfReader not opened with owner password
Run Code Online (Sandbox Code Playgroud)

我检查了有关此主题的其他线程,似乎最简单的解决方案是添加 PdfReader.unethicalreading = true;

但是,我被迫使用 iText 2.1.7 或更早版本( com.lowagieiText)而不是 iText 5.0.0 或更新版本( com.itextpdfiText)PdfReader.unethicalreading …

java pdf itext pdf-reader

2
推荐指数
1
解决办法
3649
查看次数