com.sun.net.httpserver.HttpPrincipal Java Examples

The following examples show how to use com.sun.net.httpserver.HttpPrincipal. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Deadlock.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void handle (HttpExchange t)
    throws IOException
{
    InputStream is = t.getRequestBody();
    Headers map = t.getRequestHeaders();
    Headers rmap = t.getResponseHeaders();
    while (is.read() != -1);
    is.close();
    t.sendResponseHeaders(200, -1);
    HttpPrincipal p = t.getPrincipal();
    if (!p.getUsername().equals("fred")) {
        error = true;
    }
    if (!p.getRealm().equals("[email protected]")) {
        error = true;
    }
    t.close();
}
 
Example #2
Source File: Deadlock.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void handle (HttpExchange t)
    throws IOException
{
    InputStream is = t.getRequestBody();
    Headers map = t.getRequestHeaders();
    Headers rmap = t.getResponseHeaders();
    while (is.read() != -1);
    is.close();
    t.sendResponseHeaders(200, -1);
    HttpPrincipal p = t.getPrincipal();
    if (!p.getUsername().equals("fred")) {
        error = true;
    }
    if (!p.getRealm().equals("[email protected]")) {
        error = true;
    }
    t.close();
}
 
Example #3
Source File: Deadlock.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void handle (HttpExchange t)
    throws IOException
{
    InputStream is = t.getRequestBody();
    Headers map = t.getRequestHeaders();
    Headers rmap = t.getResponseHeaders();
    while (is.read() != -1);
    is.close();
    t.sendResponseHeaders(200, -1);
    HttpPrincipal p = t.getPrincipal();
    if (!p.getUsername().equals("fred")) {
        error = true;
    }
    if (!p.getRealm().equals("[email protected]")) {
        error = true;
    }
    t.close();
}
 
Example #4
Source File: Deadlock.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void handle (HttpExchange t)
    throws IOException
{
    InputStream is = t.getRequestBody();
    Headers map = t.getRequestHeaders();
    Headers rmap = t.getResponseHeaders();
    while (is.read() != -1);
    is.close();
    t.sendResponseHeaders(200, -1);
    HttpPrincipal p = t.getPrincipal();
    if (!p.getUsername().equals("fred")) {
        error = true;
    }
    if (!p.getRealm().equals("[email protected]")) {
        error = true;
    }
    t.close();
}
 
Example #5
Source File: Deadlock.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void handle (HttpExchange t)
    throws IOException
{
    InputStream is = t.getRequestBody();
    Headers map = t.getRequestHeaders();
    Headers rmap = t.getResponseHeaders();
    while (is.read() != -1);
    is.close();
    t.sendResponseHeaders(200, -1);
    HttpPrincipal p = t.getPrincipal();
    if (!p.getUsername().equals("fred")) {
        error = true;
    }
    if (!p.getRealm().equals("[email protected]")) {
        error = true;
    }
    t.close();
}
 
Example #6
Source File: Deadlock.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void handle (HttpExchange t)
    throws IOException
{
    InputStream is = t.getRequestBody();
    Headers map = t.getRequestHeaders();
    Headers rmap = t.getResponseHeaders();
    while (is.read() != -1);
    is.close();
    t.sendResponseHeaders(200, -1);
    HttpPrincipal p = t.getPrincipal();
    if (!p.getUsername().equals("fred")) {
        error = true;
    }
    if (!p.getRealm().equals("[email protected]")) {
        error = true;
    }
    t.close();
}
 
Example #7
Source File: Deadlock.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void handle (HttpExchange t)
    throws IOException
{
    InputStream is = t.getRequestBody();
    Headers map = t.getRequestHeaders();
    Headers rmap = t.getResponseHeaders();
    while (is.read() != -1);
    is.close();
    t.sendResponseHeaders(200, -1);
    HttpPrincipal p = t.getPrincipal();
    if (!p.getUsername().equals("fred")) {
        error = true;
    }
    if (!p.getRealm().equals("[email protected]")) {
        error = true;
    }
    t.close();
}
 
Example #8
Source File: Deadlock.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void handle (HttpExchange t)
    throws IOException
{
    InputStream is = t.getRequestBody();
    Headers map = t.getRequestHeaders();
    Headers rmap = t.getResponseHeaders();
    while (is.read() != -1);
    is.close();
    t.sendResponseHeaders(200, -1);
    HttpPrincipal p = t.getPrincipal();
    if (!p.getUsername().equals("fred")) {
        error = true;
    }
    if (!p.getRealm().equals("[email protected]")) {
        error = true;
    }
    t.close();
}
 
Example #9
Source File: Deadlock.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void handle (HttpExchange t)
    throws IOException
{
    InputStream is = t.getRequestBody();
    Headers map = t.getRequestHeaders();
    Headers rmap = t.getResponseHeaders();
    while (is.read() != -1);
    is.close();
    t.sendResponseHeaders(200, -1);
    HttpPrincipal p = t.getPrincipal();
    if (!p.getUsername().equals("fred")) {
        error = true;
    }
    if (!p.getRealm().equals("[email protected]")) {
        error = true;
    }
    t.close();
}
 
Example #10
Source File: Deadlock.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void handle (HttpExchange t)
    throws IOException
{
    InputStream is = t.getRequestBody();
    Headers map = t.getRequestHeaders();
    Headers rmap = t.getResponseHeaders();
    while (is.read() != -1);
    is.close();
    t.sendResponseHeaders(200, -1);
    HttpPrincipal p = t.getPrincipal();
    if (!p.getUsername().equals("fred")) {
        error = true;
    }
    if (!p.getRealm().equals("[email protected]")) {
        error = true;
    }
    t.close();
}
 
Example #11
Source File: Deadlock.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void handle (HttpExchange t)
    throws IOException
{
    InputStream is = t.getRequestBody();
    Headers map = t.getRequestHeaders();
    Headers rmap = t.getResponseHeaders();
    while (is.read() != -1);
    is.close();
    t.sendResponseHeaders(200, -1);
    HttpPrincipal p = t.getPrincipal();
    if (!p.getUsername().equals("fred")) {
        error = true;
    }
    if (!p.getRealm().equals("[email protected]")) {
        error = true;
    }
    t.close();
}
 
Example #12
Source File: Deadlock.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void handle (HttpExchange t)
    throws IOException
{
    InputStream is = t.getRequestBody();
    Headers map = t.getRequestHeaders();
    Headers rmap = t.getResponseHeaders();
    while (is.read() != -1);
    is.close();
    t.sendResponseHeaders(200, -1);
    HttpPrincipal p = t.getPrincipal();
    if (!p.getUsername().equals("fred")) {
        error = true;
    }
    if (!p.getRealm().equals("[email protected]")) {
        error = true;
    }
    t.close();
}
 
Example #13
Source File: Deadlock.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void handle (HttpExchange t)
    throws IOException
{
    InputStream is = t.getRequestBody();
    Headers map = t.getRequestHeaders();
    Headers rmap = t.getResponseHeaders();
    while (is.read() != -1);
    is.close();
    t.sendResponseHeaders(200, -1);
    HttpPrincipal p = t.getPrincipal();
    if (!p.getUsername().equals("fred")) {
        error = true;
    }
    if (!p.getRealm().equals("[email protected]")) {
        error = true;
    }
    t.close();
}
 
Example #14
Source File: BasicLongCredentials.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public void handle (HttpExchange t) throws IOException {
    InputStream is = t.getRequestBody();
    while (is.read () != -1) ;
    is.close();
    t.sendResponseHeaders(200, -1);
    HttpPrincipal p = t.getPrincipal();
    if (!p.getUsername().equals(USERNAME)) {
        error = true;
    }
    if (!p.getRealm().equals(REALM)) {
        error = true;
    }
    t.close();
}
 
Example #15
Source File: BasicLongCredentials.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public void handle (HttpExchange t) throws IOException {
    InputStream is = t.getRequestBody();
    while (is.read () != -1) ;
    is.close();
    t.sendResponseHeaders(200, -1);
    HttpPrincipal p = t.getPrincipal();
    if (!p.getUsername().equals(USERNAME)) {
        error = true;
    }
    if (!p.getRealm().equals(REALM)) {
        error = true;
    }
    t.close();
}
 
Example #16
Source File: BasicLongCredentials.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
public void handle (HttpExchange t) throws IOException {
    InputStream is = t.getRequestBody();
    while (is.read () != -1) ;
    is.close();
    t.sendResponseHeaders(200, -1);
    HttpPrincipal p = t.getPrincipal();
    if (!p.getUsername().equals(USERNAME)) {
        error = true;
    }
    if (!p.getRealm().equals(REALM)) {
        error = true;
    }
    t.close();
}
 
Example #17
Source File: BasicLongCredentials.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public void handle (HttpExchange t) throws IOException {
    InputStream is = t.getRequestBody();
    while (is.read () != -1) ;
    is.close();
    t.sendResponseHeaders(200, -1);
    HttpPrincipal p = t.getPrincipal();
    if (!p.getUsername().equals(USERNAME)) {
        error = true;
    }
    if (!p.getRealm().equals(REALM)) {
        error = true;
    }
    t.close();
}
 
Example #18
Source File: BasicLongCredentials.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public void handle (HttpExchange t) throws IOException {
    InputStream is = t.getRequestBody();
    while (is.read () != -1) ;
    is.close();
    t.sendResponseHeaders(200, -1);
    HttpPrincipal p = t.getPrincipal();
    if (!p.getUsername().equals(USERNAME)) {
        error = true;
    }
    if (!p.getRealm().equals(REALM)) {
        error = true;
    }
    t.close();
}
 
Example #19
Source File: BasicLongCredentials.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public void handle (HttpExchange t) throws IOException {
    InputStream is = t.getRequestBody();
    while (is.read () != -1) ;
    is.close();
    t.sendResponseHeaders(200, -1);
    HttpPrincipal p = t.getPrincipal();
    if (!p.getUsername().equals(USERNAME)) {
        error = true;
    }
    if (!p.getRealm().equals(REALM)) {
        error = true;
    }
    t.close();
}
 
Example #20
Source File: BasicLongCredentials.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public void handle (HttpExchange t) throws IOException {
    InputStream is = t.getRequestBody();
    while (is.read () != -1) ;
    is.close();
    t.sendResponseHeaders(200, -1);
    HttpPrincipal p = t.getPrincipal();
    if (!p.getUsername().equals(USERNAME)) {
        error = true;
    }
    if (!p.getRealm().equals(REALM)) {
        error = true;
    }
    t.close();
}
 
Example #21
Source File: BasicLongCredentials.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public void handle (HttpExchange t) throws IOException {
    InputStream is = t.getRequestBody();
    while (is.read () != -1) ;
    is.close();
    t.sendResponseHeaders(200, -1);
    HttpPrincipal p = t.getPrincipal();
    if (!p.getUsername().equals(USERNAME)) {
        error = true;
    }
    if (!p.getRealm().equals(REALM)) {
        error = true;
    }
    t.close();
}
 
Example #22
Source File: BasicLongCredentials.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
public void handle (HttpExchange t) throws IOException {
    InputStream is = t.getRequestBody();
    while (is.read () != -1) ;
    is.close();
    t.sendResponseHeaders(200, -1);
    HttpPrincipal p = t.getPrincipal();
    if (!p.getUsername().equals(USERNAME)) {
        error = true;
    }
    if (!p.getRealm().equals(REALM)) {
        error = true;
    }
    t.close();
}
 
Example #23
Source File: BasicLongCredentials.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
public void handle (HttpExchange t) throws IOException {
    InputStream is = t.getRequestBody();
    while (is.read () != -1) ;
    is.close();
    t.sendResponseHeaders(200, -1);
    HttpPrincipal p = t.getPrincipal();
    if (!p.getUsername().equals(USERNAME)) {
        error = true;
    }
    if (!p.getRealm().equals(REALM)) {
        error = true;
    }
    t.close();
}
 
Example #24
Source File: BasicLongCredentials.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public void handle (HttpExchange t) throws IOException {
    InputStream is = t.getRequestBody();
    while (is.read () != -1) ;
    is.close();
    t.sendResponseHeaders(200, -1);
    HttpPrincipal p = t.getPrincipal();
    if (!p.getUsername().equals(USERNAME)) {
        error = true;
    }
    if (!p.getRealm().equals(REALM)) {
        error = true;
    }
    t.close();
}
 
Example #25
Source File: BasicLongCredentials.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public void handle (HttpExchange t) throws IOException {
    InputStream is = t.getRequestBody();
    while (is.read () != -1) ;
    is.close();
    t.sendResponseHeaders(200, -1);
    HttpPrincipal p = t.getPrincipal();
    if (!p.getUsername().equals(USERNAME)) {
        error = true;
    }
    if (!p.getRealm().equals(REALM)) {
        error = true;
    }
    t.close();
}
 
Example #26
Source File: BasicLongCredentials.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public void handle (HttpExchange t) throws IOException {
    InputStream is = t.getRequestBody();
    while (is.read () != -1) ;
    is.close();
    t.sendResponseHeaders(200, -1);
    HttpPrincipal p = t.getPrincipal();
    if (!p.getUsername().equals(USERNAME)) {
        error = true;
    }
    if (!p.getRealm().equals(REALM)) {
        error = true;
    }
    t.close();
}
 
Example #27
Source File: MockHttpExchange.java    From glowroot with Apache License 2.0 4 votes vote down vote up
void setPrincipal(HttpPrincipal principal) {
    this.principal = principal;
}
 
Example #28
Source File: MockHttpExchange.java    From glowroot with Apache License 2.0 4 votes vote down vote up
@Override
public HttpPrincipal getPrincipal() {
    return principal;
}
 
Example #29
Source File: UserIT.java    From glowroot with Apache License 2.0 4 votes vote down vote up
@Override
public HttpPrincipal getPrincipal() {
    throw new RuntimeException("Glowroot should not call this directly as it may fail");
}
 
Example #30
Source File: UserIT.java    From glowroot with Apache License 2.0 4 votes vote down vote up
@Override
protected void before(HttpExchange exchange) {
    ((MockHttpExchange) exchange)
            .setPrincipal(new HttpPrincipal(PRINCIPAL_NAME, "my realm"));
}